:root {
  --bg: #eef2f8;
  --bg-elevated: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f3f6fb;
  --sidebar: #0f1726;
  --sidebar-soft: #1a2436;
  --border: #dce4f0;
  --text: #101a2b;
  --muted: #607089;
  --accent: #0f766e;
  --accent-strong: #0a5f58;
  --warning: #9a6700;
  --danger: #a11f3a;
  --success: #1f7a44;
  --shadow: 0 20px 45px rgba(15, 23, 38, 0.09);
  --shadow-soft: 0 8px 24px rgba(17, 25, 40, 0.08);
  --radius: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(15, 118, 110, 0.1), transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(15, 23, 38, 0.08), transparent 30%),
    var(--bg);
}

html {
  scroll-behavior: smooth;
}

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

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: 'Sora', 'Manrope', sans-serif;
  letter-spacing: -0.03em;
}

code {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  color: #14334f;
  background: rgba(15, 118, 110, 0.08);
  border-radius: 8px;
  padding: 2px 6px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(500px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  padding: 30px;
  display: grid;
  gap: 18px;
}

.login-card h1 {
  font-size: clamp(1.4rem, 2vw, 1.8rem);
}

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

.brand-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, #10b981, #0f1726);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.25);
}

.login-brand strong,
.brand strong {
  display: block;
  font-size: 15px;
}

.login-brand span,
.brand span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #2d3a4f;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 11px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
}

input:focus,
select:focus {
  outline: none;
  border-color: #3baaa1;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(130deg, var(--accent), #0f1726);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 38, 0.25);
}

.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface-soft);
  border-color: #c7d3e2;
}

.btn-small {
  padding: 7px 11px;
  font-size: 12px;
}

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

.shell-sidebar {
  border-right: 1px solid #1f2b40;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 42%),
    var(--sidebar);
  color: #dde7f7;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.brand span {
  color: #9db0ce;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  padding: 10px 12px;
  border-radius: 10px;
  color: #c9d7ee;
  font-weight: 700;
  font-size: 13px;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
}

.side-nav a.active {
  background: linear-gradient(120deg, rgba(15, 118, 110, 0.32), rgba(15, 118, 110, 0.14));
  color: #e6fffb;
}

.side-nav a.side-nav-bottom {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 14px;
}

.sidebar-meta {
  margin-top: auto;
  border: 1px solid #28374f;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  display: grid;
  gap: 4px;
}

.sidebar-meta p,
.sidebar-meta span {
  font-size: 12px;
  color: #a5b7d4;
}

.sidebar-meta strong {
  font-size: 14px;
  color: #f4f8ff;
}

.shell-main {
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.shell-topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-soft);
}

.shell-topbar h1 {
  font-size: clamp(1.2rem, 1.8vw, 1.6rem);
}

.shell-topbar p {
  margin-top: 4px;
  font-size: 13px;
}

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

.impersonation-banner {
  border: 1px solid rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.08);
  color: #0b5a54;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.card h2 {
  font-size: 20px;
}

.card h3 {
  font-size: 15px;
}

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

.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  font-size: 12px;
  font-weight: 700;
  color: #425067;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  text-transform: capitalize;
}

.pill.active {
  background: rgba(15, 118, 110, 0.1);
  color: #0f5d56;
  border-color: transparent;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.report-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.report-type {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.report-card h3 {
  margin-top: 8px;
  font-size: 20px;
}

.report-range {
  margin-top: 8px;
  font-size: 13px;
}

.report-actions {
  display: flex;
  gap: 8px;
}

.empty-card h3 {
  margin-bottom: 8px;
}

.viewer-card {
  padding: 10px;
}

.viewer-toolbar {
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-frame {
  width: 100%;
  min-height: 76vh;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #c9d4e4;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #32455f;
  text-transform: uppercase;
}

.tag-success {
  color: #155e33;
  border-color: rgba(21, 94, 51, 0.25);
  background: rgba(21, 94, 51, 0.08);
}

.tag-muted {
  color: #4f5f75;
  border-color: rgba(79, 95, 117, 0.24);
  background: rgba(79, 95, 117, 0.08);
}

.tag-admin {
  color: #5f3d00;
  border-color: rgba(154, 103, 0, 0.3);
  background: rgba(154, 103, 0, 0.1);
}

.tag-client {
  color: #0b5a54;
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(15, 118, 110, 0.1);
}

.split-card {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

.flow-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  padding: 14px;
  display: grid;
  gap: 10px;
}

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

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

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.full-col {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
}

.check-row input[type='checkbox'] {
  width: auto;
}

.form-actions {
  display: flex;
  align-items: end;
}

.inline-form {
  display: flex;
  align-items: end;
  gap: 8px;
}

.compact-label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.compact-label select {
  min-width: 180px;
}

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

.inline-help {
  margin-top: 6px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 13px;
}

th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #52637c;
  background: var(--surface-soft);
}

.flash {
  border-radius: 11px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.flash-error {
  background: rgba(161, 31, 58, 0.08);
  border-color: rgba(161, 31, 58, 0.32);
  color: var(--danger);
}

.flash-success {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.3);
  color: #0b5a54;
}

.admin-overview {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.4fr 1fr;
  background:
    radial-gradient(circle at 0% 0%, rgba(15, 118, 110, 0.16), transparent 45%),
    linear-gradient(130deg, #ffffff, #f6fbf9);
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2b5d8a;
}

.admin-overview h2 {
  margin-top: 8px;
  max-width: 30ch;
}

.admin-jump-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.metric-card {
  border: 1px solid #d2dfef;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  padding: 12px;
}

.metric-card span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #556983;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  font-family: 'Sora', 'Manrope', sans-serif;
}

.metric-card p {
  margin-top: 3px;
  font-size: 12px;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 10px;
  z-index: 5;
}

.section-tabs a {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  color: #334a67;
}

.section-tabs a:hover {
  border-color: #b9c9de;
  background: var(--surface-soft);
}

.section-tabs a.active {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.1);
  color: #0f5d56;
}

.anchor-offset {
  position: relative;
  top: -100px;
  display: block;
  visibility: hidden;
}

.admin-section {
  scroll-margin-top: 104px;
}

[data-client-assignment].is-disabled {
  opacity: 0.6;
}

.inline-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  min-width: 240px;
}

tr.hidden-row {
  display: none;
}

@media (max-width: 1180px) {
  .admin-overview {
    grid-template-columns: 1fr;
  }

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

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

  .shell-sidebar {
    border-right: none;
    border-bottom: 1px solid #2a3a55;
  }

  .shell-main {
    padding: 12px;
  }

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

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form,
  .inline-filter-bar {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .search-input {
    min-width: 100%;
  }

  .section-tabs {
    position: static;
  }

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