:root {
	--ink: #201a18;
	--muted: #786b64;
	--paper: #fbf5ed;
	--card: rgba(255, 250, 245, 0.78);
	--wine: #7f1f2e;
	--rose: #d9897d;
	--sage: #7d9285;
	--gold: #c49b5d;
	--line: rgba(32, 26, 24, 0.12);
	--shadow: 0 24px 80px rgba(61, 34, 24, 0.14);
	font-family: "IBM Plex Sans KR", sans-serif;
}

* {
	box-sizing: border-box;
}
body {
	margin: 0;
	min-height: 100vh;
	color: var(--ink);
	background:
		radial-gradient(
			circle at 15% 8%,
			rgba(217, 137, 125, 0.34),
			transparent 28rem
		),
		radial-gradient(
			circle at 86% 14%,
			rgba(125, 146, 133, 0.3),
			transparent 30rem
		),
		linear-gradient(135deg, #fffaf5, var(--paper));
}
a {
	color: inherit;
	text-decoration: none;
}
button,
input,
select {
	font: inherit;
}

.admin-shell {
	min-height: 100vh;
}
.login-panel {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 28px;
}
.home-link {
	position: fixed;
	top: 24px;
	left: 24px;
	color: var(--muted);
	font-weight: 700;
}
.login-card {
	width: min(540px, 100%);
	padding: clamp(30px, 5vw, 54px);
	border: 1px solid rgba(255, 255, 255, 0.74);
	border-radius: 34px;
	background: var(--card);
	box-shadow: var(--shadow);
	backdrop-filter: blur(20px);
}
.eyebrow {
	margin: 0 0 12px;
	color: var(--wine);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.18em;
}
h1,
h2 {
	margin: 0;
	font-family: "Gowun Batang", serif;
	letter-spacing: -0.055em;
}
h1 {
	font-size: clamp(42px, 7vw, 68px);
	line-height: 1;
}
h2 {
	font-size: 30px;
}
p {
	color: var(--muted);
	line-height: 1.75;
}
.login-form {
	display: grid;
	gap: 16px;
	margin-top: 28px;
}
label span {
	display: block;
	margin-bottom: 8px;
	color: var(--muted);
	font-weight: 700;
}
input,
select {
	width: 100%;
	height: 52px;
	border: 1px solid var(--line);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.72);
	color: var(--ink);
	padding: 0 16px;
	outline: none;
}
input:focus,
select:focus {
	border-color: var(--wine);
	box-shadow: 0 0 0 4px rgba(127, 31, 46, 0.08);
}
.form-message {
	min-height: 24px;
	margin: 0;
	color: var(--wine);
	font-weight: 700;
}

.button,
.small-button {
	border: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	font-weight: 800;
	transition:
		transform 170ms ease,
		box-shadow 170ms ease;
}
.button {
	min-height: 52px;
	padding: 0 22px;
}
.button:hover,
.small-button:hover {
	transform: translateY(-2px);
}
.primary {
	color: #fffaf5;
	background: var(--wine);
	box-shadow: 0 18px 42px rgba(127, 31, 46, 0.23);
}
.ghost {
	border: 1px solid var(--line);
	color: var(--ink);
	background: rgba(255, 250, 245, 0.68);
}
.small-button {
	min-height: 40px;
	padding: 0 14px;
	color: #fffaf5;
	background: var(--wine);
}

