:root {
  --ink: #0b0f0c;
  --ink-soft: #101713;
  --ink-raised: #151d18;
  --paper: #f5f2eb;
  --paper-soft: #dedbd3;
  --green: #2fe38b;
  --green-bright: #59f1a7;
  --green-deep: #102f21;
  --amber: #f4c467;
  --red: #ff7b72;
  --blue: #81b9ff;
  --line: rgba(245, 242, 235, 0.13);
  --line-strong: rgba(245, 242, 235, 0.24);
  --muted: rgba(245, 242, 235, 0.62);
  --faint: rgba(245, 242, 235, 0.4);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Newsreader, Iowan Old Style, Baskerville, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  --sidebar-width: 256px;
  --header-height: 82px;
  color-scheme: dark;
  font-synthesis: none;
}

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

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 76% -10%, rgba(47, 227, 139, 0.08), transparent 30rem),
    var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: inherit;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

::selection {
  background: var(--green);
  color: var(--ink);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-root {
  min-height: 100vh;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--paper);
  font-size: 1.22rem;
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1;
  text-decoration: none;
}

.wordmark span {
  color: var(--green);
}

.wordmark--large {
  font-size: clamp(1.35rem, 2vw, 1.65rem);
}

.wordmark--mobile {
  display: none;
}

.kicker {
  margin-bottom: 0.68rem;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.17em;
  line-height: 1.3;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(47, 227, 139, 0.1);
}

.login-view {
  display: grid;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
}

.login-story {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 100svh;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 70px);
  border-right: 1px solid var(--line);
  background:
    linear-gradient(138deg, rgba(47, 227, 139, 0.08), transparent 37%),
    var(--ink);
}

