/* ==========================================================================
   Nixtrail Telemetry — dashboard theme
   Dark, hairline-driven developer console.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces, from deepest to most elevated. */
  --bg: #0a0c10;
  --bg-well: #07090c;
  --surface: #101319;
  --surface-raised: #151a22;
  --surface-hover: #171d26;

  /* Hairlines. */
  --line: #1d222c;
  --line-strong: #2a313d;
  --line-bright: #38414f;

  /* Type. */
  --ink: #e8ecf3;
  --ink-soft: #aeb7c5;
  --muted: #7d8796;
  --faint: #5b6472;

  /* Accent — signal green. */
  --accent: #3fd68b;
  --accent-dim: #2eb974;
  --accent-deep: #1d7d4d;
  --accent-on: #04150c;
  --accent-soft: rgb(63 214 139 / 11%);
  --accent-line: rgb(63 214 139 / 30%);

  /* Data + state hues. */
  --blue: #63a9ff;
  --blue-soft: rgb(99 169 255 / 12%);
  --blue-line: rgb(99 169 255 / 28%);
  --amber: #f2b45c;
  --amber-soft: rgb(242 180 92 / 12%);
  --amber-line: rgb(242 180 92 / 28%);
  --red: #ff6f6f;
  --red-soft: rgb(255 111 111 / 12%);
  --red-line: rgb(255 111 111 / 30%);
  --violet: #ab8cff;
  --violet-soft: rgb(171 140 255 / 12%);

  /* Geometry. */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 9px;
  --r-lg: 13px;

  --topbar-h: 64px;
  --rail-w: 240px;

  --ring: 0 0 0 3px rgb(63 214 139 / 20%);
  --shadow: 0 24px 64px rgb(0 0 0 / 62%), 0 0 0 1px rgb(255 255 255 / 5%);
  --shadow-sm: 0 8px 24px rgb(0 0 0 / 45%);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Inter, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono",
    Menlo, Consolas, monospace;

  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 15px;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  color: var(--ink);
  background: rgb(63 214 139 / 26%);
}

* {
  scrollbar-width: thin;
  scrollbar-color: #2b333f transparent;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 8px;
  background: #2b333f;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a4453;
  background-clip: content-box;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

a {
  color: var(--accent);
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--accent);
}

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

[hidden] {
  display: none !important;
}

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

/* --------------------------------------------------------------------------
   Brand
   -------------------------------------------------------------------------- */

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.brand { color: var(--ink); text-decoration: none; }
.topbar .brand strong { font-size: 16px; letter-spacing: -.4px; }

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand strong {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Bootstrap + login
   -------------------------------------------------------------------------- */

.bootstrap-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--bg);
}

.bootstrap-brand {
  display: grid;
  justify-items: center;
  gap: 20px;
}

.bootstrap-spinner {
  width: 18px;
  height: 18px;
  animation: bootstrap-spin 640ms linear infinite;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
}

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

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 50% -8%, rgb(63 214 139 / 9%), transparent 68%),
    linear-gradient(90deg, rgb(255 255 255 / 2.6%) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(rgb(255 255 255 / 2.6%) 1px, transparent 1px) 0 0 / 34px 34px,
    var(--bg);
}

.login-panel {
  display: grid;
  width: min(100%, 392px);
  gap: 14px;
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 22px 0 4px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.login-step {
  display: grid;
  gap: 13px;
}

.login-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 450;
}

.remember-row input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.totp-input {
  font-family: var(--font-mono);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.32em;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template:
    "topbar topbar" var(--topbar-h)
    "sidebar workspace" minmax(0, 1fr) /
    var(--rail-w) minmax(0, 1fr);
}

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.topbar-context {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.topbar-actions .button-quiet {
  font-size: 12px;
}

.account-dropdown {
  position: relative;
  min-width: 0;
}

#account-button {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
}

#account-username {
  max-width: min(200px, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#account-button svg {
  flex-shrink: 0;
}

#account-button[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.account-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: 180px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.account-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  background: transparent;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  background: var(--surface-hover);
}

/* Project picker ---------------------------------------------------------- */

.shell-icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
}
.shell-icon-button:hover, .shell-icon-button[aria-expanded="true"] { background: var(--surface-hover); color: var(--ink); }
.topbar-context { gap: 24px; }
.topbar-actions { gap: 12px; }
.account-avatar { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--accent-line); border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
#account-button { min-height: 44px; padding: 4px 8px; }
.account-menu { width: 200px; padding: 6px; }
.account-menu button { min-height: 40px; padding: 10px 12px; font-size: 13px; }
.notification-dropdown { position: relative; }
.notifications-panel { position: absolute; top: calc(100% + 10px); right: 0; width: min(380px, calc(100vw - 24px)); max-height: calc(100dvh - 90px); overflow-y: auto; padding: 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow); }
.notifications-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notifications-panel h2 { margin: 0; font-size: 16px; }
.notifications-panel header p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.notifications-context { padding: 12px 0; margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; border-bottom: 1px solid var(--line); }
.notification-item { display: grid; gap: 6px; width: 100%; padding: 16px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.notification-item:hover { color: var(--accent); }
.notification-item strong { font-size: 13px; overflow-wrap: anywhere; }
.notification-item span { font-size: 11px; color: var(--muted); }
.notifications-panel footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.notifications-panel .overview-empty { padding: 20px 0; margin: 0; }
.project-picker-icon { flex-shrink: 0; color: var(--accent); }
.project-picker-chevron { flex-shrink: 0; color: var(--muted); }
.manage-projects-action { color: var(--muted); }
.manage-projects-action strong { font-size: 12px; }
.sidebar-backdrop { position: fixed; z-index: 25; inset: var(--topbar-h) 0 0; border: 0; background: rgb(0 0 0 / 55%); }
body.sidebar-modal-open { overflow: hidden; }
.app-shell.sidebar-collapsed { --rail-w: 76px; }
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .sidebar-action-label,
.sidebar-collapsed .project-picker-label,
.sidebar-collapsed .project-picker-chevron { display: none; }
.sidebar-collapsed .sidebar-action, .sidebar-collapsed .project-picker-button { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .project-picker-menu { left: calc(100% + 24px); bottom: 0; }
.apps-mode .management-layout { display: block; }
.apps-mode .management-project-detail { border: 0; padding: 0; }
#overview-retry { margin: 0 0 16px; }

@media (any-pointer: coarse) {
  .shell-icon-button { width: 44px; height: 44px; }
  .account-menu button, .picker-project { min-height: 44px; }
}

.project-picker {
  position: relative;
  min-width: 0;
}

.project-picker-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 9px 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}


.project-picker-button:hover,
.project-picker-button[aria-expanded="true"] {
  border-color: var(--line-bright);
  background: var(--surface-hover);
}

.project-picker-button > span:first-of-type {
  min-width: 0;
  flex: 1;
}

.project-picker-button small,
.project-picker-button strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-picker-button small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
}

