:root {
  /* ── Typography ────────────────────────────────────────── */
  --font-family-sans: Inter, "Segoe UI", Arial, sans-serif;
  --font-size-1: 0.875rem;
  --font-size-2: 1rem;
  --font-size-3: 1.125rem;
  --font-size-4: 1.375rem;
  --font-size-5: 1.75rem;

  /* ── Spacing scale ─────────────────────────────────────── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  /* ── Border radius ─────────────────────────────────────── */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  /* ── Colour palette ────────────────────────────────────── */
  --bg: #f7f8fc;
  --bg-accent-1: #ecefff;
  --bg-accent-2: #fef3f7;
  --panel: #ffffff;
  --panel-border: #dfe6f2;
  --text: #111a28;
  --muted: #5d6b82;
  --link: #355dff;
  --primary-start: #5669ff;
  --primary-end: #7a47ff;
  --primary-text: #ffffff;
  --secondary-bg: #edf2ff;
  --secondary-border: #d1dcff;
  --secondary-text: #1e2a48;
  --danger-bg: #ffe8ee;
  --danger-border: #ffc8d6;
  --danger-text: #b42345;
  --topbar-start: #0f1a30;
  --topbar-mid: #1d2f52;
  --topbar-end: #2b2f67;
  --topbar-text: #f5f8ff;
  --input-bg: #ffffff;
  --table-border: #e7ecf5;
  --pill-bg: #edf2ff;
  --pill-border: #d7e1ff;
  --pill-text: #243b7b;

  /* ── Shadows & effects ─────────────────────────────────── */
  --ring: rgba(86, 105, 255, 0.35);
  --shadow-soft: 0 2px 8px rgba(32, 51, 84, 0.06), 0 8px 24px rgba(32, 51, 84, 0.09);
  --shadow-lift: 0 8px 18px rgba(39, 65, 126, 0.14), 0 20px 48px rgba(86, 105, 255, 0.18);
  --shadow-card: 0 1px 3px rgba(32, 51, 84, 0.07), 0 6px 20px rgba(32, 51, 84, 0.08);

  /* ── Transitions ───────────────────────────────────────── */
  --transition-fast: 110ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-mid: 200ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-slow: 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  --bg: #0d1220;
  --bg-accent-1: #1a2442;
  --bg-accent-2: #301b3d;
  --panel: #121a2b;
  --panel-border: #26324a;
  --text: #e8edf9;
  --muted: #aab7d2;
  --link: #8ca7ff;
  --primary-start: #7a89ff;
  --primary-end: #9a6cff;
  --primary-text: #f8fbff;
  --secondary-bg: #1a263f;
  --secondary-border: #33456b;
  --secondary-text: #dbe7ff;
  --danger-bg: #391b28;
  --danger-border: #643248;
  --danger-text: #ffc5d5;
  --topbar-start: #090f1e;
  --topbar-mid: #131f3b;
  --topbar-end: #241f4a;
  --topbar-text: #ecf2ff;
  --input-bg: #0e1729;
  --table-border: #25324d;
  --pill-bg: #1a2743;
  --pill-border: #32466f;
  --pill-text: #d0ddff;
  --ring: rgba(122, 137, 255, 0.45);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.28), 0 8px 28px rgba(0, 0, 0, 0.38);
  --shadow-lift: 0 8px 20px rgba(0, 0, 0, 0.38), 0 20px 48px rgba(85, 102, 255, 0.28);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-2);
  line-height: 1.5;
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 10% -10%, var(--bg-accent-1) 0%, transparent 36%),
    radial-gradient(circle at 90% -15%, var(--bg-accent-2) 0%, transparent 34%),
    var(--bg);
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
}

h2 {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
}

h3 {
  font-size: clamp(1.05rem, 1.7vw, 1.2rem);
}

.container {
  width: min(1800px, calc(100vw - 2rem));
  margin: 0 auto;
}