.dashboard {
	min-height: 100vh;
	display: grid;
	grid-template-columns: 270px minmax(0, 1fr);
}
.sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	gap: 28px;
	padding: 28px;
	border-right: 1px solid var(--line);
	background: rgba(255, 250, 245, 0.72);
	backdrop-filter: blur(18px);
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
}
.brand-mark {
	display: grid;
	width: 44px;
	height: 44px;
	place-items: center;
	border-radius: 50%;
	color: #fffaf5;
	background: linear-gradient(135deg, var(--wine), #b15748);
	font:
		700 24px / 1 "Gowun Batang",
		serif;
}
.brand strong,
.brand small {
	display: block;
}
.brand small {
	color: var(--muted);
	font-size: 12px;
	letter-spacing: 0.12em;
}
.sidebar nav {
	display: grid;
	gap: 8px;
}
.sidebar nav a {
	border-radius: 16px;
	color: var(--muted);
	font-weight: 800;
	padding: 14px 16px;
}
.sidebar nav a.active,
.sidebar nav a:hover {
	color: var(--wine);
	background: rgba(127, 31, 46, 0.08);
}
.logout-button {
	margin-top: auto;
}

.workspace {
	padding: clamp(22px, 4vw, 48px);
}
.workspace-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 24px;
}
.date-chip {
	min-width: 180px;
	padding: 18px 20px;
	border: 1px solid var(--line);
	border-radius: 24px;
	background: var(--card);
	text-align: right;
	box-shadow: 0 18px 46px rgba(61, 34, 24, 0.08);
}
.date-chip span,
.date-chip strong {
	display: block;
}
.date-chip span {
	color: var(--muted);
	font-weight: 700;
}
.date-chip strong {
	margin-top: 4px;
	color: var(--wine);
	font-size: 20px;
}
.notice-card,
.stats-grid article,
.schedule-card,
.utility-card {
	border: 1px solid var(--line);
	border-radius: 28px;
	background: var(--card);
	box-shadow: 0 18px 55px rgba(61, 34, 24, 0.08);
}
.notice-card {
	margin-top: 28px;
	padding: 20px 24px;
}
.notice-card p {
	margin: 6px 0 0;
}
.stats-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	margin-top: 18px;
}
.stats-grid article {
	padding: 22px;
}
.stats-grid span,
.stats-grid small {
	color: var(--muted);
	font-weight: 700;
}
.stats-grid strong {
	display: block;
	margin: 10px 0;
	color: var(--wine);
	font-size: 42px;
	line-height: 1;
}

.schedule-grid {
	display: grid;
	gap: 18px;
	margin-top: 18px;
}
.schedule-card {
	padding: 22px;
	overflow: hidden;
}
.card-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	margin-bottom: 16px;
}
.table-wrap {
	overflow-x: auto;
}
table {
	width: 100%;
	min-width: 860px;
	border-collapse: collapse;
}
th,
td {
	padding: 14px 12px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	white-space: nowrap;
}
th {
	color: var(--muted);
	font-size: 13px;
}
td {
	font-weight: 600;
}
.badge {
	display: inline-flex;
	border-radius: 999px;
	padding: 5px 10px;
	color: var(--wine);
	background: rgba(127, 31, 46, 0.08);
	font-size: 12px;
}

