:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #e2e0da;
  --accent: #c8102e;
  --ok: #1a7f37;
  --bad: #b42318;
  --warn: #b54708;
  --chip: #f0eee9;
  --p1: #8a3ab9; /* 예매자 1 = 보라 */
  --p2: #2457c5; /* 예매자 2 = 파랑 */
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; }
button, select, input { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 12px; }
button:hover { border-color: var(--ink); }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
button.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
button:disabled { opacity: .4; cursor: default; }
input, select { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: #fff; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: 24px; align-items: center; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar h1 { font-size: 16px; margin: 0; }
#tabs { display: flex; gap: 4px; }
#tabs button { border: none; background: transparent; padding: 8px 12px; border-radius: 6px; }
#tabs button.active { background: var(--ink); color: #fff; }
.whoami { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.conn { font-size: 12px; color: var(--muted); }
.conn.on { color: var(--ok); }
.conn.off { color: var(--bad); }

main { padding: 20px; max-width: 1280px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.panel h3 { font-size: 14px; margin: 12px 0 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.warn { color: var(--warn); }
.err { color: var(--bad); }
.hint { background: #fff8e6; border: 1px solid #f3dfae; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }

.p1 { color: var(--p1); }
.p2 { color: var(--p2); }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--chip); color: var(--muted); margin-left: 4px; vertical-align: 1px; }
.tag.gv { background: #fde7ea; color: var(--accent); }
.tag.hedge { background: #fff1e0; color: var(--warn); }
.tag.must { background: var(--ink); color: #fff; }
.tag.want { background: #555; color: #fff; }
.tag.maybe { background: #ddd; color: #333; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 56px; background: var(--panel); }
tr.graded { background: #fcfbf8; }
/* 작품 목록: 행 사이를 넉넉하게 */
tbody td { padding: 14px 10px; }
.title-cell { line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 12px; background: var(--chip); border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.chip-when { font-variant-numeric: tabular-nums; }
.chip-where { margin-left: 6px; color: var(--muted); }
.chip .tag { margin-left: 6px; }
/* 작품 목록의 회차 칩은 한 줄에 하나씩 */
tbody .chips { flex-direction: column; align-items: flex-start; }
.meta-cell { font-size: 13px; color: var(--muted); }
.chip.together { border-color: #9bb5ea; }
.chip.solo { border-style: dashed; border-color: #bbb; }
.chip.none { opacity: .35; }
.chip.excluded { text-decoration: line-through; opacity: .45; }
.chip.owned { background: #e3f2e7; border-color: var(--ok); opacity: 1; }
.chip.confirmed { background: var(--ok); border-color: var(--ok); color: #fff; }
.chip.confirmed::before { content: '✓ '; font-weight: 700; }
.chip.confirmed .chip-where { color: rgba(255, 255, 255, .85); }
.confirm-btn { font-size: 12px; padding: 3px 10px; border-radius: 999px; color: var(--ok); border-color: #b9dcc3; background: #fff; white-space: nowrap; }
.confirm-btn.on { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 700; }
.grade-select { width: 104px; border-radius: 6px; transition: background-color .12s, color .12s; }
.grade-select.g-must { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }
.grade-select.g-want { background: #e4eafa; color: #23407f; border-color: #c2d0ef; font-weight: 600; }
.grade-select.g-maybe { background: #f2f0ea; color: #5f5c55; border-color: #e0ddd4; }
.grade-select.g-none { background: #fafafa; color: #a9a9ae; border-color: #ececed; }
.grade-select.g-unavailable { background: #f6f5f3; color: #a09a94; border-style: dashed; border-color: #ddd8d0; opacity: 1; }

.chip-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.chip-legend .chip { cursor: default; }

.plan-list { list-style: none; margin: 0; padding: 0; }
/* 순번 | 예매자 | 상영코드 | 작품·일시(남는 폭 전부) | 매수·대체 회차(내용 크기) */
.plan-list li { display: grid; grid-template-columns: 40px 72px 44px minmax(0, 1fr) auto; gap: 8px 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plan-list li.no-person { grid-template-columns: 40px 44px minmax(0, 1fr) auto; }
.plan-list .cl-meta { white-space: nowrap; }
/* 예매 결과 표시가 붙은 줄은 칸이 하나 더 있다 */
.plan-list li.marked { grid-template-columns: 40px 72px 44px minmax(0, 1fr) auto auto; }
.cl-marks { display: flex; gap: 2px; }
.mark-btn { padding: 2px 8px; font-size: 12px; color: var(--muted); }
.mark-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.plan-list li.is-success .mark-btn.on { background: var(--ok); border-color: var(--ok); }
.plan-list li.is-fail .mark-btn.on { background: var(--bad); border-color: var(--bad); }
/* 더 이상 가능하지 않은 줄: 글자에 줄을 긋고 흐리게 */
.plan-list li.struck > :not(.cl-marks) { text-decoration: line-through; opacity: .45; }
.tag.struck-why { background: #fdeceb; color: var(--bad); text-decoration: none; }
.tag.mark-ok { background: #e4f2e8; color: var(--ok); font-weight: 700; }
/* 순번은 오른쪽 정렬하되 뒤 칸(예매자·상영코드)과 붙어 보이지 않게 오른쪽 여백을 둔다 */
.plan-list .step { color: var(--muted); text-align: right; padding-right: 12px; }
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .5px; }

.live-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.big-card { background: var(--panel); border: 2px solid var(--ink); border-radius: 14px; padding: 24px; }
.big-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.big-card .big-code { font-size: 72px; line-height: 1; margin: 8px 0 12px; font-family: ui-monospace, Consolas, monospace; font-weight: 800; }
.big-card .title { font-size: 22px; font-weight: 700; }
.big-card .meta { font-size: 16px; margin: 6px 0 16px; }
.big-card .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.big-card .actions button { font-size: 18px; padding: 12px 22px; border-radius: 10px; }
.big-card.pending { border-color: var(--accent); }
.seats { font-size: 20px; font-weight: 800; color: var(--accent); }
.other-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.log li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
/* 라이브 탭 확보 목록: 코드 | 제목(위)·날짜(아래) | 관람 확정 버튼 */
.log li.booked-item { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.log li.booked-item:last-child { border-bottom: none; }
.booked-body { min-width: 0; }
.booked-title { font-weight: 600; line-height: 1.35; }
.log { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow: auto; }
.kbd { font-family: ui-monospace, Consolas, monospace; font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

/* 작품 정보 모달 */
.film-link { color: #2457c5; text-decoration: underline; cursor: pointer; }
.film-title { font-weight: 700; }
.row-link { cursor: pointer; }
.tag.none { background: #eee; color: #888; }
.chip.keyword { background: #eef1f7; color: #3c4a68; cursor: default; }
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 20, 22, .55); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 100; }
.modal { position: relative; background: var(--panel); border-radius: 14px; max-width: 720px; width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal-close { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, .9); border-radius: 50%; width: 32px; height: 32px; padding: 0; line-height: 1; }
/* 닫기(✕)와 같은 높이, 모달 왼쪽 위 — 닫기와 같은 동그란 모양 */
.modal-back { position: absolute; top: 10px; left: 10px; width: 32px; height: 32px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); font-size: 16px; line-height: 1; }
.modal-poster { width: 100%; max-height: 42vh; object-fit: cover; display: block; background: #eee; }
.modal-body { padding: 20px 24px 24px; }
.modal-body h2 { margin: 0; font-size: 20px; }
.modal-note { white-space: pre-wrap; line-height: 1.7; margin: 0; }

/* 프로그램 노트: 쉬운 글 / 원문 탭 */
.note-tabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.note-tabs-label { color: var(--muted); margin-right: 10px; padding-bottom: 7px; }
.note-tab { border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; margin-bottom: -1px; padding: 6px 14px; font-size: 13px; color: var(--muted); background: none; }
.note-tab:hover { color: var(--ink); }
.note-tab.active { border-color: var(--line); background: var(--panel); color: var(--ink); font-weight: 700; }
/* 라벨 칸과 내용 칸을 나눈다. 라벨 칸은 가장 긴 라벨 너비에 맞춰져 줄이 가지런하다 */
.plain-note { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 12px; row-gap: 8px; }
.plain-label { font-size: 13px; font-weight: 400; color: var(--muted); line-height: 1.7; }
.plain-text { margin: 0; line-height: 1.7; }
.modal-info { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 0; margin: 0 0 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.modal-info li { display: flex; gap: 6px; }
.modal-footer {
  position: sticky; bottom: 0; margin-top: 18px; padding: 14px 24px;
  margin-left: -24px; margin-right: -24px; margin-bottom: -24px;
  /* 평가 영역은 본문과 구분되도록 연한 배경을 깐다(흰 버튼이 도드라지게) */
  background: var(--bg); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 12px rgba(0, 0, 0, .04);
  max-height: 46vh; overflow: auto;
}
.modal-grades { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.modal-nav { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; }
.nav-move { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.auto-next { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.auto-next input { width: 16px; height: 16px; }
.modal-grade-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grade-person { min-width: 64px; font-weight: 700; font-size: 13px; }
.grade-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.grade-btn { padding: 7px 12px; border-radius: 999px; font-size: 13px; background: var(--panel); color: var(--muted); }
.grade-btn:hover { border-color: var(--ink); }
.grade-btn.active { font-weight: 700; }
.grade-btn.active.g-must { background: var(--ink); color: #fff; border-color: var(--ink); }
.grade-btn.active.g-want { background: #e4eafa; color: #23407f; border-color: #c2d0ef; }
.grade-btn.active.g-maybe { background: #f2f0ea; color: #5f5c55; border-color: #ddd8cd; }
.grade-btn.active.g-none { background: #f1f1f2; color: #85858b; border-color: #e2e2e4; }
.grade-btn.active.g-unset { background: #fff; color: var(--ink); border-color: var(--ink); }
/* '관람 불가'는 버튼이 아니라 span 이라 테두리 두께를 직접 줘야 한다(안 주면 기본 3px로 두껍게 그려진다) */
.grade-btn.g-unavailable { display: inline-block; border: 1px dashed #d6d1c8; line-height: 1.5; color: #a09a94; cursor: default; }

.modal-films { list-style: none; padding: 0; margin: 0 0 16px; }
.modal-films li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.btn-link { display: inline-block; padding: 6px 12px; border: 1px solid var(--ink); border-radius: 6px; background: var(--ink); color: #fff; text-decoration: none; }

/* 태블릿 */
@media (max-width: 900px) {
  .live-grid { grid-template-columns: 1fr; }
  .plan-list li { grid-template-columns: 40px 72px 44px minmax(0, 1fr); }
  .plan-list li.no-person { grid-template-columns: 40px 44px minmax(0, 1fr); }
  .plan-list .cl-meta { grid-column: 2 / -1; white-space: normal; }
  .plan-list li.marked { grid-template-columns: 40px 72px 44px minmax(0, 1fr) auto; }
  .plan-list .cl-marks { grid-column: 2 / -1; }
  .grid2 { grid-template-columns: minmax(0, 1fr); } /* 칸 내용이 넓어도 화면을 넘지 않게 */
}

/* 휴대폰 */
@media (max-width: 760px) {
  /* 타이포 스케일: 본문 15 / 보조 13 / 라벨 12 */
  body { font-size: 15px; }
  .small, .muted.small { font-size: 13px; }
  input, select, textarea, button { font-size: 16px; }
  .panel h2 { font-size: 15px; }
  .panel h3 { font-size: 14px; }

  main { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .panel { padding: 14px; border-radius: 10px; margin-bottom: 12px; }
  .row { gap: 10px; margin-bottom: 10px; }

  .topbar { gap: 8px; padding: 8px 12px; }
  .topbar h1 { font-size: 15px; }
  .whoami { gap: 8px; font-size: 13px; }
  .conn { font-size: 11px; }
  #tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  #tabs::-webkit-scrollbar { display: none; }
  #tabs button { white-space: nowrap; padding: 8px 12px; font-size: 15px; }

  /* 작품 표 → 카드 목록 */
  table, tbody, td { display: block; width: 100%; }
  thead { display: none; }
  tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
  td { border: none; padding: 0; }
  td[data-label=""], td[data-label="회차"] { grid-column: 1 / -1; }
  tbody td[data-label="회차"]:not([data-label=""])::before { display: none; } /* 라벨 표시 규칙보다 한 단계 구체적으로 */
  tbody td { padding: 0; }
  td[data-label]:not([data-label=""])::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    font-size: 12px; color: var(--muted);
  }
  td[data-label=""] a, td[data-label=""] b { font-size: 16px; }
  .chips { gap: 6px; }
  .chip { padding: 7px 12px; font-size: 13px; }
  .grade-select { width: 100%; padding: 9px 8px; }

  /* 입력 요소 */
  .row > input[type="datetime-local"], .row > input[type="text"], .row > input:not([type]), .row > select { flex: 1 1 100%; }
  input:not([type="checkbox"]):not([type="radio"]), select { max-width: 100%; min-width: 0; }
  label { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
  label > input:not([type="checkbox"]):not([type="radio"]) { flex: 1 1 auto; width: auto; }
  label > input[type="checkbox"] { width: 18px; height: 18px; flex: none; }

  /* 계획표 */
  .plan-list li { grid-template-columns: 30px auto 1fr; gap: 4px 8px; padding: 10px 0; }
  .plan-list .step { padding-right: 10px; }
  /* 순번이 첫 칸이므로 그다음부터 차례로: 예매자 | 상영코드 | 작품·일시 | 매수 */
  .plan-list li > :nth-child(2) { grid-column: 2; }
  .plan-list li > :nth-child(3) { grid-column: 3; justify-self: end; }
  .plan-list li > :nth-child(4) { grid-column: 2 / -1; }
  .plan-list li > :nth-child(5) { grid-column: 2 / -1; }
  .plan-list li > :nth-child(6) { grid-column: 2 / -1; }
  /* 예매자 칸이 없는 줄(라이브): 코드 | 작품·일시, 그 아래 매수 */
  .plan-list li.no-person { grid-template-columns: 30px auto minmax(0, 1fr); }
  .plan-list li.no-person > :nth-child(2) { grid-column: 3; justify-self: start; }
  .plan-list li.no-person > :nth-child(3) { grid-column: 3; } /* 제목·날짜와 같은 선에서 시작 */

  /* 라이브 */
  .big-card { padding: 18px; }
  .big-card .big-code { font-size: 64px; }
  .big-card .title { font-size: 19px; }
  .big-card .meta { font-size: 15px; }
  .big-card .actions { gap: 8px; }
  .big-card .actions button { flex: 1 1 calc(50% - 4px); font-size: 17px; padding: 14px 8px; }
  .kbd { display: none; }
  .log { max-height: 240px; }
  .log li { flex-wrap: wrap; gap: 6px; }

  /* 모달 */
  /* 휴대폰에서도 화면 가운데에 뜨는 카드 */
  .modal-overlay {
    align-items: center;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  }
  .modal { max-height: 90vh; max-height: 90dvh; border-radius: 14px; }
  .modal-poster { max-height: 30vh; }
  .modal-body { padding: 16px; }
  .modal-body h2 { font-size: 19px; }
  .modal-info { gap: 6px 14px; font-size: 13px; }
  /* 이름과 평가 버튼 다섯 개를 한 줄에: 버튼은 같은 너비로 남은 폭을 나눠 쓴다 */
  .modal-grade-row { gap: 6px; flex-wrap: nowrap; }
  .grade-person { flex: 0 0 2.8em; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .grade-buttons { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; gap: 3px; }
  .grade-btn { flex: 1 1 0; min-width: 0; padding: 8px 2px; font-size: 12px; white-space: nowrap; text-align: center; }
  .grade-btn.g-unavailable { flex: 0 0 auto; padding: 8px 14px; }
  .modal-footer { padding: 12px 16px; margin: 14px -16px -16px; }
  .modal-grades { gap: 8px; margin-bottom: 10px; }
  /* 이동 묶음과 더 보기·닫기 묶음을 위아래로 나누고, 두 묶음 사이만 넉넉히 띄운다 */
  .modal-nav { flex-direction: column; align-items: stretch; gap: 10px; } /* 평가 버튼 ↔ 이전/다음 간격(.modal-grades margin-bottom)과 같게 */
  .nav-move { gap: 8px 6px; }
  /* 버튼은 내용 크기로 작게(입력칸 확대 방지용 16px 규칙은 버튼에는 필요 없다) */
  .nav-move button, .nav-actions > button, .nav-actions > a { flex: 0 0 auto; font-size: 13px; padding: 6px 12px; border-radius: 8px; }
  .nav-move .nav-count { margin-left: auto; }
  .nav-actions { margin-left: 0; }
  .nav-actions .auto-next { flex: 1 1 auto; min-width: 0; margin-right: auto; }
  .modal-note { font-size: 15px; }
}

/* AI 한 줄 요약 */
/* 두 박스 모두 '라벨 칸 | 내용 칸'으로 고정해, 내용이 같은 위치에서 시작하고 줄바꿈도 내용 칸 안에서만 일어나게 한다 */
.ai-summary { display: grid; grid-template-columns: 88px 1fr; column-gap: 8px; align-items: baseline; margin-top: 14px; padding: 12px 14px; background: #f4f6fb; border-radius: 10px; font-size: 14px; }
.ai-badge { justify-self: start; white-space: nowrap; font-size: 11px; font-weight: 700; letter-spacing: .3px; color: #4a5a86; background: #e2e8f6; border-radius: 4px; padding: 2px 7px; }
.ai-content { min-width: 0; line-height: 1.6; }
.ai-difficulty { margin-top: 8px; }
.difficulty-level { display: inline-block; font-weight: 800; font-size: 13px; padding: 1px 9px; border-radius: 999px; }
.difficulty-level.d-high { background: #fde7ea; color: #a4152c; }
.difficulty-level.d-mid { background: #fff1d6; color: #8a5a00; }
.difficulty-level.d-low { background: #e3f2e7; color: #1a6b31; }

/* ---------- 체류 시간대 그리기 ---------- */
.stay-tools { align-items: center; gap: 8px; margin: 6px 0 8px; }
.stay-tools button { padding: 3px 10px; font-size: 12px; }
.stay-grid { display: flex; gap: 4px; min-width: 0; user-select: none; }
.stay-hours { flex: none; width: 36px; }
.stay-hour { height: 24px; font-size: 11px; color: var(--muted); text-align: right; padding-right: 4px; transform: translateY(-6px); }
.stay-days { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; touch-action: none; }
.stay-daycol { flex: 1 1 0; min-width: 0; }
.stay-dayhead { height: 20px; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.stay-slots { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.stay-slot { height: 12px; background: #fff; cursor: cell; }
.stay-slot.hour { border-top: 1px solid #f1efe9; }
.stay-slot:first-child { border-top: none; }
.stay-slot.on { background: #cfe3d4; }
.stay-slot.on.hour { border-top-color: #b6d2bd; }
.stay-summary { margin: 8px 0 0; line-height: 1.6; }
.stay-manual { margin-top: 10px; }
.stay-manual summary { font-size: 12px; color: var(--muted); cursor: pointer; }

/* 휴대폰: 9일치가 가로 스크롤 없이 들어가게 줄인다 */
@media (max-width: 760px) {
  .stay-hours { width: 26px; }
  .stay-hour { font-size: 10px; padding-right: 2px; }
  .stay-dayhead { font-size: 10px; }
  .stay-dayhead .sd-month { display: none; }
  .stay-days { gap: 1px; }
  .stay-slot { height: 13px; }
}

/* ---------- 확보 티켓 캘린더 ---------- */
.owned-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.owned-head h2 { margin: 0; }
.view-switch { display: flex; gap: 4px; }
/* 목록·캘린더 아래에 오는 도구 줄 */
.body-tools { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.body-tools button { font-size: 12px; padding: 5px 10px; }
.view-switch .view-btn { padding: 5px 12px; font-size: 13px; }
.owned-add { margin-top: 12px; }

.cal-head { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.cal-head button { padding: 4px 10px; }
.cal-head .cal-today { margin-left: auto; font-size: 12px; }
.cal-head .cal-only { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cal-head .cal-img { font-size: 12px; padding: 4px 8px; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: 12px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-dow.sun { color: #c0392b; }
.cal-dow.sat { color: #2b6cb0; }
.cal-cell { min-height: 86px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.cal-cell.out { background: #faf9f7; }
.cal-cell.out .cal-daynum { color: #c3bfb6; }
.cal-daynum { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

.cal-event { position: relative; display: flex; gap: 4px; align-items: baseline; font-size: 11px; line-height: 1.35; padding: 2px 5px; margin-bottom: 3px; border: 1px solid transparent; border-radius: 5px; background: #e8eefb; color: #23407f; cursor: pointer; overflow: hidden; }
.cal-event:hover { box-shadow: inset 0 0 0 1px currentColor; }
/* 확보한 회차는 초록 계열. 관람 확정하면 진한 초록 */
.cal-event.booked { background: #e4f2e8; color: #17692f; }
.cal-event.confirmed { background: #1f9d55; color: #fff; }
/* 선호도가 '꼭'인 회차는 테두리 실선으로 표시한다 */
.cal-event.must { border-color: currentColor; border-width: 2px; }
/* 계획표 캘린더는 예매자 색으로 구분한다 */
.cal-event.person.p1 { background: #f0e6fa; color: #6b2a94; }
.cal-event.person.p2 { background: #e3ecfc; color: #1c4aa8; }
/* 예매 시도 순서: 칸 배경에 깔리는 큰 숫자 */
.cal-order { position: absolute; right: 4px; bottom: -2px; font-size: 30px; font-weight: 800; line-height: 1; opacity: .18; pointer-events: none; font-variant-numeric: tabular-nums; }
.cal-month .cal-order { font-size: 17px; bottom: -1px; right: 3px; }
.cal-block.narrow .cal-order { font-size: 17px; }
/* 확보한 회차 지우기. 주 뷰 블록은 늘 보이고, 좁은 월 뷰 칩은 올려놨을 때만 보인다 */
/* 선순위 회차가 성공해 더는 볼 수 없게 된 후보는 회색으로 */
.cal-event.out, .cal-event.person.out { background: #f1f0ed; color: #97948e; }

/* 계획표 목록에서 표시한 예매 결과: 성공 O / 실패 X */
.cal-mark { flex: none; align-self: center; width: 15px; height: 15px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; }
.cal-mark.success { background: var(--ok); }
.cal-mark.fail { background: var(--bad); }
.cal-block .cal-mark { position: absolute; top: 2px; right: 2px; }
.cal-block.narrow .cal-mark { width: 13px; height: 13px; font-size: 9px; }
.cal-del { position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; padding: 0; line-height: 1; font-size: 10px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .18); background: #fff; color: #444; }
.cal-del:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.cal-month .cal-del { opacity: 0; }
.cal-month .cal-event:hover .cal-del, .cal-month .cal-del:focus { opacity: 1; }
.cal-time { flex: none; font-variant-numeric: tabular-nums; opacity: 0.85; }
.cal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 상영코드는 고정폭으로 두어 자릿수가 가지런하게 */
.cal-code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .3px; }

.cal-week { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.cal-hours { flex: none; width: 38px; position: sticky; left: 0; z-index: 1; background: var(--panel); }
.cal-hour { font-size: 11px; color: var(--muted); text-align: right; box-sizing: border-box; padding-right: 4px; transform: translateY(-6px); }
.cal-daycol { flex: 1 1 0; min-width: 104px; }
.cal-dayhead { height: 22px; font-size: 12px; color: var(--muted); text-align: center; }
.cal-daybody { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal-gridline { position: absolute; left: 0; right: 0; border-top: 1px solid #f1efe9; }
.cal-block { position: absolute; flex-direction: column; gap: 0; align-items: flex-start; margin: 0; padding: 3px 5px; }
.cal-block .cal-title { white-space: normal; text-overflow: clip; }

/* 휴대폰 */
@media (max-width: 760px) {
  .cal-cell { min-height: 64px; padding: 3px; }
  .cal-event { font-size: 10px; padding: 1px 4px; }
  .cal-month .cal-time { display: none; } /* 월 뷰는 좁으니 제목만, 대신 두 줄까지 */
  .cal-month .cal-title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .cal-daycol { min-width: 92px; }
}
