/* notify.911medical.id Admin — design tokens (911 Medical / dashboard palette) */
:root {
  /* Primary (911 Medical) */
  --primary: #1e3a8a;
  --primary-hover: #2563eb;
  --primary-dark: #1e40af;
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --bg-light: #f9fafb;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --input-border: #d1d5db;

  /* Sidebar / top bar */
  --sidebar-bg: #1e3a8a;
  --sidebar-active: #2563eb;
  --sidebar-user-bg: rgba(37, 99, 235, 0.25);
  --header-fg: #ffffff;
  --header-fg-muted: rgba(255, 255, 255, 0.78);

  /* Semantic — success */
  --success-fg: #166534;
  --success-bg: #dcfce7;
  --success-icon: #047857;

  /* Semantic — error */
  --error-fg: #b91c1c;
  --error-fg-bright: #dc2626;
  --error-bg: #fef2f2;
  --error-bg-strong: #fee2e2;

  /* Priority bands */
  --priority-red-bg: #fee2e2;
  --priority-red-text: #b91c1c;
  --priority-orange-bg: #ffedd5;
  --priority-orange-text: #c2410c;
  --priority-yellow-bg: #fef9c3;
  --priority-yellow-text: #a16207;
  --priority-green-bg: #d1fae5;
  --priority-green-text: #047857;

  /* KPI / status icon colors */
  --kpi-green: #047857;
  --kpi-blue: #1d4ed8;
  --kpi-orange: #b45309;
  --kpi-red: #b91c1c;
  --kpi-purple: #6d28d9;
  --kpi-gray: #6b7280;

  /* SOP-style status (abu / hijau / biru / kuning / merah) */
  --sop-neutral-bg: #f3f4f6;
  --sop-neutral-text: #4b5563;
  --sop-success-bg: #d1fae5;
  --sop-success-text: #047857;
  --sop-info-bg: #dbeafe;
  --sop-info-text: #1d4ed8;
  --sop-warn-bg: #fef9c3;
  --sop-warn-text: #a16207;
  --sop-danger-bg: #fee2e2;
  --sop-danger-text: #b91c1c;

  /* Aliases — dipakai komponen admin yang ada */
  --bg-deep: var(--bg-light);
  --bg-mid: #f3f4f6;
  --surface: var(--card-bg);
  --surface-elevated: #ffffff;
  --border: var(--card-border);
  --border-strong: var(--input-border);
  --text: var(--text-dark);
  --accent: var(--primary-hover);
  --accent-dim: rgba(37, 99, 235, 0.12);
  --accent-hover: var(--primary-dark);
  --ok: var(--success-icon);
  --ok-bg: var(--success-bg);
  --err: var(--error-fg-bright);
  --err-bg: var(--error-bg);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 24px rgba(15, 23, 42, 0.08);
  --font-ui: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.admin-app {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg-light);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(30, 58, 138, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg-light) 0%, var(--bg-mid) 100%);
  background-attachment: fixed;
}

/* ——— Login (centered) ——— */
body.admin-app.layout-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

body.admin-app.layout-login .container {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 0;
}

/* ——— Skip link ——— */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.5rem;
  z-index: 200;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary-hover);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-120%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  outline: none;
  box-shadow: var(--focus-ring);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— Top bar (brand bar = sidebar palette) ——— */
.top {
  padding: 0.65rem 1.25rem;
  background: var(--sidebar-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

.top-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand--link {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  max-width: min(100%, 22rem);
}

.brand--link:hover .brand-text strong {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.brand--link:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.brand-logo {
  display: block;
  height: 2.75rem;
  width: auto;
  max-width: 8.25rem;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.brand strong {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--header-fg);
}

.brand .brand-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.82);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--header-fg);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.nav-toggle-bars {
  display: block;
  width: 1.1rem;
  height: 0.7rem;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 100% 2px no-repeat;
}

.nav-panel {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-panel-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  justify-content: flex-end;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--header-fg-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--header-fg);
  background: rgba(255, 255, 255, 0.1);
}