.utility-grid {
	display: grid;
	grid-template-columns: 1.1fr 0.9fr;
	gap: 18px;
	margin-top: 18px;
}
.utility-card {
	padding: 24px;
}
.search-form {
	display: grid;
	grid-template-columns: 120px minmax(0, 1fr) auto;
	gap: 10px;
	margin-top: 18px;
}
.admin-toolbar {
	align-items: end;
}
.toolbar-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
}
.toolbar-actions select {
	width: auto;
	min-width: 180px;
}
.wide-card {
	grid-column: 1 / -1;
}
.calendar-card {
	background:
		linear-gradient(
			145deg,
			rgba(255, 250, 245, 0.88),
			rgba(255, 250, 245, 0.62)
		),
		radial-gradient(
			circle at 90% 10%,
			rgba(196, 155, 93, 0.18),
			transparent 18rem
		);
}
.calendar-weekdays,
.calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 8px;
}
.calendar-weekdays {
	margin: 18px 0 8px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 900;
	text-align: center;
}
.calendar-day {
	position: relative;
	min-height: 86px;
	border: 1px solid var(--line);
	border-radius: 20px;
	background: rgba(255, 255, 255, 0.58);
	color: var(--ink);
	cursor: pointer;
	padding: 12px;
	text-align: left;
	transition:
		transform 170ms ease,
		border-color 170ms ease,
		background 170ms ease;
}
.calendar-day:hover {
	transform: translateY(-2px);
	border-color: rgba(127, 31, 46, 0.32);
	background: rgba(255, 250, 245, 0.9);
}
.calendar-day.outside {
	opacity: 0.42;
}
.calendar-day.selected {
	border-color: var(--wine);
	background: rgba(127, 31, 46, 0.1);
	box-shadow: 0 14px 38px rgba(127, 31, 46, 0.12);
}
.calendar-day span {
	font-weight: 900;
}
.calendar-day strong {
	position: absolute;
	right: 10px;
	bottom: 10px;
	display: grid;
	min-width: 28px;
	height: 28px;
	place-items: center;
	border-radius: 999px;
	color: #fffaf5;
	background: var(--wine);
	font-size: 13px;
}
.bulk-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 16px 0;
	color: var(--muted);
	font-weight: 800;
}
.bulk-actions button,
.row-actions button {
	border: 1px solid var(--line);
	border-radius: 999px;
	background: rgba(255, 250, 245, 0.82);
	color: var(--ink);
	cursor: pointer;
	font-weight: 800;
	padding: 7px 10px;
}
.row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
/* 아래 .admin-modal(560px) 규칙과 특이도가 같아 소스 순서로 덮이지 않도록 특이도를 올림 */
.admin-modal.reservation-modal {
	width: min(760px, calc(100% - 32px));
}
.admin-modal.reservation-modal.wide {
	/* 예전 1000px 고정이라 넓은 화면에서 절반을 놀리고 글자는 잘렸다. */
	width: min(1680px, calc(100vw - 48px));
	max-height: calc(100vh - 48px);
}
.admin-modal .table-wrap table {
	min-width: 0;
	width: 100%;
}
.total-table {
	table-layout: fixed;
}
.total-table th,
.total-table td {
	white-space: normal;
	word-break: break-word;
	vertical-align: middle;
}
.total-table .cell-date {
	white-space: nowrap;
}
/* 번호 4 · 구분 5 · 예약일 9 · 시간 5 · 이름 7 · 생년월일 7 · 전화번호 10
   · 진료구분 8 · 시술내용 나머지 · 방문 5 · 담당 5 · 출처 6 */
.total-table th:nth-child(1),  .total-table td:nth-child(1)  { width: 4%; }
.total-table th:nth-child(2),  .total-table td:nth-child(2)  { width: 5%; }
.total-table th:nth-child(3),  .total-table td:nth-child(3)  { width: 9%; }
.total-table th:nth-child(4),  .total-table td:nth-child(4)  { width: 5%; }
.total-table th:nth-child(5),  .total-table td:nth-child(5)  { width: 7%; }
.total-table th:nth-child(6),  .total-table td:nth-child(6)  { width: 7%; }
.total-table th:nth-child(7),  .total-table td:nth-child(7)  { width: 10%; }
.total-table th:nth-child(8),  .total-table td:nth-child(8)  { width: 8%; }
.total-table th:nth-child(9),  .total-table td:nth-child(9)  { width: auto; }
.total-table th:nth-child(10), .total-table td:nth-child(10) { width: 5%; }
.total-table th:nth-child(11), .total-table td:nth-child(11) { width: 5%; }
.total-table th:nth-child(12), .total-table td:nth-child(12) { width: 6%; }

/* 행이 91px 씩 차지해 한 화면에 6줄밖에 안 보였다. 조밀하게 줄인다. */
.total-table th,
.total-table td {
	padding: 7px 8px;
	font-size: 13px;
	line-height: 1.4;
}
.total-table thead th {
	position: sticky;   /* 스크롤해도 머리글이 남아있게 */
	top: 0;
	z-index: 2;
	background: var(--card);
	font-size: 12px;
	padding-top: 10px;
	padding-bottom: 10px;
}
.total-table .cell-date,
.total-table .cell-time,
.total-table .cell-tel,
.total-table .cell-num,
.total-table .cell-name {
	white-space: nowrap;
}
.total-table .cell-part {
	white-space: normal;
	word-break: break-word;
}
.total-table tbody tr:hover {
	background: rgba(127, 31, 46, 0.04);
}
/* 표가 길어도 모달 안에서만 스크롤되게 */
.total-wrap {
	max-height: calc(100vh - 300px);
	overflow: auto;
}
/* 원본(MSSQL) 행 표시 — 삭제 버튼 자리를 대신한다 */
.origin-tag {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	border: 1px solid var(--line);
	color: var(--muted);
	font-size: 11px;
	font-weight: 800;
	white-space: nowrap;
}
/* td에 display:flex(.row-actions)가 걸리면 table-layout:fixed의 컬럼폭이 무너져 삭제칸이 찌그러진다.
   전체리스트에서는 표 셀로 되돌려 지정 폭(10%)을 유지한다. */
