:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --ink: #172421;
  --muted: #65736f;
  --line: #e5e1df;
  --teal: #88070f;
  --teal-deep: #5f050a;
  --success: #0f766e;
  --success-deep: #0b4f4a;
  --gold: #b88a2f;
  --blue: #2563eb;
  --red: #b42318;
  --green-soft: #e5f4ef;
  --gold-soft: #fff4d8;
  --blue-soft: #e8efff;
  --red-soft: #fde8e3;
  --shadow: 0 14px 34px rgba(74, 18, 22, 0.1);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #fafafa 0, #f0f1f2 420px, #f5f6f7 100%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "PingFang TC",
    "Segoe UI",
    Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  min-height: 188px;
  padding: 31px clamp(22px, 4vw, 58px);
  background:
    linear-gradient(115deg, rgba(69, 4, 8, 0.98), rgba(136, 7, 15, 0.95) 58%, rgba(184, 138, 47, 0.74)),
    #88070f;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 5px solid rgba(184, 138, 47, 0.9);
}

.brand-block {
  min-width: 0;
  max-width: 1050px;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logos {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px rgba(41, 4, 7, 0.2);
}

.brand-logo {
  width: 66px;
  height: 66px;
  object-fit: contain;
  display: block;
}

.brand-logo.cklc-logo {
  width: 64px;
}

.brand-copy-block {
  min-width: 0;
}

.brand-block h1,
.results h2,
.filters h2,
.drawer-head h2 {
  margin: 0;
}

.brand-block h1 {
  font-size: clamp(32px, 3.6vw, 48px);
  font-weight: 800;
  letter-spacing: 0;
}

.hero-copy {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.84;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  position: relative;
}

.status-title {
  margin: 0 0 10px;
  font-weight: 800;
  color: var(--ink);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  border: 1px solid rgba(136, 7, 15, 0.15);
  background: #faf8f8;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  white-space: nowrap;
}

.status-pill.error {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.warn {
  background: var(--gold-soft);
  color: #8a5c11;
}

.account-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 800;
}

.account-name {
  max-width: 180px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-menu {
  position: relative;
}

.source-toggle {
  list-style: none;
}

.source-toggle::-webkit-details-marker {
  display: none;
}

.source-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(41, 4, 7, 0.2);
  padding: 14px;
}

.account-strip.standalone {
  margin-top: 0;
}

.topbar > .account-strip.standalone {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 7px;
  padding: 6px 10px;
  color: #ffffff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.12);
}

.mini-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

.shell {
  width: min(1800px, calc(100% - 36px));
  margin: 24px auto 46px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  min-height: 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

.kpi-action {
  cursor: pointer;
  text-decoration: none;
}

.kpi-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(74, 18, 22, 0.14);
  text-decoration: none;
}

.kpi-action:focus,
.kpi-action span,
.kpi-action strong {
  text-decoration: none;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi strong {
  display: block;
  margin-top: 5px;
  font-size: 27px;
  line-height: 1.05;
  font-weight: 820;
}

.workspace {
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.filters,
.results {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters {
  padding: 18px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(136, 7, 15, 0.035), rgba(255, 255, 255, 0) 110px),
    rgba(255, 255, 255, 0.98);
}

.filter-head,
.result-toolbar,
.drawer-head,
.pager,
.actions,
.warning-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters h2,
.results h2,
.drawer-head h2 {
  font-size: 21px;
}

.filter-head {
  padding-bottom: 12px;
  border-bottom: 1px solid #eee5e6;
}

.filter-head h2 {
  color: var(--ink);
  font-weight: 900;
}

.filter-primary-grid,
.filter-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 10px;
  margin-top: 16px;
}

.filter-span-2 {
  grid-column: 1 / -1;
}

.filter-primary-grid > .field,
.filter-primary-grid > .field-row,
.filter-advanced-grid > .field,
.filter-advanced-grid > .field-row,
.filter-range-grid > .field {
  margin-top: 0;
}

.filter-rank-row {
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  margin-top: 0;
}

.filter-section-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.filter-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.filter-section-head h3,
.filter-advanced-card summary strong {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
}

.filter-section-meta {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #eadde0;
  border-radius: 999px;
  background: #fffafa;
  color: var(--teal-deep);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.filter-summary-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.active-filter-card,
.filter-advanced-card {
  margin-top: 16px;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfd, #fbf8f8);
  box-shadow: 0 8px 24px rgba(74, 18, 22, 0.05);
}

.active-filter-card {
  padding: 14px;
}

.filter-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(136, 7, 15, 0.16);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-deep);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.filter-chip:not(.empty) {
  cursor: pointer;
}

.filter-chip:not(.empty):hover {
  background: #fff6f7;
  border-color: rgba(136, 7, 15, 0.32);
}

.filter-chip strong {
  font-size: 14px;
  line-height: 1;
}

.filter-chip.empty {
  color: var(--muted);
  background: #fafafa;
  border-style: dashed;
}

.filter-advanced-card {
  overflow: hidden;
}

.filter-advanced-card summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}

.filter-advanced-card summary::-webkit-details-marker {
  display: none;
}

.filter-advanced-card summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--teal);
  font-size: 18px;
  font-weight: 900;
  flex: 0 0 auto;
  box-shadow: 0 1px 0 rgba(74, 18, 22, 0.04);
}

.filter-advanced-card .filter-section-meta {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
}

.filter-advanced-card[open] summary {
  border-bottom: 1px solid #eee5e6;
}

.filter-advanced-card[open] summary::after {
  content: "−";
}