.nav-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.nav-link.is-active {
  color: #ffffff;
  background: var(--sidebar-active);
  border-color: transparent;
}

.nav-link.is-active:hover {
  color: #ffffff;
  background: var(--primary-hover);
}

.nav-logout {
  display: inline;
  margin: 0;
  margin-left: 0.25rem;
}

.top form.inline,
td form.inline {
  display: inline;
  margin: 0;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  margin-left: 0.25rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--header-fg-muted);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-logout:hover {
  color: var(--header-fg);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

.btn-logout:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ——— Main ——— */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3.5rem;
}

.page-head {
  margin-bottom: 1.75rem;
}

.page-head h1 {
  margin: 0 0 0.4rem;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
}

.page-head .lead,
.page-head + .lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 42rem;
}

.page-head .lead a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.page-head .lead a:hover {
  text-decoration: underline;
}

.toolbar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.toolbar-links .back-link {
  margin-bottom: 0;
}

.checkbox-fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

.fieldset-legend {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0;
  margin-bottom: 0.35rem;
}

.fieldset-hint {
  margin: 0 0 0.75rem;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.check-row input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.check-row code {
  font-size: 0.85em;
}

h2.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.form-section {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.form-section:first-of-type {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
}

/* ——— Flash ——— */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.flash-mark {
  flex-shrink: 0;
  font-weight: 800;
  line-height: 1.2;
}

.flash.ok .flash-mark {
  color: var(--ok);
}

.flash.err .flash-mark {
  color: var(--err);
}

.flash-body {
  flex: 1 1 auto;
  min-width: 0;
}

.flash.ok {
  background: var(--success-bg);
  border-color: rgba(22, 163, 74, 0.28);
  color: var(--success-fg);
}

.flash.err {
  background: var(--error-bg);
  border-color: rgba(220, 38, 38, 0.22);
  color: var(--error-fg);
}

.flash--banner {
  padding: 1.1rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-width: 2px;
}

.flash-dismiss {
  flex-shrink: 0;
  margin: -0.2rem -0.2rem -0.2rem 0;
  padding: 0.15rem 0.45rem;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  color: inherit;
  opacity: 0.75;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.flash-dismiss:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.06);
}

.flash-dismiss:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.flash--fade {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.flash-detail {
  margin-top: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 400;
}

.flash-detail summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.flash-detail-pre {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-mid);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ——— Dashboard cards ——— */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  list-style: none;
  padding: 0;
}

.dash-card {
  display: block;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}

.dash-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.dash-card:focus-visible {
  outline: none;
  box-shadow: var(--shadow-md), var(--focus-ring);
}

.dash-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--accent-dim);
  color: var(--kpi-blue);
}

.dash-card-icon svg {
  display: block;
}

.dash-section {
  margin-bottom: 2rem;
}

