:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f7faff;
  --ink: #172033;
  --muted: #64748b;
  --line: #d6e0ee;
  --line-strong: #c9d4e2;
  --nav: #142238;
  --nav-button: #25354f;
  --blue: #3166d5;
  --blue-dark: #2f4b73;
  --green: #20a263;
  --danger: #b42318;
  --orange: #d97706;
  --teal: #0ea5a3;
  --shadow: 0 14px 36px rgba(21, 34, 56, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
}

main {
  padding: 16px 20px 34px;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 22px;
  background: var(--nav);
  box-shadow: 0 8px 24px rgba(13, 23, 39, 0.2);
}

.nav-left,
.nav-right,
.nav-links {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.brand-link {
  margin-right: 8px;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.nav-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border-radius: 6px;
  background: var(--nav-button);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.nav-button:hover {
  background: #304361;
}

.nav-badge {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #facc15;
  color: #101827;
  font-size: 11px;
  font-weight: 900;
}

.muted-button {
  color: #f4f7fb;
}

.status {
  margin-bottom: 12px;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 800;
}

.success-text {
  background: #dcfce7;
  color: #166534;
}

.error-text {
  background: #fee2e2;
  color: var(--danger);
}

.warning-text {
  background: #fff7ed;
  color: var(--orange);
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.96fr) minmax(540px, 1.52fr) minmax(235px, 0.58fr) minmax(390px, 1.2fr);
  gap: 14px;
  align-items: stretch;
}

.panel,
.static-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 12px;
}

.static-panel {
  width: min(760px, calc(100% - 40px));
  margin: 42px auto 0;
  padding: 24px;
  border-radius: 12px;
}

.settings-panel {
  margin-bottom: 16px;
}