.login-story::before,
.login-story::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.login-story::before {
  top: 18%;
  right: -24%;
  width: 74%;
  aspect-ratio: 1;
  border: 1px solid rgba(47, 227, 139, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 70px rgba(47, 227, 139, 0.025),
    0 0 0 140px rgba(47, 227, 139, 0.018);
}

.login-story::after {
  right: 7%;
  bottom: 8%;
  width: 1px;
  height: 42%;
  background: linear-gradient(transparent, var(--green), transparent);
  opacity: 0.45;
}

.login-story__copy {
  max-width: 730px;
  padding: 10vh 0 8vh;
}

.login-story h1 {
  max-width: 11ch;
  margin-bottom: 1.5rem;
  font-family: var(--serif);
  font-size: clamp(3rem, 6.5vw, 6.8rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.96;
}

.login-story h1 em {
  color: rgba(245, 242, 235, 0.48);
  font-weight: 400;
}

.login-story__lede {
  max-width: 52ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.65;
}

.login-story__status {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-story__status > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-index {
  color: var(--green);
}

.login-panel {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(28px, 7vw, 96px);
  background: var(--ink-soft);
}

.login-card {
  width: min(100%, 460px);
}

.login-card__heading {
  margin-bottom: 2.3rem;
}

.login-card h2 {
  margin-bottom: 0.75rem;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4vw, 3.55rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.login-card__heading > p:last-child,
.login-help {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 1.2rem;
}

.field,
.filter-field,
.compact-filter,
.practice-field {
  display: grid;
  gap: 0.48rem;
}

.field label,
.filter-field label,
.compact-filter label,
.practice-field label {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  line-height: 1.25;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(245, 242, 235, 0.045);
  padding: 0.75rem 0.9rem;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

input:hover,
select:hover {
  border-color: rgba(245, 242, 235, 0.4);
}

input:focus,
select:focus {
  border-color: var(--green);
  background: rgba(47, 227, 139, 0.035);
  box-shadow: 0 0 0 4px rgba(47, 227, 139, 0.08);
  outline: none;
}

select {
  appearance: none;
  padding-right: 2.3rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.form-error {
  margin: 0;
  border-left: 2px solid var(--red);
  color: #ffc2bd;
  padding: 0.2rem 0 0.2rem 0.9rem;
  font-size: 0.9rem;
}

.login-help {
  margin: 1.5rem 0 0;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.6;
}

.button,
.text-button,
.icon-button,
.nav-item {
  border: 0;
  font: inherit;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.68rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button--wide {
  width: 100%;
  min-height: 52px;
  margin-top: 0.35rem;
}

.button--primary {
  background: var(--green);
  color: var(--ink);
}

.button--primary:hover {
  background: var(--green-bright);
}

.button--secondary {
  border-color: var(--line-strong);
  background: rgba(245, 242, 235, 0.05);
  color: var(--paper);
}

.button--secondary:hover {
  border-color: var(--green);
  background: rgba(47, 227, 139, 0.07);
}

.button--quiet {
  min-height: 38px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.button--quiet:hover {
  border-color: var(--line-strong);
  color: var(--paper);
}

.button__progress {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(11, 15, 12, 0.28);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

.text-button {
  min-height: 40px;
  background: transparent;
  padding: 0.4rem 0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 740;
  text-underline-offset: 4px;
}

.text-button:hover {
  text-decoration: underline;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  font-size: 1.35rem;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--green);
  color: var(--green);
}

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

.app-view {
  display: grid;
  min-height: 100svh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--ink);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 100svh;
  flex-direction: column;
  padding: 29px 22px 24px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(47, 227, 139, 0.045), transparent 34%),
    var(--ink-soft);
}

.sidebar__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.sidebar__close {
  display: none;
}

.primary-nav {
  display: grid;
  gap: 6px;
  margin-top: 64px;
}

.nav-item {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 48px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  background: transparent;
  padding: 0.6rem 0.7rem;
  color: var(--muted);
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.nav-item::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: -22px;
  width: 2px;
  border-radius: 2px;
  background: var(--green);
  content: "";
  opacity: 0;
  transform: scaleY(0.3);
  transition: opacity 150ms ease, transform 150ms ease;
}

.nav-item:hover {
  background: rgba(245, 242, 235, 0.045);
  color: var(--paper);
}

.nav-item.is-active,
.nav-item[aria-current="page"] {
  background: rgba(47, 227, 139, 0.08);
  color: var(--paper);
}

.nav-item.is-active::before,
.nav-item[aria-current="page"]::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav-item__index {
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
}

.nav-item__count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  padding: 0 6px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 750;
}

.sidebar__footer {
  margin-top: auto;
  padding: 20px 10px 0;
  border-top: 1px solid var(--line);
}

.service-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--paper-soft);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar__footer p {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1.55;
}

.nav-scrim {
  display: none;
}

.workspace {
  min-width: 0;
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(24px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 12, 0.9);
  backdrop-filter: blur(18px);
}

.workspace-header__left,
.workspace-header__tools,
.user-summary {
  display: flex;
  align-items: center;
}

.workspace-header__tools {
  width: 100%;
  justify-content: flex-end;
  gap: clamp(12px, 2vw, 24px);
}

.practice-field {
  width: min(280px, 31vw);
}

.practice-field select {
  min-height: 40px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  background-color: var(--ink-raised);
}

.user-summary {
  gap: 10px;
}

.user-summary__avatar {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(47, 227, 139, 0.32);
  border-radius: 50%;
  background: var(--green-deep);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 750;
}

.user-summary__text {
  display: grid;
  min-width: 0;
}

.user-summary__text strong {
  max-width: 180px;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary__text small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.59rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.mobile-nav-toggle {
  display: none;
  border: 0;
}

.mobile-nav-toggle span {
  display: block;
  width: 18px;
  height: 1px;
  background: currentColor;
}

.mobile-nav-toggle span + span {
  margin-top: 4px;
}

.workspace-main {
  width: min(100%, 1520px);
  margin: 0 auto;
  padding: clamp(34px, 5vw, 76px) clamp(22px, 4vw, 58px) 80px;
}

.page-heading,
.section-heading,
.panel__header,
.message-card header,
.message-card footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-heading {
  align-items: flex-end;
  margin-bottom: clamp(26px, 4vw, 46px);
}

.page-heading h1,
.section-heading h2,
.panel h3,
.message-card h3,
.lead-card h3,
.state-card h2,
.detail-dialog h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.page-heading h1 {
  margin-bottom: 0;
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  line-height: 0.95;
}

.page-heading__context {
  margin: 0 0 0.45rem;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.view-content {
  min-height: 380px;
  scroll-margin-top: calc(var(--header-height) + 28px);
}

.dashboard-section {
  display: grid;
  gap: 26px;
}

.section-heading {
  align-items: end;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  line-height: 1.05;
}

.section-heading p:last-child:not(.kicker) {
  max-width: 62ch;
  margin: 0.65rem 0 0;
  color: var(--muted);
}

.date-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.6rem 0.9rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--ink-soft);
}

.metric-card {
  position: relative;
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(22px, 2.6vw, 34px);
  border-right: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(245, 242, 235, 0.018), transparent);
}

.metric-card:last-child {
  border-right: 0;
}

.metric-card--accent::after {
  position: absolute;
  right: 22px;
  bottom: 21px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  content: "";
  box-shadow: 0 0 0 7px rgba(47, 227, 139, 0.08);
}

.metric-card__label,
.metric-card__note,
.report-card span,
.message-card time,
.lead-card time {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4vw, 4.3rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.metric-card__note {
  max-width: 22ch;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.71rem;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 20px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--ink-soft);
  padding: clamp(20px, 3vw, 30px);
}

.panel__header {
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel h3 {
  margin: 0;
  font-size: 1.55rem;
}

.record-list,
.message-list,
.report-list,
.lead-list {
  display: grid;
}

.record-list:empty::after,
.message-list:empty::after,
.report-list:empty::after,
.lead-list:empty::after {
  display: grid;
  min-height: 170px;
  place-items: center;
  color: var(--faint);
  content: "No records to show yet.";
  font-size: 0.83rem;
  text-align: center;
}

.filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink-soft);
  padding: 16px;
}

.filter-field {
  min-width: 150px;
}

.filter-field--grow {
  min-width: 210px;
  flex: 1;
}

.filter-field input,
.filter-field select,
.compact-filter select {
  min-height: 42px;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.compact-filter {
  width: min(230px, 34vw);
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink-soft);
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

th,
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: var(--paper-soft);
  font-size: 0.82rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(245, 242, 235, 0.022);
}

.table-action {
  text-align: right;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(245, 242, 235, 0.04);
  padding: 0.25rem 0.52rem;
  color: var(--paper-soft);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 680;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge[data-tone="positive"],
.badge[data-value="BOOKED"],
.badge[data-value="delivered"] {
  border-color: rgba(47, 227, 139, 0.28);
  background: rgba(47, 227, 139, 0.08);
  color: var(--green-bright);
}

.badge[data-tone="urgent"],
.badge[data-value="EMERGENCY"],
.badge[data-value="dead_letter"] {
  border-color: rgba(255, 123, 114, 0.32);
  background: rgba(255, 123, 114, 0.08);
  color: #ffaaa4;
}

.badge[data-tone="warning"],
.badge[data-value="retry"] {
  border-color: rgba(244, 196, 103, 0.32);
  background: rgba(244, 196, 103, 0.08);
  color: var(--amber);
}

.message-list,
.lead-list {
  gap: 12px;
}

.message-card,
.lead-card,
.report-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink-soft);
  padding: clamp(20px, 2.7vw, 28px);
}

.message-card header {
  align-items: flex-start;
}

.message-card h3,
.lead-card h3 {
  margin: 0.6rem 0 0;
  font-size: 1.55rem;
}

.message-card > p,
.lead-card p {
  max-width: 74ch;
  margin: 1rem 0 1.25rem;
  color: var(--muted);
  line-height: 1.65;
}

.message-card footer {
  align-items: center;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.report-list {
  gap: 10px;
}

.report-card {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) repeat(2, minmax(110px, 0.75fr)) minmax(140px, 1fr) auto;
  align-items: center;
  gap: 24px;
}

.report-card__date,
.report-card__metric,
.report-card__value {
  display: grid;
  gap: 5px;
}

.report-card time,
.report-card strong {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.report-card__value strong {
  color: var(--green);
  font-size: 1.5rem;
}

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

.lead-card__action {
  display: grid;
  flex: 0 0 auto;
  gap: 12px;
  justify-items: end;
}

.pagination {
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.state-card {
  display: flex;
  min-height: 300px;
  align-items: center;
  justify-content: center;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--ink-soft);
  padding: clamp(28px, 6vw, 70px);
  text-align: left;
}

.state-card > div:last-child {
  max-width: 510px;
}

.state-card h2 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.75rem, 3vw, 2.6rem);
}