.filter-advanced-card .filter-advanced-grid {
  margin-top: 0;
  padding: 14px;
}

.filter-range-card {
  margin-top: 0;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.filter-range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.compact-field {
  margin-top: 0;
}

.compact-filter-select .option-search {
  display: none;
}

.compact-filter-select .filter-selection-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
}

.preset-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.preset-button {
  min-height: 36px;
  border: 1px solid #eadde0;
  background: #fffafa;
  color: #5f050a;
  padding: 7px 9px;
  font-size: 13px;
}

.preset-button:hover,
.preset-button.active {
  border-color: rgba(136, 7, 15, 0.3);
  background: #f7e8ea;
  color: var(--teal-deep);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 116px;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd7d0;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  outline: none;
}

select.admin-role-select,
.admin-form select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--teal-deep) 50%) right 16px top 18px / 7px 7px no-repeat,
    linear-gradient(135deg, var(--teal-deep) 50%, transparent 50%) right 11px top 18px / 7px 7px no-repeat,
    #ffffff;
  padding-right: 36px;
}

.role-field {
  border: 0;
  padding: 0;
  margin: 14px 0 0;
}

.role-field legend {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.role-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.role-segment label {
  display: block;
}

.role-segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-segment span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid #cbd7d0;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.role-segment input:checked + span {
  border-color: rgba(136, 7, 15, 0.4);
  background: #fff7f8;
  color: var(--teal-deep);
  box-shadow: 0 0 0 3px rgba(136, 7, 15, 0.08);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--teal);
  vertical-align: middle;
}

input[type="checkbox"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(136, 7, 15, 0.12);
}

textarea {
  resize: vertical;
  min-height: 102px;
}

input.option-search {
  min-height: 36px;
  padding: 7px 10px;
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.3;
}

input.option-search::placeholder {
  color: #7a8682;
  opacity: 1;
}

.filter-combo {
  position: relative;
}

.filter-combo.open {
  z-index: 35;
}

.filter-selection-summary {
  min-height: 24px;
  border: 1px solid #eadde0;
  border-radius: 7px;
  background: #fffafa;
  color: var(--teal-deep);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.filter-combo.open .filter-selection-summary {
  border-color: rgba(136, 7, 15, 0.36);
  background: #fff7f8;
  box-shadow: 0 0 0 3px rgba(136, 7, 15, 0.08);
}

.filter-selection-summary.empty {
  color: var(--muted);
  background: #fafafa;
}

select.filter-dropdown-select[multiple] {
  display: none;
  position: static;
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
}

.filter-picker-panel {
  position: fixed;
  z-index: 120;
  display: none;
  overflow: hidden;
  border: 1px solid rgba(136, 7, 15, 0.22);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 58px rgba(55, 16, 20, 0.2);
}

.filter-picker-panel.open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.filter-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid #f0e1e4;
  background: #fff9fa;
  color: var(--teal-deep);
  font-size: 12px;
  font-weight: 900;
}

.filter-picker-clear {
  width: auto;
  min-height: 28px;
  border: 1px solid #ead5d8;
  border-radius: 7px;
  background: #ffffff;
  color: var(--teal);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.filter-picker-clear:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.55;
}

.filter-picker-options {
  overflow: auto;
  padding: 6px;
}

.filter-picker-option {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.filter-picker-option:hover,
.filter-picker-option:focus-visible {
  background: #f8f2f3;
}

.filter-picker-option.is-selected {
  background: #f7e8ea;
  color: var(--teal-deep);
  font-weight: 900;
}

.filter-picker-check {
  width: 14px;
  height: 14px;
  border: 1px solid #c9b8bc;
  border-radius: 4px;
  background: #ffffff;
}

.filter-picker-option.is-selected .filter-picker-check {
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: inset 0 0 0 3px #ffffff;
}

.filter-picker-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.35;
}