.topbar {
  background: linear-gradient(120deg, var(--topbar-start) 0%, var(--topbar-mid) 55%, var(--topbar-end) 100%);
  color: var(--topbar-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 26px rgba(12, 19, 38, 0.25);
}

.topbar .container {
  padding: var(--space-4) 0;
}

.topbar-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  font-weight: 700;
  color: var(--topbar-text);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-logo {
  width: clamp(168px, 21vw, 224px);
  height: auto;
  display: block;
}

.brand-logo-mobile {
  width: 34px;
  height: 34px;
  display: none;
  border-radius: 10px;
}

.topbar a {
  color: var(--topbar-text);
}

.topbar-nav {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar .topbar-btn {
  background: var(--secondary-bg);
  border-color: var(--secondary-border);
  color: var(--secondary-text);
}

.topbar .topbar-btn:hover {
  background: #e7eeff;
}

.topbar-separator {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.3);
}

.tenant-brand-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.36rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.tenant-brand-mini img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
}

a {
  color: var(--link);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.between {
  justify-content: space-between;
}

.gap {
  gap: var(--space-3);
}

.wrap {
  flex-wrap: wrap;
}

main.container {
  padding: var(--space-5) 0 var(--space-6);
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-4);
}

.hero h1 {
  margin-top: 0;
}

.hero-mark {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(72, 89, 184, 0.28);
  margin-bottom: 0.55rem;
}

.narrow {
  max-width: 620px;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stack {
  display: grid;
  gap: var(--space-3);
}

label {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  padding: 0.68rem 0.8rem;
  color: var(--text);
  transition: border-color var(--transition-mid), box-shadow var(--transition-mid), transform var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid var(--ring);
  border-color: var(--primary-start);
}

.btn-primary,
.btn-secondary,
.btn-danger {
  border-radius: 12px;
  padding: 0.6rem 0.95rem;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-mid), background var(--transition-mid), border-color var(--transition-mid);
}

.btn-primary {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  color: var(--primary-text);
  box-shadow: 0 8px 22px rgba(86, 105, 255, 0.35);
}

.btn-secondary {
  border: 1px solid var(--secondary-border);
  background: var(--secondary-bg);
  color: var(--secondary-text);
}

.btn-danger {
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lift);
}

.btn-secondary:hover {
  background: #e7eeff;
}

.btn-danger:hover {
  background: #ffe0e8;
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: translateY(0);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
  opacity: 0.68;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.theme-fab {
  position: fixed;
  left: 1rem;
  right: auto;
  bottom: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--secondary-border);
  background: var(--secondary-bg);
  color: var(--secondary-text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  z-index: 50;
}

.ai-assistant-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  color: var(--primary-text);
  box-shadow: var(--shadow-lift);
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  z-index: 61;
}

.ai-assistant-fab:hover {
  transform: translateY(-1px);
}

.ai-assistant-fab:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.ai-assistant-panel {
  position: fixed;
  right: 1rem;
  bottom: 4.4rem;
  width: min(440px, calc(100vw - 2rem));
  height: min(640px, calc(100vh - 6rem));
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  resize: both;
  min-width: 320px;
  min-height: 360px;
  max-width: calc(100vw - 1rem);
  max-height: calc(100vh - 1rem);
  display: none;
  z-index: 60;
}

.ai-assistant-panel.is-open {
  display: flex;
  flex-direction: column;
}

.ai-assistant-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--panel-border);
  cursor: move;
  user-select: none;
}

.ai-assistant-panel iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--panel);
}

.ai-assistant-unread {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ff5f7a;
  border: 1px solid rgba(255, 255, 255, 0.6);
  margin-left: 0.35rem;
  display: none;
  box-shadow: 0 0 0 2px rgba(255, 95, 122, 0.28);
}

.ai-assistant-unread.show {
  display: inline-block;
}

body.ai-assistant-dragging {
  user-select: none;
}

.assistant-embed-body {
  margin: 0;
  background: transparent;
  color: var(--text);
}

.assistant-embed-main {
  height: 100vh;
  padding: 0;
}

.assistant-chat-shell {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.assistant-chat-shell-full {
  min-height: clamp(520px, 70vh, 760px);
}

.assistant-chat-shell-embedded {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.assistant-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(86, 105, 255, 0.08), rgba(86, 105, 255, 0)),
    var(--panel);
}

.assistant-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.assistant-chat-header p {
  margin: 0.2rem 0 0;
  font-size: var(--font-size-1);
}

.assistant-inline-notice {
  margin: 0.75rem;
}