.panel-title {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.panel-title h2 {
  margin: 0;
  color: #162033;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.panel-title span,
.muted {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 5px;
  color: #182235;
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1.2;
}

input,
select,
textarea {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background-color: #fff;
  color: #1f2937;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.2;
  outline: none;
}

input,
textarea {
  padding: 8px 10px;
}

select {
  appearance: none;
  padding: 8px 36px 8px 10px;
  background-image:
    linear-gradient(45deg, transparent 50%, #9aa1aa 50%),
    linear-gradient(135deg, #9aa1aa 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select option {
  min-height: 36px;
  padding: 9px 12px;
  color: #172033;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.plain:focus-visible,
.tiny-button:focus-visible {
  border-color: #8bb5ff;
  box-shadow: 0 0 0 3px rgba(49, 102, 213, 0.16);
}

textarea {
  resize: vertical;
  line-height: 1.35;
}

button,
.plain,
.tiny-button {
  min-height: 37px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1.1;
  padding: 8px 11px;
  text-decoration: none;
}

button:hover,
.plain:hover,
.tiny-button:hover {
  border-color: #a9bbd1;
  background: #f8fbff;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.secondary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.primary:hover {
  background: #1d955b;
  border-color: #1d955b;
}

.secondary:hover {
  background: #2c5dc5;
  border-color: #2c5dc5;
}

.danger,
.danger-outline {
  color: var(--danger);
}

.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.danger-outline {
  background: #fff6f5;
  border-color: #fecaca;
}

.report-panel,
.columns-panel,
.splits-panel,
.filters-panel {
  min-width: 0;
}

.report-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.button-row button {
  min-height: 39px;
}

.range-picker {
  position: relative;
  z-index: 6;
}

.date-range-box {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: center;
  overflow: visible;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.date-part-button {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  border: 0;
  border-radius: 0;
  background: #fff;
  padding: 0 10px;
  text-align: left;
}

.date-part-button span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.date-part-button strong {
  overflow: hidden;
  color: #172033;
  font-size: 13.5px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-arrow {
  color: #2f3b4d;
  font-size: 23px;
  font-weight: 650;
  text-align: center;
}

.range-popover {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  z-index: 50;
  width: 340px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.24);
}

.range-calendar-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.range-calendar-head strong {
  color: #404040;
  font-size: 19px;
  font-weight: 900;
  text-align: center;
}

.range-calendar-head button {
  min-height: 39px;
  color: #737373;
  font-size: 22px;
  font-weight: 500;
}

.range-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.range-mode-tabs button {
  min-height: 34px;
}

.range-mode-tabs button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.range-weekday {
  min-height: 30px;
  color: #737373;
  font-size: 13px;
  font-weight: 700;
  line-height: 30px;
  text-align: center;
}

.range-grid button {
  min-height: 38px;
  padding: 0;
  border-radius: 0;
  border-color: #e5e7eb;
  background: #fff;
  color: #444;
  font-size: 15px;
  font-weight: 700;
}

.range-grid button:hover {
  border-color: var(--teal);
  background: #f1fbfb;
}

.range-grid .range-start,
.range-grid .range-end {
  background: var(--teal);
  color: #fff;
}

.range-grid .range-inside {
  background: #dff3f2;
}

.preset-box {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8ff;
}

.save-report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: end;
}

.saved-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.mini-actions button {
  min-height: 36px;
}

.metric-checklist {
  max-height: 205px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 26px;
  align-content: start;
  gap: 5px 16px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.metric-checklist label,
.filter-options label {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: #263244;
  font-size: 12.5px;
  font-weight: 750;
}

.metric-checklist input[type="checkbox"],
.filter-options input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.column-buckets {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 94px;
  gap: 7px;
  margin: 9px 0 12px;
}

.column-buckets div {
  min-height: 62px;
  padding: 8px;
  border: 1px solid #d8e5f3;
  border-radius: 8px;
  background: #f8fbff;
}

.column-buckets strong {
  display: block;
  margin-bottom: 4px;
  color: #5f718a;
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.column-buckets span {
  display: block;
  color: #41516a;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
}

.column-buckets button {
  min-height: 62px;
  padding: 7px 8px;
}

.metric-filters {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.subheading {
  color: #182235;
  font-size: 12.5px;
  font-weight: 900;
}

.metric-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 72px 68px;
  gap: 5px;
}

.metric-filter-row input,
.metric-filter-row select,
.metric-filter-row button {
  min-height: 35px;
  padding: 7px 8px;
  font-size: 12px;
}

.columns-panel > .plain {
  margin-top: 8px;
}

.splits-panel {
  display: grid;
  align-content: start;
  gap: 9px;
}

.splits-panel .panel-title h2 {
  font-size: 16px;
}

.splits-panel .panel-title span {
  font-size: 11px;
}

.splits-panel label {
  gap: 7px;
  color: #172033;
  font-size: 14px;
  font-weight: 900;
}

.splits-panel select {
  min-height: 46px;
  padding: 10px 38px 10px 12px;
  font-size: 15px;
  font-weight: 650;
}

.filter-list {
  display: grid;
  gap: 8px;
  max-height: 590px;
  overflow: auto;
}

.filter-box {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.filter-box[open] {
  border-color: #a8c7fa;
  box-shadow: 0 0 0 2px rgba(49, 102, 213, 0.1);
}

.filter-box summary {
  min-height: 41px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  color: #4b5563;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 900;
  list-style: none;
}

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

.filter-box summary::after {
  content: "";
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #9aa1aa;
}

.filter-box[open] summary::after {
  border-top: 0;
  border-bottom: 6px solid #9aa1aa;
}

.active-filter-pill {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 900;
}

.filter-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 8px 9px 0;
}

.filter-tools button {
  min-height: 32px;
  font-size: 11.5px;
}

.filter-options {
  display: grid;
  gap: 6px;
  max-height: 225px;
  overflow: auto;
  padding: 8px 10px 10px;
}

.filter-options label {
  min-height: 26px;
  font-size: 13px;
}

.filter-options label:has(textarea),
.filter-options label:has(input[type="text"]),
.filter-options label:has(input:not([type])) {
  display: grid;
  align-items: stretch;
}

.filter-options textarea {
  min-height: 78px;
  font-size: 13px;
}

.report-area {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(26, 39, 58, 0.1);
}

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

.report-toolbar h2 {
  margin: 0;
  color: #172033;
  font-size: 17px;
  font-weight: 900;
}

.report-toolbar span,
.report-tools {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.report-tools label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
}

.report-tools select {
  width: 82px;
  min-height: 38px;
}

.report-table-scroll {
  overflow: auto;
  border: 1px solid #d8e2ef;
  border-radius: 10px;
  background: #fff;
}

.report-table,
.plain-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #2f3d52;
  color: #f8fafc;
  border-right: 1px solid #64748b;
  text-align: center;
}

.report-table th.sorted-column {
  background: #35527b;
}

.report-table th,
.report-table td {
  padding: 12px 13px;
  border-bottom: 1px solid #d9e8f7;
  font-size: 13.5px;
  text-align: center;
  white-space: nowrap;
}

.sort-button {
  width: 100%;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 12.5px;
  font-weight: 900;
}

.sort-button:hover {
  background: transparent;
  text-decoration: underline;
}

.sort-arrow {
  min-width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(147, 197, 253, 0.22);
  color: #93c5fd;
  font-size: 14px;
  line-height: 1;
}

.report-table tbody tr:nth-child(odd) {
  background: #edf6ff;
}

.report-table tbody tr:nth-child(even) {
  background: #fff;
}

.report-table tbody tr:hover {
  background: #eef4ff;
}

.report-table tbody td:first-child {
  font-weight: 900;
}

.report-table tfoot td {
  position: sticky;
  bottom: 0;
  background: #eaf0f7;
  border-top: 3px solid #3b82f6;
  font-weight: 900;
}

.kpi-pill {
  display: inline-flex;
  justify-content: center;
  color: #4d7c0f;
  font-weight: 900;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.pagination-controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pagination-controls button {
  min-height: 34px;
}

.plain-table th,
.plain-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  text-align: left;
  vertical-align: middle;
}

.plain-table th {
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 900;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.log-table th:first-child,
.log-table td:first-child {
  width: 170px;
}

.log-table th:nth-child(2),
.log-table td:nth-child(2) {
  width: 190px;
}

.log-table th:nth-child(3),
.log-table td:nth-child(3) {
  width: 96px;
}

.log-message {
  color: #263244;
  line-height: 1.45;
}

.log-download-link {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 3px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #255ea8;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.log-download-link:hover {
  background: #dbeafe;
}

.log-level {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #d8e2ef;
  background: #f8fafc;
  color: #64748b;
  text-transform: capitalize;
}

.log-level-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #16803a;
}

.log-level-error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.log-level-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2f5f9f;
}

.settings-form,
.admin-form {
  display: grid;
  gap: 12px;
}

.action-stack,
.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.program-log-head {
  width: min(1180px, calc(100% - 40px));
  margin-top: 18px;
}

.program-error {
  margin: 14px 0 0;
}

.access-dialog {
  width: min(860px, calc(100vw - 36px));
  max-height: calc(100vh - 44px);
  overflow: hidden;
  background: #fff;
  border: 1px solid #cfdced;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.38);
}

.access-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
}

.access-dialog .settings-form {
  max-height: calc(100vh - 46px);
  overflow-y: auto;
  padding: 18px;
  border-radius: 12px;
  background: #fff;
}

.access-dialog .panel-title {
  position: sticky;
  top: -18px;
  z-index: 2;
  margin: -18px -18px 12px;
  padding: 16px 18px 12px;
  background: #fff;
}

.access-group {
  padding: 12px;
  border: 1px solid #d6e3f3;
  border-radius: 8px;
  background: #f7faff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.access-options {
  max-height: 160px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  overflow-y: auto;
  padding-right: 6px;
}

.access-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12.5px;
  color: #1f2937;
  overflow-wrap: anywhere;
}

.access-options input {
  width: auto;
  min-height: auto;
}

.access-footer {
  position: sticky;
  bottom: -18px;
  z-index: 2;
  margin: 2px -18px -18px;
  padding: 12px 18px 16px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.access-footer .primary {
  width: 100%;
}

.login-shell {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(320px, 430px);
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 44px 20px;
}

.login-shell .static-panel {
  width: 100%;
  margin: 0;
}

.login-visual {
  min-height: 420px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(49, 102, 213, 0.16), rgba(32, 162, 99, 0.12)),
    #f8fbff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-visual-card {
  width: min(360px, 82%);
  min-height: 250px;
  display: grid;
  gap: 22px;
  padding: 26px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #d9e4f3;
  box-shadow: 0 18px 42px rgba(24, 39, 68, 0.14);
}

.visual-topline {
  width: 52%;
  height: 12px;
  border-radius: 999px;
  background: #d9e8ff;
}

.visual-bars {
  height: 120px;
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #dbe7f5;
}

.visual-bars span {
  flex: 1;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, #2f69d9, #20a263);
}

.visual-row {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 16px;
  align-items: center;
}

.visual-row span,
.visual-row strong {
  height: 10px;
  border-radius: 999px;
  background: #e5edf7;
}

.visual-row strong {
  background: #bbf7d0;
}

.visual-row.short span {
  width: 72%;
}

.admin-form {
  grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
  align-items: end;
}

.modal-form {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  min-width: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

.status-pill.active {
  background: #dcfce7;
  color: #166534;
}

.status-pill.disabled {
  background: #fee2e2;
  color: var(--danger);
}

.good {
  color: var(--green);
  font-weight: 900;
}

.bad {
  color: var(--danger);
}

.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 12px 0;
}

.qr-wrap img {
  width: 220px;
  height: 220px;
}

.qr-wrap code {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.modal-dialog {
  width: min(420px, calc(100% - 36px));
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: transparent;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.28);
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.34);
}

.modal-dialog .admin-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(5px);
}

.loading-overlay[hidden] {
  display: none;
}

.loader-card {
  width: min(650px, calc(100% - 40px));
  min-height: 292px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.28);
}

