/* 스케줄 변경 입력 화면. 프런트 데스크의 태블릿/노트북에서 쓰므로 터치 영역을 넉넉히 둔다. */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #dcdfe4;
  --text: #1c2024;
  --muted: #6b7280;
  --accent: #2563eb;
  --ok-bg: #eff8f1;
  --ok-line: #9ccfab;
  --bad-bg: #fdf2f2;
  --bad-line: #e8a9a9;
  --warn: #9a6700;
  --accent-soft: rgba(37, 99, 235, 0.07);
  --accent-ring: rgba(37, 99, 235, 0.22);
}

@media all { /* 항상 다크모드 (2026-10-17) */
  :root {
    color-scheme: dark; /* 입력칸·스크롤바·달력도 어둡게 */
    --bg: #15171a;
    --card: #1e2125;
    --line: #343a40;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --accent: #6ea8fe;
    --ok-bg: #16281c;
    --ok-line: #2f6b42;
    --bad-bg: #2b1a1a;
    --bad-line: #7a3b3b;
    --warn: #e0b341;
    --accent-soft: rgba(110, 168, 254, 0.09);
    --accent-ring: rgba(110, 168, 254, 0.28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}

header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

h1 { margin: 0; font-size: 20px; }
.header-btn {
  margin-left: auto;
  align-self: center;
  font-size: 12.5px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}
.header-btn:hover { color: var(--accent); border-color: var(--accent); }
h2 { margin: 0 0 14px; font-size: 16px; }

main {
  max-width: 1080px; /* 105석을 한 화면에 더 많이 보이게 넓게 */
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
}

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.error { color: #c0392b; }
.footnote { color: var(--muted); font-size: 13px; line-height: 1.6; }

input[type="text"], input[type="search"], input[type="date"], input[type="password"], select {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  width: 100%;
}

select { padding: 6px; }
select option { padding: 5px 4px; }

input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.field { margin-bottom: 18px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.stack { flex-direction: column; align-items: stretch; }
.radios { display: flex; flex-wrap: wrap; gap: 14px; }
.radios label, .checkline { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.radios input, .checkline input { width: auto; }

code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}

/* 시간표 */
.timetable-wrap { overflow-x: auto; margin-top: 14px; }

table.timetable, table.list {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

table.timetable th, table.timetable td,
table.list th, table.list td {
  border: 1px solid var(--line);
  padding: 7px 9px;
  text-align: left;
  white-space: nowrap;
}

table.timetable thead th, table.list thead th {
  background: var(--bg);
  font-size: 13px;
  text-align: center;
}

table.timetable tbody th { background: var(--bg); font-weight: 600; font-size: 13px; }
table.timetable.editable td { padding: 3px; }
table.timetable.editable input { min-width: 120px; padding: 6px 7px; font-size: 13px; }

/* 버튼 */
.actions { display: flex; gap: 10px; margin-top: 4px; }

button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 18px;
  cursor: pointer;
}

button:hover { border-color: var(--accent); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.cancel { padding: 5px 11px; font-size: 13px; font-weight: 500; }

/* 결과 / 미리보기 */
.result { margin-top: 14px; }

.box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
}

.box p:first-child { margin-top: 0; }
.box p:last-child { margin-bottom: 0; }
.box.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.box.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.box ul { margin: 8px 0 0; padding-left: 20px; }

.diff { font-size: 14px; padding: 3px 0; }
.diff.add { color: #1e7b34; }
.diff.del { color: #a33; text-decoration: line-through; }
.diff.warn { color: var(--warn); }

@media all { /* 항상 다크모드 (2026-10-17) */
  .diff.add { color: #7ee2a0; }
  .diff.del { color: #e59a9a; }
}

/* 목록 */
table.list td { white-space: normal; }
table.list tr.dim { opacity: 0.5; }

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.badge.live { border-color: var(--ok-line); background: var(--ok-bg); font-weight: 600; }
.badge.warn { border-color: var(--bad-line); background: var(--bad-bg); font-weight: 600; }

/* 로그인 */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 340px;
}

.login-card h1 { margin: 0 0 4px; }
.login-card p { margin: 0 0 18px; font-size: 14px; }
.login-card input { margin-bottom: 12px; }
.login-card button { width: 100%; }
.login-card .error { margin: 12px 0 0; font-size: 14px; }

/* 달력 ---------------------------------------------------------------------
   특정일(여러 날 토글) / 기간(시작~마지막) / 영구(하루) 를 한 달력으로 받는다.
   프런트 데스크가 태블릿에서 쓰므로 날짜 버튼을 손가락 크기로 둔다. */
.calendar {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 12px;
  max-width: 360px;
  background: var(--card);
  user-select: none;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-title { font-weight: 600; font-size: 15px; }

.cal-nav {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--line);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dow {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 4px;
}

.cal-day {
  height: 40px;
  padding: 0;
  font-size: 15px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
}

.cal-day:hover:not(:disabled) { border-color: var(--line); }
.cal-day:disabled { color: var(--muted); opacity: 0.35; cursor: default; }
.cal-day.sun { color: #c0392b; }
.cal-day.sat { color: #2563eb; }
.cal-day.today { font-weight: 700; text-decoration: underline; }

/* 고른 날 */
.cal-day.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
/* 기간의 시작과 끝 사이 */
.cal-day.in { background: var(--ok-bg); border-color: var(--ok-line); }

.cal-pad { height: 40px; }

.actions.subtle { margin-top: 10px; }
.actions.subtle button { font-size: 14px; padding: 8px 12px; }

/* 좌석 목록 ----------------------------------------------------------------
   105석을 버튼으로 깔아두고, 위 검색창으로 걸러낸다. 한 화면에 최대한 많이 보이도록
   작게 두되, 손가락으로 누를 수 있게 높이 44px 은 지킨다. */
.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.search-row input { flex: 1; font-size: 17px; padding: 11px 13px; }
.search-row .muted { white-space: nowrap; font-size: 14px; }

.seat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 5px;
}

.seat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 44px;
  padding: 4px 2px;
  border-radius: 8px;
  font-weight: 400;
  line-height: 1.25;
}
/* display:flex 가 hidden 속성을 이겨버리므로 명시해야 검색 결과에서 실제로 사라진다 */
.seat-btn[hidden] { display: none; }

.seat-no { font-size: 11px; color: var(--muted); }
.seat-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-btn.empty { cursor: default; opacity: 0.45; border-style: dashed; }
.seat-btn.empty:hover { border-color: var(--line); }
.seat-btn.empty .seat-name { font-size: 11px; font-weight: 400; color: var(--muted); }

#seatGridMsg:empty { display: none; }

/* 좌석 하나 화면의 머리 */
.seat-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.seat-head h2 { margin: 0; font-size: 19px; }
.seat-head button { padding: 8px 14px; font-size: 14px; }

/* 한 문장으로 입력 ----------------------------------------------------------
   화면 맨 위의 주 입력창이라 다른 카드보다 눈에 띄게: 은은한 강조색 배경, 큰 입력칸,
   눌러서 넣어보는 예시. */
.ai-card {
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--card);
  border-color: var(--accent-ring);
  padding: 20px;
}
.ai-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.ai-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.ai-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
}
.ai-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
}
.ai-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.ai-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 4px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ai-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.ai-composer input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 17px;
  padding: 10px 10px;
  outline: none;
  box-shadow: none;
}
.ai-composer button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: 9px;
  padding: 10px 16px;
}
.ai-composer.busy button { opacity: 0.75; cursor: progress; }
.ai-composer.busy { border-color: var(--accent); }

.ai-examples { margin-top: 10px; font-size: 13px; }
.ai-examples summary { cursor: pointer; color: var(--muted); width: fit-content; user-select: none; }
.ai-examples summary:hover { color: var(--accent); }
.ai-examples .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
}
.chip:hover { color: var(--accent); }

.ai-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* 키가 없어 꺼진 상태 */
.ai-card.off { background: var(--card); border-color: var(--line); }
.ai-card.off .ai-icon { background: var(--line); color: var(--muted); }
.ai-card.off .ai-composer, .ai-card.off .ai-examples { opacity: 0.5; }

@media (max-width: 560px) {
  .ai-card { padding: 16px; }
  .ai-composer input { font-size: 16px; }
  .ai-composer .ai-btn-label { display: none; } /* 좁은 화면에서는 화살표만 */
  .chip { font-size: 12px; }
}
.ai-note { margin-bottom: 14px; }
.ai-confirm { border-color: var(--line, #444); }
.confirm-table { border-collapse: collapse; margin: 8px 0; width: 100%; }
.confirm-table th { text-align: left; white-space: nowrap; padding: 6px 14px 6px 0; vertical-align: top; color: var(--muted, #999); font-weight: 600; width: 1%; }
.confirm-table td { padding: 6px 0; }
.confirm-table td div + div { margin-top: 4px; }
.wrong-parts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 4px; }
.wrong-parts label { display: inline-flex; align-items: center; gap: 4px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; text-align: left; }
.pick .muted { font-size: 13px; font-weight: normal; }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.chip-tag { font-size: 11px; font-weight: 700; color: var(--accent); }

/* 되묻기 / 여러 명 확인표 */
.ask { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px dashed var(--line); }
.ask p { margin: 0 0 4px; }
.pick.drop { border-style: dashed; }
.reason-row { display: flex; gap: 8px; margin-top: 8px; }
.reason-row input { flex: 1; min-width: 0; }
.confirm-table.people { border-top: 1px solid var(--line); margin-top: 4px; }
.confirm-table.people th { color: var(--text); padding-top: 8px; }
.confirm-table.people td { padding-top: 8px; border-bottom: 1px solid var(--line); }
.confirm-table.people th { border-bottom: 1px solid var(--line); }
.confirm-table.people td.x { width: 1%; text-align: right; }
.confirm-table.people tr:last-child th, .confirm-table.people tr:last-child td { border-bottom: none; }
.confirm-table.people th, .confirm-table.people td { vertical-align: middle; padding-bottom: 8px; }
.confirm-table.people td.x button { white-space: nowrap; }

/* 회차 (2차 등원 등) */
.slot-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); vertical-align: middle; }
.confirm-table tr.skip th, .confirm-table tr.skip td div { opacity: 0.75; }
.ask ul { margin: 4px 0 0; padding-left: 20px; font-size: 14px; }

/* 회차가 겹칠 때 묻는 표 */
.ov-title { font-weight: 700; color: var(--warn); }
.ov-case { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.ov-head { margin-bottom: 4px; font-size: 14px; }
.ov-scroll { overflow-x: auto; }
.ov-table { border-collapse: collapse; font-size: 14px; }
.ov-table th, .ov-table td { padding: 4px 18px 4px 0; text-align: left; white-space: nowrap; }
.ov-table thead th { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.ov-table tbody th { color: var(--muted); font-weight: 600; }
.ov-table tr.changed td:last-child strong { color: var(--accent); }
.ov-tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.ov-tag.bad { color: #cf222e; background: var(--bad-bg); border: 1px solid var(--bad-line); }
.ov-result { margin: 0 0 4px 2px; font-size: 14px; }
@media all { /* 항상 다크모드 (2026-10-17) */
  .ov-tag.bad { color: #ff8182; }
}

/* [저장] 확인 창 */
.confirm-dlg {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.confirm-dlg::backdrop { background: rgba(0, 0, 0, 0.5); }
.confirm-dlg h2 { margin: 0 0 12px; font-size: 18px; }
.confirm-dlg .box { margin-top: 12px; }
.confirm-dlg .actions { margin-top: 16px; justify-content: flex-end; }
.diff.muted { color: var(--muted); }
.confirm-dlg button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 한 문장에 날짜마다 다른 변경 */
.ai-confirm .part { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ai-confirm .part p { margin: 0 0 4px; }
.ai-confirm .people-line { margin: 6px 0 0; }

/* [AI 기록] 페이지 (ai-log.html) */
.log-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.log-head h2 { margin: 0; }
.log-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.log-stats > div { display: flex; flex-direction: column; min-width: 92px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.log-stats span { font-size: 12.5px; }
.log-stats b { font-size: 20px; }
table.log-table td { white-space: normal; vertical-align: top; }
table.log-table td:first-child { white-space: nowrap; }
table.log-table td .muted { font-size: 12.5px; margin-top: 3px; }
.verdict { font-weight: 700; white-space: nowrap; }
.verdict.ok { color: #1a7f37; }
.verdict.wrong { color: #cf222e; }
.verdict.none { color: var(--muted); font-weight: 500; }
@media all { /* 항상 다크모드 (2026-10-17) */
  .verdict.ok { color: #6fdd8b; }
  .verdict.wrong { color: #ff8182; }
}

/* 좌석 선택하여 직접 변경하기 (접는 카드) - 접혀 있어도 다른 카드와 같은 넓이로 보인다 */
.seat-fold { padding: 0; }
.seat-fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.seat-fold > summary::-webkit-details-marker { display: none; }
.seat-fold > summary::before { content: '▸'; color: var(--muted); transition: transform 0.15s; }
.seat-fold[open] > summary::before { transform: rotate(90deg); }
.seat-fold > summary:hover { color: var(--accent); }
.seat-fold[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.seat-fold > :not(summary) { margin-left: 18px; margin-right: 18px; }
.seat-fold > :last-child { margin-bottom: 18px; }
