/*
 * Apple-inspired console presentation, layered after the existing activity CSS.
 * Keep Django forms, table columns, date controls, dialogs and pagination intact.
 * Existing scripts own validation placement, navigation state and file handling.
 */
:root {
  --bg: #ffffff;
  --ink: #1d1d1f;
  --muted: #626269;
  --line: #e7e7eb;
  --primary: #0071e3;
  --primary-light: #eaf3fd;
  --purple: #6c5e86;
  --amber: #775319;
  --danger: #b42318;
  --radius: 12px;
  --apple-sidebar: #f5f5f7;
  --apple-time: #424247;
  --apple-input-line: #c9c9d1;
  --apple-sidebar-width: 210px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #cce4ff; color: #1d1d1f; }
a { color: #0066cc; text-underline-offset: 4px; }
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: #0071e318; }
button, a, input, select, textarea {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #0071e3;
  outline-offset: 3px;
}
small { font-size: 12px; font-weight: 400; }
h1 { font-size: 32px; font-weight: 650; letter-spacing: -.035em; line-height: 1.22; }
main h2, .import-dialog h2 {
  font-size: 21px !important;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.025em;
}
main h3 { font-size: 16px; font-weight: 600; line-height: 1.5; }

/* Application frame. The existing 600px navigation mode remains authoritative. */
.sidebar {
  width: var(--apple-sidebar-width);
  padding: 29px 14px 24px;
  background: var(--apple-sidebar);
  border-right: 0;
  scrollbar-color: #c7c7ce var(--apple-sidebar);
}
.sidebar .brand {
  padding: 0 31px 28px 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.5;
  gap: 9px;
}
.brandmark { background: var(--ink); box-shadow: none; color: #fff; border-radius: 9px; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.sidebar nav a {
  min-height: 44px;
  gap: 9px;
  margin: 3px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  color: #505057;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.sidebar nav a:hover { background: #eaeaec; color: var(--ink); }
.sidebar nav a.active {
  color: #fff;
  background: var(--ink);
  border-color: transparent;
  font-weight: 600;
}
.sidebar nav a.active:hover { background: #303034; color: #fff; }
.sidebar .redemption-menu { margin: 5px 0; }
.sidebar .redemption-menu > summary {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #505057;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.sidebar .redemption-menu > summary::before { font-size: 18px; flex-basis: 10px; }
.sidebar .redemption-menu > summary:hover { background: #eaeaec; color: var(--ink); }
.sidebar .redemption-menu[open] > summary { background: transparent; color: var(--ink); font-weight: 600; }
.sidebar .redemption-menu > summary:focus-visible { outline-color: var(--primary); }
.sidebar .redemption-submenu {
  margin: 3px 0 8px 16px;
  padding: 0 0 0 8px;
  border-radius: 0;
  background: transparent;
}
.sidebar .redemption-submenu > a {
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}
.sidebar .redemption-submenu > a.active { background: var(--ink); color: #fff; border-color: transparent; font-weight: 500; }
.sidebar .redemption-submenu > a:hover { background: #eaeaec; color: var(--ink); }
.sidebar .redemption-submenu > a.active:hover { background: #303034; color: #fff; }
.sidebar .system-menu { margin-top: 21px; padding-top: 15px; border-color: #dfdfe5; }
.sidebar .system-menu > summary { min-height: 42px; padding: 10px 12px; font-size: 12px; color: var(--muted); }
.sidebar .nav-label { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.sidebar-foot { padding: 20px 10px 0; color: var(--muted); font-size: 12px; }
.sidebar-foot small { color: var(--muted); font-size: 11px; }
.sidebar-toggle {
  top: 27px;
  right: 9px;
  width: 28px;
  height: 32px;
  border: 1px solid #d9d9df;
  border-radius: 8px;
  color: #505057;
  background: #fff;
  font-size: 24px;
}
.sidebar-toggle:hover { background: #eaeaec; color: var(--ink); }
.workspace { margin-left: var(--apple-sidebar-width); min-width: 0; }
html.sidebar-collapsed .sidebar { width: 48px; padding: 0; }
html.sidebar-collapsed .workspace { margin-left: 48px; }
html.sidebar-collapsed .sidebar-toggle { right: 9px; }
.topbar {
  min-height: 76px;
  height: auto;
  padding: 18px 44px;
  gap: 20px;
  background: #fff;
  border-bottom: 0;
  backdrop-filter: none;
}
.breadcrumb { color: var(--muted); font-size: 13px; line-height: 1.6; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { color: #8b8b92; margin: 0 10px; }
.breadcrumb > [aria-current=page] { color: var(--ink); }
.account { gap: 9px; font-size: 12px; }
.account small { color: var(--muted); font-size: 11px; }
.avatar { width: 30px; height: 30px; background: var(--apple-sidebar); color: var(--ink); }
.account .text-button, .account .subtle { font-size: 12px !important; font-weight: 400; }
.account .subtle { margin-left: 8px; }
.account form { margin-left: 5px; }
main { max-width: 1500px; padding: 26px 44px 38px; min-width: 0; }
.page-context { margin-bottom: 24px; }
.page-context .heading-summary { max-width: 80ch; }
.page-context .heading-summary strong { color: var(--ink); font-size: 18px; line-height: 1.45; font-weight: 600; letter-spacing: -.02em; }
.page-context .heading-summary p { margin-top: 8px; }
.page-heading { gap: 18px; margin-bottom: 24px; align-items: flex-start; }
.heading-summary { border-left: 0; padding-left: 0; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .02em; }
.overview-actions { gap: 9px; margin-bottom: 26px; }

/* Quiet sections retain the existing DOM and its operational grouping. */
.card {
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 25px 0;
  margin-bottom: 24px;
  box-shadow: none;
}
.card .card { margin-top: 22px; margin-bottom: 0; }
.two-col { gap: 30px; }
.dashboard-grid { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); }
.section-heading, main .section-heading { gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-heading > a { font-size: 13px; }
.form-card { max-width: 720px; }
.metrics { gap: 0 28px; margin: 26px 0; }
.metrics article { padding: 21px 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.metrics article > span { color: var(--muted); font-size: 13px; }
.metrics strong { color: var(--ink); font-size: 29px; font-weight: 600; letter-spacing: -.025em; margin: 7px 0; }
.metrics small { color: var(--apple-time); font-size: 12px; }
.camp-row { padding: 23px 0; border-color: var(--line); }
.camp-row p, .camp-row dt { color: var(--muted); font-size: 13px; }
.camp-row dl { gap: 16px 24px; }
.camp-row dd { color: var(--ink); font-size: 21px; font-weight: 500; }
.camp-icon, .camp-icon.dou { background: var(--apple-sidebar); color: var(--muted); border-radius: 9px; }
.progress-stat { border-color: var(--line); padding: 16px 0; gap: 18px; }
.progress-stat > span, .progress-stat small { color: var(--muted); font-size: 13px; }
.progress-stat strong { color: var(--ink); font-size: 25px; font-weight: 500; }
.welcome, .ranking-intro { background: #fff; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 6px 0 24px; min-height: 0; }
.welcome h2, .ranking-intro h2 { color: var(--ink); }
.welcome p, .ranking-intro p { color: var(--muted); font-size: 14px; }
.ranking-symbol { color: var(--muted); }
.rank-position { width: 30px; height: 30px; border-radius: 8px; background: var(--apple-sidebar); color: var(--muted); font-weight: 500; }
.rank-position.rank-top { background: var(--ink); color: #fff; }
.ranking-points { color: var(--ink); font-size: 18px; font-weight: 600; }
.module-tabs { gap: 5px 22px; padding: 0; margin-bottom: 25px; border-color: var(--line); }
.module-tabs a { min-height: 44px; padding: 12px 0; border-radius: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; }
.module-tabs a.selected { background: transparent; color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.module-tabs a:hover { color: #0066cc; text-decoration: none; }

/* Keep native inputs and the shared date/select enhancement hooks. */
.filter-bar {
  align-items: flex-end;
  gap: 12px;
  padding: 21px 0;
  margin-bottom: 22px;
  border: 0;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}
.filter-field { flex: 1 1 135px; min-width: 125px; max-width: 240px; }
form label, .filter-field label { color: #424247 !important; font-size: 13px !important; font-weight: 500; margin-bottom: 8px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  min-height: 44px;
  border: 1px solid var(--apple-input-line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 14px !important;
  font-weight: 400;
  line-height: 1.5;
  caret-color: var(--primary);
}
input::placeholder, textarea::placeholder { color: #73737a; opacity: 1; }
:is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea):focus { border-color: var(--primary); box-shadow: none; }
:is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), textarea)[readonly] { background: #fafafa; }
:is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea):disabled { background: var(--apple-sidebar); color: var(--muted); cursor: not-allowed; opacity: 1; }
:is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea)[aria-invalid=true] { border-color: var(--danger); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; }
input[type=date], input[type=datetime-local], time, .timestamp, .datetime, .table-time { color: var(--apple-time); font-variant-numeric: tabular-nums; }
input:is([type=date],[type=datetime-local]):not([type=checkbox]):not([type=hidden]) { color: var(--apple-time); }
input[type=date]::-webkit-calendar-picker-indicator { padding: 3px; opacity: .75; }
textarea { resize: vertical; min-height: 100px; }
.upload-date-picker.enhanced { border-color: var(--apple-input-line); border-radius: 9px; min-height: 44px; background: #fff; }
.upload-date-picker.enhanced .upload-date-display { color: var(--apple-time); font-size: 14px; min-height: 44px; padding: 10px 38px 10px 12px; font-variant-numeric: tabular-nums; }
.upload-date-picker.enhanced .upload-date-icon { color: var(--muted); top: 9px; }
.upload-date-picker:focus-within, .upload-dropzone:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
.rate-input-grid, .upload-fields, .roster-assignment-grid { gap: 20px 24px; }
.task-assignment-grid { gap: 18px; }
.inline-form { gap: 13px; }

/* A single control vocabulary, without changing link or submit semantics. */
.button, .button.small {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--primary);
  border-radius: 22px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  gap: 7px;
}
.button:hover { border-color: #0077ed; background: #0077ed; color: #fff; }
.button:active { border-color: #0067d0; background: #0067d0; }
.button.secondary { border-color: #d2d2d7; background: #fff; color: var(--ink); }
.button.secondary:hover { border-color: #c7c7ce; background: var(--apple-sidebar); color: var(--ink); }
.button.ghost { border-color: transparent; background: transparent; color: #0066cc; }
.button.ghost:hover { background: var(--primary-light); color: #0066cc; }
.button.danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.button.danger:hover { border-color: #951d14; background: #951d14; }
.button.small { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.text-button { color: #0066cc; font-size: 13px; font-weight: 500; text-underline-offset: 4px; }
.text-button:hover { text-decoration: underline; }
.filter-bar .button { min-height: 44px; border-radius: 9px; }
button:disabled, .button:disabled { opacity: .45; cursor: not-allowed; }
.badge { padding: 4px 9px; border-radius: 7px; background: var(--apple-sidebar); color: #505057; font-size: 12px; font-weight: 500; }
.badge.green { background: #eaf2ec; color: #31623d; }
.badge.purple, .purple { background: #f1edf6; color: #65537d; }
.badge.amber { background: #fff4e3; color: #775319; }
.tiny { background: #e8e8ed; color: #505057; font-size: 11px; }
.status-dot { background: #648c70; }

/* All data columns remain available; wide operational tables scroll locally. */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: #c7c7ce #f5f5f7; }
table:not(.excel-example) { width: 100%; border-collapse: collapse; table-layout: auto; font-size: 14px; color: var(--ink); }
table:not(.excel-example) th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #505057;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: bottom;
}
table:not(.excel-example) td {
  height: 56px;
  padding: 15px 14px;
  border-bottom: 1px solid #eeeef1;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
  vertical-align: middle;
}
table:not(.excel-example) tbody tr:last-child td { border-bottom: 0; }
table:not(.excel-example) tbody tr:hover { background: #fafafa; }
table:not(.excel-example) tbody tr:has(input[type=checkbox]:checked) { background: #f1f7fe; }
table .number { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.timestamp, table:not(.excel-example) td.timestamp, .detail-grid dd.timestamp,
table time, table .datetime, table .table-time { color: var(--apple-time); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.member-home-link { font-weight: 500; text-decoration: none; text-underline-offset: 4px; }
.member-home-link:hover { text-decoration: underline; }
.empty-cell, table:not(.excel-example) .empty-cell { padding: 48px 20px; height: auto; color: var(--muted); font-size: 14px; }
.empty { padding: 40px 20px; }
.empty h3 { color: var(--ink); font-weight: 500; }
.empty p, .empty a { font-size: 13px; }
.mobile-table-hint { color: var(--muted); font-size: 12px; }
.pagination { align-items: center; gap: 14px; padding-top: 20px; margin-top: 20px; border-color: var(--line); }
.pagination-controls, .pagination-form { gap: 8px; }
.pagination .button { min-height: 36px; padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.pagination-form select, .pagination-form input[type=number] { min-height: 36px; padding: 7px 9px; border-radius: 8px; font-size: 12px !important; }
.pagination-form select { width: 76px; }
.pagination-form input[type=number] { width: 68px; }
.pagination-form label { font-size: 12px !important; font-weight: 400; }

/* Existing messages keep semantic colors and their script-controlled position. */
.muted, .hint, .note, .subtle, .heading-summary p, .pagination, .pagination-form label {
  color: var(--muted) !important;
  font-size: 13px !important;
  font-weight: 400;
  line-height: 1.75;
}
.helptext { color: var(--muted); font-size: 13px; line-height: 1.75; }
.note { padding: 14px 16px; border: 0; border-radius: 10px; background: var(--apple-sidebar); margin: 18px 0; }
.message { padding: 14px 16px; border: 0; border-radius: 10px; background: var(--primary-light); color: #195786; font-size: 14px; line-height: 1.75; }
.message.error { background: #fff0ee; color: #9d241a; }
.message.warning { background: #fff5e6; color: #775319; }
.message.success { background: #edf5ee; color: #31623d; }
.errorlist, ul.errorlist, .upload-file-error { color: var(--danger); font-size: 13px; line-height: 1.7; }
.updated-value, .import-result-counts .modified-count strong, .import-result-counts .modified-count > span { color: #b42318; font-weight: 600; }
table:not(.excel-example) td.updated-value, table:not(.excel-example) .updated-value { color: #b42318; font-weight: 600; }
.danger-text { color: var(--danger); }
.green-text { color: #31623d; }
.amber-text { color: #775319; }
table:not(.excel-example) td.danger-text { color: var(--danger); }
table:not(.excel-example) td.green-text { color: #31623d; }
table:not(.excel-example) td.amber-text { color: #775319; }
.preview-banner, .balance-callout, .formula { background: var(--apple-sidebar); color: #505057; border-radius: 10px; }
.preview-banner { gap: 15px; padding: 16px 18px; }
.formula { font-size: 14px; }
.formula b { color: var(--ink); font-weight: 500; }
.balance-callout strong, .locked-rates b { color: var(--ink); font-weight: 600; }
.danger-zone { border-top-color: #e4c7c2; background: #fff; }
.danger-zone p { color: #775047; font-size: 14px; }
.detail-grid { gap: 20px 24px; }
.detail-grid dt { color: var(--muted); font-size: 13px; }
.detail-grid dd { color: var(--ink); font-size: 14px; }
.log-values { background: var(--apple-sidebar); border-radius: 9px; }
.log-values pre, .mono { font-size: 13px; }

/* Upload UI remains the real input/dropzone; template links stay prominent. */
.import-upload-card { max-width: 1050px; padding: 25px 0; }
.upload-heading { align-items: center; gap: 18px; margin-bottom: 23px; }
.upload-templates { gap: 9px; flex-wrap: wrap; }
.upload-templates a {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #d2d2d7;
  border-radius: 20px;
  background: #fff;
  color: #0066cc;
  font-size: 13px;
  font-weight: 500;
}
.upload-templates a:hover { border-color: #c7c7ce; background: var(--apple-sidebar); color: #0066cc; }
input[type=file] { padding: 15px !important; background: #fafafa !important; border-color: #bdbdc6; border-radius: 11px; font-size: 13px !important; }
.upload-file input[type=file] { background: #fafafa !important; }
input[type=file]::file-selector-button, .upload-file input::file-selector-button { padding: 8px 13px; border: 1px solid #d2d2d7; border-radius: 18px; background: #fff; color: var(--ink); font: inherit; margin-right: 12px; }
.upload-dropzone.enhanced { min-height: 132px; border: 1px dashed #b9b9c2; border-radius: 12px; background: #fafafa; }
.upload-dropzone.enhanced .dropzone-caption { padding: 24px 20px; gap: 8px; }
.dropzone-caption strong { color: var(--ink); font-size: 15px; font-weight: 500; }
.dropzone-caption > span { color: var(--muted); font-size: 13px; }
.upload-dropzone.drag-over { border-color: var(--primary); background: var(--primary-light); box-shadow: none; }
.upload-dropzone.has-file { border-color: #7d9cbc; background: #f7faff; }
.upload-dropzone.file-selected .upload-file-name { color: var(--ink); font-size: 16px; font-weight: 500; line-height: 1.7; overflow-wrap: anywhere; }
.task-file-clear { width: 32px; height: 32px; border-color: #d2d2d7; background: #fff; color: var(--muted); font-size: 22px; }
.task-file-clear:hover { background: var(--apple-sidebar); color: var(--ink); }
.upload-actions { gap: 13px; margin-top: 22px; flex-wrap: wrap; }
.upload-actions > span, .upload-rules p, .upload-rules summary, .task-latest, .camp-latest { color: var(--muted); font-size: 13px; }
.camp-latest time { color: var(--apple-time); font-size: 13px; }
.upload-rules { padding-top: 18px; margin-top: 23px; border-color: var(--line); }
.upload-recent { padding: 22px 0; max-width: 1050px; }
.upload-recent > summary { font-size: 14px; font-weight: 500; }
.upload-history-link { font-size: 13px; }
.camp-upload-grid { gap: 24px; }
.camp-upload-panel, .camp-upload-panel[data-camp=dou] { padding: 21px 0; background: #fff; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.task-template-guide { background: var(--apple-sidebar); border: 0; border-radius: 11px; padding: 17px 18px; }
.task-template-guide > p, .task-template-guide .hint { color: #505057; font-size: 13px; }
.task-template-guide code { background: #e9e9ed; color: #424247; }
.task-column-order > span { border: 1px solid #dedee4; border-radius: 8px; font-size: 13px; }
.task-column-order b { color: var(--ink); font-weight: 500; }
.template-link { border-color: var(--line); border-radius: 10px; color: var(--ink); font-size: 14px; }
.template-link small { color: var(--muted); font-size: 12px; }
.file-icon, .file-icon.purple { background: var(--apple-sidebar); color: var(--muted); }
#task-assignment { border: 0; border-radius: 11px; padding: 18px 20px; background: #fff5e6; }
.task-recognition-icon { background: #f0dfbd; color: #775319; }
.task-recognition-callout strong { color: #775319; font-size: 15px; font-weight: 600; }
#task-recognition { color: #775319; font-size: 13px; }

/* Native dialog behavior, focus management and scroll boundaries are preserved. */
.import-dialog {
  border: 1px solid #e1e1e7;
  border-radius: 18px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px #15151d30;
}
.import-dialog::backdrop { background: #15151d52; backdrop-filter: none; }
.import-dialog-header { gap: 20px; padding: 25px 28px 21px; background: #fff; border-color: var(--line); }
.import-dialog-header p { color: var(--muted); font-size: 13px; line-height: 1.75; }
.manual-participant-dialog .import-dialog-header h2 { font-size: 23px !important; }
.dialog-close { width: 34px; height: 34px; border-radius: 50%; background: var(--apple-sidebar); color: var(--muted); font-size: 24px; flex-shrink: 0; }
.dialog-close:hover { background: #e8e8ed; color: var(--ink); }
.import-dialog-body { padding: 23px 28px; scrollbar-color: #c7c7ce #fff; }
.import-dialog-footer { padding: 19px 28px; border-color: var(--line); background: #fff; flex-wrap: wrap; }
.import-result-counts { gap: 22px; padding-bottom: 20px; border-color: var(--line); }
.import-result-counts span, .import-result-counts small { font-size: 13px; }
.import-result-counts strong { color: var(--ink); font-size: 29px; font-weight: 600; }
.import-result-counts .modified-count strong { color: var(--danger); }
.steps { gap: 20px; color: var(--muted); font-size: 13px; }
.steps .current { color: var(--ink); font-weight: 600; }
.steps i { color: #8b8b92; }
footer { color: var(--muted); font-size: 12px; letter-spacing: 0; }
.login-layout { background: var(--apple-sidebar); }
.login-layout .login-panel { padding: 34px; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 40px #15151d08; }
.login-layout .login-panel h2 { font-size: 25px; font-weight: 600; letter-spacing: -.025em; }

/* Shared enhancement controls keep the existing JS and native form behavior. */
input[type=checkbox], input[type=radio] { min-height: 0; padding: 0; flex-shrink: 0; }
input[type=radio]:not([type=checkbox]):not([type=hidden]) { width: 16px; height: 16px; min-height: 0; padding: 0; border: initial; background: initial; appearance: auto; }
.clearable-filter select { padding-right: 64px; }
.clearable-filter .clearable-filter-clear {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}
.clearable-filter .clearable-filter-clear:hover { background: var(--apple-sidebar); color: var(--ink); }
.clearable-filter .clearable-filter-clear:focus-visible { outline-color: var(--primary); }
.excel-dropzone { padding: 23px; border: 1px dashed #b9b9c2; border-radius: 12px; background: #fafafa; }
.excel-dropzone .hint { font-size: 14px !important; color: var(--muted) !important; }
.excel-dropzone input[type=file] { padding: 0 !important; background: transparent !important; border: 0; border-radius: 0; }
.excel-dropzone.drag-over, .excel-dropzone:focus-within { border-color: var(--primary); background: var(--primary-light); }
.excel-dropzone:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
.upload-date-picker.enhanced:has(input:disabled),
.schedule-locked .upload-date-picker.enhanced { background: var(--apple-sidebar); border-color: #d9d9df; cursor: not-allowed; }
.upload-date-picker.enhanced:has(input:disabled) .upload-date-display,
.upload-date-picker.enhanced:has(input:disabled) .upload-date-icon,
.schedule-locked .upload-date-picker.enhanced .upload-date-display,
.schedule-locked .upload-date-picker.enhanced .upload-date-icon { color: var(--muted); }
.upload-date-picker.enhanced:has(input[aria-invalid=true]) { border-color: var(--danger); }

/* These page-local styles occur after base.html; scoped selectors keep the theme
 * consistent without overriding late-loaded layout, form errors or visibility. */
main .module-tabs a.button {
  padding: 9px 16px;
  border: 1px solid var(--primary);
  border-radius: 22px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}
main .module-tabs a.button:hover,
main .module-tabs a.button:focus-visible { background: #0077ed; border-color: #0077ed; color: #fff; }
main .import-upload-card { padding: 25px 0; }
main .import-upload-card .upload-templates { gap: 9px; }
main .camp-upload-panel { padding: 20px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #fff; }
main .camp-upload-panel h4 { font-size: 15px; font-weight: 600; }
main .camp-upload-panel h4 small { font-size: 13px; color: var(--muted); }
main .camp-group-status { padding: 12px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; font-size: 13px; }
main .camp-group-status strong { color: #9d3025; font-size: 13px; font-weight: 500; }
main .camp-group-status.is-uploaded { border-color: #c7dbcb; background: #edf5ee; }
main .camp-group-status.is-uploaded strong { color: #31623d; }
main .today-upload-status .upload-go-grant { font-weight: 500; }
main .schedule-phase { padding: 23px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
main .schedule-dates { gap: 20px; }
main .pending-grant-notice { background: #fff5e6; border: 0; border-radius: 10px; padding: 17px 18px; }
main .pending-grant-notice > strong { color: #775319; font-size: 15px; font-weight: 600; }
main .pending-grant-notice a { color: #775319; font-size: 14px; font-weight: 500; }
main .pending-grant-notice p { color: #775319; font-size: 12px; }
main .preview-base-rates span { background: var(--apple-sidebar); color: var(--muted); border-radius: 8px; }
main .preview-base-rates strong { color: var(--ink); font-weight: 500; }

/* Machine checks and quick-review forms are real business state. Do not recolor
 * their inline pass/fail text, hide columns, or change automatic-submit behavior. */
table.award-review-table .check-cell { font-size: 13px; line-height: 1.7; }
table.award-review-table .hint { margin: 7px 0 0; font-size: 12px !important; }
table.award-review-table .quick-offline-form,
table.award-review-table .quick-manual-form { margin: 0; min-width: 104px; }
table.award-review-table .quick-offline-form select,
table.award-review-table .quick-manual-form select { min-width: 104px; min-height: 40px; font-size: 13px !important; }
.review-operation-errors .message { padding-right: 43px; margin: 10px 0 0; }
.review-operation-errors .review-error-close { width: 32px; height: 32px; border-radius: 7px; color: var(--danger); }
.review-operation-errors .review-error-close:hover { background: #f4dcd8; }
.reward-checklist { font-size: 14px; line-height: 1.8; }
.reward-checklist strong { color: var(--ink); font-weight: 500; }
main .award-review { padding: 21px 0; border-color: var(--line); }

/* reward_drawer.css is loaded by the review template after this stylesheet.
 * Higher-specificity presentation selectors leave its sizing and modes intact. */
dialog.reward-review-drawer { background: #fff; box-shadow: -12px 0 40px #15151d24; }
dialog.reward-review-drawer::backdrop { background: #15151d52; }
.reward-review-drawer .review-drawer-header { background: #fff; border-color: var(--line); }
.reward-review-drawer .review-drawer-header h2 { font-size: 21px !important; font-weight: 600; letter-spacing: -.025em; line-height: 1.4; }
.reward-review-drawer .review-drawer-frame { background: #fff; }
.reward-review-drawer .review-drawer-loading { color: var(--muted) !important; font-size: 13px !important; }
dialog.reward-review-drawer.quick-preview { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 36px #15151d24; }
.reward-review-drawer.quick-preview .review-drawer-header h2 { font-size: 18px !important; }

@media (max-width: 1150px) {
  :root { --apple-sidebar-width: 196px; }
  .sidebar { padding-left: 11px; padding-right: 11px; }
  .sidebar .brand { font-size: 15px; padding-left: 8px; }
  main { padding: 25px 30px 32px; }
  .topbar { padding-left: 30px; padding-right: 30px; }
  .dashboard-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 850px) {
  :root { --apple-sidebar-width: 180px; }
  .sidebar .brand { font-size: 14px; }
  .sidebar nav a, .sidebar .redemption-menu > summary { font-size: 12px; padding-left: 10px; padding-right: 10px; }
  .sidebar .redemption-submenu > a { font-size: 12px; padding-left: 8px; }
  .sidebar .redemption-submenu { margin-left: 10px; padding-left: 6px; }
  main { padding: 24px; }
  .topbar { padding: 18px 24px; }
  .two-col { grid-template-columns: minmax(0,1fr); gap: 0; }
  .metrics { gap: 0 22px; }
  .metrics.three { grid-template-columns: 1fr; }
  .page-context .heading-summary strong { font-size: 17px; }
}
@media (max-width: 600px) {
  body { font-size: 14px; }
  .sidebar { position: relative; width: 100%; padding: 18px 16px 10px; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 0 45px 16px 6px; font-size: 16px; }
  .sidebar nav { gap: 5px; align-items: flex-start; }
  .sidebar nav a { min-height: 44px; padding: 10px 12px; font-size: 13px; }
  .sidebar .redemption-menu { margin: 0; }
  .sidebar .redemption-menu > summary { min-height: 44px; padding: 10px 12px; font-size: 13px; }
  .sidebar .redemption-submenu { margin: 4px 0 7px 8px; padding-left: 7px; }
  .sidebar .redemption-submenu > a { min-height: 44px; padding: 10px; font-size: 12px; }
  .sidebar .system-menu { padding-top: 8px; margin-top: 10px; }
  .sidebar .system-menu > summary { min-height: 44px; padding: 10px 12px; font-size: 13px; }
  .sidebar-toggle { top: 15px; right: 16px; min-width: 36px; height: 36px; }
  html.sidebar-collapsed .sidebar { width: 100%; height: 58px; }
  html.sidebar-collapsed .sidebar-toggle { top: 10px; left: 16px; right: auto; }
  .workspace, html.sidebar-collapsed .workspace { margin-left: 0; }
  .topbar { min-height: 66px; height: auto; padding: 14px 20px; border-bottom: 1px solid var(--line); }
  .account { gap: 7px; font-size: 12px; flex-wrap: wrap; justify-content: flex-end; }
  .account .subtle { margin-left: 4px; }
  .account .text-button { min-height: 36px; }
  main { padding: 25px 20px 28px; }
  h1 { font-size: 28px; }
  main h2, .import-dialog h2 { font-size: 20px !important; }
  .page-context { margin-bottom: 22px; }
  .page-context .heading-summary strong { font-size: 17px; }
  .card { padding: 22px 0; margin-bottom: 20px; }
  .section-heading { align-items: flex-start; }
  .module-tabs { gap: 4px 17px; margin-bottom: 22px; }
  .module-tabs a { font-size: 13px; min-height: 44px; padding: 12px 0; }
  .button, .button.small, .filter-bar .button { min-height: 44px; padding: 10px 14px; font-size: 13px; }
  main .participant-page-actions .button { min-height: 44px; }
  .clearable-filter select { padding-right: 78px; }
  .clearable-filter .clearable-filter-clear { width: 44px; height: 44px; right: 25px; }
  table.award-review-table .quick-offline-form select,
  table.award-review-table .quick-manual-form select { min-height: 46px; font-size: 16px !important; }
  .review-operation-errors .message { padding-right: 54px; }
  .review-operation-errors .review-error-close { width: 44px; height: 44px; }
  .filter-bar { gap: 13px 10px; padding: 19px 0; }
  .filter-field { min-width: 0; flex-basis: calc(50% - 10px); max-width: none; }
  .filter-field:has(input[type=search]), .filter-field:has(input[name=q]), .filter-field:has(input[name=weibo_id]) { flex-basis: 100%; }
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { font-size: 16px !important; min-height: 46px; }
  input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
  input[type=radio]:not([type=checkbox]):not([type=hidden]) { width: 18px; height: 18px; }
  .upload-date-picker.enhanced { min-height: 46px; }
  .upload-date-picker.enhanced .upload-date-display { min-height: 46px; font-size: 16px; padding-top: 10px; padding-bottom: 10px; }
  .metrics { gap: 0 20px; }
  .metrics article { padding: 19px 0; }
  .metrics strong { font-size: 26px; }
  .camp-row dl { gap: 15px 20px; }
  .camp-row dd { font-size: 20px; }
  table:not(.excel-example) th { padding: 12px 10px; font-size: 12px; }
  table:not(.excel-example) td { padding: 14px 10px; height: 56px; font-size: 14px; }
  table time, table .timestamp, table .datetime, table .table-time { font-size: 13px; }
  .pagination { align-items: flex-start; gap: 13px; }
  .pagination-controls { width: 100%; gap: 8px; }
  .pagination .button { min-height: 44px; padding: 10px 12px; }
  .pagination-form { gap: 10px; }
  .pagination-form select, .pagination-form input[type=number] { min-height: 44px; font-size: 16px !important; }
  .upload-heading { gap: 14px; align-items: flex-start; }
  .upload-templates { gap: 8px; }
  .upload-templates a { min-height: 44px; padding: 10px 13px; font-size: 13px; }
  .upload-fields, .roster-assignment-grid, .task-assignment-grid, .camp-upload-grid, .rate-input-grid { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .camp-upload-panel { padding: 20px 0; }
  .task-file-clear { min-width: 44px; height: 44px; right: 9px; top: 9px; }
  .upload-dropzone.file-selected .upload-file-name { font-size: 15px; padding: 0 35px; }
  .import-dialog { width: calc(100% - 20px); border-radius: 16px; }
  .import-dialog-header { padding: 21px 20px 18px; }
  .import-dialog-body { padding: 20px; }
  .import-dialog-footer { padding: 17px 20px; gap: 12px; }
  .dialog-close { width: 44px; height: 44px; }
  .manual-participant-dialog .import-dialog-header h2 { font-size: 22px !important; }
  .import-result-counts { gap: 16px; }
  .import-result-counts strong { font-size: 26px; }
  .login-layout { padding: 20px; }
  .login-layout .login-panel { max-width: 440px; padding: 28px 24px; }
  .steps { gap: 10px; flex-wrap: wrap; }
  footer { gap: 12px; flex-wrap: wrap; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  button, a, input, select, textarea, .sidebar .redemption-menu > summary::before, .upload-dropzone.enhanced { transition: none; }
}

/* Nested sections use spacing; tabs and filter bottoms provide one boundary. */
main .card .card{border-top:0}
main .module-tabs + .card, main .module-tabs + .filter-bar{border-top:0}