.project-picker-button strong {
  font-size: 12.5px;
  font-weight: 600;
}

.project-picker-button > span:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.project-picker-menu {
  position: absolute;
  z-index: 60;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(320px, calc(100vw - 28px));
  max-height: calc(100dvh - 160px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.project-picker-menu input[type="search"] {
  min-height: 32px;
  font-size: 12.5px;
}

.project-picker-list {
  display: grid;
  max-height: min(280px, calc(100dvh - 260px));
  gap: 1px;
  margin: 8px 0;
  overflow-y: auto;
}

.picker-project,
.management-project-item {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.picker-project:hover,
.management-project-item:hover {
  background: var(--surface-hover);
}

.picker-project.active,
.management-project-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.picker-project strong,
.management-project-item strong {
  font-size: 12.5px;
  font-weight: 600;
}

.picker-project small,
.management-project-item small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 450;
}

/* Service state ----------------------------------------------------------- */

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px 0 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.service-state::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.service-state.healthy {
  color: var(--accent);
}

.service-state.healthy::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.service-state.unhealthy {
  color: var(--red);
}

.service-state.unhealthy::before {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.compact-field select {
  width: 112px;
}

/* --------------------------------------------------------------------------
   Sidebar rail
   -------------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  display: flex;
  grid-area: sidebar;
  height: calc(100dvh - var(--topbar-h));
  flex-direction: column;
  overflow: visible;
  border-right: 1px solid var(--line);
  background: var(--bg-well);
}

.sidebar-main {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-navigation {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 12px 10px;
}

.sidebar-label {
  margin: 2px 0 8px;
  padding-left: 9px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-heading {
  display: flex;
  height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-footer {
  flex-shrink: 0;
  display: grid;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-action {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  text-align: left;
  background: transparent;
  transition: color 120ms ease, background 120ms ease;
}

.sidebar-action:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.sidebar-action.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.sidebar-action.active::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 2px;
  height: 15px;
  transform: translateY(-50%);
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  content: "";
}

.sidebar-action-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.sidebar-action.active .sidebar-action-icon {
  color: var(--accent);
}

.sidebar-action strong {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
}

/* The rail reads as a list of destinations; the descriptions repeat the
   labels, so they are suppressed here and kept for assistive tech. */
.sidebar-action small {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Workspace
   -------------------------------------------------------------------------- */

.workspace {
  grid-area: workspace;
  min-width: 0;
  overflow: hidden;
  padding: 26px clamp(18px, 3.4vw, 44px) 72px;
}

.workspace > div,
.help-view,
.management-view,
.empty-state {
  width: min(100%, 1440px);
  margin: 0 auto;
}

/* Unified view header: identity on the left, live context on the right. */
.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.view-header-identity {
  min-width: 0;
}

.view-header-identity h1 {
  margin: 7px 0 5px;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.view-header-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.control-field {
  display: grid;
  gap: 6px;
}

.control-field > span,
.context-label {
  display: block;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.control-field select {
  width: min(190px, 22vw);
  min-height: 32px;
  font-size: 12.5px;
}

.control-divider {
  width: 1px;
  height: 32px;
  background: var(--line);
}

.project-slug {
  margin: 0;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow span + span::before {
  margin-right: 7px;
  color: var(--line-bright);
  content: "/";
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.environment-picker {
  display: inline-grid;
  grid-auto-columns: minmax(58px, 1fr);
  grid-auto-flow: column;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg-well);
}

.environment-picker button {
  min-height: 26px;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--r-xs);
  color: var(--muted);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 120ms ease, background 120ms ease;
}

.environment-picker button:hover {
  color: var(--ink);
}

.environment-picker button.active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.empty-state {
  display: grid;
  min-height: calc(100vh - 190px);
  place-content: center;
  justify-items: center;
  gap: 16px;
}

.empty-state h1 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 19px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Metric strip
   -------------------------------------------------------------------------- */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.story-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  display: grid;
  min-width: 0;
  min-height: 96px;
  align-content: center;
  gap: 6px;
  padding: 18px 20px;
}

.metric + .metric {
  border-left: 1px solid var(--line);
}

.metric span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.metric strong {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric .metric-time {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.metric small {
  color: var(--muted);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Story navigation
   -------------------------------------------------------------------------- */

.story-breadcrumbs {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  margin: 14px 0 20px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.story-breadcrumbs button {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  transition: color 120ms ease;
}

.story-breadcrumbs button:hover {
  color: var(--accent);
}

.story-breadcrumbs button:disabled {
  color: var(--ink-soft);
  cursor: default;
  opacity: 1;
}

.story-breadcrumbs span:last-child {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-view {
  min-width: 0;
}

.back-button {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: -4px 0 16px;
  padding: 4px 9px 4px 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.back-button:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 12px;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-heading p,
.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.story-heading {
  min-height: 48px;
  margin-bottom: 10px;
}

.story-heading h2 {
  font-size: 15px;
}

#installations-view .story-heading h2 {
  font-size: 20px;
}

#installations-status {
  color: var(--muted);
  font-size: 13px;
}

#installations-retry {
  margin-bottom: 14px;
}

.story-heading p {
  font-size: 11.5px;
}

.sessions-heading {
  margin-top: 30px;
}

.installation-search {
  width: min(300px, 100%);
}

.installation-search input {
  min-height: 32px;
  padding-left: 11px;
  font-size: 12.5px;
}

/* --------------------------------------------------------------------------
   Charts
   -------------------------------------------------------------------------- */

.installation-chart-panel {
  min-height: 300px;
  margin-bottom: 26px;
  padding: 16px 16px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.usage-chart-panel {
  margin-top: 26px;
}

.installation-chart-header {
  display: flex;
  min-height: 42px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.installation-chart-header h2 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 600;
}

.installation-chart-header p {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.chart-granularity {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.chart-window-control {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg-well);
}

.chart-window-control button {
  width: 38px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--r-xs);
  color: var(--muted);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  transition: color 120ms ease, background 120ms ease;
}

.chart-window-control button:hover {
  color: var(--ink);
}

.chart-window-control button.active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.chart-window-control button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.installation-chart {
  position: relative;
  width: 100%;
  min-height: 236px;
  overflow: hidden;
}

.installation-chart .uplot,
.installation-chart .u-legend {
  font-family: var(--font-mono);
}

.installation-chart .u-hz .u-cursor-x {
  border-right: 1px dashed var(--line-bright);
}

.installation-chart .u-hz .u-cursor-y {
  border-bottom: 1px dashed var(--line-bright);
}

.installation-chart .u-select {
  background: rgb(63 214 139 / 10%);
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  display: grid;
  max-width: min(220px, 100%);
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  background: rgb(21 26 34 / 97%);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  pointer-events: none;
}

.chart-tooltip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tooltip-when {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 450;
}

.chart-tooltip-value {
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.chart-empty {
  min-height: 236px;
  place-content: center;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
}

.chart-empty:not([hidden]) {
  display: grid;
}

.chart-wrap {
  position: relative;
  height: 230px;
  margin-top: 18px;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-wrap > .chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* --------------------------------------------------------------------------
   Data rows
   -------------------------------------------------------------------------- */

.story-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.installation-columns,
.session-columns,
.installation-row,
.session-row {
  display: grid;
  align-items: center;
  column-gap: 16px;
}

.installation-columns,
.installation-row {
  grid-template-columns:
    minmax(220px, 1.55fr)
    minmax(90px, 0.65fr)
    minmax(90px, 0.65fr)
    minmax(140px, 1fr)
    minmax(70px, 0.52fr)
    minmax(100px, 0.72fr)
    minmax(130px, 0.92fr)
    16px;
}

.session-columns,
.session-row {
  grid-template-columns:
    minmax(300px, 1.65fr)
    minmax(100px, 0.65fr)
    minmax(140px, 0.85fr)
    minmax(80px, 0.55fr)
    16px;
}

.installation-columns,
.session-columns {
  min-height: 34px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.installation-row,
.session-row {
  position: relative;
  width: 100%;
  min-height: 68px;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  background: transparent;
  transition: background 110ms ease;
}

.installation-row:last-child,
.session-row:last-child {
  border-bottom: 0;
}

.installation-row:hover,
.session-row:hover {
  background: var(--surface-hover);
}

.installation-row::before,
.session-row::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transition: opacity 110ms ease;
}

.installation-row:hover::before,
.session-row:hover::before {
  opacity: 1;
}

.installation-row:focus-visible,
.session-row:focus-visible {
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.installation-identity,
.session-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.installation-identity > span:last-child,
.session-identity > span:last-child,
.row-value {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.installation-identity strong,
.session-identity strong,
.row-value strong {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.installation-identity strong {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}

.installation-identity small,
.session-identity small,
.row-value small {
  overflow: hidden;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 450;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-value strong {
  font-variant-numeric: tabular-nums;
}

.installation-context-mobile {
  display: none;
}

.mini-device {
  position: relative;
  width: 21px;
  height: 33px;
  flex: 0 0 21px;
  border: 1.5px solid #4a5566;
  border-radius: 5px;
  background: linear-gradient(160deg, rgb(63 214 139 / 16%), rgb(99 169 255 / 13%));
}

.mini-device::before {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 7px;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: #4a5566;
  content: "";
}

.mini-device.ipados {
  width: 27px;
  flex-basis: 27px;
  border-radius: 4px;
}

.row-arrow {
  color: var(--line-bright);
  font-size: 19px;
  font-weight: 300;
  text-align: right;
  transition: color 110ms ease;
}

.installation-row:hover .row-arrow,
.session-row:hover .row-arrow {
  color: var(--accent);
}

.story-empty {
  display: grid;
  min-height: 150px;
  place-content: center;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.story-empty strong {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.story-empty span {
  font-size: 11px;
}

.load-more {
  display: block;
  margin: 14px auto 0;
}

/* --------------------------------------------------------------------------
   Installation detail
   -------------------------------------------------------------------------- */

.installation-hero,
.session-hero {
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 18px;
  padding: 0 0 20px;
}

.installation-hero > div:nth-child(2),
.session-hero > div:first-child {
  min-width: 0;
  flex: 1;
}

.installation-hero h2,
.session-hero h2 {
  margin: 4px 0 6px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.installation-hero p,
.session-hero p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-kicker {
  color: var(--accent) !important;
  font-family: var(--font-mono);
  font-size: 9.5px !important;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.device-mark {
  position: relative;
  width: 40px;
  height: 62px;
  flex: 0 0 40px;
  border: 2px solid #4f5b6c;
  border-radius: 9px;
  background: linear-gradient(155deg, rgb(63 214 139 / 20%), rgb(99 169 255 / 15%) 60%, rgb(171 140 255 / 15%));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 6%);
}

.device-mark::before {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 14px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: #4f5b6c;
  content: "";
}

.device-mark.ipados {
  width: 50px;
  flex-basis: 50px;
  border-radius: 7px;
}

.installation-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.trust-badge,
.presence-badge,
.session-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--amber-line);
  border-radius: var(--r-xs);
  color: var(--amber);
  background: var(--amber-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.trust-badge.verified,
.presence-badge {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.presence-badge.inactive {
  border-color: var(--amber-line);
  color: var(--amber);
  background: var(--amber-soft);
}

.fact-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.fact-strip > div {
  min-width: 0;
  padding: 14px 16px;
}

.fact-strip > div + div {
  border-left: 1px solid var(--line);
}

.fact-strip dt,
.technical-details dt {
  margin-bottom: 6px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.fact-strip dd,
.technical-details dd {
  overflow: hidden;
  margin: 0;
  font-size: 12px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Session detail
   -------------------------------------------------------------------------- */

.session-index {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.session-status {
  width: max-content;
  border-color: var(--line-strong);
  color: var(--muted);
  background: var(--bg-well);
}

.session-status.active {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.session-status.ended {
  border-color: var(--blue-line);
  color: var(--blue);
  background: var(--blue-soft);
}

.session-duration {
  display: grid;
  min-width: 140px;
  justify-items: end;
  gap: 3px;
}

.session-duration strong {
  font-family: var(--font-mono);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.session-duration span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.session-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.session-stats > div {
  display: grid;
  gap: 5px;
  padding: 13px 16px;
}

.session-stats > div + div {
  border-left: 1px solid var(--line);
}

.session-stats strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.session-stats span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.replay-shell {
  margin-top: 30px;
  padding: 22px 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.replay-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.replay-heading h3 {
  margin: 4px 0 0;
  font-size: 16px;
}

.replay-heading > span,
.replay-controls > span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.replay-stage-wrap {
  display: grid;
  min-height: 460px;
  place-items: center;
  overflow: hidden;
  background: #080b0f;
}

.replay-stage {
  position: relative;
  width: min(100%, 360px);
  max-height: 620px;
  overflow: hidden;
  background: #11161d;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 12%);
}

.replay-stage > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.replay-touches {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.replay-touches > span {
  position: absolute;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgb(50 224 141 / 42%);
  box-shadow: 0 0 0 5px rgb(50 224 141 / 18%);
}

.replay-controls {
  display: grid;
  grid-template-columns: 34px 34px 34px 42px minmax(120px, 1fr) 42px 72px;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.replay-frame-position {
  margin-top: 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.replay-controls input[type="range"] {
  width: 100%;
}

.replay-controls select {
  min-height: 32px;
  padding: 4px 8px;
}

.replay-loading {
  padding: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.form-section-heading {
  display: grid;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-section-heading small {
  color: var(--faint);
  font-size: 10.5px;
}

@media (max-width: 600px) {
  .replay-stage-wrap {
    min-height: 390px;
  }

  .replay-controls {
    grid-template-columns: 34px 34px 34px minmax(100px, 1fr) 64px;
  }

  .replay-controls > span {
    display: none;
  }

  .replay-controls select {
    width: 64px;
  }
}

/* Timeline ---------------------------------------------------------------- */

.timeline-shell {
  margin-top: 30px;
}

.timeline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.timeline-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.timeline-heading span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.session-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  display: grid;
  min-height: 88px;
  grid-template-columns: 86px 38px minmax(0, 1fr);
  align-items: stretch;
}

.timeline-item > time {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 3px;
  padding: 19px 12px 0 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.timeline-item > time span {
  color: var(--faint);
  font-size: 9px;
  font-weight: 450;
}

.timeline-rail {
  position: relative;
  display: grid;
  justify-items: center;
}

.timeline-rail::before {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
  content: "";
}

.timeline-item:first-child .timeline-rail::before {
  top: 24px;
}

.timeline-item:last-child .timeline-rail::before {
  bottom: calc(100% - 25px);
}

.timeline-marker {
  position: relative;
  z-index: 1;
  display: grid;
  width: 24px;
  height: 24px;
  margin-top: 13px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-raised);
  font-size: 11px;
  font-weight: 600;
}

.timeline-item.install .timeline-marker,
.timeline-item.session .timeline-marker,
.timeline-item.foreground .timeline-marker {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.timeline-item.open .timeline-marker,
.timeline-item.screen .timeline-marker,
.timeline-item.custom .timeline-marker {
  border-color: var(--blue-line);
  color: var(--blue);
  background: var(--blue-soft);
}

.timeline-item.background .timeline-marker,
.timeline-item.session-end .timeline-marker,
.timeline-item.end .timeline-marker {
  color: var(--muted);
  background: var(--bg-well);
}

.timeline-item.timeout .timeline-marker {
  border-color: var(--amber-line);
  color: var(--amber);
  background: var(--amber-soft);
}

.timeline-item.error .timeline-marker {
  border-color: var(--red-line);
  color: var(--red);
  background: var(--red-soft);
}

.timeline-body {
  min-width: 0;
  padding: 16px 0 20px 14px;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child .timeline-body {
  border-bottom: 0;
}

.timeline-body h4 {
  margin: 0 0 4px;
  font-size: 12.5px;
  font-weight: 600;
}

.timeline-body > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.event-properties {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
}

.event-properties > div {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
}

.event-properties dt,
.event-properties dd {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 4px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.event-properties dt {
  color: var(--faint);
  background: var(--bg-well);
}

.event-properties dd {
  max-width: 320px;
  overflow: hidden;
  color: var(--ink-soft);
  background: var(--surface);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-details {
  margin-top: 12px;
  color: var(--faint);
  font-size: 10px;
}

.technical-details summary {
  width: max-content;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.technical-details summary:hover {
  color: var(--accent);
}

.technical-details dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 11px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-well);
}

.technical-details dd {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 450;
}

/* --------------------------------------------------------------------------
   Project management
   -------------------------------------------------------------------------- */

.management-header,
.help-header {
  display: flex;
  min-height: 92px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line);
}

.management-header h1,
.help-header h1 {
  margin: 6px 0 6px;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.management-header p,
.help-header p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.management-layout {
  display: grid;
  min-height: 540px;
  grid-template-columns: 236px minmax(0, 1fr);
}

.management-project-list {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 20px 18px 20px 0;
  border-right: 1px solid var(--line);
}

.management-project-detail {
  min-width: 0;
  padding: 20px 0 50px 32px;
}

.managed-project-header,
.managed-app > header,
.managed-environment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.managed-project-header {
  padding-bottom: 20px;
}

.managed-project-header h2,
.managed-app h3 {
  margin: 0;
}

.managed-project-header h2 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.managed-project-header p,
.managed-app header p {
  margin: 4px 0 0;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.managed-app {
  border-top: 1px solid var(--line);
}

.managed-app > header {
  padding: 20px 0 12px;
}

.managed-app h3 {
  font-size: 14px;
  font-weight: 600;
}

.managed-environments {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.managed-environment {
  display: grid;
  min-height: 60px;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
}

.managed-environment:first-child {
  border-top: 0;
}

.managed-environment.empty {
  background: var(--bg-well);
}

.managed-environment strong,
.managed-environment small {
  display: block;
}

.managed-environment strong {
  font-size: 12px;
  font-weight: 550;
}

.managed-environment small {
  max-width: 650px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.environment-badge {
  width: max-content;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  color: var(--muted);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.environment-badge.development {
  border-color: var(--blue-line);
  color: var(--blue);
  background: var(--blue-soft);
}

.environment-badge.staging {
  border-color: var(--amber-line);
  color: var(--amber);
  background: var(--amber-soft);
}

.environment-badge.production {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.management-empty {
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.management-empty strong {
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Help
   -------------------------------------------------------------------------- */

.help-kicker,
.help-article-eyebrow {
  color: var(--accent) !important;
  font-family: var(--font-mono);
  font-size: 9.5px !important;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.help-search {
  width: min(340px, 100%);
  flex: 0 0 min(340px, 34%);
}

.help-search input {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.help-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: calc(100vh - 250px);
}

.help-navigation {
  position: sticky;
  top: calc(var(--topbar-h) + 22px);
  display: grid;
  align-content: start;
  align-self: start;
  gap: 1px;
  padding: 22px 20px 40px 0;
}

.help-navigation > p {
  margin: 0 0 10px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.help-navigation button {
  position: relative;
  display: grid;
  min-height: 40px;
  align-content: center;
  gap: 2px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  text-align: left;
  background: transparent;
  transition: color 120ms ease, background 120ms ease;
}

.help-navigation button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.help-navigation button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.help-navigation button.active::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 2px;
  height: 16px;
  transform: translateY(-50%);
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  content: "";
}

.help-navigation button strong {
  font-size: 12px;
  font-weight: 550;
}

.help-navigation button small {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  font-weight: 450;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.help-no-results {
  padding: 14px 10px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.help-content {
  min-width: 0;
  padding: 34px 0 80px clamp(28px, 4.5vw, 64px);
  border-left: 1px solid var(--line);
}

.help-article {
  width: min(100%, 820px);
}

.help-article h2 {
  margin: 6px 0 12px;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.18;
}

.help-article h3 {
  margin: 34px 0 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.help-article p,
.help-article li,
.help-article dd {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.68;
}

.help-article p {
  margin: 0 0 13px;
}

.help-article ul,
.help-article ol:not(.help-steps) {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.help-article li::marker {
  color: var(--faint);
}

.help-article li strong {
  color: var(--ink);
}

.help-article code:not(.help-code code) {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.help-lede {
  max-width: 740px;
  color: var(--muted) !important;
  font-size: 14.5px !important;
  line-height: 1.66 !important;
}

.help-definition-list {
  margin: 15px 0 0;
  border-block: 1px solid var(--line);
}

.help-definition-list > div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
}

.help-definition-list > div + div {
  border-top: 1px solid var(--line);
}

.help-definition-list dt {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.help-definition-list dd {
  margin: 0;
}

.help-steps {
  display: grid;
  gap: 0;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}

.help-steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.help-steps li:last-child {
  border-bottom: 1px solid var(--line);
}

.help-steps li > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}

.help-steps strong {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}

.help-steps p {
  margin: 3px 0 0;
}

.help-note {
  display: block;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid var(--blue-line);
  border-left-width: 2px;
  border-radius: var(--r-sm);
  background: var(--blue-soft);
}

.help-note strong {
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
}

.help-note.warning {
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.help-note.warning strong {
  color: var(--amber);
}

.help-note p {
  margin: 5px 0 0;
  color: var(--ink-soft);
}

.help-code {
  overflow: hidden;
  margin: 14px 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-well);
}

.help-code > div {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 8px 0 13px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-raised);
  font-family: var(--font-mono);
  font-size: 10px;
}

.help-code button {
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  color: var(--muted);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.help-code button:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.help-code pre {
  max-height: none;
  margin: 0;
  overflow-x: auto;
  padding: 16px;
  border: 0;
  border-radius: 0;
  color: var(--ink-soft);
  background: transparent;
  white-space: pre;
  word-break: normal;
}

.help-code code {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  white-space: pre;
}

.help-table {
  width: 100%;
  min-width: 0;
  margin: 14px 0 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  background: var(--surface);
}

.help-table th,
.help-table td {
  width: auto !important;
  padding: 11px 13px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.help-table th {
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.help-table td {
  border-top: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.6;
  vertical-align: top;
}

.help-table tr + tr td {
  border-top: 1px solid var(--line);
}

.help-table th:first-child,
.help-table td:first-child {
  width: 28% !important;
}

.event-reference th:first-child,
.event-reference td:first-child {
  width: 31% !important;
}

.event-reference th:last-child,
.event-reference td:last-child {
  width: 82px !important;
}

.help-do-dont {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
  border-block: 1px solid var(--line);
}

.help-do-dont > div {
  padding: 15px 18px 15px 0;
}

.help-do-dont > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.help-do-dont strong {
  font-size: 12px;
  font-weight: 600;
}

.help-do-dont > div:first-child strong {
  color: var(--accent);
}

.help-do-dont > div + div strong {
  color: var(--red);
}

.help-do-dont p {
  margin: 8px 0 0;
  line-height: 1.9;
}

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.button,
.icon-button {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-weight: 550;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button {
  padding: 6px 12px;
  font-size: 12px;
}

.button-primary {
  border-color: var(--accent-dim);
  color: var(--accent-on);
  background: var(--accent);
  font-weight: 600;
}

.button-primary:hover {
  border-color: var(--accent);
  background: #4ce197;
}

.button-secondary {
  border-color: var(--line-strong);
  color: var(--ink-soft);
  background: var(--surface-raised);
}

.button-secondary:hover {
  border-color: var(--line-bright);
  color: var(--ink);
  background: var(--surface-hover);
}

.button-quiet {
  color: var(--muted);
  background: transparent;
}

.button-quiet:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.button-danger {
  border-color: var(--red-line);
  color: var(--red);
  background: var(--red-soft);
  font-weight: 600;
}

.button-danger:hover {
  color: #0f0405;
  background: var(--red);
}

.icon-button {
  display: inline-grid;
  width: 30px;
  flex: 0 0 30px;
  place-items: center;
  padding: 0;
  border-color: var(--line-strong);
  color: var(--muted);
  background: var(--surface-raised);
  font-size: 15px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--line-bright);
  color: var(--ink);
  background: var(--surface-hover);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  outline: none;
  color: var(--ink);
  background: var(--bg-well);
  font-weight: 450;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

select {
  appearance: none;
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position:
    calc(100% - 15px) calc(50% + 1px),
    calc(100% - 11px) calc(50% + 1px);
  background-size: 4px 4px, 4px 4px;
}

textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-bright);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: var(--ring);
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.input-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.input-suffix input {
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}

.input-suffix span {
  display: grid;
  min-height: 34px;
  place-items: center;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--faint);
  background: var(--surface-raised);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.form-error {
  min-height: 16px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

.field-error {
  min-height: 16px;
  margin: -8px 0 0;
  color: var(--red);
  font-size: 11.5px;
  line-height: 1.4;
}

.dialog-form input[aria-invalid="true"] {
  border-color: var(--red-line);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.form-hint {
  margin: -4px 0 0;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.5;
}

.danger-note {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--red-line);
  border-radius: var(--r-sm);
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Legacy table surface
   -------------------------------------------------------------------------- */

.table-wrap {
  position: relative;
  min-height: 180px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  overflow: hidden;
  padding: 11px 14px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  color: var(--faint);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

td {
  border-top: 1px solid var(--line);
  font-size: 12px;
}

th:first-child,
td:first-child {
  width: 24%;
}

th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3) {
  width: 11%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 13%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 18%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 23%;
}

.event-row {
  cursor: pointer;
}

.event-row:hover {
  background: var(--surface-hover);
}

.event-name {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 550;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  color: var(--muted);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge.lifecycle {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.error,
.badge.critical,
.badge.diagnostic {
  border-color: var(--red-line);
  color: var(--red);
  background: var(--red-soft);
}

.badge.custom {
  border-color: var(--blue-line);
  color: var(--blue);
  background: var(--blue-soft);
}

.badge.high {
  border-color: var(--amber-line);
  color: var(--amber);
  background: var(--amber-soft);
}

.table-empty {
  display: grid;
  min-height: 145px;
  place-items: center;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.events-section {
  margin-top: 32px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.filters input {
  width: 190px;
}

.filters select {
  width: 140px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.data-panel {
  min-width: 0;
  min-height: 300px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.top-events {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.top-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  align-items: center;
}

.top-event-name {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-event-count {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.top-event-track {
  height: 4px;
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg-well);
}

.top-event-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

/* --------------------------------------------------------------------------
   Dialogs
   -------------------------------------------------------------------------- */

dialog {
  width: min(92vw, 680px);
  max-height: min(90vh, 820px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(4 6 9 / 68%);
  backdrop-filter: blur(3px);
}

.dialog-form {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.dialog-form > header,
.dialog-form > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-form > header {
  align-items: flex-start;
}

.dialog-form > footer {
  justify-content: flex-end;
}

.dialog-form h2,
.dialog-form h3 {
  margin: 0;
}

.dialog-form h2 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.dialog-form h3 {
  font-size: 12px;
  font-weight: 600;
}

.dialog-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dialog-compact {
  max-width: 480px;
  margin: 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.full-width {
  grid-column: 1 / -1;
}

.new-organization-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}

.toggle-row {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}

.toggle-row small {
  margin-top: 4px;
  color: var(--faint);
  font-weight: 450;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: 0 0 18px;
}

.event-detail {
  gap: 20px;
}

.event-detail header > div {
  display: grid;
  gap: 8px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-well);
}

.metadata-grid div {
  min-width: 0;
}

.metadata-grid dt {
  margin-bottom: 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.metadata-grid dd {
  overflow: hidden;
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

pre {
  max-height: 240px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Enrollment dialog ------------------------------------------------------- */

#enrollment-dialog {
  width: min(92vw, 720px);
  overflow-x: hidden;
}

.enrollment-settings {
  width: 100%;
  min-width: 0;
}

.enrollment-settings > section {
  border-top: 1px solid var(--line);
}

.enrollment-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
}

.enrollment-option > div {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 12px;
}

.enrollment-option h3,
.enrollment-key-list-section h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.enrollment-option p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.enrollment-option p.configured {
  color: var(--accent);
}

.enrollment-option p.not-configured {
  color: var(--amber);
}

.enrollment-option-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.enrollment-option-icon.key {
  border-color: var(--blue-line);
  color: var(--blue);
  background: var(--blue-soft);
}

.enrollment-key-option {
  grid-template-columns: 1fr;
}

.enrollment-key-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  gap: 10px;
  align-items: end;
  padding-left: 40px;
}

.enrollment-key-form label {
  min-width: 0;
}

.enrollment-key-form .form-error {
  grid-column: 1 / -1;
}

.new-enrollment-key {
  display: grid;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--accent-line) !important;
  border-radius: var(--r-md);
  background: var(--accent-soft);
}

.new-enrollment-key strong {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.new-enrollment-key p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.new-enrollment-key code {
  display: block;
  overflow-wrap: anywhere;
  padding: 10px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  color: var(--ink);
  background: var(--bg-well);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  user-select: all;
}

.new-enrollment-key .button {
  width: max-content;
}

.enrollment-key-list-section {
  padding-top: 18px;
}

.enrollment-key-list-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.enrollment-key-list-section > header span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.enrollment-key-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.enrollment-key-list:empty {
  display: none;
}

.enrollment-key-row {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.enrollment-key-row:first-child {
  border-top: 0;
}

.enrollment-key-row > div {
  min-width: 0;
}

.enrollment-key-row strong,
.enrollment-key-row small,
.enrollment-key-row code {
  display: block;
}

.enrollment-key-row strong {
  font-size: 12px;
  font-weight: 600;
}

.enrollment-key-row small {
  margin: 3px 0;
  color: var(--muted);
  font-size: 10px;
}

.enrollment-key-row code {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.enrollment-key-row.revoked {
  background: var(--bg-well);
  opacity: 0.55;
}

.enrollment-key-list-section .story-empty {
  min-height: 96px;
}

/* Organizations dialog ---------------------------------------------------- */

.organization-settings {
  width: min(660px, calc(100vw - 32px));
}

.organization-list-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.organization-list-section > header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.organization-list-section > header span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.organization-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.organization-list:empty {
  display: none;
}

.organization-row {
  display: flex;
  min-height: 60px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
}

.organization-row:first-child {
  border-top: 0;
}

.organization-row > div:first-child {
  min-width: 0;
}

.organization-row strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.organization-row small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organization-confirm {
  align-self: center;
  margin-right: 2px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.organization-edit-form {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.organization-edit-form .form-error,
.organization-edit-form .row-actions {
  grid-column: 1 / -1;
}

.organization-edit-form .form-error:empty {
  display: none;
}

/* Account dialog ---------------------------------------------------------- */

.account-settings {
  width: min(700px, calc(100vw - 32px));
}

.account-settings > section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.account-settings > section:first-of-type {
  margin-top: 2px;
}

.account-settings h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.settings-form label {
  display: grid;
  gap: 6px;
}

.settings-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.settings-form .form-error {
  grid-column: 1 / -1;
}

.settings-form .button {
  width: max-content;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 11px 14px;
  transform: translateY(14px);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-sm);
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  border-left-color: var(--red);
  color: var(--red);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .view-header {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .view-header-controls {
    justify-content: flex-start;
  }

  .view-header-controls .project-actions {
    margin-left: auto;
  }
}

@media (max-width: 1050px) {
  .management-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .management-project-detail {
    padding-left: 24px;
  }

  .managed-environment {
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .managed-environment .row-actions {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 8px;
  }

  .help-layout {
    grid-template-columns: 212px minmax(0, 1fr);
  }

  .help-navigation {
    padding-right: 15px;
  }

  .help-content {
    padding-left: 30px;
  }

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

  .metric:nth-child(3) {
    border-left: 0;
  }

  .metric:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .story-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .story-metrics .metric:nth-child(3) {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

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

  .data-panel {
    min-height: 270px;
  }

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

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    justify-content: flex-start;
  }

  .installation-columns,
  .session-columns {
    display: none;
  }

  .installation-row {
    grid-template-columns:
      minmax(220px, 1.4fr)
      minmax(90px, 0.65fr)
      minmax(90px, 0.65fr)
      minmax(140px, 1fr)
      minmax(130px, 0.9fr)
      16px;
  }

  .installation-row > .sessions-value,
  .installation-row > .duration-value {
    display: none;
  }

  .session-row {
    grid-template-columns: minmax(260px, 1.5fr) minmax(100px, 0.6fr) minmax(80px, 0.5fr) 16px;
  }

  .session-row > .row-value:nth-of-type(3) {
    display: none;
  }

  .fact-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fact-strip > div:nth-child(4) {
    border-left: 0;
  }

  .fact-strip > div:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template: "topbar" var(--topbar-h) "workspace" minmax(0, 1fr) / minmax(0, 1fr);
  }
  .topbar { gap: 12px; padding: 0 14px; }
  .topbar-context { gap: 10px; }
  .topbar-actions { gap: 4px; }
  .topbar #account-username { display: none; }
  .topbar .brand-wordmark { display: none; }
  .compact-field span { display: none; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: min(288px, calc(100vw - 48px));
    height: calc(100dvh - var(--topbar-h));
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: var(--shadow-sm);
  }
  .app-shell.sidebar-open .sidebar { transform: none; visibility: visible; }
  .sidebar-navigation { padding: 18px 12px; }
  .sidebar-action { min-width: 0; }
  .sidebar-footer { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .project-picker-menu { width: 100%; }
  .notifications-panel { position: fixed; top: calc(var(--topbar-h) + 8px); left: 12px; right: 12px; width: auto; }

  .workspace {
    padding: 20px 14px 56px;
  }

  .view-header-controls {
    flex-wrap: wrap;
  }

  .control-divider {
    display: none;
  }

  .control-field select {
    width: min(100%, 220px);
  }

  .management-header,
  .managed-project-header,
  .managed-app > header {
    align-items: stretch;
    flex-direction: column;
  }

  .management-layout {
    grid-template-columns: 1fr;
  }

  .management-project-list {
    display: flex;
    padding: 14px 0;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .management-project-item {
    min-width: 190px;
  }

  .management-project-detail {
    padding: 22px 0 45px;
  }

  .managed-environment {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .managed-environment .row-actions {
    grid-column: 1;
  }

  .enrollment-option,
  .enrollment-key-form {
    grid-template-columns: 1fr;
  }

  .enrollment-key-form {
    padding-left: 0;
  }

  .help-header {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .help-search {
    width: 100%;
    flex: none;
  }

  .help-layout {
    display: block;
  }

  .help-navigation {
    position: static;
    display: flex;
    margin-inline: -14px;
    overflow-x: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .help-navigation > p {
    display: none;
  }

  .help-navigation button {
    min-width: 172px;
  }

  .help-navigation button.active::before {
    top: auto;
    bottom: 0;
    left: 50%;
    width: 20px;
    height: 2px;
    transform: translateX(-50%);
    border-radius: 2px 2px 0 0;
  }

  .help-no-results {
    min-width: 150px;
  }

  .help-content {
    padding: 28px 0 60px;
    border-left: 0;
  }

  .metrics-grid,
  .story-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .story-metrics .metric:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .metric {
    min-height: 92px;
    padding: 15px;
  }

  .metric strong {
    font-size: 22px;
  }

  .story-heading {
    align-items: stretch;
  }

  .installation-search {
    width: 100%;
  }

  .installation-row,
  .session-row {
    grid-template-columns: minmax(0, 1fr) 16px;
    min-height: 78px;
    gap: 10px;
  }

  .installation-row > .row-value,
  .session-row > .row-value,
  .session-row > .session-status {
    display: none;
  }

  .installation-context-mobile {
    display: block;
  }

  .installation-chart-panel {
    min-height: 320px;
    padding-inline: 12px;
  }

  .installation-chart-header {
    min-height: 72px;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .chart-granularity {
    white-space: normal;
  }

  .chart-window-control {
    align-self: flex-start;
  }

  .installation-hero {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .installation-hero .installation-badges {
    margin-left: 58px;
  }

  .fact-strip {
    grid-template-columns: 1fr 1fr;
  }

  .fact-strip > div:nth-child(3),
  .fact-strip > div:nth-child(5) {
    border-left: 0;
  }

  .fact-strip > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .session-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .session-duration {
    min-width: 0;
    justify-items: start;
  }

  .session-stats {
    grid-template-columns: 1fr 1fr;
  }

  .session-stats > div:nth-child(3) {
    border-left: 0;
  }

  .session-stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .timeline-item {
    grid-template-columns: 62px 32px minmax(0, 1fr);
  }

  .timeline-item > time {
    padding-right: 7px;
    font-size: 9.5px;
  }

  .timeline-body {
    padding-left: 10px;
  }

  .technical-details dl {
    grid-template-columns: 1fr 1fr;
  }

  .filters {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .filters input {
    width: auto;
    grid-column: 1 / -1;
  }

  .filters select {
    width: auto;
  }

  .form-grid,
  .metadata-grid,
  .settings-form,
  .new-organization-fields,
  .organization-edit-form {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  dialog {
    width: calc(100vw - 24px);
  }

  .dialog-form {
    padding: 18px;
  }

  table {
    min-width: 820px;
  }

  .top-events {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .sidebar-action {
    min-width: 0;
    padding-inline: 10px;
  }

  .help-header h1,
  .management-header h1,
  .view-header-identity h1 {
    font-size: 22px;
  }

  .help-article h2 {
    font-size: 21px;
  }

  .help-definition-list > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .help-do-dont {
    grid-template-columns: 1fr;
  }

  .help-do-dont > div + div {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .help-code pre {
    padding: 14px;
  }

  .help-table {
    display: block;
    overflow-x: auto;
  }

  .login-panel {
    padding: 22px 18px;
  }

  .metrics-grid,
  .story-metrics {
    grid-template-columns: 1fr;
  }

  .metric + .metric,
  .metric:nth-child(3) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .story-metrics .metric:nth-child(3) {
    grid-column: auto;
  }

  .fact-strip {
    grid-template-columns: 1fr;
  }

  .fact-strip > div + div,
  .fact-strip > div:nth-child(3),
  .fact-strip > div:nth-child(5) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .installation-hero .trust-badge {
    margin-left: 0;
  }

  .timeline-item {
    grid-template-columns: 52px 28px minmax(0, 1fr);
  }

  .timeline-marker {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .event-properties {
    display: grid;
  }

  .event-properties > div {
    display: grid;
    grid-template-columns: minmax(90px, auto) minmax(0, 1fr);
  }

  .technical-details dl {
    grid-template-columns: 1fr;
  }

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

  .filters input {
    grid-column: auto;
  }
}

/* Product overview */
.activity-status { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 16px 0; color: var(--muted); font-size: 12px; }
.activity-status strong { color: var(--ink-soft); font-weight: 500; }
.overview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 22px 0 16px; }
.overview-toolbar h2 { margin: 4px 0; font-size: 24px; letter-spacing: -0.6px; }
.overview-toolbar p:not(.story-kicker) { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.overview-status { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--muted); font-size: 12px; }
.overview-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin: 0 0 18px; }
.overview-metrics .metric { padding: 18px 20px; background: var(--surface); border: 0; min-width: 0; }
.overview-metrics .metric strong { font-size: 30px; }
.overview-metrics .metric small { display: block; margin-top: 5px; }
.overview-metrics small[data-trend="up"] { color: var(--accent); }
.overview-metrics small[data-trend="down"] { color: var(--red); }
.overview-insights { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.overview-insight { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-soft); font-size: 12px; text-align: left; }
.overview-insight.attention { border-color: var(--red-line); color: var(--red); }
.overview-charts, .overview-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.overview-charts .installation-chart-panel { margin: 0; min-width: 0; }
.overview-charts .installation-chart-header { min-height: 76px; }
.overview-panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.overview-panel header { margin-bottom: 14px; }
.overview-panel h3 { margin: 0; font-size: 14px; }
.overview-panel header p, .overview-empty { color: var(--muted); font-size: 12px; line-height: 1.7; }
.overview-row { display: flex; gap: 14px; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.overview-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.overview-row strong, .overview-row small { display: block; }
.overview-row strong { font-weight: 500; }
.overview-row small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.overview-row > span:last-child { text-align: right; flex-shrink: 0; }
button.overview-row { width: 100%; color: var(--ink); background: transparent; border-right: 0; border-left: 0; border-bottom: 0; text-align: left; }
button.overview-row:hover { color: var(--accent); background: var(--surface-hover); }
.overview-definitions { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 20px 0 30px; }
.overview-definitions summary { cursor: pointer; color: var(--ink-soft); }
@media (min-width: 1600px) { .overview-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 900px) { .overview-charts, .overview-details { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-metrics .metric { padding: 14px 12px; }
  .overview-metrics .metric strong { font-size: 25px; }
  .overview-toolbar { align-items: flex-start; flex-direction: column; }
}

.sdk-guide-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}
.sdk-guide-links a {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  text-decoration: none;
}
.sdk-guide-links a:hover { border-color: var(--accent); }
.sdk-guide-links strong { font-size: 14px; }
.sdk-guide-links span { color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .sdk-guide-links { grid-template-columns: minmax(0, 1fr); }
}

/* Diagnostic evidence must remain readable beyond compact timeline value limits. */
#installation-diagnostics .event-properties dd {
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

#installation-diagnostics .diagnostic-evidence {
  max-height: 28rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

#installation-diagnostics .event-properties > div { max-width: 100%; }
#installation-diagnostics summary { width: auto; overflow-wrap: anywhere; }
#installation-diagnostics details details { margin-top: 12px; }
#installation-diagnostics .diagnostic-evidence { font-size: 12px; line-height: 1.5; color: var(--ink-soft); }

/* Account destinations share the workspace, never a catch-all dialog. */
.settings-view { max-width: 1120px; margin: 0 auto; padding: 8px 0 48px; }
.settings-heading { padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.settings-heading h1 { margin: 5px 0 10px; font-size: 28px; letter-spacing: -.7px; }
.settings-heading p:last-child, .settings-card header p, .agent-heading p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 36px; }
.settings-navigation { display: flex; flex-direction: column; gap: 6px; align-self: start; }
.settings-navigation button { border: 1px solid transparent; background: none; border-radius: 6px; color: var(--ink-soft); padding: 13px 15px; text-align: left; font-weight: 550; }
.settings-navigation button span { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 5px; }
.settings-navigation button:hover { background: var(--surface-hover); }
.settings-navigation button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.settings-content { min-width: 0; }
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 26px; margin-bottom: 22px; }
.settings-card header { margin-bottom: 24px; }
.settings-card h2, .agent-heading h2 { font-size: 21px; margin: 0 0 8px; }
.settings-card h3 { font-size: 15px; margin: 0 0 8px; }
.settings-card .settings-form { max-width: 440px; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.settings-card .form-error:empty { display: none; }
.agent-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 24px; }
.access-badge { flex-shrink: 0; padding: 5px 9px; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 20px; font-size: 11px; }
.agent-empty { padding: 24px 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
.agent-token-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.agent-token-row > div { min-width: 0; }
.agent-token-row h4 { margin: 0 0 6px; font-size: 14px; overflow-wrap: anywhere; }
.agent-token-row p { color: var(--ink-soft); font-size: 12px; margin: 0 0 8px; overflow-wrap: anywhere; line-height: 1.6; }
.agent-token-row small { display: block; color: var(--muted); font-size: 11px; line-height: 1.7; }
.agent-token-row button { flex-shrink: 0; }
.agent-create-details { border-top: 1px solid var(--line); padding-top: 18px; }
.agent-create-details > summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 550; }
.agent-token-form { margin-top: 22px; }
.agent-form-fields { display: grid; grid-template-columns: 1fr 150px; gap: 16px; }
.agent-form-fields label { display: grid; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.agent-token-form fieldset { margin: 24px 0 18px; padding: 0; border: 0; min-width: 0; }
.agent-token-form legend { font-size: 13px; font-weight: 550; }
.agent-token-form fieldset > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.agent-environment-options { max-height: 300px; overflow: auto; }
.agent-environment-group { display: flex; flex-wrap: wrap; gap: 12px 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.agent-environment-group strong { flex-basis: 100%; font-size: 12px; overflow-wrap: anywhere; }
.agent-environment-group label { display: flex; gap: 7px; align-items: center; color: var(--ink-soft); font-size: 12px; }
.agent-environment-group input { width: 15px; height: 15px; accent-color: var(--accent); }
.agent-secret-panel { background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 20px; margin-top: 20px; border-radius: 6px; }
.agent-secret-panel p { font-size: 12px; line-height: 1.7; }
#agent-secret { display: block; padding: 14px 0; overflow-wrap: anywhere; user-select: all; }
.agent-secret-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.agent-connection-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.agent-connection-tabs button { color: var(--muted); padding: 8px 14px; background: transparent; border: 1px solid var(--line); border-radius: 5px; }
.agent-connection-tabs button[aria-pressed="true"] { color: var(--ink); background: var(--surface-raised); border-color: var(--line-bright); }
.agent-connect p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.agent-connect pre { font-size: 12px; line-height: 1.7; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 18px; background: var(--bg-well); border: 1px solid var(--line); border-radius: 5px; }
.account-menu button span { color: var(--muted); margin-left: 10px; font-size: 10px; }
.account-menu #logout-button { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
#agent-access-status:not(:empty) { font-size: 13px; color: var(--amber); }
@media (max-width: 760px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .settings-navigation { flex-direction: row; gap: 4px; overflow-x: auto; }
  .settings-navigation button { flex: 1; padding: 12px 9px; white-space: nowrap; text-align: center; }
  .settings-navigation button span { display: none; }
  .settings-card { padding: 18px; }
  .settings-card .settings-form { max-width: none; }
  .settings-form .button { width: 100%; }
  .settings-form .button, .login-step .button { min-height: 44px; font-size: 14px; }
  .login-view { min-height: 100svh; }
  .agent-form-fields { grid-template-columns: minmax(0, 1fr); }
  .agent-token-row { align-items: start; flex-direction: column; }
  .agent-heading { gap: 10px; }
}

@media (max-width: 760px), (any-pointer: coarse) {
  /* Keep iOS from zooming focused fields, including compact search/filter
     overrides. Preserve the viewport's normal pinch-to-zoom behavior. */
  input, select, textarea { font-size: 16px !important; }

  :root body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  :root body select,
  :root body textarea {
    min-height: 44px;
  }

  .input-suffix span { min-height: 44px; }
}
