/* 시간표 만들기 · 인쇄 */
.tt { display: grid; gap: 14px; }
.tt-tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tt-tablist { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.tt-tab { min-height: 38px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); font-weight: 700; font-size: 14.5px; cursor: pointer; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-tab[aria-selected="true"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--surface)); color: var(--link); }
.tt-tab-input { min-height: 38px; width: 160px; padding: 0 14px; border: 1.5px solid var(--primary); border-radius: 99px; font-size: 14.5px; font-weight: 700; outline: none; }
.tt-tab-tools { display: inline-flex; gap: 2px; margin-left: 2px; }
.tt-mini { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 10px; background: none; color: var(--subtle); font-size: 15px; cursor: pointer; }
.tt-mini:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.tt-mini.confirm { background: #e5484d; color: #fff; font-size: 12.5px; font-weight: 700; }

.tt-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.tt-main { display: grid; gap: 14px; min-width: 0; padding: clamp(16px, 2.6vw, 26px); }
.tt-side { display: grid; gap: 12px; position: sticky; top: 86px; }
.tt-box { padding: 0; }
.tt-box > summary { padding: 15px 18px; font-weight: 800; font-size: 15px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.tt-box > summary::-webkit-details-marker { display: none; }
.tt-box > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--subtle); border-bottom: 2px solid var(--subtle); transform: rotate(45deg); transition: transform .2s; }
.tt-box[open] > summary::after { transform: rotate(-135deg); }
.tt-box > :not(summary) { margin-left: 18px; margin-right: 18px; }
.tt-box > :last-child { margin-bottom: 18px; }
.tt-box .field { margin-bottom: 12px; }
.tt-box .field-label small { color: var(--subtle); font-weight: 500; }
.tt-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tt-row2 .segmented { display: flex; }
.tt-row2 .segmented label { flex: 1; text-align: center; }
.tt-row2 .segmented span { padding: 7px 6px; white-space: nowrap; }
.tt-box select { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.tt-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-check { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.tt-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.tt-check small { color: var(--subtle); font-weight: 500; }

/* 팔레트 */
.tt-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation; transition: border-color .15s, box-shadow .15s; }
.tt-chip i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.tt-chip small { min-width: 20px; padding: 0 6px; border-radius: 99px; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--muted); font-size: 11.5px; text-align: center; }
.tt-chip[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); background: color-mix(in srgb, var(--c, var(--primary)) 45%, var(--surface)); }
.tt-chip.tool[aria-pressed="true"] { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--link); }
.tt-help { margin: -4px 0 0; }

