/* certpilot dashboard stylesheet.
 *
 * One design system for every server-rendered page: spacing, type scale,
 * radius, colour tokens, status chips, cards, tables and forms. Light and dark
 * themes follow the operating system; no JavaScript and no external assets.
 */

:root {
  color-scheme: light dark;

  /* 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: 2.5rem;
  --space-8: 3rem;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.15rem;
  --text-xl: 1.4rem;
  --text-2xl: 1.75rem;

  /* Radius */
  --radius-sm: 0.3rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-pill: 999px;

  /* Light theme */
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-alt: #eef1f5;
  --text: #1c2430;
  --muted: #5b6675;
  --border: #d8dee6;
  --border-strong: #b7c1cd;
  --accent: #1f5fbf;
  --accent-hover: #174a99;
  --accent-soft: #e8f0fb;
  --focus: #1f5fbf;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);

  /* Status colours (AA on their backgrounds) */
  --ok-bg: #e7f6ec;
  --ok-text: #17643a;
  --ok-border: #b7e2c6;
  --due-bg: #fff6d6;
  --due-text: #6b4e00;
  --due-border: #f0d27a;
  --failing-bg: #fde8e8;
  --failing-text: #9b1c1c;
  --failing-border: #f5b5b5;
  --offline-bg: #eceff3;
  --offline-text: #3b4655;
  --offline-border: #c9d1dc;
  --revoked-bg: #fbe9ef;
  --revoked-text: #8a1f3c;
  --revoked-border: #efc2d0;
  --pending-bg: #eaf2fb;
  --pending-text: #174a8a;
  --pending-border: #b9d3ef;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b2129;
    --surface-alt: #232b35;
    --text: #e6edf5;
    --muted: #9aa6b6;
    --border: #2c3542;
    --border-strong: #3a4654;
    --accent: #6ea8ff;
    --accent-hover: #9bc3ff;
    --accent-soft: #1d2c40;
    --focus: #9bc3ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 1px 3px rgb(0 0 0 / 0.45);

    --ok-bg: #16351f;
    --ok-text: #8fe0ab;
    --ok-border: #2c5a3a;
    --due-bg: #3a2f0c;
    --due-text: #f3d27a;
    --due-border: #6b5518;
    --failing-bg: #3a1717;
    --failing-text: #ff9c9c;
    --failing-border: #6b2a2a;
    --offline-bg: #232a33;
    --offline-text: #c2ccd9;
    --offline-border: #3a4654;
    --revoked-bg: #331b2a;
    --revoked-text: #e9a8c8;
    --revoked-border: #5c2f4a;
    --pending-bg: #16273a;
    --pending-text: #a8cbf5;
    --pending-border: #2c4a6b;
  }
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.shell {
  max-width: 72rem;
  min-width: 0;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-8);
}

/* Skip link: visible on keyboard focus, otherwise out of the way. */
.skip-link {
  position: absolute;
  left: -999rem;
  top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 10;
}
.skip-link:focus {
  left: var(--space-4);
}

/* Top navigation */
.topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.topbar nav {
  min-width: 0;
}
.brand {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}
.nav-list a:hover {
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
}
.nav-list a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted);
  min-width: 0;
  overflow-wrap: anywhere;
}
.nav-secondary form {
  margin: 0;
}
.logout-form {
  display: inline;
  margin: 0;
}
.nav-secondary button.logout-link {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.nav-secondary button.logout-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}

/* Page header */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.page-header h1 {
  margin: 0 0 var(--space-1);
}
.page-header .subtitle {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  max-width: 52rem;
}
.page-header .header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

h1 {
  font-size: var(--text-xl);
  line-height: 1.25;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
}
h2 {
  font-size: var(--text-lg);
  line-height: 1.3;
  margin: var(--space-6) 0 var(--space-3);
}
h3 {
  font-size: var(--text-base);
  margin: var(--space-4) 0 var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
}
.muted {
  color: var(--muted);
}
.error {
  color: var(--failing-text);
}
.small {
  font-size: var(--text-sm);
}

/* Links and buttons */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}
button:hover,
.button:hover {
  background: var(--surface-alt);
  text-decoration: none;
}
.button-primary,
button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.button-primary:hover,
button[type="submit"]:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}
.button-secondary,
button.button-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.button-secondary:hover,
button.button-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
  color: var(--text);
}
.button-danger,
button.button-danger {
  background: var(--failing-bg);
  border-color: var(--failing-border);
  color: var(--failing-text);
}
.button-danger:hover,
button.button-danger:hover {
  background: var(--failing-border);
  color: var(--failing-text);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-6);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}