.loader-card strong {
  color: #172033;
  font-size: 32px;
  font-weight: 900;
}

.loader-card span {
  color: #64748b;
  font-size: 22px;
  font-weight: 900;
}

.loader-spinner {
  width: 86px;
  height: 86px;
  border: 10px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stats-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.stats-grid strong {
  display: block;
  font-size: 18px;
}

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

@media (max-width: 1450px) {
  main {
    padding: 14px 16px 30px;
  }

  .control-grid {
    grid-template-columns: minmax(300px, 0.95fr) minmax(470px, 1.42fr) minmax(220px, 0.58fr) minmax(340px, 1.14fr);
  }

  .metric-checklist {
    max-height: 180px;
  }
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

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

  .access-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .control-grid,
  .admin-form,
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .report-toolbar,
  .report-tools,
  .pagination-controls {
    align-items: stretch;
    flex-direction: column;
  }

  main {
    padding: 12px;
  }

  .control-grid,
  .admin-form,
  .button-row,
  .save-report-row,
  .saved-actions,
  .column-buckets,
  .metric-filter-row,
  .metric-checklist,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .date-range-box {
    grid-template-columns: 1fr;
  }

  .date-arrow {
    display: none;
  }

  .range-popover {
    width: calc(100vw - 42px);
  }
}

/* Calm typography and final report layout pass. */
body {
  font-weight: 400;
}

.control-grid {
  grid-template-columns: minmax(330px, 0.95fr) minmax(470px, 1.25fr) minmax(310px, 0.82fr) minmax(390px, 1.2fr);
}

.brand-link {
  font-weight: 700;
}

.nav-button,
.panel-title h2,
.panel-title span,
label,
button,
.plain,
.tiny-button,
input,
select,
textarea,
.subheading,
.report-toolbar h2,
.report-toolbar span,
.report-tools,
.pagination-controls span,
.column-buckets strong,
.column-buckets span,
.filter-box summary,
.active-filter-pill,
.status,
.stats-grid span,
.status-pill,
.good,
.kpi-pill {
  font-weight: 500;
}

.panel-title h2 {
  font-size: 15px;
}

.panel-title span {
  font-size: 12px;
}

label {
  color: #202a3a;
  font-size: 12.5px;
}

input,
select,
textarea {
  font-weight: 400;
}

button,
.plain,
.tiny-button {
  font-weight: 600;
}

.report-panel {
  gap: 9px;
}

.columns-panel {
  overflow: hidden;
}

.metric-checklist {
  max-height: 188px;
  grid-auto-rows: 23px;
  gap: 3px 12px;
  padding: 8px 10px;
}

.metric-checklist label {
  min-height: 23px;
  gap: 7px;
  font-size: 12px;
  font-weight: 400;
}

.mini-actions {
  margin: 8px 0 0;
}

.mini-actions button {
  min-height: 32px;
}

.column-buckets {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 88px;
}

.column-buckets div {
  max-height: 92px;
  overflow: auto;
}

.column-buckets strong {
  font-size: 10.5px;
  letter-spacing: 0;
}

.column-buckets span {
  font-size: 11.5px;
}

.metric-filters {
  max-height: 190px;
  overflow: auto;
}

.metric-filter-row {
  grid-template-columns: minmax(0, 1fr) 54px 70px 64px;
}

.splits-panel {
  gap: 10px;
}

.splits-panel .panel-title h2 {
  font-size: 15px;
}

.splits-panel label {
  font-size: 13px;
  font-weight: 500;
}

.splits-panel select {
  min-height: 42px;
  font-size: 14px;
}

.split-field {
  display: grid;
  gap: 7px;
}

.date-group-field {
  margin-top: -2px;
  padding: 8px;
  border: 1px solid #d7e2ef;
  border-radius: 7px;
  background: #f7fbff;
}

.date-group-field[hidden] {
  display: none !important;
}

.range-jump {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
  margin-bottom: 12px;
}

.range-jump select {
  min-height: 36px;
  font-size: 13px;
}

.range-calendar-head strong,
.date-part-button strong {
  font-weight: 500;
}

.saved-select {
  position: relative;
}

.saved-select-button {
  position: relative;
  width: 100%;
  min-height: 39px;
  justify-content: flex-start;
  border-color: var(--line-strong);
  background: #fff;
  color: #172033;
  font-size: 13.5px;
  font-weight: 400;
  text-align: left;
}

.saved-select-button.placeholder {
  color: #8b8f97;
}

.saved-select-button::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #9aa1aa;
  transform: translateY(-50%);
}

