:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f0f4f8;
  --text: #14181f;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #1e6fd9;
  --primary-dark: #1558ad;
  --primary-soft: rgba(30, 111, 217, 0.12);
  --accent: #1e6fd9;
  --blue: #1e6fd9;
  --orange: #ff9f43;
  --green: #2a9d6e;
  --green-dark: #1f7a56;
  --green-soft: rgba(42, 157, 110, 0.14);
  --red: #f5535f;
  --sidebar: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.04), 0 8px 24px rgba(20, 24, 31, 0.04);
  --table-header-bg: var(--surface-2);
  --table-header-text: var(--text);
  --table-hover-bg: var(--surface-2);
}

[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1d212a;
  --text: #eef1f6;
  --muted: #8a94a6;
  --border: #262b35;
  --sidebar: #131620;
  --table-header-bg: #1f2430;
  --table-header-text: #dce3ed;
  --table-hover-bg: #232936;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.admin-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "cv02", "cv03";
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.admin-shell {
  min-height: 100vh;
}

.dashboard,
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 28px;
  width: 248px;
  height: 100vh;
  padding: 24px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--green));
  color: #fff;
}

.brand strong,
.brand small {
  display: block;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav-group,
.nav-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-bottom {
  margin-top: auto;
}

.nav-label {
  margin: 0;
  padding: 4px 12px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-stack a,
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}

.nav-stack a:hover,
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-stack a.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-ic {
  display: inline-flex;
  color: inherit;
}

.theme-row {
  cursor: default;
}

.theme-row span:nth-child(2) {
  flex: 1;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
}

.switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: 0.2s;
}

.slider::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  content: "";
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--blue);
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(52, 199, 123, 0.14);
}

.workspace,
.main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar-spacer {
  flex: 1;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

h3 {
  margin: 16px 0 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

p {
  color: var(--muted);
}

.top-actions,
.action-row,
.inline-form,
.filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.top-actions {
  flex: 1;
  justify-content: flex-end;
  margin-left: auto;
}

.search,
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  min-width: min(340px, 100%);
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
}

.search input,
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.menu-btn {
  display: none;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--green));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.page-section {
  display: none;
  padding: 28px;
}

.page-section.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.metric-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  min-height: 146px;
  padding: 22px;
  overflow: hidden;
}