.card h2,
.card h3 {
  margin-top: 0;
}
.card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 var(--space-2);
}
.attention-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.attention-card .attention-count {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
}
.attention-card .attention-label {
  font-weight: 600;
}
.attention-card .attention-detail {
  color: var(--muted);
  font-size: var(--text-sm);
}
.attention-card a {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}
.attention-card.is-attention {
  border-color: var(--due-border);
  background: var(--due-bg);
  color: var(--due-text);
}
.attention-card.is-attention .attention-count,
.attention-card.is-attention .attention-detail {
  color: var(--due-text);
}
.attention-card.is-clear {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
}
.attention-card.is-clear .attention-count,
.attention-card.is-clear .attention-detail {
  color: var(--ok-text);
}
.attention-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}
.attention-links a {
  margin-top: 0;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: var(--space-3) 0 var(--space-5);
}
table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  font-size: var(--text-sm);
}
th,
td {
  text-align: left;
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
td {
  overflow-wrap: anywhere;
}
th {
  background: var(--surface-alt);
  font-weight: 600;
  white-space: normal;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--surface-alt);
}

/* Status chips: colour + text label + a small shape, never colour alone. */
.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.1rem var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.chip::before,
.badge::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  background: currentColor;
  border-radius: 50%;
}
.chip-ok,
.badge-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}
.chip-due,
.badge-warn {
  background: var(--due-bg);
  color: var(--due-text);
  border-color: var(--due-border);
}
.chip-failing,
.badge-danger {
  background: var(--failing-bg);
  color: var(--failing-text);
  border-color: var(--failing-border);
}
.chip-offline {
  background: var(--offline-bg);
  color: var(--offline-text);
  border-color: var(--offline-border);
}
.chip-revoked,
.badge-expired {
  background: var(--revoked-bg);
  color: var(--revoked-text);
  border-color: var(--revoked-border);
}
.chip-pending {
  background: var(--pending-bg);
  color: var(--pending-text);
  border-color: var(--pending-border);
}
.chip-expired {
  background: var(--revoked-bg);
  color: var(--revoked-text);
  border-color: var(--revoked-border);
}
.chip-failing::before {
  border-radius: 0;
  transform: rotate(45deg);
}
.chip-offline::before {
  border-radius: 2px;
}
.chip-revoked::before,
.chip-expired::before {
  border-radius: 0;
}
.chip-due::before {
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.chip-pending::before {
  background: transparent;
  border: 1.5px dashed currentColor;
}

/* Forms */
form {
  margin: var(--space-3) 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--space-3) var(--space-5);
  align-items: start;
}
.form-row {
  margin: 0 0 var(--space-4);
  max-width: 36rem;
}
.form-row label,
label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}
.form-row .help,
.help {
  display: block;
  color: var(--muted);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}
.form-row .field-error {
  display: block;
  color: var(--failing-text);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}
input,
select,
textarea {
  font: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  max-width: 100%;
}
input[type="checkbox"] {
  width: auto;
  margin-right: var(--space-1);
}
.form-row input:not([type="checkbox"]),
.form-row select,
.form-row textarea {
  width: 100%;
}
label > input[type="checkbox"] {
  display: inline-block;
  vertical-align: middle;
}
.checkbox-row,
.form-row.checkbox-row label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.checkbox-row {
  margin-bottom: var(--space-4);
}
.form-row.checkbox-row label {
  margin-bottom: 0;
}
.checkbox-row input[type="checkbox"] {
  margin: 0;
}

/* Add agent wizard */
.wizard-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  margin: 0 0 var(--space-5);
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-sm);
}
.wizard-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
}
.wizard-step.done {
  color: var(--text);
}
.wizard-step.done .wizard-step-num {
  background: var(--ok-bg);
  color: var(--ok-text);
}
.wizard-step.current {
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
.wizard-step.current .wizard-step-num {
  background: var(--accent);
  color: #fff;
}
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-3);
}
label.platform-card {
  display: block;
  font-weight: 400;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
}
label.platform-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
label.platform-card input {
  margin-right: var(--space-2);
}
label.platform-card .platform-name {
  font-weight: 600;
}
label.platform-card .platform-desc {
  display: block;
  color: var(--muted);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}
.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
label.radio-option {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-weight: 400;
  margin: 0;
}
label.radio-option input {
  margin: 0;
}
.checklist {
  margin: 0 0 var(--space-5);
  padding-left: 1.25rem;
  display: grid;
  gap: var(--space-2);
}
.checklist li {
  line-height: 1.5;
}
.checklist-note {
  color: var(--failing-text);
}