.assistant-chat-history {
  padding: 1rem;
  overflow: auto;
  display: grid;
  gap: 0.95rem;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(86, 105, 255, 0.03), rgba(86, 105, 255, 0)),
    var(--bg);
}

.assistant-message {
  width: min(84%, 40rem);
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  padding: 0.75rem 0.85rem;
  box-shadow: 0 4px 12px rgba(20, 35, 66, 0.06);
  animation: assistantMessageIn var(--transition-mid) ease;
  transition: box-shadow var(--transition-mid), border-color var(--transition-mid), transform var(--transition-fast);
}

.assistant-message:hover {
  border-color: var(--secondary-border);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.assistant-message p {
  margin: 0;
}

.assistant-message p + p {
  margin-top: 0.3rem;
}

.assistant-message.assistant-message-user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(86, 105, 255, 0.14), rgba(122, 71, 255, 0.08));
  border-color: rgba(86, 105, 255, 0.28);
}

.assistant-message.assistant-message-bot {
  margin-right: auto;
  background: var(--panel);
}

.assistant-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.assistant-message-label {
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.assistant-message-provider {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.assistant-message-content {
  margin-top: 0.25rem;
  line-height: 1.55;
}

.assistant-message pre {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
}

.assistant-response-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
  opacity: 0.92;
  padding-top: 0.3rem;
  border-top: 1px dashed var(--table-border);
}

.assistant-tool-btn {
  border: 1px solid var(--panel-border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.4rem 0.66rem;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.assistant-tool-btn:hover {
  transform: translateY(-1px);
  border-color: var(--secondary-border);
  background: var(--secondary-bg);
}

.assistant-tool-btn:active {
  transform: translateY(0);
}

.assistant-tool-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.assistant-tool-vote {
  font-size: 0.95rem;
  padding-inline: 0.55rem;
}

.assistant-tool-vote.is-selected {
  border-color: rgba(86, 105, 255, 0.42);
  background: var(--secondary-bg);
}

.assistant-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0.9rem 0.85rem;
}

.assistant-chip {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--secondary-border);
  background: var(--secondary-bg);
  color: var(--secondary-text);
  font-weight: 600;
  padding: 0.45rem 0.82rem;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-mid), background var(--transition-mid);
}

.assistant-chip:hover {
  transform: translateY(-1px);
  background: #e7eeff;
}

.assistant-chip:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.assistant-chip-command {
  font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  letter-spacing: 0.01em;
}

.assistant-chat-composer {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  border-top: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(86, 105, 255, 0), rgba(86, 105, 255, 0.05)),
    var(--panel);
}

.assistant-chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
}

.assistant-chat-textarea {
  min-height: 52px;
  max-height: 140px;
  resize: none;
  border-radius: 16px;
  padding: 0.82rem 0.95rem;
  overflow-y: auto;
}

.assistant-send-button {
  min-width: 88px;
}

.assistant-composer-hint {
  margin: 0;
  font-size: 0.79rem;
  letter-spacing: 0.01em;
}

.assistant-empty-state {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
}

.assistant-empty-state p {
  margin: 0;
}

.assistant-empty-state p + p {
  margin-top: 0.35rem;
}

@keyframes assistantMessageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.assistant-page-layout {
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.8fr);
  align-items: start;
}

.theme-fab:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.theme-fab:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.session-toast {
  position: fixed;
  right: 1rem;
  bottom: 4.6rem;
  width: min(320px, calc(100vw - 2rem));
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-soft);
  padding: 0.72rem 0.8rem;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
}

.session-toast strong {
  display: block;
  margin-bottom: 0.35rem;
}

.session-toast p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.session-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.mobile-nav-toggle {
  display: none;
}

.muted {
  color: var(--muted);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.card-header h1,
.card-header h2,
.card-header h3 {
  margin: 0;
}

.card-subtitle {
  margin: 0;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  display: block;
  overflow-x: auto;
  min-width: 640px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--table-border);
  padding: 0.45rem 0.3rem;
  vertical-align: top;
}