.total-table td.row-actions {
	display: table-cell;
	text-align: center;
	white-space: nowrap;
	overflow: visible;
}
.cell-date {
	font-variant-numeric: tabular-nums;
}

/* 알림/확인 레이어 (.admin-modal 폭 560px를 이기도록 특이도 상향) */
.admin-modal.message-modal {
	width: min(420px, calc(100% - 32px));
	padding: 30px 28px 26px;
	text-align: center;
}
.message-text {
	margin: 0;
	color: var(--ink);
	font-weight: 700;
	font-size: 16px;
	line-height: 1.7;
	white-space: pre-wrap;
	word-break: keep-all;
}
.message-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 24px;
}
.message-actions .button {
	min-width: 100px;
}
.reservation-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
	margin-top: 20px;
}
.reservation-form label,
.visit-form label {
	color: var(--muted);
	font-weight: 800;
}
.reservation-form textarea {
	width: 100%;
	min-height: 92px;
	border: 1px solid var(--line);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.72);
	color: var(--ink);
	padding: 12px 16px;
	resize: vertical;
}
.reservation-form label:has(textarea),
.reservation-form button {
	grid-column: 1 / -1;
}
.detail-list {
	display: grid;
	gap: 10px;
	margin-top: 20px;
}
.detail-list div {
	display: grid;
	grid-template-columns: 120px 1fr;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}
.detail-list dt {
	color: var(--muted);
	font-weight: 800;
}
.detail-list dd {
	margin: 0;
}
.visit-form {
	display: grid;
	gap: 14px;
	margin-top: 20px;
}
.visit-detail {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px 16px;
	margin: 0;
}
.visit-detail div {
	display: grid;
	grid-template-columns: 84px 1fr;
	gap: 10px;
	align-items: baseline;
	padding: 8px 0;
	border-bottom: 1px solid var(--line);
}
.visit-detail dt {
	color: var(--muted);
	font-weight: 800;
	font-size: 13px;
}
.visit-detail dd {
	margin: 0;
	font-weight: 600;
}
.visit-choice {
	display: flex;
	gap: 20px;
	align-items: center;
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 12px 16px;
}
.visit-choice legend {
	padding: 0 8px;
	color: var(--muted);
	font-weight: 800;
}
.visit-choice label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.visit-choice input {
	width: auto;
	height: auto;
}
.search-results {
	margin: 18px 0 0;
	padding: 0;
	list-style: none;
}
.search-results li {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
	color: var(--muted);
}
.utility-card.accent {
	background: linear-gradient(
		145deg,
		rgba(127, 31, 46, 0.94),
		rgba(80, 35, 38, 0.92)
	);
	color: #fffaf5;
}
.utility-card.accent p,
.utility-card.accent .eyebrow {
	color: rgba(255, 250, 245, 0.78);
}
.quick-actions {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	margin-top: 22px;
}
.quick-actions button,
.quick-actions a {
	min-height: 58px;
	border: 1px solid rgba(255, 250, 245, 0.25);
	border-radius: 18px;
	color: #fffaf5;
	background: rgba(255, 255, 255, 0.08);
	display: grid;
	place-items: center;
	font-weight: 800;
	cursor: pointer;
}