textarea {
  width: 100%;
  min-height: 8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-5);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filters label {
  margin-bottom: 0;
}
.filters select,
.filters input {
  display: block;
  margin-top: var(--space-1);
}
.login {
  max-width: 22rem;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login input {
  width: 100%;
}
.login input[type="checkbox"] {
  width: auto;
}

/* Progressive-enhancement fieldsets on the Add device form. With JavaScript
 * off every fieldset stays visible; the inline script hides the groups that do
 * not match the selected device type and disables their inputs. */
fieldset.type-fields {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-4);
}
fieldset.type-fields legend {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}
fieldset.type-fields[hidden] {
  display: none !important;
}
tr.row-revoked td {
  color: var(--muted);
}
.agent-name,
.customer-name,
.install-mode {
  white-space: nowrap;
}
time {
  white-space: nowrap;
}

/* Notices after redirects and inline errors */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--text-sm);
}
.notice-success {
  border-color: var(--ok-border);
  border-left-color: var(--ok-text);
  background: var(--ok-bg);
  color: var(--ok-text);
}
.notice-error {
  border-color: var(--failing-border);
  border-left-color: var(--failing-text);
  background: var(--failing-bg);
  color: var(--failing-text);
}
.notice-info {
  border-color: var(--pending-border);
  border-left-color: var(--pending-text);
  background: var(--pending-bg);
  color: var(--pending-text);
}

/* Empty states */
.empty-state {
  padding: var(--space-6) var(--space-4);
  margin: var(--space-4) 0 var(--space-5);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}
.empty-state strong {
  display: block;
  color: var(--text);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}
.empty-state .button {
  margin-top: var(--space-3);
}

/* Confirmation pages */
.confirm-card {
  max-width: 34rem;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--failing-border);
  border-left: 4px solid var(--failing-text);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.confirm-card h2 {
  margin-top: 0;
}

/* Code and preformatted text */
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1rem 0.3rem;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  overflow-x: auto;
  margin: var(--space-2) 0 var(--space-3);
}
pre.fleet-summary {
  max-height: 22rem;
}

/* Licensing banner */
.license-banner {
  max-width: none;
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--due-bg);
  border: 1px solid var(--due-border);
  color: var(--due-text);
  border-radius: var(--radius);
}

/* Action tiles on the device page: a responsive grid of buttons, each with
 * one plain sentence describing the action. */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--space-3);
}
.action-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.action-tile .button {
  align-self: flex-start;
}
.action-tile p {
  margin: 0;
  font-size: var(--text-sm);
}

/* Compact per-row action menu on the Agents page: a "Run…" disclosure that
 * opens a small popover-style panel with the action buttons. */
/* Agents table actions. The table wrapper scrolls horizontally, which also
 * clips vertically, so the Run… menu opens in the row (the row grows)
 * instead of as a floating popover that would be cut off. */
.button-small {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}
.row-actions {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  white-space: nowrap;
}
.row-menu {
  display: inline-block;
}
.row-menu > summary {
  list-style: none;
}
.row-menu > summary::-webkit-details-marker {
  display: none;
}
.row-menu > summary::after {
  content: " ▾";
}
.row-menu[open] > summary::after {
  content: " ▴";
}
.row-menu-panel {
  margin-top: var(--space-2);
  min-width: 12rem;
  padding: var(--space-3);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: normal;
}
.row-menu-panel form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.row-menu-panel label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
}
.row-menu-panel details summary {
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  list-style: none;
  font-size: var(--text-sm);
  font-weight: 600;
}
.row-menu-panel details summary::before {
  content: "▸ ";
}
.row-menu-panel details[open] summary::before {
  content: "▾ ";
}
.row-menu-panel details[open] {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.row-menu summary:focus-visible,
.row-menu-panel details summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Responsive: stack the header below 900 px; keep one row at desktop widths
 * (brand · nav · signed-in user + Log out). */
@media (max-width: 899px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar nav {
    width: 100%;
  }
  .nav-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
  }
  .nav-list a {
    white-space: nowrap;
  }
}

/* Responsive: phone width. Tables scroll inside their container. */
@media (max-width: 640px) {
  .shell {
    padding: var(--space-3) var(--space-3) var(--space-6);
  }
  .page-header {
    flex-direction: column;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .action-grid {
    grid-template-columns: 1fr;
  }
  .row-menu-panel {
    position: static;
    min-width: 0;
    box-shadow: none;
  }
  h1 {
    font-size: var(--text-lg);
  }
}

/* Getting started checklist on the Overview (global admins only). */
.onboarding-checklist {
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.onboarding-checklist h2 {
  margin-top: 0;
}
.onboarding-checklist ol {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
}
.onboarding-checklist li {
  margin: var(--space-1) 0;
}
.onboarding-checklist li.done {
  color: var(--muted);
}
.onboarding-checklist .check {
  font-weight: 700;
}
.onboarding-checklist form {
  margin-top: var(--space-3);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