.inline {
  display: inline-block;
  margin-right: 0.3rem;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.flash {
  border-radius: 12px;
  margin-bottom: 0.8rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.flash-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  transition: opacity var(--transition-fast);
}

.flash-dismiss:hover {
  opacity: 1;
}

.flash-info {
  background: #e9f1ff;
  border-color: #cadbff;
}

.flash-success {
  background: #e6faee;
  border-color: #bdebcf;
}

.flash-error {
  background: #ffeaee;
  border-color: #ffc9d5;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  color: var(--pill-text);
  padding: 0.2rem 0.56rem;
  font-size: 0.8rem;
}

.pill-approved,
.pill-complete,
.pill-active {
  background: #e6faee;
  border-color: #bdebcf;
  color: #19663b;
}

.pill-rejected,
.pill-disputed,
.pill-error,
.pill-cancelled,
.pill-canceled {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.pill-pending,
.pill-submitted,
.pill-not_requested {
  background: var(--secondary-bg);
  border-color: var(--secondary-border);
  color: var(--secondary-text);
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.avatar-image,
.avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 999px;
}

.avatar-image {
  object-fit: cover;
  border: 1px solid var(--panel-border);
}

.avatar-placeholder {
  display: grid;
  place-items: center;
  border: 1px solid var(--panel-border);
  background: var(--secondary-bg);
  color: var(--secondary-text);
  font-weight: 700;
}

.tenant-brand-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.tenant-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  padding: 0.3rem;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.dashboard-sidebar h3 {
  margin: 1rem 0 0.5rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.3rem;
  margin: 0.8rem 0 1rem;
}

.sidebar-nav-item {
  display: block;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
}

.sidebar-nav-item:hover {
  background: var(--secondary-bg);
  border-color: var(--secondary-border);
}

.sidebar-nav-item.active {
  background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  color: var(--primary-text);
  border-color: transparent;
}

.trial-banner {
  border-left: 4px solid var(--secondary-border);
}

.trial-banner-warning {
  border-left-color: var(--danger-border);
}

.plan-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.2rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-trial {
  background: var(--secondary-bg);
  border: 1px solid var(--secondary-border);
  color: var(--secondary-text);
}

.plan-active {
  background: #e6faee;
  border: 1px solid #bdebcf;
  color: #19663b;
}

.plan-canceled,
.plan-cancelled,
.plan-past_due,
.plan-unpaid,
.plan-incomplete {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.dashboard-main .card + .card {
  margin-top: 0;
}

/* Dashboard overview nav cards */
a.dashboard-nav-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

a.dashboard-nav-card:hover,
a.dashboard-nav-card:focus-visible {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
  border-color: var(--secondary-border);
  outline: none;
}

a.dashboard-nav-card:focus-visible {
  outline: 2px solid var(--primary-start);
  outline-offset: 2px;
}

a.dashboard-nav-card p.muted {
  margin-top: var(--space-2);
}

.skip-link {
  position: absolute;
  top: -999px;
  left: var(--space-3);
  background: var(--panel);
  color: var(--text);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  z-index: 1000;
}

.skip-link:focus {
  top: var(--space-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.stack.compact {
  gap: 0.45rem;
}

.section-toolbar {
  align-items: flex-end;
  margin-bottom: 0.9rem;
}

.table-action-group {
  display: grid;
  gap: 0.5rem;
  min-width: clamp(320px, 24vw, 560px);
  max-width: 100%;
}

.table-action-input {
  width: 100%;
  max-width: 100%;
}

.row-action-details {
  margin: 0;
}

.row-action-details summary {
  cursor: pointer;
  color: var(--link);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.row-action-details[open] summary {
  margin-bottom: var(--space-3);
}

.document-list {
  margin: 0;
  padding-left: 1rem;
}

.document-list > li + li {
  margin-top: var(--space-2);
}

td {
  overflow-wrap: anywhere;
}

@media (min-width: 1800px) {
  .container {
    width: min(3200px, calc(100vw - 3rem));
  }

  .dashboard-shell {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 1.25rem;
  }

  .card {
    padding: 1.35rem 1.45rem;
  }

  .table-action-group {
    min-width: clamp(360px, 22vw, 640px);
  }

  .assistant-page-layout {
    grid-template-columns: minmax(0, 1.85fr) minmax(340px, 1fr);
  }
}

@media (min-width: 2800px) {
  .container {
    width: min(3360px, calc(100vw - 4rem));
  }

  .dashboard-shell {
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 1.4rem;
  }

  .table-action-group {
    min-width: clamp(400px, 20vw, 720px);
  }
}

@media (max-width: 1080px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .assistant-page-layout {
    grid-template-columns: 1fr;
  }

  .table-action-group {
    min-width: min(320px, 88vw);
  }
}

@media (max-width: 820px) {
  .container {
    width: min(100%, 95vw);
  }

  .card {
    padding: 1rem;
  }

  .brand-logo {
    display: none;
  }

  .brand-logo-mobile {
    display: block;
  }

  .mobile-nav-toggle {
    display: inline-block;
    margin-left: auto;
  }

  .topbar-nav {
    display: none;
    width: 100%;
    padding-top: 0.6rem;
    justify-content: flex-start;
  }

  .topbar-nav.is-open {
    display: flex;
  }

  .topbar-nav form {
    margin: 0;
  }

  .topbar-separator {
    width: 100%;
    height: 1px;
    margin: 0.15rem 0;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .table-action-group {
    min-width: 0;
  }

  .ai-assistant-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    height: min(70vh, calc(100vh - 6rem));
    resize: none;
    min-width: auto;
    min-height: 0;
    max-width: none;
    max-height: none;
  }

  .ai-assistant-fab {
    right: 0.5rem;
    bottom: 0.5rem;
  }

  .theme-fab {
    left: 0.5rem;
    bottom: 0.5rem;
  }

  .assistant-chat-input {
    grid-template-columns: 1fr;
  }

  .assistant-send-button {
    width: 100%;
  }

  .assistant-message {
    width: min(94%, 100%);
  }

  table {
    min-width: 560px;
  }
}

/* ═══════════════════════════════════════════════════════════
   SPLASH / MARKETING PAGE
   ═══════════════════════════════════════════════════════════ */

/* Full-bleed layout overrides for the splash page */
body.splash-body {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(86, 105, 255, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% -5%, rgba(122, 71, 255, 0.14) 0%, transparent 50%),
    var(--bg);
}

.splash-main {
  padding: 0;
  width: 100%;
  max-width: 100%;
}

/* ── Hero ──────────────────────────────────────────────────── */

.splash-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(5rem, 12vw, 8rem) 0 clamp(4rem, 8vw, 6rem);
  text-align: center;
}

.splash-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.splash-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  background: var(--secondary-bg);
  border: 1px solid var(--secondary-border);
  color: var(--secondary-text);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.splash-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  flex-shrink: 0;
}

.splash-h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6.5vw, 4.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
  max-width: 14em;
}

.splash-gradient-text {
  background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-lead {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--muted);
  max-width: 42em;
  line-height: 1.65;
}

.splash-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
}

.splash-cta-primary {
  font-size: 1.05rem;
  padding: 0.8rem 1.6rem;
  border-radius: 14px;
}

.splash-cta-secondary {
  font-size: 1.05rem;
  padding: 0.8rem 1.6rem;
  border-radius: 14px;
}

.splash-tenant-context {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* Decorative blobs */
.splash-blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.splash-blob-1 {
  width: clamp(300px, 50vw, 640px);
  height: clamp(200px, 30vw, 420px);
  background: radial-gradient(ellipse, rgba(86, 105, 255, 0.22) 0%, transparent 70%);
  top: -10%;
  left: -8%;
}

.splash-blob-2 {
  width: clamp(280px, 40vw, 560px);
  height: clamp(180px, 28vw, 380px);
  background: radial-gradient(ellipse, rgba(122, 71, 255, 0.16) 0%, transparent 70%);
  top: -5%;
  right: -6%;
}

.splash-blob-3 {
  width: clamp(200px, 30vw, 400px);
  height: clamp(160px, 22vw, 300px);
  background: radial-gradient(ellipse, rgba(250, 180, 90, 0.1) 0%, transparent 70%);
  bottom: 5%;
  left: 40%;
}

/* ── Stats bar ─────────────────────────────────────────────── */

.splash-stats-bar {
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  background: var(--panel);
  padding: var(--space-5) 0;
}

.splash-stats-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.splash-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 2.5rem;
  text-align: center;
}

.splash-stat-num {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-stat-label {
  font-size: 0.84rem;
  color: var(--muted);
}

.splash-stat-divider {
  width: 1px;
  height: 36px;
  background: var(--panel-border);
  flex-shrink: 0;
}

/* ── Generic section layout ────────────────────────────────── */

.splash-section {
  padding: clamp(3.5rem, 7vw, 6rem) 0;
}

.splash-section-features {
  background: var(--bg);
}

.splash-section-how {
  background: var(--panel);
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
}

.splash-section-roles {
  background: var(--bg);
}

.splash-section-header {
  text-align: center;
  max-width: 54rem;
  margin: 0 auto var(--space-7);
}

.splash-eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary-start);
}

.splash-h2 {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.14;
  color: var(--text);
}

.splash-section-sub {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
}

/* ── Feature cards ─────────────────────────────────────────── */

.splash-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.splash-feature-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.5rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-mid), box-shadow var(--transition-mid), border-color var(--transition-mid);
}