.filter-picker-empty {
  padding: 18px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.native-choice-select {
  display: none;
}

.choice-select-trigger {
  width: 100%;
  min-height: 42px;
  position: relative;
  display: block;
  border: 1px solid #cbd7d0;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 34px 9px 11px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(74, 18, 22, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.choice-select-trigger:hover {
  background: #fffafa;
  border-color: rgba(136, 7, 15, 0.24);
}

.choice-select-trigger.open,
.choice-select-trigger:focus-visible {
  border-color: var(--teal);
  background: #fff7f8;
  box-shadow: 0 0 0 3px rgba(136, 7, 15, 0.12);
}

.choice-select-trigger:disabled {
  cursor: default;
  opacity: 0.62;
}

button:disabled,
.secondary-button:disabled,
.primary-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.choice-select-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

.choice-select-arrow {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  color: var(--teal);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  text-align: center;
}

.choice-picker-panel {
  position: fixed;
  z-index: 122;
  display: none;
  overflow: hidden;
  border: 1px solid rgba(136, 7, 15, 0.22);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 58px rgba(55, 16, 20, 0.2);
}

.choice-picker-panel.open {
  display: block;
}

.choice-picker-options {
  max-height: inherit;
  overflow: auto;
  padding: 6px;
}

.choice-picker-option {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.choice-picker-option:hover,
.choice-picker-option:focus-visible {
  background: #f8f2f3;
}

.choice-picker-option.is-selected {
  background: #f7e8ea;
  color: var(--teal-deep);
  font-weight: 900;
}

.choice-picker-check {
  width: 14px;
  height: 14px;
  border: 1px solid #c9b8bc;
  border-radius: 50%;
  background: #ffffff;
}

.choice-picker-option.is-selected .choice-picker-check {
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: inset 0 0 0 3px #ffffff;
}

.choice-picker-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.35;
}

.date-picker-control {
  display: block;
  width: 100%;
}

.date-picker-control input {
  min-width: 0;
}

.date-picker-panel {
  position: absolute;
  z-index: 260;
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 48px rgba(23, 36, 33, 0.18);
  padding: 10px;
}

.date-picker-panel.open {
  display: block;
}

.date-picker-head,
.date-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-picker-head strong {
  font-size: 15px;
}

.date-picker-head button,
.date-picker-foot button {
  min-height: 34px;
  border: 1px solid #d5ded8;
  background: #f7faf7;
  color: var(--ink);
  padding: 5px 10px;
}

.date-picker-weekdays,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.date-picker-weekdays {
  margin: 10px 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.date-picker-day {
  min-height: 34px;
  padding: 0;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid transparent;
}

.date-picker-day:hover {
  border-color: #c6d5cf;
  background: #f3f8f5;
}

.date-picker-day.today {
  border-color: var(--gold);
}

.date-picker-day.selected {
  background: var(--teal);
  color: #ffffff;
}

.date-picker-day.in-range {
  background: rgba(136, 7, 15, 0.1);
  border-color: rgba(136, 7, 15, 0.16);
  color: var(--teal-deep);
}

.date-picker-day.range-start,
.date-picker-day.range-end {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.residence-cell {
  vertical-align: middle;
  white-space: normal;
  text-align: center;
}

.tag-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  white-space: normal;
  line-height: 1.25;
}

.tag-stack .tag {
  flex: 0 0 auto;
  line-height: 1;
}

.date-picker-foot {
  margin-top: 10px;
}

select[multiple] {
  min-height: 118px;
  padding: 8px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(136, 7, 15, 0.16);
}

.actions {
  margin-top: 18px;
  flex-wrap: wrap;
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.import-button {
  border-color: rgba(184, 138, 47, 0.42);
  background: #fff8e8;
}

button {
  border: 0;
  border-radius: 7px;
  min-height: 42px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--teal-deep);
}

.secondary-button {
  background: #f1f5f2;
  color: var(--ink);
  border: 1px solid #d5ded8;
}

.secondary-button:hover {
  background: #e7eee9;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  padding: 9px 14px;
  font-weight: 800;
  text-decoration: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.button-row.compact {
  justify-content: flex-end;
}

.detail-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.detail-quick-actions .secondary-button,
.detail-quick-actions .button-link {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  text-align: center;
}

.danger-button {
  background: var(--red);
}

.danger-button:hover {
  background: #8f1c14;
}

.danger-outline {
  border-color: rgba(180, 35, 24, 0.26);
  background: #fff7f5;
  color: var(--red);
}

.danger-outline:hover {
  background: var(--red-soft);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #f1f5f2;
  color: var(--ink);
  border: 1px solid #d5ded8;
  border-radius: 8px;
  font-size: 22px;
}

.results {
  min-width: 0;
  overflow: hidden;
}

.result-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 14px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(136, 7, 15, 0.055), rgba(255, 255, 255, 0) 42%),
    #fbfcfa;
}

.result-toolbar > div {
  min-width: 0;
}

.result-toolbar h2 {
  font-size: 20px;
  line-height: 1.15;
}

.result-toolbar .page-size {
  width: 132px;
  margin-top: 0;
  justify-self: end;
  order: 3;
  gap: 6px;
}

.result-toolbar .table-view-controls {
  order: 2;
}

.result-toolbar .page-size > span {
  font-size: 12px;
}

.result-toolbar .page-size .choice-select-trigger {
  min-height: 36px;
  padding: 7px 10px;
}

.table-view-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.toggle-control input {
  width: 18px;
  min-height: 18px;
}

.reminder-panel {
  border-bottom: 1px solid var(--line);
  background: #fffaf0;
  padding: 14px 18px;
}

.reminder-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.reminder-head h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.18;
}

.reminder-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.reminder-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 12px;
}

.reminder-item {
  min-width: 260px;
  max-width: 360px;
  text-align: left;
  background: #ffffff;
  border: 1px solid #f0d49b;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
}

.reminder-item strong,
.reminder-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reminder-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.bulk-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(138px, 1fr)) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfb, #f4f9f7);
}

.bulk-toolbar > span {
  width: 100%;
  height: 43px;
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e3ebe6;
  border-radius: 8px;
  background: #ffffff;
  color: var(--teal-deep);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.bulk-toolbar input,
.bulk-toolbar select,
.bulk-toolbar .choice-select-trigger {
  height: 43px;
  min-height: 43px;
}

.bulk-toolbar .choice-select-trigger {
  padding: 9px 30px 9px 10px;
}

.bulk-toolbar .choice-select-arrow {
  right: 10px;
}

.bulk-toolbar .date-picker-control,
.bulk-toolbar #bulkDate,
.bulk-toolbar #bulkNote {
  width: 100%;
}

.bulk-toolbar button {
  min-height: 43px;
  white-space: nowrap;
}

#resultMeta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-size {
  width: 98px;
  margin-top: 0;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 318px);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.student-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
  table-layout: fixed;
}

.student-table .col-select {
  width: 48px;
}

.student-table .col-rank {
  width: 78px;
}

.student-table .col-student-id {
  width: 112px;
}

.student-table .col-name {
  width: 182px;
}

.student-table .col-residence {
  width: 132px;
}

.student-table .col-year {
  width: 72px;
}

.student-table .col-programme {
  width: 230px;
}

.student-table .col-number {
  width: 82px;
}