.dash-section--cards {
  margin-bottom: 0;
  margin-top: 0.25rem;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.dash-stats--primary {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.dash-stats--secondary {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.dash-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.dash-stat-icon {
  color: var(--kpi-green);
  margin-bottom: 0.15rem;
}

.dash-stat-icon svg {
  display: block;
}

.dash-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dash-stat-value--compact {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.dash-stat--secondary .dash-stat-value--compact {
  font-size: 0.78rem;
  font-weight: 600;
}

.dash-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  line-height: 1.35;
}

.dash-stat--primary {
  padding: 1rem 1.15rem;
  border-color: rgba(37, 99, 235, 0.22);
  background: linear-gradient(165deg, rgba(37, 99, 235, 0.06), var(--surface));
}

.dash-stat--primary .dash-stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--kpi-blue);
}

.dash-stat--primary .dash-stat-label {
  color: var(--text);
  opacity: 0.85;
}

.dash-stat--secondary .dash-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.dash-stat--secondary .dash-stat-label {
  font-size: 0.65rem;
  opacity: 0.9;
}

.dash-usage-link {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
}

.dash-usage-link a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.dash-usage-link a:hover {
  text-decoration: underline;
}

.dash-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.dash-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.dash-card code {
  font-size: 0.8em;
}

.note-box {
  margin-top: 1.75rem;
  padding: 1rem 1.15rem;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.note-box code {
  color: var(--accent);
}

.note-box a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.note-box a:hover {
  text-decoration: underline;
}

/* ——— Documentation page ——— */
.doc-page {
  max-width: 48rem;
}

.doc-toc {
  margin: 0 0 2rem;
  padding: 1rem 1.15rem;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.doc-toc-title {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.doc-toc-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text);
}

.doc-toc-list a {
  color: var(--primary-hover);
  font-weight: 600;
  text-decoration: none;
}

.doc-toc-list a:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

.doc-section {
  margin-bottom: 2.25rem;
  scroll-margin-top: 5rem;
}

.doc-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.doc-section p,
.doc-section ul {
  margin: 0 0 0.85rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
}

.doc-section ul {
  padding-left: 1.25rem;
}

.doc-section li {
  margin-bottom: 0.4rem;
}

.doc-section li:last-child {
  margin-bottom: 0;
}

.doc-steps {
  margin: 0;
  padding-left: 1.35rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
}

.doc-steps li {
  margin-bottom: 0.5rem;
}

.doc-pre {
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: auto;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

.doc-callout {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.55;
  border: 1px solid var(--border);
}

.doc-callout strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  color: var(--primary);
}

.doc-callout--info {
  background: var(--sop-info-bg);
  border-color: rgba(29, 78, 216, 0.22);
  color: var(--text-dark);
}

.doc-callout--info code {
  color: var(--sop-info-text);
}

.doc-callout--warn {
  background: var(--priority-yellow-bg);
  border-color: rgba(161, 98, 7, 0.25);
  color: var(--text-dark);
}

/* ——— Tables ——— */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data th,
.data td {
  text-align: left;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data thead th {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: rgba(37, 99, 235, 0.06);
  border-bottom: 1px solid var(--border-strong);
}

.data th.th--num,
.data td.td--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data tbody tr:last-child td {
  border-bottom: none;
}

.data tbody tr:hover td {
  background: rgba(37, 99, 235, 0.04);
}

.data td.cell-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.actions {
  white-space: nowrap;
}

.actions a {
  display: inline-flex;
  align-items: center;
  margin-right: 0.5rem;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
}

.actions a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.actions .btn-inline-danger {
  display: inline-flex;
  vertical-align: middle;
}

/* ——— Forms ——— */
.card {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-width: 440px;
  padding: 1.5rem 1.6rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.card.card--wide {
  max-width: 520px;
}

.card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card label .hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.9;
}

.card input:disabled,
.card select:disabled {
  opacity: 0.75;
  color: var(--text-muted);
}

input,
select,
textarea {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.5;
}

input:hover,
select:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: var(--border);
  background: var(--bg-mid);
}

button[type="submit"]:disabled,
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.15);
  transform: none;
  box-shadow: none;
}

button[type="submit"]:disabled:hover,
.btn-primary:disabled:hover {
  filter: grayscale(0.15);
}

button[type="submit"],
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(165deg, var(--primary-hover), var(--primary));
  color: #ffffff;
  cursor: pointer;
  align-self: flex-start;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.28);
  transition: filter 0.15s, transform 0.1s;
}

button[type="submit"]:hover,
.btn-primary:hover {
  filter: brightness(1.06);
}

button[type="submit"]:active,
.btn-primary:active {
  transform: scale(0.98);
}

button[type="submit"]:focus-visible,
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.35), var(--focus-ring);
}

button.danger,
button.btn-inline-danger {
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--error-bg);
  color: var(--error-fg);
  border: 1px solid rgba(220, 38, 38, 0.35);
  box-shadow: none;
}

button.danger:hover,
button.btn-inline-danger:hover {
  background: var(--error-bg-strong);
  color: var(--error-fg-bright);
  filter: none;
}

