:root {
  --seat-ink: #172b4d;
  --seat-muted: #65758b;
  --seat-line: #d9e1ec;
  --seat-soft: #f4f7fb;
  --seat-primary: #275dad;
  --seat-primary-dark: #184886;
}

body { background: #f7f9fc; color: var(--seat-ink); }
.screen-only h1, .screen-only h2, .screen-only h3, .screen-only button,
.screen-only .tool-breadcrumb, .screen-only .hero-copy { word-break: keep-all; overflow-wrap: anywhere; }
.tool-breadcrumb { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; padding: 1rem 0; color: #64748b; font-size: .86rem; }
.tool-breadcrumb a { color: #315b91; }
.tool-hero { padding: 2.6rem 0 3.3rem; color: #fff; text-align: center; background: radial-gradient(circle at 82% 0%, #4978bb 0, transparent 34%), linear-gradient(130deg, #183d72, #275dad 60%, #2878a0); }
.tool-hero .eyebrow { color: #d7e8ff; }
.tool-hero h1 { margin: .4rem 0 .65rem; color: #fff; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.25; }
.hero-copy { margin: 0 auto; max-width: 42rem; font-size: 1.08rem; color: #eaf2ff; }
.eyebrow { margin: 0 0 .45rem; color: #65758b; font-size: .73rem; font-weight: 800; letter-spacing: .13em; }
.tool-area { padding: 1.5rem 0 4rem; }
.tool-area > .container { max-width: 1120px; }
.privacy-note { display: flex; gap: 1rem; align-items: flex-start; margin: 0 0 1.15rem; padding: 1.15rem 1.3rem; border: 1px solid #b9d9ce; border-radius: 14px; background: #effaf5; }
.privacy-icon { flex: 0 0 auto; padding: .4rem .55rem; border-radius: 7px; background: #d9f2e7; color: #176247; font-size: .68rem; font-weight: 850; letter-spacing: .06em; }
.privacy-note h2 { margin: 0 0 .3rem; color: #164b3a; font-size: 1.02rem; word-break: keep-all; overflow-wrap: anywhere; }
.privacy-note p { margin: 0; color: #355c50; font-size: .88rem; line-height: 1.65; }
.tool-panel { padding: clamp(1rem, 3vw, 2rem); border: 1px solid #e1e7ef; border-radius: 18px; background: #fff; box-shadow: 0 14px 40px rgba(26, 48, 80, .07); }
.panel-heading, .workspace-heading, .subpanel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-heading { padding-bottom: 1.35rem; border-bottom: 1px solid #edf0f4; }
.panel-heading h2, .workspace-heading h2 { margin: 0; font-size: 1.35rem; }
.memory-badge, .count-pill { border-radius: 999px; background: #eef3f9; color: #48617e; padding: .35rem .68rem; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.setup-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(240px, .75fr); gap: 1.5rem; padding: 1.35rem 0 1.6rem; border-bottom: 1px solid #edf0f4; }
.field-label { display: block; margin-bottom: .25rem; font-size: .94rem; font-weight: 800; word-break: keep-all; overflow-wrap: anywhere; }
.field-help { margin: 0 0 .6rem; color: var(--seat-muted); font-size: .79rem; line-height: 1.55; }
#roster-input { display: block; width: 100%; min-height: 190px; padding: .8rem .9rem; resize: vertical; border: 1px solid #cbd5e1; border-radius: 10px; background: #fbfcfe; color: #1f2f45; font: inherit; font-size: .94rem; line-height: 1.6; }
#roster-input:focus, .field-row input:focus, .field-row select:focus { outline: 3px solid rgba(39, 93, 173, .18); border-color: var(--seat-primary); }
.button-row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.roster-actions { margin-top: .7rem; }
.button { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; padding: .55rem .85rem; border: 1px solid transparent; border-radius: 9px; font: inherit; font-size: .85rem; font-weight: 750; cursor: pointer; transition: background .15s, transform .15s, border-color .15s; word-break: keep-all; overflow-wrap: anywhere; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .person-button:focus-visible, .seat:focus-visible { outline: 3px solid #80b5ff; outline-offset: 2px; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { background: var(--seat-primary); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--seat-primary-dark); }
.button-secondary { border-color: #cddcf0; background: #edf4ff; color: #234f89; }
.button-quiet { border-color: #d9e1ec; background: #fff; color: #42556e; }
.button-quiet:hover:not(:disabled) { background: #f4f7fb; }
.button-danger { color: #89504e; }
.layout-setup { padding: 1rem 1rem 1.05rem; border: 1px solid #e4eaf2; border-radius: 12px; background: #f8fafd; }
.layout-setup h3 { margin: 0 0 .8rem; font-size: .97rem; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 10rem; gap: .8rem; align-items: center; margin: .45rem 0; }
.field-row label { color: #40536a; font-size: .83rem; font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
.field-row input, .field-row select { width: 100%; min-height: 40px; padding: .45rem .6rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1f2f45; font: inherit; }
.check-row { display: flex; gap: .55rem; align-items: center; margin: .8rem 0; font-size: .83rem; font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
.check-row input { width: 17px; height: 17px; accent-color: var(--seat-primary); }
.layout-setup .field-help { margin: .8rem 0 0; }
.layout-setup .layout-help { margin: -.35rem 0 .8rem; color: #536780; font-size: .76rem; }
.workspace-heading { align-items: end; margin: 1.55rem 0 .5rem; }
.workspace-heading h2 { font-size: 1.25rem; }
.summary { margin: 0; color: #536780; font-size: .83rem; text-align: right; }
.instruction { margin: 0 0 .9rem; color: #5d6d81; font-size: .84rem; line-height: 1.6; }
.workspace { display: grid; grid-template-columns: minmax(215px, .36fr) minmax(0, 1fr); gap: 1rem; }
.roster-list-panel, .seat-panel { min-width: 0; padding: 1rem; border: 1px solid #e1e7ef; border-radius: 12px; background: #fcfdff; }
.subpanel-heading { margin-bottom: .75rem; }
.subpanel-heading h3 { margin: 0; font-size: .96rem; }
.front-label { color: #6c7f97; font-size: .73rem; }
.empty-message { margin: .25rem 0; color: #8190a2; font-size: .82rem; line-height: 1.55; }
.roster-list { display: grid; gap: .4rem; max-height: 430px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.person-button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .45rem; padding: .58rem .65rem; border: 1px solid #e1e7ef; border-radius: 8px; background: #fff; color: #2d4058; text-align: left; cursor: pointer; }
.person-button[aria-pressed="true"] { border-color: #2c67b4; background: #edf4ff; box-shadow: inset 3px 0 #2c67b4; }
.person-name { min-width: 0; overflow-wrap: anywhere; font-size: .83rem; font-weight: 700; }
.person-position { flex: 0 0 auto; color: #718096; font-size: .69rem; }
.person-button[aria-pressed="true"] .person-position { color: #2c67b4; }
.unassigned-note { margin: .75rem 0 0; padding: .6rem .7rem; border-radius: 8px; background: #fff6e7; color: #76521e; font-size: .78rem; line-height: 1.5; }
.teacher-desk-view { max-width: 240px; margin: .2rem auto .75rem; padding: .35rem; border: 1px solid #c6d2e0; border-radius: 6px; background: #edf2f7; color: #596b80; font-size: .73rem; font-weight: 750; text-align: center; }
.teacher-desk-view[hidden] { display: none; }
.seat-map-scroll { overflow-x: auto; padding: 0 0 .5rem; }
.seat-map { display: flex; flex-direction: column; gap: .45rem; min-width: max-content; }
.seat-row { display: flex; gap: .45rem; }
.seat.pair-after { margin-right: 1rem; }
.seat.aisle-after { margin-right: 1.6rem; }
.seat { flex: 0 0 clamp(70px, 8vw, 96px); min-height: 67px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .2rem; padding: .35rem; border: 1px solid #bfcbd9; border-radius: 9px 9px 13px 13px; background: linear-gradient(180deg, #fff, #f3f6fa); color: #64748b; cursor: pointer; text-align: center; }
.seat:hover { border-color: #7996bd; background: #f0f6ff; }
.seat.occupied { border-color: #9fb9dc; background: #edf4ff; color: #244f86; }
.seat.is-selected { outline: 3px solid #eeb64c; outline-offset: 1px; }
.seat-label { font-size: .64rem; color: #8290a1; }
.seat-name { max-width: 100%; overflow: hidden; font-size: .78rem; font-weight: 800; text-overflow: ellipsis; overflow-wrap: anywhere; }
.seat-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.seat-actions .button { min-height: 36px; font-size: .77rem; }
.status-message { min-height: 1.3rem; margin-top: .45rem; color: #315f4d; font-size: .8rem; }
.print-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.15rem; padding: 1rem 1.1rem; border-radius: 12px; background: #f1f5fa; }
.print-actions h3 { margin: 0 0 .15rem; font-size: .93rem; }
.print-actions p { margin: 0; color: #65758b; font-size: .76rem; line-height: 1.5; }
.steps-section, .faq-section, .related-tools { margin-top: 2rem; }
.steps-section > h2, .faq-section > h2, .related-tools > h2 { margin: 0 0 .8rem; color: #233852; font-size: 1.25rem; word-break: keep-all; overflow-wrap: anywhere; }
.steps-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 0; padding: 0; list-style: none; }
.steps-list li { display: flex; gap: .75rem; padding: 1rem; border: 1px solid #e3e9f0; border-radius: 12px; background: #fff; }
.steps-list li > span { flex: 0 0 auto; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: #e9f1fd; color: #2d5c9b; font-size: .77rem; font-weight: 800; }
.steps-list h3 { margin: 0 0 .25rem; font-size: .88rem; word-break: keep-all; overflow-wrap: anywhere; }
.steps-list p { margin: 0; color: #66768b; font-size: .76rem; line-height: 1.55; }
.faq-section details { padding: .9rem 1rem; border: 1px solid #e1e7ef; border-radius: 10px; background: #fff; }
.faq-section details + details { margin-top: .55rem; }
.faq-section summary { color: #2d4058; cursor: pointer; font-size: .88rem; font-weight: 750; word-break: keep-all; overflow-wrap: anywhere; }
.faq-section details p { margin: .6rem 0 0; color: #5d6d81; font-size: .83rem; line-height: 1.7; }
.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.related-card { display: flex; align-items: center; gap: .75rem; padding: .85rem; border: 1px solid #e1e7ef; border-radius: 11px; background: #fff; color: inherit; text-decoration: none; }
.related-card:hover { border-color: #9db6d7; background: #f7faff; }
.related-icon { display: grid; place-items: center; width: 43px; height: 38px; border-radius: 8px; background: #edf3fb; color: #42648d; font-size: .65rem; font-weight: 850; }
.related-card strong, .related-card small { display: block; }
.related-card strong { font-size: .82rem; word-break: keep-all; overflow-wrap: anywhere; }
.related-card small { margin-top: .15rem; color: #6c7b8f; font-size: .72rem; }
.related-arrow { margin-left: auto; color: #7b8ea7; font-size: 1.3rem; }
.print-only { display: none; }

@media (max-width: 760px) {
  .setup-grid { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .roster-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 290px; }
  .print-actions { align-items: flex-start; flex-direction: column; }
  .steps-list { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .tool-hero { padding: 2rem 0 2.35rem; }
  .tool-area { padding-top: 1rem; }
  .privacy-note { gap: .65rem; padding: .9rem; }
  .privacy-icon { padding: .35rem; font-size: .6rem; }
  .roster-list { grid-template-columns: 1fr; }
  .roster-actions .button { flex: 1 1 auto; }
  .related-grid { grid-template-columns: 1fr; }
  .summary { max-width: 48%; }
}

@page seat-page { size: A4 landscape; margin: 10mm; }
@page badges-page { size: A4 portrait; margin: 10mm; }
@media print {
  body { background: #fff !important; color: #111 !important; }
  body.print-seat .screen-only, body.print-badges .screen-only { display: none !important; }
  body.print-seat #print-seat, body.print-badges #print-badges-output { display: block !important; }
  .print-seat-only { page: seat-page; }
  .print-badges-only { page: badges-page; }
  .print-header { margin-bottom: 6mm; text-align: center; }
  .print-header h1 { margin: 0 0 2mm; font-size: 20pt; }
  .print-header p { margin: 0; color: #444; font-size: 9pt; }
  .print-teacher-desk { width: 34%; margin: 0 auto 5mm; padding: 2mm; border: 1px solid #555; text-align: center; font-size: 9pt; }
  .print-seat-table { width: 100%; height: 148mm; border-collapse: separate; border-spacing: 1.5mm; table-layout: fixed; }
  .print-seat-table td { height: 1%; padding: 1mm; border: 1px solid #556171; border-radius: 2mm; text-align: center; vertical-align: middle; overflow-wrap: anywhere; }
  .print-seat-table td.pair-after { border-right: 2.5mm solid #fff; }
  .print-seat-table td.aisle-after { border-right: 5mm solid #fff; }
  .print-seat-name { display: block; font-size: 12pt; font-weight: 700; }
  .print-seat-empty { color: #818181; font-size: 9pt; }
  .print-seat-position { display: block; margin-bottom: 1mm; color: #555; font-size: 7pt; }
  .print-badges-heading { margin: 0 0 5mm; font-size: 17pt; text-align: center; }
  .badge-grid { display: block; }
  .name-badge { display: inline-flex; width: 31%; height: 49mm; justify-content: center; align-items: center; margin: 0 .7% 2mm; padding: 3mm; border: 1px dashed #737d89; vertical-align: top; text-align: center; overflow-wrap: anywhere; break-inside: avoid; page-break-inside: avoid; }
  .name-badge span { font-size: 19pt; font-weight: 750; }
}
