:root {
  --ink: #172033;
  --muted: #5f6b7a;
  --line: #d8dee8;
  --panel: #f7f9fc;
  --accent: #176b87;
  --warn: #fff1c9;
  --bad: #fde2e1;
  --ok: #e8f5ee;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: #fff; }
header { padding: 24px 30px; border-bottom: 1px solid var(--line); }
h1 { margin: 0 0 6px; font-size: 27px; }
h2 { margin: 0 0 12px; font-size: 19px; }
p { color: var(--muted); }
main { max-width: 1440px; padding: 22px 30px 52px; }
button, .button { border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 8px 12px; cursor: pointer; font-size: 13px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select { border: 1px solid var(--line); border-radius: 6px; padding: 8px 9px; font-size: 14px; }
input[type="checkbox"] { width: auto; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 15px; margin: 0 0 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.fields label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 9px 14px; font-size: 13px; }
.drop { min-height: 112px; border: 1px dashed #9fb0c0; border-radius: 8px; background: var(--panel); padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 7px; text-align: center; cursor: pointer; }
.drop input { display: none; }
.drop.drag { border-color: var(--accent); background: #edf8fb; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; margin-top: 12px; }
.file-card { border: 1px solid var(--line); border-radius: 8px; padding: 11px; background: #fff; }
.file-card strong { display: block; margin-bottom: 5px; }
.file-card span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin: 12px 0; }
.muted { color: var(--muted); font-size: 13px; }
pre#status { white-space: pre-wrap; margin: 0; color: var(--muted); line-height: 1.5; }
.hidden { display: none; }
.pair-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.pair-pill { display: inline-flex; gap: 6px; align-items: center; border: 1px solid #f0b36d; background: #fff4e4; color: #5f3d00; border-radius: 6px; padding: 6px 8px; font-size: 12px; }
.bundle-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 0 0 18px; }
.bundle-group { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.bundle-group strong { display: block; margin-bottom: 8px; }
.bundle-check { display: flex; gap: 8px; align-items: flex-start; margin: 7px 0; font-size: 13px; line-height: 1.35; }
.bundle-check input:disabled + span { color: #a5acb6; }
.selection-options { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: -4px 0 14px; }
.option-check { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font-size: 13px; background: #fff; }
.cell-info { color: var(--muted); font-size: 12px; margin: 4px 0; }
.matrix-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 18px; }
table { border-collapse: collapse; width: 100%; table-layout: fixed; }
th, td { border: 1px solid var(--line); padding: 7px 8px; vertical-align: top; font-size: 13px; }
th { background: #eef3f8; text-align: left; }
.matrix { width: max-content; min-width: 100%; }
.matrix th, .matrix td { text-align: center; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: #fff; text-align: left; min-width: 160px; }
.matrix .possible { background: #f6b26b; font-weight: 700; }
.matrix .self { background: #f2f4f7; color: #a0a8b2; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 7px 10px; font-size: 13px; }
.schedule th, .schedule td { text-align: center; vertical-align: middle; }
.schedule tbody tr.day-start > th, .schedule tbody tr.day-start > td { border-top: 4px solid #536b86; }
.day-col { width: 78px; cursor: grab; }
.period-col { width: 76px; cursor: grab; }
.grade-head { color: #6f3c91; background: #eadff0; font-size: 16px; }
.subject-card { border: 1px solid #c6d4df; background: #fff; border-radius: 8px; padding: 5px 7px; margin: 2px 0; cursor: grab; box-shadow: 0 1px 2px rgba(23,32,51,.08); }
.subject-card.essay { background: var(--warn); border-color: #d6a23a; }
.subject-card.self { background: #f4f6f8; color: var(--muted); border-style: dashed; }
.subject-card strong { display: block; font-size: 13px; }
.subject-card span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.drop-target { background: #f4fbff; }
.day-handle.drop-target, .period-handle.drop-target { outline: 2px solid var(--accent); outline-offset: -3px; }
.slot-total.tight { background: var(--warn); }
.slot-total.bad { background: var(--bad); font-weight: 700; }
.absence-row th, .absence-row td { background: #f8fafc; font-weight: 700; color: #405166; }
.tables { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 24px; }
.integrated-table th:first-child { min-width: 240px; white-space: nowrap; }
.integrated-cell { background: #f6b26b; font-weight: 700; }
.class-total-row th, .class-total-row td { background: #eef3f8; font-weight: 700; }
.bundle-row th { background: #f8f3e8; }
.ok { background: var(--ok); }
.bad { background: var(--bad); font-weight: 700; }
.ok-text { color: #146c43; font-weight: 700; }
.note { border-left: 4px solid var(--accent); background: var(--panel); padding: 12px 14px; margin: 12px 0 20px; }