button.danger:focus-visible,
button.btn-inline-danger:focus-visible {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.back-link:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

/* ——— Login panel ——— */
.login-panel {
  width: 100%;
}

.login-panel .login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-panel .login-brand .login-logo {
  display: block;
  margin: 0 auto 0.85rem;
  max-width: 12rem;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.login-panel h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-panel .login-sub {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.login-panel .card {
  max-width: none;
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 0.12em 0.4em;
  border-radius: 4px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--primary-dark);
}

.breadcrumbs {
  margin-bottom: 1rem;
}

.breadcrumbs-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.breadcrumbs-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.breadcrumbs-list li + li::before {
  content: "/";
  color: rgba(107, 114, 128, 0.55);
  font-weight: 400;
  font-size: 0.75rem;
}

.breadcrumbs-list a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumbs-list a:hover {
  text-decoration: underline;
}

.breadcrumbs-current {
  color: var(--text);
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.list-toolbar--split {
  justify-content: space-between;
  align-items: flex-start;
}

.list-toolbar-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

/* ——— Add application dialog ——— */
.admin-dialog {
  width: min(92vw, 46rem);
  max-height: min(92vh, 44rem);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.admin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}

.admin-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.admin-dialog-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-dialog-x {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.admin-dialog-x:hover {
  color: var(--text);
  background: var(--bg-mid);
}

.admin-dialog-x:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.admin-dialog-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding: 1rem 1.15rem 0;
  overflow-y: auto;
  max-height: min(58vh, 30rem);
}

@media (min-width: 720px) {
  .admin-dialog-body {
    grid-template-columns: minmax(11rem, 16.5rem) minmax(0, 1fr);
    gap: 1.25rem 1.5rem;
    align-items: start;
  }
}

.access-help-panel {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.access-help-title {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.access-help-lead {
  margin: 0 0 0.65rem;
}

.access-help-list {
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
}

.access-help-list li {
  margin-bottom: 0.4rem;
}

.access-help-muted {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
}

.access-help-code {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.68rem;
  line-height: 1.45;
  overflow-x: auto;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.card.card--in-dialog {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.admin-dialog-fields {
  min-width: 0;
}

.admin-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}

.admin-dialog-footnote {
  margin: 0 1.15rem 1rem;
  text-align: center;
  font-size: 0.8125rem;
}

/* Fallback when <dialog>.showModal is missing or throws (older browsers / edge cases) */
.admin-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}

dialog.admin-dialog.admin-dialog--polyfill {
  position: fixed;
  z-index: 10001;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  max-height: min(92vh, 44rem);
}

.cell--time {
  white-space: nowrap;
}

.usage-detail-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.usage-detail-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.usage-meta-inline {
  max-width: none !important;
  width: 100%;
  margin-bottom: 1.5rem !important;
  padding: 1rem 1.15rem !important;
}

.usage-meta-inline-row {
  margin: 0 0 0.4rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.usage-meta-inline-row:last-child {
  margin-bottom: 0;
}

.usage-history-section {
  margin-bottom: 2rem;
}

.usage-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.usage-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.usage-tab:hover {
  color: var(--primary-hover);
  border-color: rgba(37, 99, 235, 0.35);
}

.usage-tab.is-active {
  color: #ffffff;
  background: linear-gradient(165deg, var(--primary-hover), var(--primary));
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.22);
}

.usage-failed-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(254, 242, 242, 0.65);
  border: 1px solid rgba(185, 28, 28, 0.2);
  border-radius: var(--radius-md);
}

.usage-delete-failed-form {
  margin: 0;
}

.usage-failed-toolbar-hint {
  margin: 0;
  font-size: 0.8rem;
}

.usage-tab-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
}

.usage-empty {
  margin: 0;
  padding: 1.25rem;
  background: var(--bg-mid);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.usage-history-table {
  font-size: 0.8125rem;
}

.usage-history-table .cell-wrap {
  max-width: 14rem;
}

.usage-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  background: var(--sop-neutral-bg);
  border: 1px solid var(--border);
}

.usage-pill--pending {
  color: var(--priority-yellow-text);
  background: var(--priority-yellow-bg);
  border-color: rgba(161, 98, 7, 0.28);
}

.usage-pill--sending {
  color: var(--sop-info-text);
  background: var(--sop-info-bg);
  border-color: rgba(29, 78, 216, 0.25);
}

.usage-pill--sent {
  color: var(--priority-green-text);
  background: var(--priority-green-bg);
  border-color: rgba(4, 120, 87, 0.22);
}

.usage-pill--failed {
  color: var(--sop-danger-text);
  background: var(--sop-danger-bg);
  border-color: rgba(185, 28, 28, 0.28);
}

.usage-history-error-row td {
  padding-top: 0.35rem;
  padding-bottom: 0.85rem;
  background: rgba(254, 242, 242, 0.85);
  border-bottom: 1px solid var(--border);
}

.usage-error-inline {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--err);
  margin-bottom: 0.35rem;
}

.usage-error-inline-pre {
  margin: 0;
  font-size: 0.72rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
  max-height: 6rem;
  overflow-y: auto;
}

.empty-state .empty-state-cta.btn-primary {
  margin-top: 0.65rem;
}

.list-search input {
  min-width: min(100%, 16rem);
}

.list-toolbar-clear {
  margin-bottom: 0;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.95rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary-hover);
  background: #ffffff;
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-secondary:hover {
  background: var(--accent-dim);
  border-color: var(--primary-hover);
  color: var(--primary-dark);
}

.btn-secondary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-compact {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1rem 0 1.5rem;
  font-size: 0.875rem;
}

.pagination-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.pagination-link:hover {
  text-decoration: underline;
}

.pagination-meta {
  color: var(--text-muted);
}

.field-error {
  margin: -0.35rem 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--err);
}

.form-fieldset {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-mid);
}