.splash-feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--secondary-border);
}

.splash-feature-card h3 {
  margin: 0.75rem 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.splash-feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.splash-feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.splash-icon-indigo { background: linear-gradient(135deg, #eff2ff 0%, #e0e4ff 100%); }
.splash-icon-violet { background: linear-gradient(135deg, #f3f0ff 0%, #e8e1ff 100%); }
.splash-icon-sky    { background: linear-gradient(135deg, #ecf8ff 0%, #d7efff 100%); }
.splash-icon-emerald{ background: linear-gradient(135deg, #ecfaf2 0%, #d5f2e3 100%); }
.splash-icon-amber  { background: linear-gradient(135deg, #fff8ed 0%, #ffedcc 100%); }
.splash-icon-rose   { background: linear-gradient(135deg, #fff1f5 0%, #ffe3eb 100%); }

/* ── How it works ──────────────────────────────────────────── */

.splash-steps {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 52rem;
}

.splash-step {
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
}

.splash-step-number {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(86, 105, 255, 0.32);
  margin-top: 0.15rem;
}

.splash-step-content {
  flex: 1;
}

.splash-step-content h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.splash-step-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Roles ─────────────────────────────────────────────────── */

.splash-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.splash-role-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.4rem;
  box-shadow: var(--shadow-card);
  border-top-width: 3px;
}

.splash-role-admin       { border-top-color: #5669ff; }
.splash-role-locum-admin { border-top-color: #7a47ff; }
.splash-role-shift-admin { border-top-color: #0ea5e9; }
.splash-role-locum       { border-top-color: #10b981; }

.splash-role-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.splash-role-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.58;
}

.splash-role-cta {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}

.splash-role-cta:hover {
  text-decoration: underline;
}

/* ── Bottom CTA section ────────────────────────────────────── */

.splash-cta-section {
  padding: clamp(4rem, 8vw, 6.5rem) 0;
  background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  text-align: center;
}

.splash-cta-section-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.splash-cta-headline {
  color: #fff;
  max-width: 20em;
  margin: 0 auto;
}

.splash-cta-sub {
  color: rgba(255, 255, 255, 0.8);
  max-width: 40em;
  margin: 0 auto;
}

.splash-cta-section .btn-primary {
  background: #fff;
  color: var(--primary-start);
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.splash-cta-section .btn-primary:hover {
  background: #f0f3ff;
}

.splash-cta-section .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.splash-cta-section .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Footer ────────────────────────────────────────────────── */

.splash-footer {
  background: var(--topbar-start);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--space-6) 0;
}

.splash-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.splash-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.splash-footer-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.splash-footer-tagline {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(245, 248, 255, 0.5);
}

.splash-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.splash-footer-links a {
  color: rgba(245, 248, 255, 0.65);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

.splash-footer-links a:hover {
  color: rgba(245, 248, 255, 0.95);
}

.splash-footer-copy {
  margin: 0;
  font-size: 0.83rem;
  color: rgba(245, 248, 255, 0.4);
  width: 100%;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: var(--space-4);
  margin-top: var(--space-2);
}

/* ── Splash responsive ─────────────────────────────────────── */

@media (max-width: 820px) {
  .splash-stats-inner {
    gap: 0;
  }

  .splash-stat {
    padding: 0.5rem 1.2rem;
  }

  .splash-stat-divider {
    display: none;
  }

  .splash-steps {
    gap: var(--space-5);
  }

  .splash-footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .splash-footer-links {
    justify-content: center;
  }

  .splash-footer-copy {
    text-align: center;
  }
}
