:root {
  --ink: #18201d;
  --muted: #66706b;
  --line: #d9dfdc;
  --soft: #f4f7f5;
  --paper: #ffffff;
  --green: #176b4d;
  --green-dark: #0f5039;
  --green-soft: #e7f4ed;
  --amber: #9a5b0a;
  --amber-soft: #fff3dc;
  --red: #a73535;
  --red-soft: #fbeaea;
  --blue: #245f9e;
  --blue-soft: #e9f1fa;
  --shadow: 0 12px 30px rgba(25, 44, 36, 0.08);
  font-family: "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #eef2ef;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #eef2ef; }
body { margin: 0; min-height: 100vh; font-size: 15px; line-height: 1.6; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); text-decoration: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 66px; flex: 0 0 66px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(20px, calc((100vw - 1180px) / 2)); background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 6px; display: grid; place-items: center;
  background: var(--green); color: #fff; font-weight: 800; font-size: 18px; flex: 0 0 38px;
}
.brand-title { font-size: 17px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { display: block; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.3; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.main { width: min(1180px, calc(100% - 32px)); margin: 28px auto 56px; flex: 1; }
.narrow { width: min(760px, calc(100% - 28px)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head h1, .page-head h2 { margin: 0; font-size: 25px; line-height: 1.25; }
.page-head p { margin: 5px 0 0; color: var(--muted); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.panel-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 18px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.panel-body { padding: 22px; }
.panel-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfb; }
.side-panel { position: sticky; top: 86px; }
.side-nav { padding: 10px; }
.side-nav button, .side-nav a {
  width: 100%; height: 43px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border: 0; background: transparent; color: var(--muted); border-radius: 4px; cursor: pointer; text-align: left;
}
.side-nav button:hover, .side-nav a:hover { background: var(--soft); color: var(--ink); }
.side-nav .active { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.nav-symbol { width: 24px; text-align: center; font-weight: 800; }

.tabs { display: flex; gap: 4px; padding: 4px; background: #e9eeeb; border-radius: 6px; width: fit-content; }
.tab {
  min-height: 38px; padding: 7px 16px; border: 0; border-radius: 4px; background: transparent;
  color: var(--muted); cursor: pointer; font-weight: 650;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(20, 30, 26, 0.12); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: #39413e; }
.field label small { font-weight: 500; color: var(--muted); }
.required::after { content: " *"; color: var(--red); }
.control {
  width: 100%; min-height: 43px; padding: 9px 11px; color: var(--ink); background: #fff;
  border: 1px solid #cbd3cf; border-radius: 4px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.control:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.12); }
.control::placeholder { color: #9aa39f; }
textarea.control { min-height: 92px; resize: vertical; }
.password-control { position: relative; min-width: 0; }
.password-control .control { padding-right: 50px; }
.password-toggle { position: absolute; top: 2px; right: 2px; width: 39px; height: 39px; padding: 0; display: grid; place-items: center; border: 0; border-left: 1px solid var(--line); border-radius: 0 3px 3px 0; color: var(--muted); background: #fff; cursor: pointer; }
.password-toggle:hover, .password-toggle:focus-visible { color: var(--green); background: var(--soft); outline: none; }
.password-eye { position: relative; width: 21px; height: 14px; display: block; border: 2px solid currentColor; border-radius: 70% 15%; transform: rotate(45deg); }
.password-eye::after { content: ""; position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: currentColor; transform: translate(-50%, -50%); }
.password-toggle.is-visible .password-eye::before { content: ""; position: absolute; top: 5px; left: -4px; width: 26px; height: 2px; background: currentColor; transform: rotate(-90deg); }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 13px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--green); flex: 0 0 auto; margin-top: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.help { margin-top: 5px; color: var(--muted); font-size: 12px; }
.error-text { color: var(--red); font-size: 13px; }

.btn {
  min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 700;
  color: var(--ink); background: #fff; border-color: #cbd3cf; transition: .15s ease;
}
.btn:hover { border-color: #9ba6a1; background: var(--soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #842929; border-color: #842929; }
.btn-amber { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 4px; font-size: 20px; }

.photo-upload { display: grid; grid-template-columns: 138px minmax(0, 1fr); gap: 16px; align-items: center; }
.photo-preview {
  width: 138px; aspect-ratio: 4 / 3; object-fit: cover; background: var(--soft); border: 1px dashed #aab4af;
  border-radius: 4px; display: grid; place-items: center; color: var(--muted); overflow: hidden;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-copy strong { display: block; margin-bottom: 4px; }
.photo-copy p { margin: 0 0 10px; color: var(--muted); font-size: 12px; }

.service-list { display: grid; gap: 12px; }
.service-item { border: 1px solid var(--line); border-radius: 6px; padding: 17px; background: #fff; }
.service-item:hover { border-color: #a9b6b0; }
.service-item h3 { margin: 0 0 4px; font-size: 16px; }
.service-item p { margin: 0; color: var(--muted); font-size: 13px; }
.service-meta { display: flex; gap: 14px; flex-wrap: wrap; margin: 11px 0; font-size: 12px; color: #48514d; }
.service-actions { justify-content: flex-end; }
.service-qr-preview { display: grid; justify-items: center; gap: 14px; text-align: center; }
.service-qr-preview p { margin: 0; color: var(--muted); }
.service-qr-preview img { width: min(320px, 100%); aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.service-share-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.roster-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.roster-stats span { padding: 7px 11px; background: #fff; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 12px; }
.roster-stats strong { color: var(--ink); font-size: 16px; }
.roster-stats .roster-stat-active { border-color: #9fc4da; background: var(--blue-soft); color: var(--blue); }
.roster-toolbar > * { max-width: 100%; }
.roster-select-all { align-items: center; color: var(--ink); }
.roster-list { min-width: 0; }
.roster-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.roster-workspace.scanner-open { grid-template-columns: minmax(0, 1fr) minmax(310px, 360px); }
.roster-list-panel { min-width: 0; overflow: hidden; }
.scanner-panel { min-width: 0; position: sticky; top: 82px; overflow: hidden; box-shadow: var(--shadow); }
.scanner-panel-head { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.scanner-panel-head strong, .scanner-panel-head small { display: block; }
.scanner-panel-head small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.scanner-panel-body { min-width: 0; padding: 12px; }
.scanner-manual { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin-top: 9px; }
.scanner-panel .scanner-view, .scanner-panel #qr-reader { width: 100%; min-height: 260px; }
.scanner-panel .scan-result { min-height: 130px; margin-top: 10px; border-top: 1px solid var(--line); background: #fff; }
.scanner-panel .scan-result .empty { padding: 24px 10px; }
.scanner-panel .approval-overview { grid-template-columns: 1fr; gap: 12px; }
.scanner-panel .approval-photo { max-height: 240px; }
.scanner-panel .approval-summary h2 { font-size: 21px; }
.scanner-panel .detail-grid { grid-template-columns: 1fr; }
.scanner-panel .detail-item { padding: 10px 4px; border-right: 0; }
.scanner-panel .decision-actions, .scanner-panel .service-result-actions { grid-template-columns: 1fr; }
.roster-item { display: grid; grid-template-columns: 20px 62px minmax(0, 1fr) 108px; gap: 12px; align-items: center; min-width: 0; padding: 12px 14px; border-bottom: 1px solid #e8ecea; background: #fff; }
.roster-item:last-child { border-bottom: 0; }
.roster-item.is-processing { border-left: 5px solid var(--blue); padding-left: 9px; background: #f5f9fd; }
.roster-check { width: 18px; height: 18px; accent-color: var(--green); }
.roster-photo { width: 62px; height: 62px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); }
.roster-photo-empty { display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; }
.roster-main { min-width: 0; }
.roster-name { font-size: 16px; }
.roster-meta, .roster-reason { margin-top: 3px; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.roster-reason { color: #39413e; }
.roster-result { display: block; width: fit-content; max-width: 100%; margin-top: 5px; padding: 2px 7px; border-radius: 3px; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; }
.roster-result.completed { color: var(--green-dark); background: var(--green-soft); }
.roster-result.unresolved { color: #75490d; background: var(--amber-soft); }
.roster-state { display: grid; justify-items: center; gap: 6px; }
.roster-state-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #77817c; font-weight: 800; }
.roster-state-icon.processing { background: var(--blue); }
.roster-state-icon.completed { background: var(--green); font-size: 22px; }
.roster-state-icon.unresolved { background: var(--amber); font-size: 22px; }
.roster-state-icon.entered { background: #397baa; }
.roster-state-icon.approved { background: var(--green); }
.service-result-panel { display: grid; gap: 13px; margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--line); }
.service-result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.status-hero { padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 22px; align-items: center; }
.status-kicker { color: var(--muted); font-size: 13px; }
.status-title { margin: 5px 0 8px; font-size: 27px; line-height: 1.25; }
.status-message { margin: 0; color: var(--muted); }
.clearance-approved { display: flex; align-items: center; gap: 14px; color: var(--green-dark); }
.clearance-approved strong { display: block; font-size: 28px; line-height: 1.2; }
.clearance-approved small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.clearance-icon {
  width: 72px; height: 72px; flex: 0 0 72px; display: grid; place-items: center; border-radius: 50%;
  color: #fff; background: var(--green); border: 5px solid #cce6d8; font-size: 42px; font-weight: 800; line-height: 1;
}
.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 10px; text-align: center; }
.qr-box img { width: 100%; aspect-ratio: 1; display: block; }
.qr-box small { color: var(--muted); }
.qr-inactive { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 5px; background: var(--soft); color: var(--muted); }
.qr-inactive span { width: 68px; height: 68px; display: grid; place-items: center; border: 4px solid #aeb6b2; border-radius: 50%; font-size: 50px; line-height: 1; }
.qr-inactive strong, .qr-inactive small { display: block; }
.reapply-panel { margin: 0 28px 24px; padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid #b9d9c8; border-left: 4px solid var(--green); border-radius: 5px; background: var(--green-soft); }
.reapply-panel p { margin: 4px 0 0; color: var(--muted); }
.reapply-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 27px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-approved, .badge-completed { background: var(--green-soft); color: var(--green); }
.badge-inside { background: var(--blue-soft); color: var(--blue); }
.badge-rejected, .badge-expired { background: var(--red-soft); color: var(--red); }
.badge-neutral { background: #edf0ee; color: #56605b; }

.timeline { padding: 8px 0; }
.timeline-step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; min-height: 56px; position: relative; }
.timeline-step:not(:last-child)::after { content: ""; position: absolute; top: 25px; left: 12px; width: 2px; height: 32px; background: var(--line); }
.step-dot { width: 26px; height: 26px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; background: #fff; color: transparent; font-size: 12px; font-weight: 800; z-index: 1; }
.timeline-step.done .step-dot { color: #fff; background: var(--green); border-color: var(--green); }
.timeline-step.current .step-dot { color: var(--green); border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.step-copy strong { display: block; line-height: 1.4; }
.step-copy small { color: var(--muted); }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.detail-item { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.detail-item:nth-child(odd) { border-right: 1px solid var(--line); }
.detail-item dt { color: var(--muted); font-size: 12px; }
.detail-item dd { margin: 2px 0 0; font-weight: 650; overflow-wrap: anywhere; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 15px 17px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin-top: 2px; font-size: 28px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-accent { border-left: 4px solid var(--green); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .control { min-height: 39px; width: auto; }
.toolbar .search { width: min(280px, 100%); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.data-table th { padding: 10px 12px; background: #f7f9f8; color: var(--muted); font-size: 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid #e8ecea; vertical-align: middle; }
.data-table tr:hover td { background: #fafcfb; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.today-cell { background: var(--green-soft); color: var(--green-dark); box-shadow: inset 4px 0 0 var(--green); font-weight: 700; }
.data-table tr:hover td.today-cell { background: #dcefe5; }
.today-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 3px; color: #fff; background: var(--green); font-size: 11px; vertical-align: 1px; }
.table-name { font-weight: 750; }
.table-sub { color: var(--muted); font-size: 12px; }
.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.pagination { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: #fbfcfb; }
.pagination-summary { color: var(--muted); font-size: 13px; }
.pagination-actions, .pagination-actions label { display: flex; align-items: center; gap: 8px; }
.pagination-actions label { color: var(--muted); font-size: 13px; }
.pagination-size { min-height: 36px; padding: 5px 26px 5px 8px; border: 1px solid #cbd3cf; border-radius: 4px; color: var(--ink); background: #fff; }
.pagination-current { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }

.scanner-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, .8fr); gap: 18px; }
.scanner-view { min-height: 370px; background: #111; border-radius: 5px; overflow: hidden; position: relative; }
#qr-reader { min-height: 370px; color: #fff; }
#qr-reader video { object-fit: cover; }
.scan-result { min-height: 370px; }
.identity { display: grid; grid-template-columns: 118px 1fr; gap: 16px; align-items: start; }
.identity-photo { width: 118px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 5px; background: var(--soft); border: 1px solid var(--line); }
.identity h2 { margin: 0; font-size: 24px; }
.identity p { margin: 3px 0; color: var(--muted); }
.decision-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.decision-actions .wide { grid-column: 1 / -1; }

.booking-page { min-width: 0; max-width: 100%; }
.booking-page > .panel, .booking-page .panel-body, .booking-page .stack,
.booking-page .stack > *, .booking-picker { width: 100%; min-width: 0; max-width: 100%; }
.booking-page > .panel { overflow: hidden; }
.picker-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.picker-heading small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.slot-days {
  display: grid; grid-auto-flow: column; grid-auto-columns: 88px; gap: 8px; width: 100%; min-width: 0; max-width: 100%;
  margin-top: 8px; padding: 0 1px 9px; overflow-x: auto; overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.day-button {
  width: 100%; min-width: 0; padding: 9px 5px; border: 1px solid var(--line); border-radius: 5px;
  background: #fff; cursor: pointer; text-align: center; scroll-snap-align: start; touch-action: manipulation;
}
.day-button strong { display: block; }
.day-button small { color: var(--muted); }
.day-button.active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; width: 100%; min-width: 0; max-width: 100%; margin-top: 14px; }
.slot { width: 100%; min-width: 0; min-height: 56px; padding: 7px 4px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; touch-action: manipulation; }
.slot strong, .slot small { display: block; }
.slot strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.slot small { color: var(--muted); }
.slot.active { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.slot:disabled { opacity: .48; cursor: not-allowed; background: var(--soft); }
.slot-available { border-color: #9bc9b2; background: #f1faf5; }
.slot-limited { border-color: #dfb45f; background: var(--amber-soft); color: #75490d; }
.slot-full:disabled { opacity: 1; border-color: #dfaaaa; background: var(--red-soft); color: var(--red); }
.slot-full:disabled small { color: var(--red); font-weight: 700; }
.slot.active { border-color: var(--green-dark); background: var(--green-soft); box-shadow: 0 0 0 2px rgba(23, 107, 77, .2); }
.slot-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.slot-legend span { display: inline-flex; align-items: center; gap: 5px; }
.slot-legend i { width: 11px; height: 11px; border: 1px solid; border-radius: 2px; }
.legend-available { border-color: #9bc9b2 !important; background: #f1faf5; }
.legend-limited { border-color: #dfb45f !important; background: var(--amber-soft); }
.legend-full { border-color: #dfaaaa !important; background: var(--red-soft); }
.compact-loading { grid-column: auto; padding: 12px 4px; white-space: nowrap; }

.notice { padding: 12px 14px; border-radius: 5px; border: 1px solid; font-size: 13px; }
.notice-info { background: var(--blue-soft); border-color: #bfd1e5; color: #234f7e; }
.notice-warn { background: var(--amber-soft); border-color: #ead09d; color: #75490d; }
.notice-success { background: var(--green-soft); border-color: #b9d9c8; color: var(--green-dark); }
.notice-danger { background: var(--red-soft); border-color: #e5bcbc; color: #832c2c; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 20, 17, .62); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal { width: min(960px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 7px; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.modal-sm { width: min(520px, 100%); }
.visit-modal { width: min(900px, 100%); }
.modal-head { min-height: 58px; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; }

.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 120; }
.toast { width: min(360px, calc(100vw - 36px)); padding: 11px 14px; border-radius: 5px; color: #fff; background: #26312c; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.loading { padding: 28px; text-align: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid #d5ded9; border-top-color: var(--green); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.text-right { text-align: right; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.separator { height: 1px; background: var(--line); margin: 20px 0; }

.approval-overview { display: grid; grid-template-columns: minmax(240px, 330px) minmax(0, 1fr); gap: 22px; align-items: start; }
.approval-photo-block { min-width: 0; }
.approval-photo-block > strong { display: block; margin-bottom: 8px; font-size: 13px; }
.approval-photo-link { display: block; color: var(--muted); text-align: center; }
.approval-photo-link small { display: block; margin-top: 5px; }
.approval-photo {
  display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; background: var(--soft);
  border: 1px solid var(--line); border-radius: 5px;
}
.approval-photo-missing { min-height: 210px; display: grid; place-items: center; padding: 18px; color: var(--muted); background: var(--soft); border: 1px dashed #aab4af; border-radius: 5px; }
.approval-summary { min-width: 0; }
.approval-summary h2 { margin: 8px 0 3px; font-size: 25px; }
.approval-summary p { margin: 3px 0; color: var(--muted); overflow-wrap: anywhere; }
.approval-summary .notice { margin-top: 14px; }
.approval-details .detail-item.full { grid-column: 1 / -1; border-right: 0; }

@media (max-width: 900px) {
  .split, .workspace, .scanner-layout { grid-template-columns: 1fr; }
  .roster-workspace, .roster-workspace.scanner-open { grid-template-columns: 1fr; }
  .scanner-panel { position: static; grid-row: 1; }
  .scanner-panel .scanner-view, .scanner-panel #qr-reader { min-height: 300px; }
  .side-panel { position: static; }
  .side-nav { display: flex; overflow-x: auto; }
  .side-nav button, .side-nav a { width: auto; min-width: max-content; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .topbar { height: 58px; padding: 0 14px; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .brand-title { font-size: 15px; max-width: 56vw; }
  .brand-sub { display: none; }
  .top-actions .btn-label { display: none; }
  .main { width: min(100% - 20px, 1180px); margin-top: 14px; }
  .narrow { width: min(100% - 20px, 760px); }
  .booking-page { width: calc(100% - 16px); margin-bottom: 32px; }
  .booking-page .panel-head, .booking-page .panel-body { padding-inline: 14px; }
  .booking-page .notice, .booking-page .muted { overflow-wrap: anywhere; }
  .booking-page .field label { flex-wrap: wrap; gap: 2px 8px; }
  .picker-heading { align-items: flex-start; }
  .picker-heading small { white-space: normal; text-align: right; }
  .slot-days { grid-auto-columns: 80px; }
  .panel-head, .panel-body { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 13px; }
  .field.full { grid-column: auto; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding-inline: 8px; }
  .photo-upload { grid-template-columns: 105px 1fr; }
  .photo-preview { width: 105px; }
  .status-hero { padding: 20px; grid-template-columns: 1fr; }
  .clearance-approved strong { font-size: 25px; }
  .clearance-icon { width: 64px; height: 64px; flex-basis: 64px; font-size: 36px; }
  .qr-box { width: min(220px, 100%); margin: auto; }
  .reapply-panel { margin: 0 14px 18px; padding: 15px; display: grid; }
  .reapply-actions { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; width: 100%; }
  .reapply-actions .btn { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item:nth-child(odd) { border-right: 0; }
  .approval-overview { grid-template-columns: 1fr; gap: 16px; }
  .approval-photo { max-height: 56vh; }
  .approval-photo-missing { min-height: 150px; }
  .approval-details .detail-item.full { grid-column: auto; }
  .visit-modal .modal-body { padding: 14px; }
  .roster-toolbar .control, .roster-toolbar .search { width: 100%; }
  .roster-select-all { flex: 1 1 auto; }
  .roster-item { grid-template-columns: 18px 52px minmax(0, 1fr); gap: 9px; padding: 11px 10px; }
  .roster-photo { width: 52px; height: 52px; }
  .roster-state { grid-column: 2 / -1; display: flex; justify-content: flex-end; align-items: center; }
  .roster-state-icon { width: 34px; height: 34px; font-size: 12px; }
  .scanner-manual { grid-template-columns: 1fr; }
  .scanner-panel .scanner-view, .scanner-panel #qr-reader { min-height: 250px; }
  .service-result-actions { grid-template-columns: 1fr; }
  .service-actions { width: 100%; justify-content: flex-start; }
  .service-actions .btn { flex: 1 1 calc(50% - 6px); }
  .service-share-row { grid-template-columns: 1fr; }
  .stat-grid { gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 24px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .booking-page .slot { min-height: 58px; font-size: 13px; }
  .identity { grid-template-columns: 92px 1fr; }
  .identity-photo { width: 92px; }
  .decision-actions { grid-template-columns: 1fr; }
  .decision-actions .wide { grid-column: auto; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination-actions { justify-content: space-between; }
}