.student-table .col-warning {
  width: 86px;
}

.student-table .col-follow {
  width: 112px;
}

.student-table .col-cped {
  width: 96px;
}

.student-table .col-status {
  width: 80px;
}

.student-table th,
.student-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef5f1;
  color: #40504b;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
  text-align: center;
}

.student-table th[data-col="select"],
.student-table td:nth-child(1),
.student-table td:nth-child(2),
.student-table td:nth-child(3),
.student-table td:nth-child(4),
.student-table td:nth-child(5),
.student-table td:nth-child(6),
.student-table td:nth-child(7),
.student-table td:nth-child(8),
.student-table td:nth-child(9),
.student-table td:nth-child(10),
.student-table td:nth-child(11),
.student-table td:nth-child(12),
.student-table th[data-col="cped"],
.student-table td:nth-child(13),
.student-table td:nth-child(14) {
  text-align: center;
}

.student-table td:nth-child(13) .tag {
  min-width: 72px;
  white-space: nowrap;
  line-height: 1;
}

.name-stack {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.22;
  text-align: center;
}

.name-stack span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name-stack .name-cn {
  color: #5f6f69;
  font-size: 0.94em;
}

.table-wrap.full-cells .student-table th,
.table-wrap.full-cells .student-table td {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.table-wrap.full-cells .name-stack span {
  overflow: visible;
  text-overflow: clip;
}

.student-table tbody tr {
  cursor: pointer;
}

.student-table tbody tr:hover {
  background: #f7fbf9;
}

.student-table tbody tr.student-warning {
  background: #fffaf0;
}

.student-table tbody tr.student-warning:hover {
  background: #fff4dc;
}

.student-table tbody tr.student-document-alert {
  background: #fffdf5;
}

.student-table tbody tr.student-document-alert:hover {
  background: #fff7e5;
}

.student-table tbody tr.student-warning.student-document-alert {
  background: #fff5e6;
}

.student-table tbody tr.student-warning.student-document-alert:hover {
  background: #ffedcf;
}

.rank-badge,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--teal-deep);
  font-weight: 850;
}

.tag {
  min-width: 0;
  padding: 4px 9px;
  min-height: 26px;
  font-size: 13px;
  background: var(--blue-soft);
  color: #1d4ed8;
}

.tag.warn {
  background: var(--gold-soft);
  color: #8a5c11;
}

.tag.bad {
  background: var(--red-soft);
  color: var(--red);
}

.tag.warn {
  background: var(--gold-soft);
  color: #8a5c11;
}

.tag.neutral {
  background: #edf2ef;
  color: #6b7772;
}

.pager {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  background: rgba(23, 36, 33, 0.34);
}

.detail-drawer.open {
  display: flex;
  justify-content: flex-end;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  background: rgba(23, 36, 33, 0.42);
  padding: 20px;
}

.confirm-overlay.open {
  display: grid;
}

.confirm-dialog {
  width: min(520px, 100%);
  border: 1px solid rgba(136, 7, 15, 0.18);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(41, 4, 7, 0.28);
  padding: 22px;
}

.confirm-head h2 {
  margin: 0;
  font-size: 24px;
}

.confirm-message {
  margin: 14px 0;
  color: var(--muted);
  font-weight: 700;
}

.confirm-details {
  display: grid;
  gap: 8px;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: #fffafa;
  padding: 12px;
}

.confirm-details span {
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(69, 4, 8, 0.96), rgba(136, 7, 15, 0.86) 55%, rgba(184, 138, 47, 0.72)),
    #88070f;
}

.login-page {
  background:
    linear-gradient(135deg, rgba(47, 3, 6, 0.98) 0%, rgba(136, 7, 15, 0.96) 58%, rgba(184, 138, 47, 0.82) 132%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 18px),
    #88070f;
}

.auth-shell {
  min-height: 100vh;
  width: min(100% - 32px, 520px);
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(1120px, calc(100% - 40px));
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  gap: 22px;
  align-items: center;
  justify-items: stretch;
  padding: 28px 0;
}

.login-visual {
  position: relative;
  width: 100%;
  min-height: 630px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 45%, rgba(0, 0, 0, 0.14)),
    linear-gradient(135deg, #5f050a, #88070f 62%, #b88a2f 138%);
  color: #ffffff;
  padding: clamp(28px, 4vw, 46px);
  box-shadow: 0 28px 80px rgba(30, 3, 5, 0.34);
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(135deg, #000 0%, transparent 70%);
  opacity: 0.55;
}

.login-visual::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 188px;
  background: linear-gradient(8deg, rgba(36, 3, 5, 0.56), rgba(184, 138, 47, 0.18));
  clip-path: polygon(0 42%, 100% 8%, 100% 100%, 0 100%);
}

.login-logo-strip,
.login-hero-copy,
.login-mascot {
  position: relative;
  z-index: 2;
}

.login-logo-strip {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-logo-tile {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 36px rgba(37, 4, 7, 0.18);
}

.login-logo-tile img {
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.login-logo-divider {
  width: 1px;
  height: 56px;
  background: rgba(255, 255, 255, 0.36);
}

.login-hero-copy {
  max-width: 520px;
  margin-top: 46px;
}

.login-hero-copy .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.login-hero-copy h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(44px, 5.8vw, 74px);
  line-height: 1.02;
  font-weight: 900;
}

.login-hero-copy p:not(.eyebrow) {
  max-width: 420px;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 18px;
  font-weight: 700;
}

.login-mascot {
  position: absolute;
  right: clamp(24px, 4vw, 58px);
  bottom: 24px;
  width: min(340px, 42%);
  filter: drop-shadow(0 26px 30px rgba(28, 3, 5, 0.32));
}

.auth-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: 0 24px 70px rgba(8, 44, 40, 0.28);
}