.timeslot-card {
	background:
		linear-gradient(
			145deg,
			rgba(255, 250, 245, 0.92),
			rgba(255, 250, 245, 0.66)
		),
		radial-gradient(
			circle at 12% 10%,
			rgba(125, 146, 133, 0.16),
			transparent 20rem
		);
}
.timeslot-legend {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 16px;
	color: var(--muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.02em;
	margin: 0;
}
.timeslot-legend span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.timeslot-legend .dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 1px solid var(--line);
}
.timeslot-legend .dot-empty {
	background: rgba(255, 255, 255, 0.78);
}
.timeslot-legend .dot-booked {
	background: var(--wine);
	border-color: var(--wine);
}
.timeslot-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
	gap: 10px;
	margin-top: 6px;
}
.timeslot {
	position: relative;
	display: grid;
	gap: 4px;
	min-height: 92px;
	padding: 14px 14px 16px;
	border-radius: 18px;
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.62);
	color: var(--ink);
	cursor: pointer;
	text-align: left;
	font-weight: 700;
	transition:
		transform 170ms ease,
		border-color 170ms ease,
		background 170ms ease,
		box-shadow 170ms ease;
}
.timeslot:hover {
	transform: translateY(-2px);
	border-color: rgba(127, 31, 46, 0.36);
}
.timeslot:focus-visible {
	outline: none;
	border-color: var(--wine);
	box-shadow: 0 0 0 4px rgba(127, 31, 46, 0.14);
}
.timeslot-time {
	color: var(--wine);
	font-family: "Gowun Batang", serif;
	font-size: 22px;
	letter-spacing: -0.03em;
	line-height: 1;
}
.timeslot.empty {
	border-style: dashed;
	background: rgba(255, 250, 245, 0.55);
}
.timeslot.empty:hover {
	background: rgba(255, 250, 245, 0.95);
	box-shadow: 0 12px 32px rgba(127, 31, 46, 0.1);
}
.timeslot.empty .timeslot-status {
	color: var(--muted);
	font-size: 12px;
	letter-spacing: 0.06em;
}
.timeslot.booked {
	border-color: rgba(127, 31, 46, 0.22);
	background: linear-gradient(
		160deg,
		rgba(127, 31, 46, 0.92),
		rgba(177, 87, 72, 0.92)
	);
	color: #fffaf5;
}
.timeslot.booked:hover {
	box-shadow: 0 18px 38px rgba(127, 31, 46, 0.28);
}
.timeslot.booked .timeslot-time {
	color: #fffaf5;
	opacity: 0.92;
}
.timeslot-name {
	font-size: 15px;
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.timeslot-part {
	font-size: 12px;
	font-weight: 600;
	opacity: 0.78;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.timeslot-more {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-grid;
	min-width: 24px;
	height: 24px;
	place-items: center;
	padding: 0 6px;
	border-radius: 999px;
	background: rgba(255, 250, 245, 0.18);
	color: #fffaf5;
	font-size: 11px;
	letter-spacing: 0;
}
.timeslot-msg {
	grid-column: 1 / -1;
	margin: 0;
	padding: 18px;
	color: var(--muted);
	text-align: center;
	border-radius: 16px;
	background: rgba(255, 250, 245, 0.4);
	border: 1px dashed var(--line);
}

.search-meta {
	margin: 10px 0 0;
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.01em;
}

.link-name {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-align: inherit;
	cursor: pointer;
	border-bottom: 1px dashed rgba(127, 31, 46, 0.28);
	transition:
		color 150ms ease,
		border-color 150ms ease,
		background 150ms ease;
}
.link-name:hover {
	color: var(--wine);
	border-bottom-color: var(--wine);
	border-bottom-style: solid;
}
.link-name:focus-visible {
	outline: none;
	color: var(--wine);
	border-bottom-color: var(--wine);
	box-shadow: 0 0 0 3px rgba(127, 31, 46, 0.16);
	border-radius: 3px;
}
h2 .link-name {
	border-bottom-width: 2px;
}
.search-form [data-action="clear-search"] {
	width: 40px;
	min-width: 40px;
	padding: 0;
	border: 1px solid var(--line);
	background: rgba(255, 250, 245, 0.72);
	color: var(--muted);
	font-size: 22px;
	line-height: 1;
}
.search-form [data-action="clear-search"]:hover {
	color: var(--wine);
	border-color: rgba(127, 31, 46, 0.32);
	background: rgba(255, 250, 245, 0.95);
}

.admin-modal {
	width: min(560px, calc(100% - 32px));
	border: 0;
	border-radius: 28px;
	padding: 30px;
	color: var(--ink);
	background: #fffaf5;
	box-shadow: var(--shadow);
}
.admin-modal::backdrop {
	background: rgba(32, 26, 24, 0.38);
	backdrop-filter: blur(5px);
}
.modal-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: rgba(127, 31, 46, 0.08);
	color: var(--wine);
	font-size: 24px;
	cursor: pointer;
}
.modal-list {
	padding-left: 20px;
	color: var(--muted);
	line-height: 1.9;
}

/* ===== MOON SYSTEM 인터페이스 ===== */
.day-nav {
	display: flex;
	align-items: center;
	gap: 10px;
}
.day-nav .small-button {
	width: 40px;
	min-width: 40px;
	padding: 0;
	font-size: 18px;
}
.admin-guide {
	margin: 22px 0 4px;
	padding: 14px 20px;
	border: 1px solid var(--line);
	border-left: 4px solid var(--wine);
	border-radius: 18px;
	background: var(--card);
	color: var(--muted);
	font-size: 14px;
	line-height: 1.7;
}
.admin-guide strong {
	color: var(--wine);
}

/* 원본 new_total.asp 처럼 기본은 좌우 2일치, 달력에서 고르면 하루만 크게. */
.day-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 18px;
	margin-top: 18px;
}
.day-grid[data-view="two"] {
	grid-template-columns: 1fr 1fr;
}
/* 두 칸으로 나뉘면 폭이 절반이라 생년월일·전화번호가 줄바꿈된다.
   이 모드에서만 글자와 여백을 줄이고 숫자 칸은 줄바꿈을 막는다. */