.metric-card::after {
  position: absolute;
  right: -28px;
  bottom: -32px;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: rgba(30, 111, 217, 0.12);
  content: "";
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin: 14px 0 6px;
  color: var(--text);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.metric-card.accent {
  background: linear-gradient(135deg, var(--primary), var(--green));
}

.metric-card.accent strong,
.metric-card.accent span,
.metric-card.accent small {
  color: var(--surface);
}

.content-grid,
.section-grid {
  display: grid;
  gap: 24px;
}

.content-grid.two,
.section-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.api-console-grid {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.panel {
  min-width: 0;
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading p {
  margin-bottom: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label,
.console-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-grid label:has(textarea),
.console-form label:has(textarea) {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  outline: 0;
}

input,
select {
  min-height: 42px;
  padding: 9px 14px;
}

textarea {
  min-height: 84px;
  padding: 10px 14px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn-soft,
.btn-linkish {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.btn-soft:hover,
.btn-linkish:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-linkish {
  min-height: 34px;
  padding: 6px 10px;
}

.btn-danger {
  background: var(--red);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(0.95);
  color: #fff;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
}

.btn-action .btn-ic {
  display: inline-flex;
  flex-shrink: 0;
}

.btn-view {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-view:hover {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

.btn-edit {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-edit:hover {
  background: var(--primary);
  color: #fff;
}

.btn-warn {
  background: rgba(255, 159, 67, 0.14);
  color: #c77700;
}

.btn-warn:hover {
  background: var(--orange);
  color: #fff;
}

.btn-success {
  background: var(--green-soft);
  color: var(--green);
}

.btn-success:hover {
  background: var(--green);
  color: #fff;
}

.btn-unemploy,
.btn-action.btn-danger {
  background: rgba(245, 83, 95, 0.12);
  color: var(--red);
  border-color: transparent;
}

.btn-unemploy:hover,
.btn-action.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.quick-actions {
  display: grid;
  gap: 10px;
  padding: 4px 0 8px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}

.quick-action:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quick-action.primary {
  border-color: transparent;
  background: var(--primary-soft);
}

.quick-action-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
}

.quick-action-desc {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.unemploy-form {
  display: grid;
  gap: 18px;
}

.unemploy-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.unemploy-banner-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(245, 83, 95, 0.12);
  color: var(--red);
  flex-shrink: 0;
}

.unemploy-banner-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.unemploy-banner-name {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 800;
}

.unemploy-banner-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.unemploy-section {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.unemploy-section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.unemploy-section-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.unemploy-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.reason-chip-grid {
  display: grid;
  gap: 8px;
}

.reason-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.reason-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.reason-option-check {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  position: relative;
  flex-shrink: 0;
}

.reason-option-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.12s ease;
}

.reason-option-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.reason-option:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface-2));
}

.reason-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent);
}

.reason-option:has(input:checked) .reason-option-check {
  border-color: var(--primary);
  background: var(--primary);
}

.reason-option:has(input:checked) .reason-option-check::after {
  transform: rotate(45deg) scale(1);
}

.reason-option:has(input:checked) .reason-option-label {
  color: var(--primary);
}

.reason-option:focus-within {
  outline: 2px solid color-mix(in srgb, var(--primary) 50%, transparent);
  outline-offset: 2px;
}

.danger-zone {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

form .btn {
  margin-top: 12px;
}

.inline-form .btn,
.filter-grid .btn {
  margin-top: 0;
}

.inline-form.wide {
  margin-top: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  margin-top: 10px;
}

.table-host,
.result-box {
  min-height: 74px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.result-box {
  padding: 14px;
  color: var(--text);
  white-space: pre-wrap;
}

.result-box:empty::before,
.table-host:empty::before {
  display: block;
  padding: 18px;
  color: var(--muted);
  content: "No data loaded yet.";
}

.empty-state {
  padding: 18px;
  color: var(--muted);
}

.empty-state.error,
.result-box.error {
  color: var(--red);
}

.muted {
  color: var(--muted);
}

/* Bootstrap tables inside table cards */
.table-host .table,
.display-section .table {
  margin-bottom: 0;
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-hover-bg: var(--table-hover-bg);
  --bs-table-hover-color: var(--text);
  --bs-table-active-bg: var(--table-hover-bg);
  --bs-table-active-color: var(--text);
  --bs-table-striped-bg: var(--table-hover-bg);
  --bs-table-striped-color: var(--text);
  color: var(--text);
}

.table-host .table thead th,
.display-section .table thead th {
  --bs-table-bg: var(--table-header-bg);
  --bs-table-color: var(--table-header-text);
  --bs-table-border-color: var(--border);
  background-color: var(--table-header-bg) !important;
  color: var(--table-header-text) !important;
  box-shadow: none;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

.table-host .table tbody td,
.display-section .table tbody td {
  --bs-table-color: var(--text);
  --bs-table-bg: var(--surface);
  color: var(--text);
  background-color: var(--surface);
  border-color: var(--border);
}

.table-host .table.table-hover > tbody > tr:hover > *,
.display-section .table.table-hover > tbody > tr:hover > * {
  --bs-table-color-state: var(--text);
  --bs-table-bg-state: var(--table-hover-bg);
  color: var(--text) !important;
  box-shadow: inset 0 0 0 9999px var(--table-hover-bg);
}

.table-host .table td.actions-col {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.table-host.compact .table-responsive {
  max-height: 300px;
  overflow-y: auto;
}

.table-host.compact .table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.375rem;
  justify-content: flex-end;
}

.cell-ellipsis {
  display: inline-block;
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: inherit;
}

.table-host .table .muted,
.display-section .table .muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.pill.danger {
  background: rgba(245, 83, 95, 0.14);
  color: var(--red);
}

.toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  /* Must sit above #modal-host overlays */
  z-index: 1200;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast-region .toast-item,
.toast-region .toast-message {
  pointer-events: auto;
}

.toast-message {
  max-width: 360px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.toast-message.error {
  border-left-color: var(--red);
}

.endpoint-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.endpoint-button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.endpoint-button.active,
.endpoint-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.method {
  width: max-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 11px;
  font-weight: 900;
}

.endpoint-path {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.console-form {
  display: grid;
  gap: 12px;
}

.console-form .console-actions {
  display: flex;
  gap: 10px;
}

.loading {
  opacity: 0.55;
  pointer-events: none;
}

code {
  color: var(--text);
  white-space: normal;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid.two,
  .section-grid,
  .api-console-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-btn {
    display: grid;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 16px 18px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .page-section {
    padding: 18px;
  }
}

@media (max-width: 620px) {
  .metric-grid,
  .form-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .search,
  .search-box {
    min-width: 100%;
  }
}

/* Page content & breadcrumbs */
.page-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.page-content > * {
  min-width: 0;
  max-width: 100%;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 28px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.breadcrumbs a:hover {
  color: var(--primary);
}

.breadcrumbs [aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}

.breadcrumb-sep {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  opacity: 0.5;
}

.breadcrumb-sep svg {
  width: 14px;
  height: 14px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h2 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}

.page-header p {
  margin: 0;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: visible;
}

.filter-bar label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 140px;
}

.filter-bar .filter-account-search,
.filter-bar .filter-lookup-search {
  width: 240px;
  min-width: 0;
  flex: 0 0 auto;
  overflow: visible;
}

.account-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  overflow: visible;
}

.account-search-icon {
  position: absolute;
  left: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
}

.account-search-wrap .account-search {
  flex: 1;
  min-width: 0;
}

.account-search-wrap .account-search-input {
  padding-left: 36px;
  padding-right: 12px;
}

.account-search-clear {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.account-search-clear:hover {
  color: var(--text);
  border-color: var(--primary);
}

.account-search {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.account-search-results {
  position: absolute;
  z-index: 200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-search-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.account-search-option:last-child {
  border-bottom: 0;
}

.account-search-option:hover,
.account-search-option:focus-visible {
  background: var(--surface-2);
}

.account-search-option-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-search-option-main strong {
  font-size: 13px;
  font-weight: 600;
}

.account-search-number {
  font-size: 12px;
  color: var(--muted);
}

.account-search-balance {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.account-search-empty {
  margin: 0;
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}

.tab-bar {
  display: flex;
  gap: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-bottom: 2px solid var(--border);
  background: transparent;
  padding: 0;
  border-radius: 0;
  scrollbar-width: thin;
}

.tab-btn {
  flex-shrink: 0;
  padding: 12px 20px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: none;
}

[data-theme="dark"] .tab-btn.active {
  color: #eef1f6;
  border-bottom-color: var(--primary);
  background: rgba(30, 111, 217, 0.18);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.detail-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.detail-card span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-card strong {
  font-size: 15px;
  word-break: break-word;
}

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-badge.active { background: var(--green-soft); color: var(--green); }
.status-badge.deleted { background: rgba(245, 83, 95, 0.14); color: var(--red); }

.statement-panel .display-host {
  border: 0;
  background: transparent;
  min-height: 120px;
  overflow: visible;
}

.statement-sheet {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.statement-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 70%, transparent), transparent 60%),
    var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.statement-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.statement-org {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.statement-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.statement-balance-card {
  min-width: 180px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: right;
}

.statement-balance-card span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.statement-balance-card strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.statement-balance-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.statement-body {
  padding: 18px 20px 22px;
}

.statement-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.statement-section-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.statement-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.statement-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.statement-table thead th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.statement-table tbody td {
  border-color: var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.statement-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.statement-row-reversed td {
  color: var(--muted);
}

.statement-fallback {
  margin: 0;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
}

@media (max-width: 720px) {
  .statement-header {
    padding: 18px;
  }

  .statement-balance-card {
    width: 100%;
    text-align: left;
  }

  .statement-org {
    font-size: 18px;
  }
}
.status-badge.suspended { background: rgba(255, 159, 67, 0.14); color: var(--orange); }

.clickable-row { cursor: pointer; }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: 12px; }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.pagination-controls { display: flex; align-items: center; gap: 10px; }
.pagination-info, .pagination-page { font-size: 13px; color: var(--muted); font-weight: 600; }
.page-size-select { min-height: 32px; padding: 4px 10px; border-radius: 8px; }

.table-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--muted);
  font-weight: 600;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Modals */
#modal-host { position: relative; z-index: 100; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 24, 31, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-backdrop.show { opacity: 1; }

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.app-modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 48px rgba(20, 24, 31, 0.18);
  transform: translateY(12px);
  transition: transform 0.2s;
}

[data-theme="dark"] .app-modal {
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.modal-backdrop.show .app-modal { transform: translateY(0); }
.app-modal.modal-lg { max-width: 720px; }

.modal-error-banner {
  grid-column: 1 / -1;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--border));
  border-left: 4px solid var(--red);
  border-radius: 12px;
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.modal-error-banner[hidden] {
  display: none !important;
}

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.app-modal-header h3 { margin: 0; font-size: 18px; font-weight: 700; }
.app-modal-body { padding: 20px 22px; }
.app-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 22px 20px;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field { display: grid; gap: 6px; }
.form-field span { font-size: 12px; font-weight: 600; color: var(--muted); }
.form-field:has(textarea) { grid-column: 1 / -1; }
.modal-message { margin: 0; color: var(--text); }

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-meta { text-align: right; }
.user-meta strong { display: block; font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 11px; font-weight: 600; }

.nav-admin-only[data-hidden="true"] { display: none; }

/* Enhanced toasts */
.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(20, 24, 31, 0.12);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.3s, transform 0.3s;
  position: relative;
  overflow: hidden;
}

.toast-item.show { opacity: 1; transform: translateX(0); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-info .toast-icon { color: var(--blue); }
.toast-text { flex: 1; font-weight: 600; font-size: 13px; line-height: 1.4; }
.toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--primary);
  transform-origin: left;
  animation: toast-progress linear forwards;
}

.toast-success .toast-progress { background: var(--green); }
.toast-error .toast-progress { background: var(--red); }

@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.display-host .display-section { margin-top: 20px; }
.display-section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.display-text { margin: 0; color: var(--text); line-height: 1.5; }
.display-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.profile-result-panel {
  padding: 0;
  overflow: hidden;
}

.profile-result-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2, var(--surface));
}

.profile-result-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-result-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.profile-result-meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.profile-result-status {
  min-width: 200px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: grid;
  gap: 4px;
  align-content: center;
}

.profile-result-status span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-result-status strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.profile-result-status.is-employed {
  border-color: color-mix(in srgb, var(--green, #16a34a) 35%, var(--border));
  background: color-mix(in srgb, var(--green, #16a34a) 8%, var(--surface));
}

.profile-result-status.is-unemployed {
  border-color: color-mix(in srgb, var(--muted) 40%, var(--border));
}

.profile-result-body {
  padding: 20px 22px 8px;
  display: grid;
  gap: 8px;
}

.profile-result-body .detail-grid {
  gap: 14px;
}

.profile-result-body .display-section {
  margin-top: 12px;
}

.profile-result-panel .display-actions {
  margin: 0;
  padding: 16px 22px 20px;
}

.profile-result-actions {
  gap: 10px;
  background: color-mix(in srgb, var(--surface-2, var(--surface)) 70%, var(--surface));
  border-top: 1px solid var(--border);
}

.profile-result-actions .btn-action {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
  box-shadow: none;
  text-decoration: none;
}

.profile-result-actions .btn-action .btn-ic {
  width: 16px;
  height: 16px;
}

.profile-result-actions .btn-action .btn-ic svg {
  display: block;
}

.profile-result-actions .btn-view {
  background: var(--surface);
}

.profile-result-actions .btn-edit {
  background: var(--primary-soft);
}

.profile-result-actions .btn-success {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 25%, transparent);
}

.profile-result-body .table-host {
  min-height: 0;
}

.profile-result-body .table-host:empty::before {
  content: none;
}

.form-section-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.repeatable-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.repeatable-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2, var(--surface));
  position: relative;
}

.repeatable-row-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.repeatable-section-toolbar {
  display: flex;
  justify-content: flex-start;
}

@media (max-width: 860px) {
  .page-content { padding: 18px; }
  .breadcrumbs { padding: 0 18px; }
  .modal-form-grid { grid-template-columns: 1fr; }
  .repeatable-row { grid-template-columns: 1fr; }
}
