.lab-toolbar, .lab-title-row, .lab-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.lab-toolbar { margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #eef3f8; }
.lab-toolbar button, .lab-actions button, .section-heading button, .recovery-banner button, .manual-backup button, .block-card button, .row-toggle, .agenda-card button { min-height: 40px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: white; color: var(--ink); cursor: pointer; font-weight: 720; }
.lab-toolbar button:disabled { opacity: .45; cursor: not-allowed; }
.draft-picker { min-width: 220px; margin-right: auto; }
.lab-title-row { justify-content: space-between; padding: 10px 0; }
.lab-title-row > label { display: grid; gap: 6px; color: var(--ink-soft); font-size: .82rem; font-weight: 750; }
.lab-title-row input { min-width: 250px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; }
.lab-title-row #target-year { min-width: 110px; width: 110px; }
.save-status { margin: 0 0 12px; color: #236d61; font-weight: 750; }
.recovery-banner, .manual-backup { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin-bottom: 18px; padding: 18px; border-radius: var(--radius-md); }
.recovery-banner { border: 1px solid #d7a041; background: #fff7e8; }
.manual-backup { border: 1px solid #c96575; background: #fff0f2; }
.recovery-banner p, .manual-backup p { margin: 5px 0 0; color: var(--ink-soft); }
.lab-empty, .agenda-empty { max-width: 760px; padding: clamp(28px, 5vw, 58px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.lab-empty h2, .agenda-empty h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); letter-spacing: -.045em; }
.lab-empty p:not(.eyebrow), .agenda-empty p { color: var(--ink-soft); line-height: 1.7; }
.lab-empty .primary-button { min-height: 48px; margin-top: 16px; }
.lab-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.lab-summary article { padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.lab-summary span { display: block; color: var(--ink-soft); font-size: .78rem; }
.lab-summary strong { display: block; margin-top: 4px; color: var(--blue-dark); font: 800 1.35rem var(--font-data); }
.lab-grid { position: relative; display: block; isolation: isolate; }
.lab-main, .validation-panel { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.lab-main { width: 100%; }
.validation-flip { position: absolute; z-index: 6; top: 72px; right: -1px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 42px; min-height: 142px; padding: 10px 8px; border: 1px solid var(--blue); border-radius: 12px 0 0 12px; background: var(--blue); color: white; cursor: pointer; font-weight: 800; writing-mode: vertical-rl; transition: right .18s ease, background .18s ease; }
.validation-flip strong { min-width: 24px; min-height: 24px; display: grid; place-content: center; border-radius: 999px; background: white; color: var(--blue-dark); font: 800 .72rem var(--font-data); }
.validation-flip[aria-expanded="true"] { right: min(340px, calc(100% - 64px)); background: var(--blue-dark); }
.validation-panel { position: absolute; z-index: 5; top: 0; right: 0; width: min(340px, calc(100% - 52px)); max-height: calc(100dvh - 102px); overflow: auto; box-shadow: -18px 20px 42px rgba(31,48,82,.2); opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(16px); transition: opacity .18s ease, transform .18s ease; }
.validation-panel[data-open="true"] { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(0); }
.validation-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.validation-panel-heading button { width: 36px; min-height: 36px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); cursor: pointer; font-size: 1.15rem; }
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 10px; }
.section-heading h2, .validation-panel h2 { margin: 0; font-size: 1.25rem; }
.section-heading .eyebrow, .validation-panel .eyebrow { margin-bottom: 7px; }
.course-scroll-guide { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 7px; }
.course-scroll-guide > span { color: var(--ink-soft); font-size: .7rem; font-weight: 750; white-space: nowrap; }
.course-table-x-scroll { width: 100%; height: 17px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line); border-radius: 7px; background: #eef3f8; }
.course-table-x-scroll > div { height: 1px; }
.course-table-scroll { max-height: clamp(340px, calc(100dvh - 640px), 520px); border: 1px solid var(--line); border-radius: 12px; }
.lab-course-table { width: 100%; min-width: 1240px; table-layout: fixed; border-collapse: collapse; font-size: .79rem; }
.lab-course-table th, .lab-course-table td { padding: 6px 5px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lab-course-table th:nth-child(1), .lab-course-table td:nth-child(1) { width: 70px; }
.lab-course-table th:nth-child(2), .lab-course-table td:nth-child(2) { width: 150px; }
.lab-course-table th:nth-child(3), .lab-course-table td:nth-child(3) { width: 92px; }
.lab-course-table th:nth-child(4), .lab-course-table td:nth-child(4) { width: 72px; }
.lab-course-table th:nth-child(5), .lab-course-table td:nth-child(5) { width: 70px; }
.lab-course-table th:nth-child(n+6):nth-child(-n+11), .lab-course-table td:nth-child(n+6):nth-child(-n+11) { width: 92px; }
.lab-course-table th:nth-child(12), .lab-course-table td:nth-child(12) { width: 130px; }
.lab-course-table thead th { position: sticky; top: 0; z-index: 2; background: #eef3f8; text-align: left; }
.lab-course-table input, .lab-course-table select, .block-card input, .block-card select { min-height: 34px; width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.lab-course-table .course-input { min-width: 130px; font-weight: 700; }
.lab-course-table td > small { display: block; max-width: 180px; margin-top: 4px; color: var(--ink-soft); }
.credit-cell { min-width: 82px; }
.credit-cell input { width: 46px; }
.credit-cell select { margin-top: 4px; min-width: 76px; padding: 3px 18px 3px 5px; font-size: .68rem; }
.disabled-row { opacity: .52; background: #f2f4f7; }
.row-order { white-space: nowrap; }
.row-order button { width: 26px; min-height: 28px; margin-right: 2px; padding: 0; border: 1px solid var(--line); background: white; border-radius: 6px; }
.row-toggle { display: block; margin-top: 5px; white-space: nowrap; }
.block-editor { margin-top: 30px; }
.block-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.block-card { display: grid; grid-template-columns: 1fr 92px 72px auto; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.block-card label { display: grid; gap: 5px; color: var(--ink-soft); font-size: .72rem; font-weight: 700; }
.disclaimer { padding: 12px; border-radius: 10px; background: #fff7e8; color: #795b22; line-height: 1.55; font-size: .83rem; }
.validation-panel ul { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 7px; }
.validation-panel li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.validation-panel li > span { align-self: start; padding: 4px 6px; border-radius: 999px; background: #e7f3ef; color: #236d61; text-align: center; font-size: .68rem; font-weight: 800; }
.validation-panel li[data-check-status="위반"] > span { background: #ffe5e9; color: var(--danger); }
.validation-panel li[data-check-status="확인 필요"] > span, .validation-panel li[data-check-status="조건부"] > span { background: #fff1d6; color: #795b22; }
.validation-panel li strong { font-size: .82rem; }
.validation-panel li p { margin: 4px 0 0; color: var(--ink-soft); font-size: .75rem; line-height: 1.5; }
.agenda-snapshot { width: 100%; min-height: 48px; }
.agenda-list { display: grid; gap: 12px; }
.agenda-card { display: grid; grid-template-columns: 1fr auto auto; gap: 20px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.agenda-card small, .agenda-card p { color: var(--ink-soft); }
.agenda-card h2 { margin: 6px 0; }
.agenda-card p { margin: 0; }
.agenda-metric { text-align: right; }
.agenda-metric span { display: block; color: var(--ink-soft); font-size: .75rem; }
.agenda-metric strong { display: block; margin-top: 5px; color: var(--blue-dark); font: 800 1.35rem var(--font-data); }

@media (max-width: 1100px) {
  .lab-grid { display: flex; flex-direction: column; }
  .validation-flip { position: static; order: 0; width: 100%; min-height: 44px; padding: 0 14px; border-radius: 10px; flex-direction: row; writing-mode: horizontal-tb; }
  .validation-flip[aria-expanded="true"] { right: auto; }
  .validation-panel { position: static; order: 1; display: none; width: 100%; max-height: none; margin-bottom: 14px; opacity: 1; visibility: visible; pointer-events: auto; transform: none; box-shadow: var(--shadow); }
  .validation-panel[data-open="true"] { display: block; }
  .lab-main { order: 2; }
  .block-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .lab-summary { grid-template-columns: repeat(2, 1fr); }
  .lab-title-row { align-items: stretch; }
  .lab-title-row > label, .lab-title-row input, .lab-actions { width: 100%; }
  .lab-actions button { flex: 1 1 42%; }
  .recovery-banner, .manual-backup, .agenda-card { display: grid; grid-template-columns: 1fr; }
  .agenda-metric { text-align: left; }
}
@media print {
  .app-header, .app-footer, .lab-toolbar, .lab-actions, .validation-flip, .course-scroll-guide, .row-order, .row-toggle, .agenda-snapshot, .recovery-banner, .manual-backup { display: none !important; }
  .app-main { width: 100%; padding: 0; }
  .lab-grid { display: block; }
  .validation-panel { position: static; display: block; width: 100%; max-height: none; margin-top: 16px; opacity: 1; visibility: visible; pointer-events: auto; transform: none; box-shadow: none; }
  .course-table-scroll { max-height: none; overflow: visible; }
}
