:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-soft: #e7edf7;
  --panel: #ffffff;
  --panel-2: #f5f7fb;
  --stroke: rgba(15, 23, 42, 0.12);
  --text: #101828;
  --muted: rgba(16, 24, 40, 0.68);
  --accent: #0f9f93;
  --accent-2: #315efb;
  --warn: #c05621;
  --danger: #dc2626;
  --success: #15803d;
  --shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
  --bg-gradient:
    radial-gradient(1200px 800px at 15% -10%, rgba(15, 159, 147, 0.16), transparent 60%),
    radial-gradient(900px 700px at 90% 10%, rgba(49, 94, 251, 0.12), transparent 55%),
    linear-gradient(180deg, #f8fbff 0%, #f3f6fb 60%, #edf2f9 100%);
  --sidebar-bg: linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(240, 245, 252, 0.96));
  --topbar-bg: linear-gradient(90deg, rgba(243, 246, 251, 0.9), rgba(236, 242, 249, 0.9));
  --card-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(243, 247, 252, 0.94));
  --card-strong-bg: linear-gradient(155deg, rgba(237, 244, 252, 0.98), rgba(232, 240, 250, 0.98));
  --modal-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 251, 0.98));
  --modal-backdrop: rgba(148, 163, 184, 0.34);
  --surface-soft: rgba(255, 255, 255, 0.72);
  --surface-muted: rgba(15, 23, 42, 0.03);
  --surface-muted-strong: rgba(15, 23, 42, 0.05);
  --surface-hover: rgba(15, 23, 42, 0.045);
  --surface-accent: rgba(15, 159, 147, 0.09);
  --surface-accent-strong: rgba(15, 159, 147, 0.13);
  --surface-brand: linear-gradient(135deg, rgba(15, 159, 147, 0.12), rgba(49, 94, 251, 0.08));
  --surface-brand-strong: linear-gradient(160deg, rgba(15, 159, 147, 0.12), rgba(49, 94, 251, 0.08));
  --brand-mark-bg: rgba(255, 255, 255, 0.82);
  --brand-mark-border: rgba(15, 23, 42, 0.12);
  --active-menu-bg: rgba(15, 159, 147, 0.1);
  --active-menu-border: rgba(15, 159, 147, 0.32);
  --focus-border: rgba(15, 159, 147, 0.55);
  --focus-ring: 0 0 0 3px rgba(15, 159, 147, 0.14);
  --primary-gradient: linear-gradient(135deg, var(--accent), #53a6ff);
  --primary-contrast: #f8fafc;
  --danger-gradient: linear-gradient(135deg, #ef4444, #e11d48);
  --sticky-head-bg: rgba(243, 246, 251, 0.95);
  --directory-shell-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 248, 252, 0.9));
  --directory-shell-inset: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --history-border: rgba(15, 159, 147, 0.16);
  --subtle-border: rgba(15, 23, 42, 0.1);
  --subtle-hover-border: rgba(15, 159, 147, 0.24);
  --hero-orb-1: radial-gradient(circle, rgba(15, 159, 147, 0.18), transparent 70%);
  --hero-orb-2: radial-gradient(circle, rgba(49, 94, 251, 0.14), transparent 70%);
  --kpi-reviews-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(235, 241, 252, 0.92));
  --kpi-invoices-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(252, 238, 241, 0.92));
  --kpi-categories-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(235, 247, 247, 0.92));
  --meter-track: rgba(15, 23, 42, 0.09);
  --meter-shadow: 0 0 14px rgba(15, 159, 147, 0.25);
  --error-border: rgba(220, 38, 38, 0.34);
  --error-bg: rgba(220, 38, 38, 0.08);
  --notice-bg: rgba(15, 159, 147, 0.08);
  --button-hover-border: rgba(15, 23, 42, 0.18);
  --badge-bg: rgba(15, 23, 42, 0.05);
  --pending-border: rgba(192, 86, 33, 0.32);
  --approved-border: rgba(21, 128, 61, 0.3);
  --rejected-border: rgba(220, 38, 38, 0.34);
  --kpi-card-border: rgba(15, 23, 42, 0.12);
  --blazor-error-bg: #fff4cc;
  --blazor-error-text: #6b4f00;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --bg-soft: #141824;
  --panel: #171c2a;
  --panel-2: #1b2031;
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #f4f4f6;
  --muted: rgba(244, 244, 246, 0.7);
  --accent: #64f3d0;
  --accent-2: #e6b1ff;
  --warn: #ffb85c;
  --danger: #ff6b6b;
  --success: #4ade80;
  --shadow: 0 30px 60px rgba(10, 12, 18, 0.45);
  --bg-gradient:
    radial-gradient(1200px 800px at 15% -10%, rgba(100, 243, 208, 0.2), transparent 60%),
    radial-gradient(900px 700px at 90% 10%, rgba(230, 177, 255, 0.18), transparent 55%),
    linear-gradient(180deg, #0b0d13 0%, #0f1115 60%, #0b0d13 100%);
  --sidebar-bg: linear-gradient(165deg, rgba(23, 28, 42, 0.95), rgba(14, 16, 25, 0.95));
  --topbar-bg: linear-gradient(90deg, rgba(15, 17, 21, 0.84), rgba(16, 20, 31, 0.84));
  --card-bg: linear-gradient(160deg, rgba(27, 32, 49, 0.9), rgba(18, 22, 34, 0.9));
  --card-strong-bg: linear-gradient(155deg, rgba(24, 35, 56, 0.92), rgba(14, 20, 34, 0.92));
  --modal-bg: linear-gradient(160deg, rgba(27, 32, 49, 0.96), rgba(14, 16, 25, 0.96));
  --modal-backdrop: rgba(7, 8, 12, 0.62);
  --surface-soft: rgba(255, 255, 255, 0.03);
  --surface-muted: rgba(255, 255, 255, 0.02);
  --surface-muted-strong: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.03);
  --surface-accent: rgba(100, 243, 208, 0.08);
  --surface-accent-strong: rgba(100, 243, 208, 0.12);
  --surface-brand: linear-gradient(135deg, rgba(100, 243, 208, 0.12), rgba(109, 208, 255, 0.08));
  --surface-brand-strong: linear-gradient(160deg, rgba(100, 243, 208, 0.12), rgba(109, 208, 255, 0.06));
  --brand-mark-bg: rgba(255, 255, 255, 0.08);
  --brand-mark-border: rgba(255, 255, 255, 0.16);
  --active-menu-bg: rgba(100, 243, 208, 0.12);
  --active-menu-border: rgba(100, 243, 208, 0.4);
  --focus-border: rgba(100, 243, 208, 0.55);
  --focus-ring: 0 0 0 3px rgba(100, 243, 208, 0.12);
  --primary-gradient: linear-gradient(135deg, var(--accent), #6dd0ff);
  --primary-contrast: #0b0d13;
  --danger-gradient: linear-gradient(135deg, #ff7b7b, #ff4d8b);
  --sticky-head-bg: rgba(15, 17, 21, 0.92);
  --directory-shell-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  --directory-shell-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --history-border: rgba(100, 243, 208, 0.12);
  --subtle-border: rgba(255, 255, 255, 0.12);
  --subtle-hover-border: rgba(100, 243, 208, 0.24);
  --hero-orb-1: radial-gradient(circle, rgba(100, 243, 208, 0.24), transparent 70%);
  --hero-orb-2: radial-gradient(circle, rgba(109, 208, 255, 0.18), transparent 70%);
  --kpi-reviews-bg: linear-gradient(160deg, rgba(27, 32, 49, 0.92), rgba(24, 23, 38, 0.92));
  --kpi-invoices-bg: linear-gradient(160deg, rgba(27, 32, 49, 0.92), rgba(36, 23, 34, 0.92));
  --kpi-categories-bg: linear-gradient(160deg, rgba(27, 32, 49, 0.92), rgba(20, 31, 38, 0.92));
  --meter-track: rgba(255, 255, 255, 0.09);
  --meter-shadow: 0 0 14px rgba(100, 243, 208, 0.42);
  --error-border: rgba(255, 107, 107, 0.4);
  --error-bg: rgba(255, 107, 107, 0.08);
  --notice-bg: rgba(100, 243, 208, 0.08);
  --button-hover-border: rgba(255, 255, 255, 0.2);
  --badge-bg: rgba(255, 255, 255, 0.06);
  --pending-border: rgba(255, 184, 92, 0.4);
  --approved-border: rgba(74, 222, 128, 0.4);
  --rejected-border: rgba(255, 107, 107, 0.4);
  --kpi-card-border: rgba(255, 255, 255, 0.12);
  --blazor-error-bg: lightyellow;
  --blazor-error-text: #242424;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg-gradient);
  overflow: hidden;
}

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
}