.day-grid[data-view="two"] .slot-table {
	font-size: 11px;
}
.day-grid[data-view="two"] .slot-table th,
.day-grid[data-view="two"] .slot-table td {
	padding: 5px 3px;
	white-space: nowrap;
}
.day-grid[data-view="two"] .slot-table th {
	font-size: 10px;
	letter-spacing: 0;
}
.day-grid[data-view="two"] .slot-table .cell-part {
	white-space: normal;
	word-break: break-all;
}
.day-grid[data-view="two"] .badge {
	padding: 1px 5px;
	font-size: 11px;
	white-space: nowrap;
}
.day-grid[data-view="two"] .table-wrap {
	overflow-x: auto;   /* 그래도 좁으면 잘리지 않고 가로 스크롤 */
}
/* 두 칸 모드에서는 카드 여백과 칸 사이 간격을 줄여 표에 폭을 더 준다. */
.day-grid[data-view="two"] {
	gap: 10px;
}
.day-grid[data-view="two"] .schedule-card {
	padding: 16px 12px;
}
.day-grid[data-view="one"] [data-day-card="1"] {
	display: none;
}

.view-switch {
	display: flex;
	gap: 8px;
	margin-top: 18px;
}
.view-switch .small-button.active {
	background: var(--admin-accent, #7f1f2e);
	border-color: var(--admin-accent, #7f1f2e);
	color: #fff;
}
.day-card .table-wrap {
	margin-top: 4px;
}
.slot-table {
	min-width: 0;
	table-layout: fixed;
	font-size: 13px;
}
.slot-table th,
.slot-table td {
	padding: 8px 5px;
	text-align: center;
	white-space: normal;
	word-break: break-word;
	vertical-align: middle;
}
.slot-table th {
	background: rgba(127, 31, 46, 0.05);
}
/* 시 8 · 분 6 · 구분 8 · 성명 14 · 생년월일 10 · 시술내용 20 · 진료 8 · 여부 8 · 전화 12 · 관리자명 6 */
.slot-table th:nth-child(1),
.slot-table td:nth-child(1) { width: 8%; }
.slot-table th:nth-child(2),
.slot-table td:nth-child(2) { width: 6%; }
.slot-table th:nth-child(3),
.slot-table td:nth-child(3) { width: 8%; }
.slot-table th:nth-child(4),
.slot-table td:nth-child(4) { width: 14%; }
.slot-table th:nth-child(5),
.slot-table td:nth-child(5) { width: 10%; }
.slot-table th:nth-child(6),
.slot-table td:nth-child(6) { width: 20%; }
.slot-table th:nth-child(7),
.slot-table td:nth-child(7),
.slot-table th:nth-child(8),
.slot-table td:nth-child(8) { width: 8%; }
.slot-table th:nth-child(9),
.slot-table td:nth-child(9) { width: 12%; }
.slot-table th:nth-child(10),
.slot-table td:nth-child(10) { width: 6%; }

/* '시' 그룹 셀 — 한 시간대를 rowspan으로 묶음 (원본 new_total.asp의 좌측 시 컬럼) */
.cell-hour {
	background: rgba(127, 31, 46, 0.06);
	color: var(--wine);
	font-family: "Gowun Batang", serif;
	font-weight: 700;
	vertical-align: middle;
	border-right: 1px solid var(--line);
}
.slot-add-row .cell-hour {
	color: var(--muted);
}
.cell-min {
	color: #2c4a7c;
	font-weight: 700;
}
.cell-name .link-name {
	font-weight: 700;
}
.slot-row {
	cursor: pointer;
	transition: background 150ms ease;
}
.slot-row:hover {
	background: rgba(127, 31, 46, 0.06);
}
.slot-add-row {
	cursor: pointer;
}
.slot-add-row td {
	border-bottom: 1px dashed var(--line);
}
.slot-empty {
	color: var(--muted);
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.04em;
	opacity: 0.55;
}
.slot-add-row:hover .slot-empty {
	color: var(--wine);
	opacity: 1;
}

/* 사이드바 미니 캘린더 */
.mini-calendar {
	padding: 16px;
	border-radius: 20px;
}
.mini-calendar .card-heading {
	margin-bottom: 10px;
}
.mini-calendar-title {
	font-size: 16px;
}
.mini-calendar .small-button {
	width: 32px;
	min-width: 32px;
	min-height: 32px;
	padding: 0;
}
.mini-weekdays,
.mini-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 3px;
}
.mini-weekdays {
	margin-bottom: 4px;
	color: var(--muted);
	font-size: 11px;
	font-weight: 800;
	text-align: center;
}
.mini-day {
	position: relative;
	aspect-ratio: 1;
	border: 1px solid transparent;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.45);
	color: var(--ink);
	cursor: pointer;
	font-size: 12px;
	font-weight: 700;
	transition: background 150ms ease, border-color 150ms ease;
}
.mini-day:hover {
	border-color: rgba(127, 31, 46, 0.3);
}
.mini-day.outside {
	opacity: 0.35;
}
.mini-day.has i {
	position: absolute;
	left: 50%;
	bottom: 4px;
	transform: translateX(-50%);
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--wine);
}
.mini-day.selected {
	border-color: var(--wine);
	background: rgba(127, 31, 46, 0.12);
	color: var(--wine);
}