.login-card {
  padding: clamp(28px, 4vw, 42px);
}

.login-card-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.login-card-mark img {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.login-card-mark h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 40px);
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.08;
}

.auth-card .eyebrow {
  color: var(--teal);
}

.auth-copy {
  margin: 12px 0 18px;
  color: var(--muted);
}

.auth-form .primary-button,
.admin-form .primary-button {
  width: 100%;
  margin-top: 16px;
}

.notice-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--green-soft);
  color: var(--ink);
  font-weight: 800;
}

.notice.error {
  border-color: #f3b8ad;
  background: var(--red-soft);
  color: var(--red);
}

.notice.success {
  border-color: #b7ded2;
  background: var(--green-soft);
  color: var(--success-deep);
}

.compact-topbar {
  min-height: 178px;
  align-items: center;
}

.admin-shell {
  width: min(1440px, calc(100% - 36px));
  margin: 24px auto 48px;
}

.maintenance-shell {
  width: min(1640px, calc(100% - 36px));
  margin: 24px auto 52px;
}

.maintenance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.maintenance-card.import-card,
.maintenance-card.export-card {
  align-self: stretch;
}

.maintenance-card.import-card {
  display: flex;
  flex-direction: column;
}

.maintenance-card.import-card .button-row {
  justify-content: flex-end;
  margin-top: auto;
}

.maintenance-card.import-card .preview-panel {
  flex: 1 1 auto;
}

.maintenance-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  padding: 18px;
}

.maintenance-card.wide {
  grid-column: 1 / -1;
}

.card-copy,
.preview-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 700;
}

.status-strip.spacious {
  gap: 10px;
}

.preview-panel {
  min-height: 138px;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: #fffdfd;
  color: var(--muted);
  padding: 18px;
  margin-bottom: 14px;
  display: grid;
  align-content: center;
}

.preview-grid,
.quality-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.preview-grid span,
.quality-summary article {
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfd, #fbf8f8);
  padding: 15px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.preview-grid strong,
.quality-summary strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.05;
}

.preview-note.warning {
  color: var(--red);
}

.preview-section {
  margin-top: 14px;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfd, #fbf8f8);
  padding: 14px;
}

.preview-section-success {
  border-color: rgba(136, 7, 15, 0.18);
  background: linear-gradient(180deg, #fffaf9, #fbf5f4);
}

.preview-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.preview-section-head strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.preview-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.preview-top-list {
  display: grid;
  gap: 10px;
}

.preview-top-item {
  display: grid;
  gap: 4px;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 13px;
}

.preview-top-item strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.preview-top-item span,
.preview-top-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.45;
}

.export-stack,
.quality-list {
  display: grid;
  gap: 10px;
}

.export-tile {
  display: grid;
  gap: 5px;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfd, #fbf8f8);
  color: inherit;
  padding: 14px;
  text-decoration: none;
  text-align: left;
}

.export-button-tile {
  width: 100%;
  min-height: 0;
  cursor: pointer;
}

.export-tile:hover {
  border-color: rgba(136, 7, 15, 0.28);
  background: #fffafa;
}

.export-tile strong {
  color: var(--ink);
  font-size: 17px;
}

