/* 功能说明：建立易排座的桌面工作区与移动端排版。职责边界：仅管理视觉和打印布局。 */
:root {
  color-scheme: light;
  --paper: #f5f4ee;
  --surface: #fffefa;
  --ink: #253128;
  --muted: #616e61;
  --line: #e2e5da;
  --pale: #edf1e8;
  --green: #34533f;
  --font: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.5 var(--font);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: inherit; }
:focus-visible { outline: 2px solid #426f50; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h2 { font-size: 17px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.masthead {
  display: flex; align-items: center; gap: 20px; min-height: 66px;
  padding: 10px max(20px, calc((100% - 1376px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; font-size: 19px; font-weight: 750; }
.masthead-label { color: var(--muted); font-size: 13px; padding-left: 18px; border-left: 1px solid var(--line); }
.masthead-actions { margin-left: auto; display: flex; gap: 16px; }
.masthead-actions button, .board-actions button, .instructions button, .board-footer button {
  padding: 4px 0; color: var(--green); background: transparent; border: 0; font-size: 13px;
}
#workspace { max-width: 1424px; margin: 0 auto; padding: 27px 24px 16px; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 21px; }
.intro h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 750; line-height: 1.12; letter-spacing: -.03em; }
.intro p { margin-top: 8px; color: var(--muted); }
.save-state { flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #6d896e; }
.save-state[data-error="true"]::before { background: #aa663e; }
.workspace-layout { display: grid; grid-template-columns: minmax(228px, 270px) minmax(0, 1fr); gap: 18px; align-items: start; }
.sidebar, .workbench { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; min-width: 0; }
.sidebar-section { padding: 17px; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--line); }
.field-label { font-size: 13px; font-weight: 650; }
.board-picker { display: flex; gap: 7px; margin-top: 8px; }
.board-picker select { width: 100%; min-width: 0; }
.board-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; }
.icon-button { flex: 0 0 39px; width: 39px; height: 39px; background: var(--pale); border: 0; border-radius: 9px; font-size: 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#member-count { color: var(--muted); font-size: 12px; }
.roster-actions { display: flex; gap: 6px; margin: 11px 0; }
.roster-actions .outline { flex: 1; }
.button, input:not([type="file"]), select, textarea { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.button { min-height: 39px; padding: 7px 12px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.primary { border-color: var(--green); background: var(--green); color: #fff; }
.outline { color: var(--green); border-color: #cbd6c8; }
.quiet { border-color: transparent; background: var(--pale); }
.button.quiet[aria-pressed="true"] { color: var(--green); box-shadow: inset 0 0 0 1px #c6d3c3; }
input:not([type="file"]), select, textarea { min-height: 39px; padding: 7px 10px; max-width: 100%; }
input[type="search"] { width: 100%; }
.roster-hint { color: var(--muted); font-size: 13px; margin: 11px 0 0; }
.roster-list { list-style: none; padding: 0; margin: 6px 0 0; max-height: 365px; overflow: auto; }
.member-row { display: flex; align-items: center; gap: 5px; border-bottom: 1px solid var(--line); padding: 2px 0; }
.member-main { flex: 1; min-width: 0; text-align: left; padding: 8px 4px; border: 0; background: transparent; border-radius: 5px; }
.member-main[aria-pressed="true"] { background: var(--pale); }
.member-name, .member-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-meta { color: var(--muted); font-size: 11px; }
.member-edit { flex-shrink: 0; padding: 5px; font-size: 12px; color: var(--green); border: 0; background: transparent; }
.board-header, .toolbar, .board-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 13px 18px; }
.board-header { padding-top: 16px; }
.board-heading { min-width: 0; overflow-wrap: anywhere; }
.board-heading h2 { font-size: 21px; line-height: 1.25; }
.board-heading p, .board-footer p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.export-actions, .arrange-controls, .view-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.toolbar { padding-top: 0; }
.toolbar select { font-size: 13px; }
.chart-scroll { overflow: auto; max-height: min(68vh, 850px); min-height: 295px; padding: 23px 18px 25px; background: #fafbf6; border-block: 1px solid var(--line); }
.chart { display: flex; flex-direction: column; align-items: center; gap: 15px; width: max-content; min-width: 100%; margin: 0 auto; }
.chart[data-podium="bottom"] .podium { order: 1; }
.podium { padding: 4px 30px; border-radius: 6px; background: #406047; color: #fff; font-size: 12px; font-weight: 650; min-width: 100px; text-align: center; }
.seat-grid { display: grid; grid-template-columns: repeat(var(--cols), var(--slot)); grid-auto-rows: var(--slot); gap: var(--gap); }
.seat-grid.has-aisle { grid-template-columns: repeat(var(--before), var(--slot)) var(--gap) repeat(var(--after), var(--slot)); }
.seat { position: relative; display: grid; place-items: center; padding: 4px; border: 1px solid transparent; border-radius: 10px; background: #f0f2ed; overflow: hidden; line-height: 1.1; }
.seat.occupied { background: #fffefa; border-color: #daddd2; }
.seat.male { background: #e6eff4; border-color: #b8cdd8; }
.seat.female { background: #f8e6df; border-color: #e4b7a7; }
.seat[draggable="true"] { cursor: grab; }
.seat[aria-pressed="true"], .seat.is-match, .seat.is-target { border-color: #52795a; box-shadow: inset 0 0 0 1px #52795a; }
.seat-position { position: absolute; top: 4px; left: 5px; color: #566957; font-size: 9px; font-variant-numeric: tabular-nums; }
.seat-name { width: 100%; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: clamp(11px, calc(var(--slot) / 5.2), 15px); font-weight: 600; }
.seat img { width: min(21px, 43%); height: auto; margin-top: 5px; pointer-events: none; }
.board-footer { min-height: 47px; padding-block: 9px; }
.board-footer p { margin: 0; }
.instructions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.instructions button { text-decoration: underline; text-underline-offset: 3px; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 16px; padding: 21px; font-size: 12px; color: var(--muted); }
.site-footer a:first-child { text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:not(:first-child) { text-decoration: none; }
.site-footer img { vertical-align: -2px; }
dialog { width: min(460px, calc(100% - 30px)); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(29 39 31 / .32); }
.dialog-head, .dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head { margin-bottom: 15px; }
.dialog-foot { justify-content: flex-end; margin-top: 16px; }
#dialog-fields { display: grid; gap: 11px; }
#dialog-fields label { display: grid; gap: 4px; min-width: 0; }
#dialog-fields textarea { width: 100%; min-height: 150px; resize: vertical; }
#dialog-fields p { color: var(--muted); font-size: 13px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-error, .storage-alert { color: #864628; background: #fbede3; border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 9px 16px; border-radius: 8px; background: var(--ink); color: white; z-index: 5; }
#print-sheet { display: none; }
@media (hover: hover) {
  .button:not(:disabled):hover, .icon-button:not(:disabled):hover { filter: brightness(.96); }
  .seat:hover, .member-main:hover { outline: 1px solid #9aad99; outline-offset: -1px; }
}
@media (max-width: 830px) {
  #workspace { padding: 20px 15px 12px; }
  .workspace-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sidebar { display: grid; grid-template-columns: 1fr 1.2fr; }
  .sidebar-section + .sidebar-section { border-top: 0; border-left: 1px solid var(--line); }
  .roster-list { max-height: 130px; }
}
@media (max-width: 500px) {
  .masthead { min-height: 58px; padding-inline: 14px; }
  .masthead-label { display: none; }
  .intro { align-items: flex-start; flex-direction: column; gap: 3px; }
  .save-state { margin-top: 3px !important; }
  .sidebar { display: block; }
  .sidebar-section + .sidebar-section { border-top: 1px solid var(--line); border-left: 0; }
  .board-header, .toolbar, .board-footer { padding-inline: 11px; }
  .chart-scroll { padding-inline: 10px; }
}
@media print {
  @page { margin: 9mm; size: A4 landscape; }
  body { background: #fff; }
  body.printing > :not(#print-sheet) { display: none !important; }
  body.printing #print-sheet { display: flex; justify-content: center; }
  #print-sheet img { display: block; max-width: 100%; max-height: 185mm; object-fit: contain; }
}