.state-card p:last-child {
  margin: 0;
  color: var(--muted);
}

.state-card .button {
  margin-top: 1rem;
}

.state-card__spinner {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 2px solid rgba(47, 227, 139, 0.15);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.state-card__mark {
  display: inline-grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--green);
  font-family: var(--mono);
  font-size: 1.2rem;
}

.state-card--error .state-card__mark {
  border-color: rgba(255, 123, 114, 0.35);
  color: var(--red);
}

.detail-dialog {
  width: min(680px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--line-strong);
  background: var(--ink-soft);
  padding: 0;
  color: var(--paper);
  box-shadow: var(--shadow);
}

.detail-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  animation: drawer-in 210ms ease-out;
}

.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

.detail-dialog__rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--green);
}

.detail-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
}

.detail-dialog h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.detail-dialog__content {
  overflow-y: auto;
  padding: clamp(24px, 4vw, 42px);
  overscroll-behavior: contain;
}

@keyframes drawer-in {
  from { transform: translateX(38px); opacity: 0.5; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(390px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  padding: 12px 14px;
  color: var(--ink);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.toast p {
  margin: 0;
  font-size: 0.82rem;
}

.toast .icon-button {
  width: 32px;
  height: 32px;
  border-color: rgba(11, 15, 12, 0.18);
  color: var(--ink);
}

.toast__mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

/* Runtime-rendered dashboard components. These remain intentionally separate
   from the static shell templates so API data is inserted only after auth. */
.mono {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.practice-strip,
.incident-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink-soft);
  padding: 18px 22px;
}

.practice-strip > div:first-child {
  display: grid;
  gap: 4px;
}

.practice-strip .eyebrow,
.incident-banner .eyebrow,
.empty-state .eyebrow,
.error-state .eyebrow {
  margin: 0;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.practice-strip small {
  color: var(--muted);
}

.incident-banner {
  border-color: rgba(244, 196, 103, 0.3);
  background: rgba(244, 196, 103, 0.06);
}

.incident-banner h2 {
  margin: 4px 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 500;
}

.incident-banner p:last-child {
  margin: 0;
  color: var(--muted);
}

.metric-card > span:first-child,
.metric-card > small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-card > small {
  font-family: var(--sans);
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.5fr);
  gap: 20px;
  margin-top: 20px;
}

.table-wrap {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.panel > .table-wrap {
  margin: 0 -1px;
}

.data-table td strong,
.data-table td small {
  display: block;
}

.data-table td small {
  margin-top: 3px;
  color: var(--faint);
}

.summary-cell {
  max-width: 40ch;
  color: var(--muted);
  line-height: 1.5;
}

.badge--success,
.badge--accent {
  border-color: rgba(47, 227, 139, 0.28);
  background: rgba(47, 227, 139, 0.08);
  color: var(--green-bright);
}

.badge--danger {
  border-color: rgba(255, 123, 114, 0.32);
  background: rgba(255, 123, 114, 0.08);
  color: #ffaaa4;
}

.badge--warning {
  border-color: rgba(244, 196, 103, 0.32);
  background: rgba(244, 196, 103, 0.08);
  color: var(--amber);
}

.empty-state,
.error-state {
  display: grid;
  min-height: 210px;
  place-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
}

.empty-state h2,
.error-state h2 {
  margin: 8px 0;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
}

.empty-state p:last-child,
.error-state p:last-of-type {
  margin: 0;
  color: var(--muted);
}

.loading-state {
  display: grid;
  min-height: 300px;
  place-content: center;
  gap: 8px;
}

.loading-state span {
  width: min(440px, 70vw);
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ink-raised), rgba(47, 227, 139, 0.16), var(--ink-raised));
  background-size: 220% 100%;
  animation: skeleton 1.2s linear infinite;
}

.loading-state span:nth-child(2) { width: min(360px, 58vw); }
.loading-state span:nth-child(3) { width: min(260px, 45vw); }

@keyframes skeleton {
  to { background-position: -220% 0; }
}

.filter-panel {
  margin-bottom: 18px;
}

.filter-form {
  display: flex;
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink-soft);
  padding: 16px;
}