/* 시간표 종이 */
.tt-scroll { overflow-x: auto; margin: 0 -4px; padding: 4px; overscroll-behavior-x: contain; }
.tt-paper { min-width: 520px; color: #1f2a37; }
.tt-head { text-align: center; margin-bottom: 14px; }
.tt-head h2 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.tt-head p { margin: 4px 0 0; color: #64748b; font-size: 14.5px; }
.tt-table { width: 100%; border-collapse: separate; border-spacing: 5px; table-layout: fixed; }
.tt-table thead th { padding: 10px 4px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 10%, #fff); font-size: 15.5px; font-weight: 800; }
.tt-corner { width: 84px; background: none !important; }
.tt-p { width: 84px; padding: 4px; text-align: center; font-size: 14px; line-height: 1.3; }
.tt-p b { display: block; font-size: 14.5px; }
.tt-p small { display: block; margin-top: 3px; color: #64748b; font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tt-cell { height: 64px; padding: 4px; border-radius: 12px; background: #f6f8f9; text-align: center; vertical-align: middle; cursor: pointer; user-select: none; -webkit-user-select: none; transition: transform .12s, box-shadow .12s; }
.tt-cell.on { background: var(--c, #fff); }
.mono .tt-cell.on { background: #fff; box-shadow: inset 0 0 0 1.5px #cfd8de; }
.tt-cell:hover { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }
.tt-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.tt-s { display: block; font-weight: 800; font-size: 16px; line-height: 1.25; word-break: keep-all; overflow-wrap: anywhere; }
.tt-m { display: block; margin-top: 2px; color: #475569; font-size: 11.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-lunch th { font-size: 13px; color: #8a6d1d; }
.tt-lunch td { padding: 8px; border-radius: 12px; background: #fff7e0; color: #8a6d1d; text-align: center; font-weight: 700; font-size: 14px; }
.tt-lunch small { margin-left: 6px; font-weight: 500; font-variant-numeric: tabular-nums; }
.font-s .tt-s { font-size: 14px; } .font-s .tt-cell { height: 56px; }
.font-l .tt-s { font-size: 19px; } .font-l .tt-cell { height: 74px; } .font-l .tt-m { font-size: 12.5px; }
.tt-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--text) 3.5%, var(--surface)); font-size: 13.5px; }
.tt-summary:empty { display: none; }
.tt-summary span { display: flex; flex-wrap: wrap; gap: 5px; }
.tt-summary em { padding: 2px 9px; border-radius: 99px; background: var(--c); color: #1f2a37; font-style: normal; font-weight: 700; font-size: 12.5px; }
.tt-summary small { margin-left: auto; color: var(--muted); }
.tt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tt-actions .btn.confirm { background: #e5484d; color: #fff; border-color: #e5484d; }

/* 과목 목록 */
.tt-subjects { display: grid; gap: 6px; margin-top: 0; margin-bottom: 10px; padding: 0; list-style: none; max-height: 300px; overflow-y: auto; }
.tt-subjects li { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; gap: 6px; }
.tt-swatch { width: 30px; height: 30px; border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); cursor: pointer; }
.tt-subjects input, .tt-add input { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 15px; width: 100%; }
.tt-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin-bottom: 8px; }

/* 직접 입력 창 */
.tt-pop { position: fixed; z-index: 70; width: 290px; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-lg); }
.tt-pop.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; border-radius: 20px 20px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.tt-pop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tt-pop .field { margin-bottom: 10px; }
.tt-pop .field-label small { color: var(--subtle); font-weight: 500; }
.tt-pop-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tt-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--subtle); cursor: pointer; font-size: 15px; }

@media (max-width: 1020px) {
  .tt-layout { grid-template-columns: 1fr; }
  .tt-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 560px) {
  .tt-scroll { margin: 0 -2px; padding: 2px; }
  .tt-paper { min-width: 0; }
  .tt-head h2 { font-size: 21px; }
  .tt-head p { font-size: 13px; }
  .tt-p, .tt-corner { width: 46px; }
  .tt-p { padding: 2px 0; font-size: 12px; }
  .tt-p b { font-size: 13px; }
  .tt-p small { font-size: 9.5px; margin-top: 2px; letter-spacing: -.02em; }
  .tt-table { border-spacing: 3px; }
  .tt-table thead th { padding: 8px 2px; border-radius: 10px; font-size: 13.5px; }
  .tt-cell { height: 54px; padding: 3px 2px; border-radius: 10px; }
  .tt-s, .font-s .tt-s { font-size: 13.5px; }
  .font-l .tt-s { font-size: 15px; }
  .tt-m, .font-l .tt-m { font-size: 10px; }
  .tt-lunch td { padding: 6px 4px; font-size: 12.5px; }
  .tt-lunch small { display: block; margin: 2px 0 0; }
  .tt-actions .btn { flex: 1 1 calc(50% - 4px); padding: 0 10px; }
}

/* 인쇄 (A4 가로) */
#lf-print { display: none; }
@page { size: A4 landscape; margin: 10mm; }
@media print {
  body.lf-printing > *:not(#lf-print) { display: none !important; }
  body.lf-printing #lf-print { display: block !important; }
  body.lf-printing { background: #fff !important; }
  #lf-print .tt-paper { min-width: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #lf-print .tt-head h2 { font-size: 24pt; }
  #lf-print .tt-head p { font-size: 12pt; }
  #lf-print .tt-table thead th { font-size: 14pt; }
  #lf-print .tt-cell, #lf-print .font-s .tt-cell, #lf-print .font-l .tt-cell { height: min(22mm, calc(150mm / var(--n, 9))); padding: 1mm; cursor: default; }
  #lf-print .tt-table { border-spacing: 1.2mm; }
  #lf-print .tt-table thead th { padding: 1.5mm; }
  #lf-print .tt-lunch td { padding: 1mm; }
  #lf-print .tt-head { margin-bottom: 3mm; }
  #lf-print .tt-s { font-size: 15pt; } #lf-print .font-s .tt-s { font-size: 13pt; } #lf-print .font-l .tt-s { font-size: 18pt; }
  #lf-print .tt-m { font-size: 9pt; }
  #lf-print .tt-p { padding: 0; line-height: 1.15; }
  #lf-print .tt-p b { font-size: 12pt; }
  #lf-print .tt-p small { font-size: 8pt; margin-top: 1mm; white-space: nowrap; }
  #lf-print .tt-p small br { display: none; }
  #lf-print .tt-s { line-height: 1.15; }
}