/* 폼/모달 보강 */
.reservation-form .full {
	grid-column: 1 / -1;
}
.customer-search-row {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-top: 8px;
}
.customer-search-row input {
	flex: 1;
	min-width: 0;
	margin: 0;
}
.customer-search-row .small-button {
	flex: 0 0 auto;
	height: 52px;
	padding: 0 16px;
}
.customer-results {
	display: grid;
	gap: 8px;
	margin-top: 6px;
	padding: 12px;
	border: 1px dashed var(--line);
	border-radius: 16px;
	background: rgba(255, 250, 245, 0.55);
}
.customer-results[hidden] {
	display: none;
}
.customer-results-head {
	margin: 0;
	font-size: 12px;
	font-weight: 800;
	color: var(--wine);
}
.customer-card {
	display: grid;
	gap: 4px;
	text-align: left;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.7);
	color: var(--ink);
	cursor: pointer;
	font: inherit;
}
.customer-card:hover {
	border-color: rgba(127, 31, 46, 0.35);
	background: rgba(255, 250, 245, 0.95);
}
.customer-card-top {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}
.customer-card-top strong {
	font-size: 15px;
}
.customer-card-top em {
	font-style: normal;
	color: var(--wine);
	font-weight: 800;
	font-size: 12px;
}
.customer-card-top span {
	color: var(--muted);
	font-size: 12px;
}
.customer-card-sub {
	color: var(--muted);
	font-size: 12px;
}
.modal-actions {
	margin-top: 18px;
	display: flex;
	justify-content: flex-end;
}
.total-search {
	margin-top: 18px;
}