h1:focus {
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--stroke);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--stroke);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--brand-mark-bg);
  border: 1px solid var(--brand-mark-border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-name {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

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

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  transition: 0.2s ease;
}

.menu-item.active {
  background: var(--active-menu-bg);
  border-color: var(--active-menu-border);
  color: var(--text);
}

.menu-item:hover {
  border-color: var(--stroke);
  color: var(--text);
}

.menu-icon {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 0.8rem;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
}

.menu-icon svg {
  width: 18px;
  height: 18px;
}

.tiny-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.dot-on {
  background: var(--success);
}

.dot-off {
  background: var(--danger);
}

.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px 16px;
  border-bottom: 1px solid var(--stroke);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
}

.topbar-title h1 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 2rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--surface-soft);
  font-size: 0.85rem;
  color: var(--text);
}

.user-pill {
  border-color: var(--active-menu-border);
  background: var(--surface-brand);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.pill-strong {
  font-weight: 700;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.pill-muted {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions .btn {
  min-width: 108px;
}

.content {
  padding: 28px 36px 40px;
  overflow: auto;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
}

.compact-panel {
  min-height: 320px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.1rem;
  margin: 0;
}

.card-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.entity-title {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 600;
}

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

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--surface-soft);
}

.row-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.list-title {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 600;
}

.requests-topbar {
  background: var(--card-strong-bg);
  border-color: var(--subtle-hover-border);
}

.requests-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.stat {
  display: grid;
  gap: 6px;
}

.stat-value {
  font-size: 2rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.stat-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.input-group {
  display: grid;
  gap: 6px;
}

.input-group label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.input-group input,
.input-group select,
.input-group textarea {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.95rem;
}

/* Chrome autofill overrides our colors; force theme consistency. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 999999s ease-in-out 0s;
  box-shadow: 0 0 0 1000px var(--panel) inset;
  border: 1px solid var(--stroke);
}

.input {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

.input:focus,
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--focus-border);
  box-shadow: var(--focus-ring);
}

.input-group.compact input {
  min-width: 220px;
}

.input-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.btn {
  border: 1px solid var(--stroke);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--button-hover-border);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--primary-gradient);
  color: var(--primary-contrast);
  border: none;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  background: var(--danger-gradient);
  border: none;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--stroke);
  background: var(--badge-bg);
}

.badge.pending {
  color: var(--warn);
  border-color: var(--pending-border);
}

.badge.approved {
  color: var(--success);
  border-color: var(--approved-border);
}

.badge.rejected {
  color: var(--danger);
  border-color: var(--rejected-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--stroke);
  font-size: 0.9rem;
  background: transparent;
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--sticky-head-bg);
  backdrop-filter: blur(10px);
  z-index: 1;
}

.table tbody tr:hover td {
  background: var(--surface-hover);
}

.directory-table-wrap {
  border-radius: 18px;
  background: var(--directory-shell-bg);
  box-shadow: var(--directory-shell-inset);
}

.directory-table td {
  vertical-align: middle;
  padding-top: 16px;
  padding-bottom: 16px;
}

.directory-row:hover td {
  background: var(--surface-accent);
}

.directory-row.is-blocked td:first-child {
  box-shadow: inset 3px 0 0 rgba(255, 107, 107, 0.45);
}

.directory-identity,
.directory-location,
.directory-metric {
  display: grid;
  gap: 6px;
}

.directory-identity {
  min-width: 300px;
}

.entity-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.button-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.entity-link:hover {
  color: var(--accent-2);
}

.identity-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.identity-contact-list {
  display: grid;
  gap: 6px;
}

.identity-value {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.identity-value.email {
  color: var(--accent);
}

.identity-value.missing {
  color: color-mix(in srgb, var(--text) 44%, transparent);
  font-style: italic;
}

.directory-location {
  min-width: 230px;
}

.location-city {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.04rem;
  font-weight: 600;
}

.location-district {
  color: var(--muted);
  line-height: 1.45;
}

.status-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.table-number {
  display: inline-block;
  min-width: 1.5rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.metric-link {
  color: inherit;
  text-decoration: none;
}

.metric-link:hover .table-number {
  color: var(--accent-2);
}

.table-date {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: color-mix(in srgb, var(--text) 90%, transparent);
  white-space: nowrap;
}

.metric-caption {
  font-size: 0.8rem;
  color: var(--muted);
}

.action-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 220px;
}

.btn.subtle {
  background: var(--surface-muted-strong);
  border-color: var(--subtle-border);
}

.btn.subtle:hover {
  background: var(--surface-hover);
  border-color: var(--subtle-hover-border);
}

.directory-table th:last-child,
.directory-table td:last-child {
  text-align: right;
}

.directory-table th.last-request-col,
.directory-table td.last-request-col {
  min-width: 150px;
}

.category-insights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.category-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  user-select: none;
}

.toggle-inline input {
  accent-color: var(--accent);
}

.category-table td {
  vertical-align: middle;
}

.category-table .badge {
  white-space: nowrap;
}

.category-load-cell {
  display: grid;
  gap: 2px;
}

.category-load-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.category-action-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.category-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.badge-mini {
  font-size: 0.68rem;
  padding: 2px 8px;
  letter-spacing: 0.03em;
}

.history-focus {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--history-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.history-focus-title {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.history-focus-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-summary-card {
  overflow: hidden;
}

.history-summary-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
}

.history-summary-identity {
  display: grid;
  gap: 8px;
}

.history-summary-name {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.15;
}

.history-summary-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.history-summary-kpi {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-muted);
  display: grid;
  gap: 6px;
}

.history-summary-kpi.wide {
  grid-column: span 2;
}

.summary-kpi-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-kpi-value {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.summary-kpi-value.small {
  font-size: 1rem;
  line-height: 1.2;
}

.summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 1100px) {
  .history-summary-shell {
    grid-template-columns: 1fr;
  }

  .history-summary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .history-summary-kpis {
    grid-template-columns: 1fr;
  }

  .history-summary-kpi.wide {
    grid-column: span 1;
  }

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

.category-modal {
  width: min(560px, 100%);
}

.category-form-grid {
  display: grid;
  gap: 10px;
}

.category-row-gap td:first-child {
  box-shadow: inset 3px 0 0 rgba(255, 107, 107, 0.5);
}

.category-row-watch td:first-child {
  box-shadow: inset 3px 0 0 rgba(255, 184, 92, 0.45);
}

.subcard {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-muted);
}

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

.map-picker {
  width: 100%;
  height: 320px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  overflow: hidden;
}

.map-picker .leaflet-control-container .leaflet-control {
  border-radius: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 1000;
}

.modal {
  width: min(820px, 100%);
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: rise 0.35s ease both;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.login-modal {
  width: min(980px, 100%);
}

.login-shell {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 16px;
}

.login-aside {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--surface-brand-strong);
  padding: 16px;
}

.login-title {
  margin: 8px 0 8px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.15rem;
}

.login-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.login-badges {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-form {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface-muted);
  display: grid;
  gap: 12px;
}

.password-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.btn.btn-icon {
  padding: 10px 12px;
  min-width: 74px;
}

.login-actions {
  margin-top: 2px;
  justify-content: flex-end;
}

.modal-title {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

.notice {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--notice-bg);
  color: var(--text);
  font-size: 0.9rem;
}

.error {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--danger);
  font-size: 0.9rem;
}

.legal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--stroke);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
}

.legal-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.legal-brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--brand-mark-border);
  background: var(--brand-mark-bg);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.legal-brand-copy {
  display: grid;
  gap: 4px;
}

.legal-brand-name {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legal-link {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--surface-soft);
  color: var(--muted);
  transition: 0.2s ease;
}

.legal-link.active,
.legal-link:hover {
  border-color: var(--active-menu-border);
  background: var(--surface-accent-strong);
  color: var(--text);
}

.legal-main {
  overflow: auto;
  padding: 32px 36px 48px;
}

.legal-page {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.legal-hero {
  display: grid;
  gap: 10px;
}

.legal-hero h1 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.legal-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  margin: 0;
}

.legal-section {
  display: grid;
  gap: 10px;
}

.legal-section h2 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.1rem;
}

.legal-section p {
  margin: 0;
  line-height: 1.7;
}

.legal-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 8px;
  line-height: 1.7;
}

.legal-note {
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.legal-inline-link {
  color: var(--accent);
  text-decoration: underline;
}

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

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before,
.dashboard-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(1px);
  pointer-events: none;
}

.dashboard-hero::before {
  width: 420px;
  height: 420px;
  right: -160px;
  top: -180px;
  background: var(--hero-orb-1);
}

.dashboard-hero::after {
  width: 360px;
  height: 360px;
  left: -130px;
  bottom: -220px;
  background: var(--hero-orb-2);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  align-items: center;
}

.hero-title {
  margin: 8px 0 8px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
}

.hero-copy {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.5;
}

.hero-tags {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-kpis {
  display: grid;
  gap: 12px;
}

.hero-kpi {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--surface-muted-strong);
  padding: 12px 14px;
}

.hero-kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-kpi-value {
  display: block;
  margin-top: 4px;
  font-size: 1.6rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
}

.kpi-grid .kpi-card {
  border-color: var(--kpi-card-border);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-grid .kpi-card:hover {
  transform: translateY(-2px);
}

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

.kpi-reviews {
  background: var(--kpi-reviews-bg);
}

.kpi-invoices {
  background: var(--kpi-invoices-bg);
}

.kpi-categories {
  background: var(--kpi-categories-bg);
}

.meter {
  margin-top: 14px;
  height: 8px;
  border-radius: 999px;
  background: var(--meter-track);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary-gradient);
  box-shadow: var(--meter-shadow);
}

.action-card {
  min-height: 320px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.action-row + .action-row {
  margin-top: 14px;
}

.shortcut-grid {
  display: grid;
  gap: 10px;
}

.shortcut {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--surface-muted);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.shortcut:hover {
  border-color: var(--focus-border);
  transform: translateX(2px);
  background: var(--surface-accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
  justify-content: center;
}

.theme-toggle-icon {
  font-size: 0.95rem;
  line-height: 1;
}

#blazor-error-ui {
  background: var(--blazor-error-bg);
  color: var(--blazor-error-text);
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.shortcut-title {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 600;
}

.shortcut-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
  }

  .menu {
    flex-direction: row;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .legal-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .content {
    padding: 20px;
  }

  .grid.cols-2,
  .grid.cols-3,
  .input-row {
    grid-template-columns: 1fr;
  }

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

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-actions {
    justify-content: stretch;
  }

  .login-actions .btn {
    width: 100%;
  }

  .map-picker {
    height: 280px;
  }

  .requests-topbar-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .category-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .action-row {
    align-items: stretch;
  }

  .action-row .btn {
    width: 100%;
  }

  .directory-identity,
  .directory-location {
    min-width: 0;
  }

  .action-cluster {
    min-width: 0;
    justify-content: flex-start;
  }

  .legal-main {
    padding: 24px 20px 36px;
  }

  .legal-topbar {
    padding: 18px 20px;
  }
}