.form-fieldset-legend {
  padding: 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.65rem;
}

.profile-filter-input {
  flex: 1 1 10rem;
  min-width: 8rem;
}

.select-host-hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.empty-state--inline {
  margin: 0;
  padding: 2rem 1.25rem;
  background: transparent;
  border: none;
}

.empty-state-icon {
  display: flex;
  justify-content: center;
  color: var(--accent);
  opacity: 0.85;
  margin-bottom: 0.75rem;
}

.empty-state-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.empty-state-text {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.empty-state-cta {
  text-decoration: none;
}

button[type="submit"].is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

button[type="submit"].is-loading::after {
  content: "";
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: admin-spin 0.65s linear infinite;
}

@keyframes admin-spin {
  to {
    transform: rotate(360deg);
  }
}

.login-show-pw {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}

.login-show-pw input {
  width: auto;
  margin: 0;
}

.login-caps-hint {
  margin: -0.5rem 0 0;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-panel {
    flex: 1 1 100%;
    order: 3;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
  }

  .nav-panel.is-open {
    max-height: 70vh;
    overflow-y: auto;
  }

  .nav-panel-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0 0.75rem;
    justify-content: flex-start;
  }

  .nav-link {
    width: 100%;
  }

  .nav-logout {
    margin-left: 0;
    margin-top: 0.35rem;
  }

  .nav-logout .btn-logout {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .data--cards thead {
    display: none;
  }

  .data--cards tbody tr {
    display: block;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
  }

  .data--cards tbody tr:last-child {
    border-bottom: none;
  }

  .data--cards tbody td {
    display: block;
    padding: 0.35rem 0;
    border: none;
    text-align: left;
  }

  .data--cards tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
  }

  .data--cards tbody td.actions {
    padding-top: 0.65rem;
  }

  .data--cards tbody td.actions::before {
    content: "";
    display: none;
  }

  .empty-state-row td {
    padding: 0 !important;
  }

  .empty-state-row td::before {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .page-head h1 {
    font-size: 1.35rem;
  }
}