.export-tile span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.quality-summary {
  margin-bottom: 14px;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.quality-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.section-caption {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  max-width: 760px;
}

.quality-item {
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: #fffdfd;
  padding: 12px 14px;
}

.quality-item summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.quality-item summary::marker {
  content: "";
}

.quality-item p {
  margin: 10px 0;
  color: var(--muted);
}

.quality-item em {
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
}

.quality-students {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quality-student-link {
  border: 0;
  border-radius: 999px;
  background: #f4f0f0;
  color: var(--ink);
  padding: 6px 9px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.quality-student-link:hover {
  background: #f7e8ea;
  color: var(--teal);
}

.quality-groups {
  display: grid;
  gap: 10px;
}

.quality-group {
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: #fffdfd;
  padding: 12px;
}

.quality-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.quality-group-head div {
  min-width: 0;
}

.quality-group-head strong {
  display: block;
  color: var(--teal-deep);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.quality-group-head em {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.quality-group-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.quality-group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.quality-group-meta span {
  border: 1px solid #eadde0;
  border-radius: 999px;
  background: #fffafa;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.quality-toggle::before {
  content: "展開";
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #eadde0;
  border-radius: 999px;
  background: #fffafa;
  color: var(--teal-deep);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.quality-item[open] .quality-toggle::before {
  content: "收起";
}

.collapsible-card {
  padding: 0;
}

.collapsible-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  margin: 0;
  padding: 18px;
  cursor: pointer;
  list-style: none;
}

.collapsible-summary::-webkit-details-marker {
  display: none;
}

.collapsible-title h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
}

.collapsible-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.collapsible-toggle::before {
  content: "展開";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 38px;
  flex: 0 0 auto;
  border: 1px solid #eadde0;
  border-radius: 999px;
  background: #fffafa;
  color: var(--teal-deep);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 900;
}

.collapsible-card[open] .collapsible-toggle::before {
  content: "收起";
}

.collapsible-body {
  border-top: 1px solid var(--line);
  padding: 18px;
}

.log-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(150px, 1fr)) minmax(210px, 1.15fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.inline-date-field {
  margin-top: 0;
  gap: 6px;
}

.inline-date-field span {
  font-size: 12px;
}

.date-range-field {
  margin-top: 0;
}

.date-range-input {
  cursor: pointer;
  background: #fffdfd;
}

.native-date-input::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 0;
  margin: 0;
  padding: 0;
}

.log-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.log-table {
  min-width: 980px;
}

.log-table td {
  font-size: 13px;
}

.maintenance-student-drawer .drawer-panel,
.student-editor-dialog {
  width: min(900px, 100%);
}

.student-editor-dialog {
  max-height: min(760px, calc(100vh - 32px));
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 26px 70px rgba(41, 4, 7, 0.3);
  display: flex;
  flex-direction: column;
}

.student-editor-dialog .detail-content {
  max-height: calc(100vh - 132px);
}

.student-editor-dialog .detail-section {
  margin-bottom: 0;
}

.maintenance-student-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.maintenance-student-summary article {
  border: 1px solid #eee5e6;
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfd, #fbf8f8);
  padding: 12px;
}

.maintenance-student-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.maintenance-student-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.12;
}

.maintenance-jump-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.maintenance-two-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.maintenance-jump-actions .secondary-button {
  width: 100%;
}

.maintenance-edit-panel {
  scroll-margin-top: 18px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.profile-editor {
  border: 1px solid #e8dcde;
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  background: #fffdfd;
  padding: 14px;
}

.compact-section-head {
  margin-bottom: 10px;
}

.compact-section-head h3 {
  margin: 0;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.profile-field {
  margin-top: 0;
}

.profile-field.is-overridden input {
  border-color: rgba(136, 7, 15, 0.38);
  background: #fff8f8;
  box-shadow: 0 0 0 2px rgba(136, 7, 15, 0.06);
}

.profile-field.is-overridden span {
  color: var(--teal-deep);
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: #7b696c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.profile-actions {
  align-items: center;
}

.maintenance-panel-focus {
  box-shadow: 0 0 0 3px rgba(136, 7, 15, 0.12), var(--shadow);
  transform: translateY(-1px);
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.analytics-topbar {
  min-height: 188px;
}

.analytics-shell {
  width: min(1800px, calc(100% - 36px));
  margin: 24px auto 52px;
}

.analytics-scope-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.scope-button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.scope-button.active {
  background: var(--teal);
  color: #ffffff;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.analytics-kpi,
.analytics-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.analytics-kpi {
  padding: 13px 15px;
  border-top: 4px solid var(--teal);
}

.analytics-kpi-link,
.analytics-kpi-link:hover,
.analytics-kpi-link:focus,
.analytics-kpi-link span,
.analytics-kpi-link strong {
  color: inherit;
  text-decoration: none;
}

.analytics-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analytics-kpi strong {
  display: block;
  margin-top: 5px;
  font-size: 27px;
  line-height: 1.05;
}

.analytics-skeleton,
.analytics-placeholder {
  position: relative;
  overflow: hidden;
}

.analytics-skeleton span,
.analytics-skeleton strong {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, #f3e7e8, #fffafa, #f3e7e8);
  color: transparent;
}

.analytics-skeleton span {
  width: 58%;
  height: 13px;
}

.analytics-skeleton strong {
  width: 42%;
  height: 30px;
}

.analytics-skeleton::after,
.analytics-placeholder::after {
  position: absolute;
  inset: 0;
  content: "";
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
  animation: analytics-shimmer 1.45s ease-in-out infinite;
}

.analytics-placeholder {
  min-height: 180px;
  border: 1px dashed #eadde0;
  border-radius: 8px;
  background: linear-gradient(135deg, #fffafa, #f7f8f8);
  color: var(--muted);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.analytics-placeholder.tall {
  min-height: 430px;
}

.analytics-placeholder strong {
  color: var(--ink);
  font-size: 16px;
}

.analytics-placeholder span {
  font-size: 13px;
  font-weight: 800;
}

@keyframes analytics-shimmer {
  100% {
    transform: translateX(100%);
  }
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.analytics-card {
  min-width: 0;
  padding: 18px;
}

.analytics-card.wide {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.section-head h2,
.chart-title {
  margin: 0;
}

.section-head h2 {
  font-size: 22px;
}

.soft-pill {
  border: 1px solid #eadde0;
  border-radius: 999px;
  background: #fffafa;
  color: var(--teal-deep);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.origin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.origin-map {
  min-height: 460px;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: linear-gradient(145deg, #fffafa, #f7f8f8);
  overflow: hidden;
}

.world-map-shell {
  position: relative;
  min-height: inherit;
  padding: 16px;
}

.origin-geo-map {
  width: 100%;
  height: min(58vw, 560px);
  min-height: 430px;
}

.origin-geo-map .plotly,
.origin-geo-map .svg-container {
  border-radius: 8px;
}

.world-svg {
  display: block;
  width: 100%;
  min-height: 430px;
}

.map-ocean {
  fill: url(#mapOcean);
}

.map-grid line {
  stroke: rgba(136, 7, 15, 0.08);
  stroke-width: 1;
}

.map-land path {
  fill: rgba(136, 7, 15, 0.08);
  stroke: rgba(136, 7, 15, 0.16);
  stroke-width: 2;
}

.origin-marker {
  cursor: pointer;
}

.origin-marker-halo {
  opacity: 0.16;
}

.origin-marker-dot {
  stroke: #ffffff;
  stroke-width: 3;
  filter: drop-shadow(0 8px 14px rgba(74, 18, 22, 0.24));
}

.origin-marker text {
  fill: #ffffff;
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
  text-anchor: middle;
}

.origin-marker:hover .origin-marker-halo {
  opacity: 0.28;
}

.origin-marker:hover .origin-marker-dot {
  stroke-width: 4;
}

.map-summary {
  position: absolute;
  left: 28px;
  bottom: 24px;
  max-width: min(520px, calc(100% - 56px));
  border: 1px solid rgba(136, 7, 15, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  box-shadow: 0 14px 34px rgba(74, 18, 22, 0.1);
}

.map-summary strong,
.map-summary span,
.map-summary em {
  display: block;
}

.map-summary strong {
  color: var(--teal-deep);
  font-size: 22px;
  line-height: 1;
}

.map-summary span,
.map-summary em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.map-summary em {
  overflow-wrap: anywhere;
}

.rank-list {
  border: 1px solid #eee5e6;
  border-radius: 8px;
  padding: 14px;
  background: #fffdfd;
}

.rank-table {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.origin-rank-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.origin-rank-grid .rank-row {
  min-height: 54px;
  border: 1px solid #f0e6e7;
  border-radius: 8px;
  background: #fffdfd;
  padding: 9px;
}

.rank-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #f1e8e9;
  padding: 7px 0;
}

.rank-row span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.rank-row strong {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.rank-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.donut-wrap,
.split-charts,
.stacked-charts {
  display: grid;
  gap: 16px;
}

.donut-wrap {
  grid-template-columns: 226px minmax(0, 1fr);
  align-items: center;
}

.donut {
  width: 210px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(74, 18, 22, 0.08);
}

.donut-core {
  width: 124px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
  display: grid;
  place-items: center;
  align-content: center;
  box-shadow: 0 10px 30px rgba(74, 18, 22, 0.12);
}

.donut-core strong {
  font-size: 27px;
  line-height: 1;
}

.donut-core span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-legend,
.bar-list {
  display: grid;
  gap: 9px;
}

.legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 3px 9px;
  align-items: start;
  border: 1px solid #f0e6e7;
  border-radius: 8px;
  background: #fffdfd;
  padding: 8px 9px;
}

.legend-row i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  grid-row: 1 / 3;
  margin-top: 5px;
}

.legend-row span,
.bar-meta span {
  overflow: visible;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.legend-row strong,
.bar-meta strong {
  color: var(--muted);
  font-size: 13px;
  white-space: normal;
}

.legend-row strong {
  grid-column: 2;
  line-height: 1.35;
}

.chart-title {
  color: var(--ink);
  font-size: 16px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0e8e9;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.split-charts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.residency-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(380px, 1fr));
  gap: 16px;
}

.sub-chart {
  min-width: 0;
  border: 1px solid #eee5e6;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfd, #fbf8f8);
  padding: 16px;
}

.sub-chart .chart-title {
  margin-bottom: 10px;
}

.year-card .donut-wrap {
  grid-template-columns: 310px minmax(0, 1fr);
  max-width: none;
  min-height: 330px;
  align-items: center;
}

.year-card .donut {
  width: 290px;
}

.year-card .donut-core {
  width: 158px;
}

.year-card .donut-core strong {
  font-size: 30px;
}

.compact-legend {
  grid-auto-flow: row;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  grid-template-rows: none;
  gap: 10px;
  overflow: visible;
  padding-bottom: 0;
}

.compact-legend .legend-row {
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 42px;
  padding: 8px 9px;
}

.compact-legend .legend-row i {
  grid-row: auto;
  margin-top: 0;
}

.compact-legend .legend-row span {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-legend .legend-row strong {
  grid-column: auto;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.residency-card .donut-wrap {
  grid-template-columns: 226px minmax(0, 1fr);
}

.programme-ranking {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.programme-ranking.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.programme-column {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.programme-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid #efe4e6;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfd, #fbf8f8);
  padding: 10px;
}

.programme-index {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f7e8ea;
  color: var(--teal-deep);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
}

.programme-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.programme-meta {
  display: grid;
  gap: 4px;
  align-items: start;
}

.programme-meta strong {
  overflow: visible;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.programme-meta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.chart-tooltip {
  position: fixed;
  z-index: 100;
  display: none;
  max-width: 250px;
  border: 1px solid rgba(136, 7, 15, 0.18);
  border-radius: 8px;
  background: rgba(23, 22, 22, 0.94);
  color: #ffffff;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 18px 40px rgba(23, 22, 22, 0.22);
  pointer-events: none;
}

.chart-tooltip.open {
  display: block;
}

.idle-timeout-warning {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 250;
  display: none;
  max-width: min(360px, calc(100vw - 44px));
  border: 1px solid rgba(136, 7, 15, 0.2);
  border-radius: 8px;
  background: rgba(255, 252, 247, 0.96);
  box-shadow: 0 18px 45px rgba(55, 26, 26, 0.16);
  color: var(--ink);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
}

.idle-timeout-warning.show {
  display: block;
}

.admin-form {
  display: grid;
}

.user-list-section {
  min-width: 0;
}

.user-table th,
.user-table td {
  vertical-align: top;
}

.user-list-head {
  align-items: baseline;
}

.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.account-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(136, 7, 15, 0.1);
  border-radius: 8px;
  padding: 16px 18px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(74, 18, 22, 0.06);
}

.account-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
}

.account-card .account-id {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
  word-break: break-word;
}

.account-card .account-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  word-break: break-word;
}

.account-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #d5ded8;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f8fbf9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-date {
  color: var(--muted);
  font-size: 12px;
}

.account-actions {
  display: grid;
  gap: 8px;
}

.account-reset {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.account-reset input {
  min-width: 0;
  width: 100%;
}

.account-reset .secondary-button {
  white-space: nowrap;
}

.account-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.account-inline-form input {
  min-width: 0;
  width: 100%;
}

.account-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.account-buttons .secondary-button,
.account-reset .secondary-button {
  min-width: 92px;
}

.account-buttons .inline-form {
  margin: 0;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.inline-form input {
  min-width: 180px;
}

@media (max-width: 760px) {
  .account-grid {
    grid-template-columns: 1fr;
  }

  .account-card-top {
    align-items: flex-start;
  }

  .account-name {
    text-align: left;
  }

  .account-inline-form {
    grid-template-columns: 1fr;
  }

  .account-reset {
    grid-template-columns: 1fr;
  }

  .account-buttons {
    width: 100%;
  }

  .account-buttons .inline-form {
    flex: 1 1 0;
  }
}

.drawer-panel {
  width: min(820px, 100%);
  height: 100%;
  background: #ffffff;
  box-shadow: -16px 0 44px rgba(23, 36, 33, 0.24);
  display: flex;
  flex-direction: column;
}

.drawer-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.detail-content {
  overflow: auto;
  padding: 20px 22px 28px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.warning-editor {
  border: 1px solid #f0d49b;
  background: #fffaf0;
  border-radius: 8px;
  padding: 14px;
}

.document-editor,
.follow-editor {
  border: 1px solid #bfddd7;
  background: #f4fbf8;
  border-radius: 8px;
  padding: 14px;
}

.warning-form .field {
  margin-top: 10px;
}

.warning-actions {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
}

.compact-info {
  margin-bottom: 10px;
}

.info-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  min-width: 0;
  background: #ffffff;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.info-item strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.mini-table th,
.mini-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  overflow-wrap: anywhere;
}

.mini-table th {
  color: var(--muted);
  font-size: 13px;
}

.detail-content .mini-table th,
.detail-content .mini-table td {
  text-align: center;
  vertical-align: middle;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar > .account-strip.standalone {
    width: 100%;
    justify-content: flex-start;
  }

  .source-popover {
    right: auto;
    left: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    max-height: none;
  }

  .bulk-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .maintenance-grid,
  .log-filters {
    grid-template-columns: 1fr;
  }

  .collapsible-summary {
    grid-template-columns: 1fr;
  }

  .collapsible-actions {
    justify-content: flex-start;
  }

  .analytics-kpis {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .analytics-grid,
  .origin-layout,
  .split-charts,
  .residency-panels {
    grid-template-columns: 1fr;
  }

  .origin-rank-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compact-legend {
    grid-template-columns: repeat(3, minmax(128px, 1fr));
  }
}

@media (max-width: 980px) {
  .detail-quick-actions,
  .maintenance-jump-actions,
  .maintenance-student-summary,
  .profile-edit-grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    width: min(760px, calc(100% - 24px));
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .login-visual {
    min-height: 430px;
  }

  .login-hero-copy {
    margin-top: 30px;
  }

  .login-mascot {
    width: min(320px, 48%);
    right: 22px;
  }
}

@media (max-width: 860px) {
  .programme-ranking,
  .programme-ranking.columns-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 20px, 1800px);
  }

  .topbar {
    padding: 24px 20px;
  }

  .filter-primary-grid,
  .filter-advanced-grid,
  .filter-range-grid {
    grid-template-columns: 1fr;
  }

  .filter-span-2 {
    grid-column: auto;
  }

  .login-shell {
    width: min(100% - 20px, 520px);
    padding: 18px 0;
  }

  .login-visual {
    min-height: 350px;
    padding: 22px;
  }

  .login-logo-tile {
    width: 68px;
    height: 68px;
  }

  .login-logo-tile img {
    width: 54px;
    height: 54px;
  }

  .login-logo-divider {
    height: 42px;
  }

  .login-hero-copy h1 {
    font-size: 42px;
  }

  .login-hero-copy p:not(.eyebrow) {
    max-width: 260px;
    font-size: 15px;
  }

  .login-mascot {
    width: 196px;
    right: 6px;
    bottom: 4px;
  }

  .login-card-mark {
    align-items: flex-start;
  }

  .brand-identity {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .brand-logo {
    width: 54px;
    height: 54px;
  }

  .brand-logo.cklc-logo {
    width: 52px;
  }

  .top-actions {
    gap: 7px;
  }

  .account-name {
    width: 100%;
    max-width: none;
  }

  .source-menu {
    position: static;
  }

  .source-popover {
    left: 20px;
    right: 20px;
    width: auto;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .field-row,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .result-toolbar {
    display: block;
  }

  .page-size {
    width: 100%;
    margin-top: 12px;
  }

  .bulk-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    width: min(100% - 20px, 1440px);
  }

  .maintenance-shell {
    width: min(100% - 20px, 1640px);
  }

  .maintenance-grid,
  .preview-grid,
  .quality-summary,
  .log-filters {
    grid-template-columns: 1fr;
  }

  .analytics-shell {
    width: min(100% - 20px, 1800px);
  }

  .analytics-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .year-card .donut-wrap,
  .residency-card .donut-wrap {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .compact-legend {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .origin-map {
    min-height: 280px;
  }

  .world-map-shell {
    padding: 10px;
  }

  .world-svg {
    min-height: 300px;
  }

  .origin-geo-map {
    height: 320px;
    min-height: 320px;
  }

  .map-summary {
    position: static;
    max-width: none;
    margin: 8px 0 0;
  }

  .origin-rank-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    display: grid;
  }

  .inline-form input {
    min-width: 0;
  }
}