.filter-form label {
  display: grid;
  min-width: 170px;
  flex: 1;
  gap: 6px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-form label small {
  font-family: var(--sans);
  letter-spacing: 0;
  text-transform: none;
}

.filter-form input,
.filter-form select {
  min-height: 43px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--ink-raised);
  padding: 0.55rem 0.7rem;
  color: var(--paper);
}

.filter-form--short label {
  max-width: 280px;
}

.message-card.is-handled {
  opacity: 0.7;
}

.message-phone {
  color: var(--green) !important;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.report-grid,
.lead-grid {
  display: grid;
  gap: 12px;
}

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

.report-grid .report-card {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 20px;
}

.report-card > header,
.lead-card > header,
.lead-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.report-card > header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
}

.report-value {
  display: grid;
  gap: 4px;
  border-block: 1px solid var(--line);
  padding-block: 18px;
}

.report-value span,
.compact-stats dt,
.detail-meta span,
.detail-stats dt {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-value strong {
  color: var(--green);
  font-family: var(--serif);
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  font-weight: 500;
}

.report-value--large strong {
  font-size: clamp(3rem, 7vw, 5rem);
}

.compact-stats,
.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
}

.compact-stats > div,
.detail-stats > div {
  display: grid;
  gap: 5px;
  background: var(--ink-soft);
  padding: 12px;
}