.saved-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 70;
  overflow: auto;
  max-height: 210px;
  border: 1px solid #c8c8c8;
  border-radius: 0 0 6px 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 32, 52, 0.14);
}

.saved-select-menu button,
.saved-select-menu span {
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #172033;
  font-size: 15px;
  font-weight: 400;
  text-align: left;
}

.saved-select-menu button:hover,
.saved-select-menu button.active {
  background: #e8f2ff;
}

.filter-tools {
  grid-template-columns: 1fr 1fr;
}

.filter-search {
  grid-column: 1 / -1;
  min-height: 34px;
  font-size: 12.5px;
}

.filter-box summary {
  color: #2d3748;
  font-size: 14px;
}

.filter-options label {
  font-weight: 400;
}

.report-table th {
  background: #2f3d52;
  color: #f8fafc;
  font-weight: 700;
}

.report-table th.sorted-column {
  background: #36517a;
}

.sort-button {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.sort-button:hover {
  text-decoration: none;
}

.report-table td {
  color: #263244;
  font-weight: 400;
}

.report-table tbody td:first-child {
  font-weight: 500;
}

.split-column {
  background-clip: padding-box;
}

.report-table th.split-divider,
.report-table td.split-divider {
  border-right: 2px solid #9fb4cf;
}

.report-table thead th.split-divider {
  border-right-color: #a8bbd5;
}

.kpi-pill {
  min-width: 0;
  padding: 0;
  border-radius: 999px;
  color: inherit;
}

.kpi-pill.framed {
  min-width: 34px;
  padding: 3px 9px;
}

.tone-high {
  color: #129066;
}

.tone-high.framed {
  background: #c9f8df;
  color: #087a52;
  box-shadow: inset 0 0 0 1px #98ecc4;
}

.tone-mid {
  color: #5c7f20;
}

.tone-low {
  color: #e11d48;
}

.tone-neutral {
  color: #263244;
}

.report-table tfoot td {
  font-weight: 500;
}

.plain-table th {
  font-weight: 600;
}

@media (max-width: 1450px) {
  .control-grid {
    grid-template-columns: minmax(300px, 0.95fr) minmax(430px, 1.18fr) minmax(285px, 0.82fr) minmax(340px, 1.08fr);
  }
}

/* Final weight guard: keep the interface calm, with emphasis only where it helps scanning. */
.brand-link,
.nav-badge,
.date-part-button span,
.date-part-button strong,
.range-calendar-head strong,
.range-weekday,
.range-grid button,
.column-buckets strong,
.column-buckets span,
.filter-tools button,
.loader-card strong,
.loader-card span,
.stats-grid strong,
.stats-grid span,
.status-pill,
.good,
.bad,
.kpi-pill,
.report-table tbody td:first-child,
.report-table tfoot td {
  font-weight: 500;
}

.nav-button,
.primary,
.secondary,
.danger,
.danger-outline,
.saved-select-menu button {
  font-weight: 600;
}

.report-table th,
.report-table th .sort-button {
  font-weight: 700;
}

/* Requested split/filter/table refinements. */
.splits-panel {
  gap: 12px;
}

.splits-panel .panel-title span {
  color: #5f718a;
  font-size: 13px;
}

.split-field {
  position: relative;
  display: grid;
  gap: 10px;
}

.split-select {
  position: relative;
}

.split-select-button {
  position: relative;
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  border: 1px solid #c8c8c8;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 15px;
  font-weight: 400;
  text-align: left;
}

.split-select-button.placeholder {
  color: #a3a3a3;
}

.split-select-button::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #9a9a9a;
  transform: translateY(-50%);
}

