:root {
  font: 15px/1.55 system-ui, sans-serif;
  color: #14283b;
  background: #f3f7fa;
  --ink: #14283b;
  --muted: #4d6275;
  --border: #dbe5eb;
  --accent: #076954;
  --accent-soft: #e6f5ef;
  --nav: #112b3e;
  --paper: #fff;
  --shadow: 0 2px 4px #15344b08, 0 12px 28px #15344b08;
  --radius: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
form { margin: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 1.15rem;
  font-size: clamp(1.65rem, 3.7vw, 2.55rem);
  letter-spacing: -.04em;
  line-height: 1.13;
  overflow-wrap: anywhere;
}
h2 { margin-bottom: .7rem; font-size: 1.15rem; line-height: 1.3; letter-spacing: -.015em; }
h3 { margin-bottom: .55rem; font-size: 1rem; }
p { margin-bottom: .9rem; }

button, .action, .tabs a, nav.actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: .48rem .8rem;
  border: 1px solid #c7d5df;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
button:not(:disabled):hover, .action:hover, .tabs a:hover, nav.actions a:hover {
  border-color: #7fa99f;
  background: #f3faf7;
}
.primary, .action.primary, .tabs a[aria-current="page"], nav.actions a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
button.primary:not(:disabled):hover, .action.primary:hover,
.tabs a[aria-current="page"]:hover, nav.actions a[aria-current="page"]:hover {
  border-color: #065441;
  background: #065441;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: .58rem .7rem;
  border: 1px solid #acbfce;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: .35rem; min-width: 0; font-weight: 650; }
:focus-visible { outline: 3px solid #2b75ba; outline-offset: 2px; }

.brand {
  color: inherit;
  font-size: 1.8rem;
  font-weight: 850;
  letter-spacing: -.08rem;
  text-decoration: none;
}
.brand span { color: #45cdb1; }
.public-brand .brand span, .login .brand span { color: var(--accent); }
.eyebrow { color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .13em; }
.public-brand { margin-bottom: 1.35rem; }
.muted, .heading p { color: var(--muted); }
.surface { min-width: 0; }
.staff-toolbar {
  display: flex;
  align-items: center;
  padding: .85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}
.staff-toolbar form { display: flex; gap: .5rem; width: min(100%, 560px); }
.staff-toolbar button { white-space: nowrap; }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 20; transform: translateY(-200%); }
.skip-link:focus { transform: none; }

#content { max-width: 1480px; margin: auto; padding: clamp(1rem, 3.5vw, 2.6rem); }
.heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.heading h1 { margin-bottom: .4rem; }
.heading p:last-child { margin-bottom: 0; }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.record-meta .badge { color: var(--accent); }

.panel, .metric, .login form {
  min-width: 0;
  margin-bottom: 1rem;
  padding: clamp(1rem, 2vw, 1.35rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.panel > :last-child { margin-bottom: 0; }
.metrics, .fields, .dashboard-grid, .profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
  gap: 1rem;
}
.dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.profile-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.dashboard-grid, .metrics { margin-bottom: 1rem; }
.dashboard-grid > .panel, .metrics > .metric { margin-bottom: 0; }
.metric { color: var(--ink); text-decoration: none; }
.metric:hover { border-color: var(--accent); }
.metric strong, .metric-value {
  display: block;
  margin: .12rem 0 .38rem;
  color: var(--accent);
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 760;
  letter-spacing: -.04em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.list { margin: 0; padding: 0; list-style: none; }
.list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem .85rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: 0; }
.list li > a:first-child { font-weight: 650; }
.badge {
  display: inline-block;
  padding: .16rem .62rem;
  border-radius: 20px;
  background: var(--accent-soft);
  color: #145b4f;
  font-size: .82rem;
  font-weight: 650;
}
.tabs, .actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
}
.tabs { margin: 0 0 1rem; }
nav.actions { margin-bottom: .85rem; }
.record-form { display: grid; gap: 1rem; }
.record-form > h2, .record-form > p { margin-bottom: 0; }
.error, .notice {
  padding: .75rem .9rem;
  border: 1px solid #edc6c9;
  border-radius: 8px;
  background: #fff2f2;
  color: #8d2733;
}
.notice { border-color: #b8dfd4; background: var(--accent-soft); color: #145b4f; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .62rem .7rem; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #f2f7fa; color: var(--muted); font-size: .86rem; }

.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(ellipse at 50% 4%, #dcefe9, transparent 65%), #edf4f7;
}
.login form { display: grid; gap: 1rem; width: min(100%, 450px); margin: 0; padding: clamp(1.25rem, 5vw, 2.4rem); }
.login h1, .login p { margin-bottom: 0; }
#content.help-content { max-width: 900px; }
.help-content .notes { margin: .5rem 0 0; }
.help-content summary { cursor: pointer; font-weight: 650; }
.checkbox-field { display: flex; align-items: baseline; gap: .5rem; }
.help-banner { border-left: 4px solid var(--accent); }
.staff-mfa-qr { width: min(100%, 260px); }
.staff-mfa-qr > * { display: block; width: 100%; height: auto; }
.profile-grid .panel + .panel { margin-top: .15rem; }
.profile-form { margin-top: 1rem; }
.profile-key { overflow-wrap: anywhere; }

@media (max-width: 740px) {
  .heading { flex-wrap: wrap; }
}

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.staff-sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 1.35rem .85rem;
  background: var(--nav);
  color: white;
}

.staff-sidebar-top {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 0 .65rem;
}

.workspace-menu-toggle {
  display: none;
}

.staff-workspaces {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .65rem;
  min-height: 0;
  margin-top: 1.1rem;
}

.workspace-nav {
  display: grid;
  align-content: start;
  gap: .2rem;
  min-height: 3.5rem;
  overflow-y: auto;
  padding: .2rem;
  scrollbar-color: #52718b transparent;
}

.workspace-nav a {
  display: block;
  border-radius: 7px;
  color: #e4edf7;
  text-decoration: none;
}

.staff-sidebar :focus-visible {
  outline-color: #91e5d3;
}

.quote-actions {
  margin-bottom: 1rem;
}

.workspace-nav a:hover {
  background: #294760;
  color: white;
}

.workspace-nav .workspace-nav-link,
.workspace-group summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .55rem .7rem;
  border-radius: 8px;
  color: #e4edf7;
  font-weight: 650;
}

.workspace-group summary {
  justify-content: space-between;
  gap: .65rem;
  list-style: none;
  cursor: pointer;
}

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

.workspace-group summary::after {
  content: "";
  flex: 0 0 .45rem;
  height: .45rem;
  margin-right: .15rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
}

.workspace-group[open] summary::after {
  transform: rotate(45deg);
}

.workspace-group summary:hover,
.workspace-group[open] summary,
.workspace-group-current summary {
  background: #294760;
  color: white;
}

.workspace-group ul {
  margin: .35rem 0 .45rem .75rem;
  padding: 0 0 0 .45rem;
  border-left: 1px solid #46637c;
  list-style: none;
}

.workspace-group li a {
  padding: .48rem .6rem;
  font-size: .93rem;
}

.workspace-nav a[aria-current="page"] {
  background: #365b73;
  color: white;
  font-weight: 700;
}

.staff-account {
  display: grid;
  flex-shrink: 0;
  gap: .15rem;
  margin-top: auto;
  padding: .6rem .2rem 0;
  border-top: 1px solid #46637c;
}

.staff-account-link,
.staff-account-signout {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .65rem;
  width: 100%;
  min-height: 44px;
  padding: .4rem .65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e4edf7;
  font-weight: 650;
  text-decoration: none;
}

.staff-account-link:hover,
.staff-account-signout:not(:disabled):hover {
  background: #294760;
  color: white;
}

.staff-account-link[aria-current="page"] {
  background: #365b73;
  color: white;
}

.staff-avatar {
  position: relative;
  display: grid;
  flex: 0 0 2rem;
  height: 2rem;
  place-items: center;
  overflow: hidden;
  border-radius: .55rem;
  background: #076954;
  color: white;
  font-size: .95rem;
  font-weight: 850;
  letter-spacing: -.06em;
}

.staff-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/favicon.svg") center / cover no-repeat;
}

.staff-toolbar input[type="search"] {
  min-width: 0;
}

@media (max-width: 800px) {
  .workspace {
    display: block;
  }

  .staff-sidebar {
    height: auto;
    padding: .6rem .85rem;
    overflow: visible;
    z-index: 10;
  }

  .staff-sidebar-top {
    padding: 0;
  }

  .workspace-menu-ready .workspace-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 44px;
    padding: .45rem .75rem;
    border-color: #52718b;
    background: #243e55;
    color: white;
    font-weight: 650;
  }

  .workspace-menu-ready .workspace-menu-toggle:hover,
  .workspace-menu-ready .workspace-menu-toggle[aria-expanded="true"] {
    border-color: #7cb4bb;
    background: #365b73;
    color: white;
  }

  .staff-workspaces {
    gap: .35rem;
    margin-top: .6rem;
  }

  .workspace-nav {
    flex: none;
    overflow: visible;
  }

  .workspace-menu-ready .staff-workspaces {
    display: none;
    position: absolute;
    inset: 100% .65rem auto;
    max-height: min(65vh, 29rem);
    max-height: min(65dvh, 29rem);
    overflow: auto;
    overscroll-behavior: contain;
    margin: .25rem 0 0;
    padding: .6rem;
    border: 1px solid #46637c;
    border-radius: 12px;
    background: var(--nav);
    box-shadow: 0 12px 28px #14283d4d;
  }

  .workspace-menu-open .staff-workspaces {
    display: flex;
  }

  .workspace-group li a {
    display: flex;
    min-height: 44px;
    align-items: center;
  }

  .staff-toolbar form {
    gap: .4rem;
  }

  .staff-toolbar button {
    padding-inline: .6rem;
  }
}