@media (max-width: 1040px) {
	.dashboard {
		grid-template-columns: 1fr;
	}
	.day-grid,
	.day-grid[data-view="two"] {
		grid-template-columns: 1fr;
	}
	.sidebar {
		position: static;
		height: auto;
		flex-direction: row;
		align-items: center;
		overflow-x: auto;
	}
	.sidebar nav {
		display: flex;
		min-width: max-content;
	}
	.logout-button {
		margin-top: 0;
		margin-left: auto;
	}
	.stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.utility-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 680px) {
	.workspace-header,
	.card-heading {
		display: grid;
	}
	.date-chip {
		text-align: left;
	}
	.stats-grid,
	.reservation-form,
	.quick-actions {
		grid-template-columns: 1fr;
	}
	.search-form {
		grid-template-columns: 1fr auto;
	}
	.search-form select {
		grid-column: 1 / -1;
	}
	.timeslot-grid {
		grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
	}
	.timeslot {
		min-height: 80px;
		padding: 12px;
	}
	.sidebar {
		padding: 18px;
	}
	.brand small {
		display: none;
	}
	.workspace {
		padding: 18px;
	}
}

/* ---------- 원본 서버 동기화 표시 ---------- */
/* 원본(MSSQL)이 노후 장비라 멈출 수 있다. 멈춘 걸 모르고 옛 자료를 최신으로
   착각하면 진료 일정이 어긋나므로, 상태를 상단에 크게 고정해 둔다. */
.sync-badge {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	margin-right: 14px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--card);
	white-space: nowrap;
}
.sync-badge .sync-text {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}
.sync-badge strong {
	font-size: 13px;
	font-weight: 800;
}
.sync-badge small {
	font-size: 11px;
	color: var(--muted);
	font-weight: 700;
}
.sync-dot {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: #b9b1ac;
	flex: none;
}

.sync-badge[data-state="on"] {
	border-color: #2e7d54;
	background: rgba(46, 125, 84, 0.08);
}
.sync-badge[data-state="on"] strong { color: #1f6742; }
.sync-badge[data-state="on"] .sync-dot {
	background: #2e9e63;
	box-shadow: 0 0 0 0 rgba(46, 158, 99, 0.7);
	animation: syncPulse 2s infinite;
}
@keyframes syncPulse {
	70%  { box-shadow: 0 0 0 8px rgba(46, 158, 99, 0); }
	100% { box-shadow: 0 0 0 0 rgba(46, 158, 99, 0); }
}

.sync-badge[data-state="off"] {
	border-color: #b3261e;
	background: rgba(179, 38, 30, 0.1);
}
.sync-badge[data-state="off"] strong { color: #8c1d18; }
.sync-badge[data-state="off"] .sync-dot { background: #d93a31; }

.sync-badge[data-state="unknown"] strong { color: var(--muted); }

/* 움직임을 줄이도록 설정한 사용자에게는 깜빡임을 끈다 */
@media (prefers-reduced-motion: reduce) {
	.sync-badge[data-state="on"] .sync-dot { animation: none; }
}

@media (max-width: 1040px) {
	.sync-badge {
		margin-right: 0;
		margin-bottom: 10px;
	}
}