.split-clear {
  position: absolute;
  right: 36px;
  top: 50%;
  z-index: 1;
  color: #8e8e8e;
  font-size: 23px;
  line-height: 1;
  transform: translateY(-52%);
}

.split-clear[hidden] {
  display: none !important;
}

.split-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 80;
  overflow: auto;
  max-height: 300px;
  border: 1px solid #c8c8c8;
  border-radius: 0 0 6px 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 32, 52, 0.14);
}

.split-select-menu button {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #172033;
  font-size: 15px;
  font-weight: 400;
  text-align: left;
}

.split-select-menu button:hover,
.split-select-menu button.active {
  background: #e8f2ff;
}

.date-group-field {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 0;
}

.date-group-field span {
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.date-group-field[hidden] {
  display: none !important;
}

.filter-options {
  gap: 3px;
}

.filter-options label {
  min-height: 22px;
}

.filter-box .active-filter-pill {
  max-width: 62%;
  overflow: hidden;
  background: #edf4ff;
  color: #45617f;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-table tbody td.split-column {
  color: #172033;
  font-weight: 700;
}

.tone-reg-high {
  color: #129066;
}

.tone-reg-mid {
  color: #c77012;
}

.tone-reg-low {
  color: #e11d48;
}

.tone-ftd.framed {
  background: #c9f8df;
  color: #087a52;
  box-shadow: inset 0 0 0 1px #98ecc4;
}

.tone-money-green {
  color: #4d7c0f;
}

.tone-negative {
  color: #b42318;
}

/* Current requested controls pass. */
.utc-status {
  display: grid;
  gap: 2px;
  color: #d7e2ef;
  font-size: 11.5px;
  line-height: 1.15;
  text-align: right;
}

.utc-status b {
  color: #fff;
  font-weight: 500;
}

.metric-checklist {
  max-height: 170px;
  grid-auto-rows: 20px;
  gap: 2px 10px;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.metric-checklist label {
  min-height: 20px;
  font-size: 11.5px;
}

.metric-checklist::-webkit-scrollbar,
.filter-options::-webkit-scrollbar,
.filter-menu::-webkit-scrollbar,
.split-select-menu::-webkit-scrollbar,
.column-buckets div::-webkit-scrollbar,
.metric-filters::-webkit-scrollbar {
  width: 10px;
}

.metric-checklist::-webkit-scrollbar-thumb,
.filter-options::-webkit-scrollbar-thumb,
.filter-menu::-webkit-scrollbar-thumb,
.split-select-menu::-webkit-scrollbar-thumb,
.column-buckets div::-webkit-scrollbar-thumb,
.metric-filters::-webkit-scrollbar-thumb {
  border: 3px solid #f7faff;
  border-radius: 999px;
  background: #b8c7da;
}

.split-select-menu {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.filter-list {
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.afp-toggle {
  width: 100%;
  margin-bottom: 9px;
}

.afp-filter.is-hidden {
  display: none;
}

.filter-box {
  position: relative;
  border: 0;
  background: transparent;
}

.filters-panel {
  overflow: visible;
}

.filter-box[open],
.filter-box[data-active-filter] {
  border-color: transparent;
  box-shadow: none;
}

.filter-select-button {
  position: relative;
  width: 100%;
  min-height: 39px;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid #c8c8c8;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 13.5px;
  font-weight: 400;
  text-align: left;
}

.filter-select-button.placeholder {
  color: #a3a3a3;
}

.filter-select-button::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #9a9a9a;
  transform: translateY(-50%);
}

.filter-select-button [data-filter-label] {
  flex: 0 0 auto;
}

.filter-clear {
  position: absolute;
  right: 34px;
  top: 50%;
  z-index: 1;
  color: #8e8e8e;
  font-size: 20px;
  line-height: 1;
  transform: translateY(-52%);
}

.filter-clear[hidden],
.active-filter-pill[hidden] {
  display: none !important;
}

.filter-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 120;
  display: grid;
  gap: 7px;
  max-height: 310px;
  overflow-y: scroll;
  margin-top: 0;
  padding: 8px;
  border: 1px solid #c8c8c8;
  border-radius: 0 0 6px 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 32, 52, 0.14);
  scrollbar-gutter: stable;
}

.filter-menu[hidden] {
  display: none !important;
}

.filter-search {
  grid-column: auto;
  min-height: 34px;
  font-size: 13px;
}

.filter-select-all {
  min-height: 32px;
  justify-content: flex-start;
  border: 0;
  border-radius: 4px;
  background: #eef5ff;
  color: #2f4b73;
}

.filter-options {
  max-height: 220px;
  gap: 2px;
  overflow-y: auto;
  padding: 0;
}

.filter-options label {
  min-height: 20px;
  padding: 1px 2px;
  font-size: 12.5px;
  line-height: 1.15;
}

.filter-options [data-filter-option-label][hidden] {
  display: none !important;
}

.report-panel > .saved-select .saved-select-menu button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.report-panel > .saved-select .saved-select-menu {
  max-height: 180px;
}

.filter-options textarea {
  min-height: 74px;
}

.filter-box .active-filter-pill {
  min-width: 0;
  max-width: calc(100% - 104px);
  margin-left: 0;
  padding: 0;
  background: transparent;
  color: #172033;
  font-size: 13.5px;
  line-height: 1.2;
}

.saved-select-menu,
.split-select-menu {
  scrollbar-gutter: stable;
}

.report-table th,
.report-table td {
  padding: 13px 15px;
  font-size: 15px;
}

.sort-button {
  font-size: 14px;
}

.report-table tfoot td,
.report-table tfoot td .kpi-pill {
  color: #172033;
  font-weight: 800;
}

.loader-card {
  width: min(360px, calc(100% - 40px));
  min-height: 190px;
  border-radius: 18px;
  gap: 10px;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border-width: 6px;
}

.loader-card strong {
  font-size: 22px;
}

.loader-card span {
  font-size: 15px;
}