.compact-stats dd,
.detail-stats dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.3rem;
}

.lead-grid .lead-card {
  align-items: stretch;
  flex-direction: column;
}

.lead-card > footer {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
}

.load-more {
  display: flex;
  justify-content: center;
  padding-top: 20px;
}

.detail-meta,
.flag-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 24px;
  background: var(--line);
}

.detail-meta > div,
.flag-list > div {
  display: grid;
  gap: 6px;
  background: var(--ink-soft);
  padding: 14px;
}

.detail-section {
  padding-block: 20px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
}

.detail-section p,
.detail-section small {
  color: var(--muted);
  line-height: 1.7;
}

.detail-section pre {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--paper-soft);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.toast-region.is-visible {
  border: 1px solid rgba(11, 15, 12, 0.18);
  border-radius: 12px;
  background: var(--paper);
  padding: 13px 16px;
  color: var(--ink);
  font-size: 0.84rem;
  box-shadow: var(--shadow);
}

@media (max-width: 1120px) {
  :root {
    --sidebar-width: 224px;
  }

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

  .metric-card:nth-child(2) {
    border-right: 0;
  }

  .metric-card:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .report-card {
    grid-template-columns: minmax(150px, 1.3fr) repeat(2, minmax(100px, 0.8fr)) auto;
  }

  .report-card__value {
    grid-column: 2 / span 2;
    grid-row: 2;
  }

  .report-card > .text-button {
    grid-column: 4;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 72px;
  }

  .app-view {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(340px, 88vw);
    height: 100dvh;
    transform: translateX(-103%);
    transition: transform 190ms ease;
  }

  .app-view.nav-open .sidebar,
  .app-view.is-nav-open .sidebar,
  .app-view[data-nav-open="true"] .sidebar {
    transform: translateX(0);
  }

  .sidebar__close {
    display: inline-grid;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(0, 0, 0, 0.66);
    opacity: 0;
    pointer-events: none;
    transition: opacity 190ms ease;
  }

  .app-view.nav-open .nav-scrim,
  .app-view.is-nav-open .nav-scrim,
  .app-view[data-nav-open="true"] .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-toggle {
    display: inline-grid;
  }

  .wordmark--mobile {
    display: inline-flex;
  }

  .workspace-header__left {
    gap: 12px;
  }

  .workspace-header {
    padding-inline: 18px;
  }

  .workspace-header__tools {
    width: auto;
  }

  .user-summary__text {
    display: none;
  }

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

  .filter-bar {
    flex-wrap: wrap;
  }

  .filter-field {
    flex: 1 1 180px;
  }

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

  .login-story {
    min-height: auto;
    padding-bottom: 38px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .login-story__copy {
    padding: 12vh 0 8vh;
  }

  .login-story h1 {
    font-size: clamp(3rem, 12vw, 5.6rem);
  }

  .login-panel {
    min-height: auto;
    padding-block: 72px;
  }
}

@media (max-width: 680px) {
  .workspace-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding-block: 13px;
  }

  .workspace-header__left {
    min-height: 42px;
  }

  .workspace-header__tools {
    width: 100%;
    justify-content: stretch;
    gap: 9px;
  }

  .practice-field {
    width: auto;
    flex: 1;
  }

  .practice-field label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .user-summary__avatar {
    width: 36px;
    height: 36px;
  }

  .button--quiet {
    width: 38px;
    min-height: 38px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  .button--quiet::before {
    content: "↗";
    font-size: 1rem;
  }

  .workspace-main {
    padding-top: 32px;
  }

  .page-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .page-heading__context {
    margin: 0;
  }

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

  .practice-strip,
  .incident-banner,
  .filter-form {
    align-items: stretch;
    flex-direction: column;
  }

  .split-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .filter-form label,
  .filter-form--short label {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .compact-stats,
  .detail-stats,
  .detail-meta,
  .flag-list {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .metric-card:nth-child(2),
  .metric-card:nth-child(-n + 2) {
    min-height: 160px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-card:last-child {
    border-bottom: 0;
  }

  .compact-filter {
    width: 100%;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-field,
  .filter-field--grow {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .message-card header,
  .message-card footer,
  .lead-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .message-card footer,
  .message-card footer .button,
  .lead-card__action,
  .lead-card__action .button {
    width: 100%;
  }

  .lead-card__action {
    justify-items: stretch;
  }

  .report-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .report-card__date {
    grid-column: 1 / -1;
  }

  .report-card__value {
    grid-column: 1 / -1;
    grid-row: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .report-card > .text-button {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: start;
  }

  .state-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-dialog {
    width: 100vw;
    border-left: 0;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }

  .login-story__status {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .wordmark--mobile {
    display: none;
  }

  .workspace-main {
    padding-inline: 16px;
  }

  .workspace-header {
    padding-inline: 14px;
  }

  th,
  td {
    padding-inline: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .status-dot,
  .toast__mark,
  .metric-card--accent::after {
    background: CanvasText;
  }

  .nav-item.is-active::before,
  .nav-item[aria-current="page"]::before,
  .detail-dialog__rail {
    background: Highlight;
  }
}
