/* Activity Atlas — in the style of a macOS app: system font and colors,
   quiet surfaces, one accent (system blue), light and dark appearance. */
:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --sidebar: rgba(236, 236, 240, .82);
  --panel: #ffffff;
  --panel-2: #f2f2f7;
  --panel-3: #e8e8ed;
  --line: rgba(0, 0, 0, .07);
  --line-2: rgba(0, 0, 0, .12);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #8e8e93;
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, .1);
  --accent-text: #ffffff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --teal: #32ade6;
  --indigo: #5856d6;
  --good: #34c759;
  --warn: #c93400;
  --bad: #ff3b30;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161617;
    --sidebar: rgba(30, 30, 32, .86);
    --panel: #1f1f21;
    --panel-2: #2a2a2d;
    --panel-3: #363639;
    --line: rgba(255, 255, 255, .07);
    --line-2: rgba(255, 255, 255, .13);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --faint: #7c7c82;
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, .18);
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --purple: #bf5af2;
    --teal: #64d2ff;
    --indigo: #5e5ce6;
    --good: #30d158;
    --warn: #ff9f0a;
    --bad: #ff453a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 13.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
h1 { font: 700 26px/1.2 var(--display); letter-spacing: -.02em; margin: 0; }
h2 { font: 600 15px/1.3 var(--display); letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-note { display: block; color: var(--faint); font-size: 11px; }
.nowrap { white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Controls */
button, select, input { font: inherit; color: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px;
  padding: 6px 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: filter .12s, background .12s;
}
button:hover { filter: brightness(1.06); }
button:active { filter: brightness(.94); }
button:disabled { opacity: .4; cursor: default; filter: none; }
button.secondary { background: var(--panel); color: var(--text); box-shadow: 0 0 0 .5px var(--line-2), 0 1px 1px rgba(0, 0, 0, .05); }
button.secondary:hover { background: var(--panel-2); filter: none; }
button.danger { background: var(--red); color: #fff; }
button.link { background: none; color: var(--accent); padding: 2px 4px; font-weight: 500; box-shadow: none; }
button.link:hover { text-decoration: underline; filter: none; }
.icon-button { background: var(--panel); color: var(--text); width: 30px; height: 30px; padding: 0; border-radius: 8px; box-shadow: 0 0 0 .5px var(--line-2), 0 1px 1px rgba(0, 0, 0, .05); }
.icon-button:hover { background: var(--panel-2); filter: none; }
input, select, textarea {
  background: var(--panel); border: 0; border-radius: 7px; padding: 6px 10px; min-width: 0; color: var(--text);
  box-shadow: 0 0 0 .5px var(--line-2), 0 1px 1px rgba(0, 0, 0, .04);
}
input[type="search"] { min-width: 240px; }
textarea { font: 12.5px/1.5 var(--mono); width: 100%; resize: vertical; min-height: 110px; }
input::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible, [role="button"]:focus-visible, tr:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
label { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.message { min-height: 1em; color: var(--muted); font-size: 12.5px; }
.message.error { color: var(--bad); }

/* Brand */
.brand { display: flex; align-items: center; gap: 9px; font: 600 15px/1 var(--display); letter-spacing: -.01em; }
.brand b { font-weight: 600; }
.logo { width: 24px; height: 24px; flex: none; }

/* Sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin-card {
  width: min(440px, 100%); background: var(--panel); border-radius: 16px; padding: 28px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 0 0 .5px var(--line), 0 10px 40px rgba(0, 0, 0, .1);
}
.signin-card .brand { margin-bottom: 6px; }
.help summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.help ul { padding-left: 18px; color: var(--muted); margin: 8px 0 0; }
.help li { margin: 4px 0; }

/* Shell: sidebar + main */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  padding: 18px 10px; background: var(--sidebar); border-right: .5px solid var(--line-2);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.sidebar .brand { padding: 2px 10px 18px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--faint); padding: 6px 10px 4px; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tabs button { justify-content: flex-start; gap: 9px; background: none; color: var(--text); padding: 6px 10px; border-radius: 7px; font-weight: 400; }
.tabs button .icon { width: 17px; height: 17px; color: var(--accent); }
.tabs button:hover { background: var(--line); filter: none; }
.tabs button.active { background: var(--line-2); font-weight: 500; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.server-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left;
  background: var(--panel); color: var(--text); border-radius: 10px; padding: 10px 12px; font-weight: 400;
  box-shadow: 0 0 0 .5px var(--line);
  /* The card is a button, and buttons do not wrap their text: a long Cloudflare or Tailscale
     address must wrap inside the card instead of running over the page. */
  white-space: normal; min-width: 0; overflow: hidden;
}
.server-card:hover { background: var(--panel-2); filter: none; }
.server-label { font-size: 11px; font-weight: 600; color: var(--faint); }
.server-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; min-width: 0; flex-wrap: wrap; }
.server-address { font: 11px/1.4 var(--mono); color: var(--muted); white-space: normal; overflow-wrap: anywhere; min-width: 0; }
.server-meta { font-size: 11px; color: var(--faint); overflow-wrap: anywhere; }
.me {
  display: flex; align-items: center; justify-content: flex-start; gap: 9px; padding: 6px 8px; background: none;
  color: var(--text); border-radius: 8px; text-align: left; font-weight: 400;
}
.me:hover { background: var(--line); filter: none; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { width: 100%; max-width: 1420px; margin: 0 auto; padding: 26px 30px 40px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.view { display: flex; flex-direction: column; gap: 16px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.view-head p.muted { margin-top: 3px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.person-status { display: inline-flex; align-items: center; gap: 6px; }
.person-status:empty { display: none; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-nav { display: inline-flex; align-items: center; gap: 4px; }
.banner { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; color: var(--text); }
.banner.error { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--text); }
.footnote { color: var(--faint); font-size: 12px; max-width: 980px; }

/* Checkboxes and the Live switch */
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; color: var(--text); font-weight: 400; white-space: nowrap; }
.check input { accent-color: var(--accent); margin: 0; box-shadow: none; padding: 0; }
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--text); font-size: 12.5px; font-weight: 400; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 32px; height: 19px; border-radius: 999px; background: var(--panel-3); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(13px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.switch input:disabled + .track { opacity: .4; }

/* Segmented control, like macOS */
.segmented { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--panel-3); }
.segmented button { background: none; color: var(--text); padding: 4px 14px; border-radius: 6px; font-weight: 400; }
.segmented button:hover { filter: none; background: color-mix(in srgb, var(--panel) 40%, transparent); }
.segmented button.active { background: var(--panel); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px var(--line); }

/* Cards */
.card {
  background: var(--panel); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 0 0 .5px var(--line), var(--shadow);
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-head.padded { padding: 16px 18px 12px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2::after { content: " ›"; color: var(--faint); }
details.card[open] > summary h2::after { content: " ⌄"; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.grid-wide { grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr); }
.grid.grid-ring { grid-template-columns: minmax(300px, 1fr) minmax(0, 1.9fr); }
.empty { color: var(--muted); padding: 16px; text-align: center; }
.legend-line { color: var(--faint); font-size: 11.5px; text-align: center; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  background: var(--panel); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: 0 0 0 .5px var(--line), var(--shadow); display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.kpi-top { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12.5px; font-weight: 500; min-width: 0; }
.kpi-top > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-icon { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.kpi-icon .icon { width: 15px; height: 15px; }
.kpi-icon.cyan { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
.kpi-icon.amber { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.kpi-icon.violet { background: color-mix(in srgb, var(--purple) 16%, transparent); color: var(--purple); }
.kpi-icon.coral { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.kpi strong { font: 600 26px/1.15 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 8px; }
.kpi small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.highlight strong { color: var(--accent); }

/* Charts */
.chart { position: relative; height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-label { fill: var(--faint); font: 10.5px var(--font); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--panel); stroke: var(--accent); stroke-width: 2; }
.chart-bar { transition: opacity .15s; }
.chart-hit { fill: transparent; }
.chart-now { stroke: var(--red); stroke-width: 1; stroke-dasharray: 2 3; opacity: .8; }
.chart-cursor { stroke: var(--line-2); stroke-width: 1; }
.chart-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); z-index: 3;
  background: var(--panel); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap;
  box-shadow: 0 0 0 .5px var(--line-2), 0 6px 20px rgba(0, 0, 0, .15);
}
.chart-tip strong { display: block; font-weight: 600; }

/* 24-hour ring */
.ring { display: grid; place-items: center; min-height: 240px; }
.ring .calendar { width: 100%; }
.ring svg { width: min(100%, 290px); height: auto; overflow: visible; }
.ring-track { fill: none; stroke: var(--panel-2); }
.ring-tick { stroke: var(--line-2); stroke-width: 1; }
.ring-tick.major { stroke: var(--faint); stroke-width: 1.2; }
.ring-label { fill: var(--faint); font: 500 10.5px var(--font); }
.ring-inner { fill: none; stroke: var(--line); }
.ring-slot { stroke-width: 3; stroke-linecap: round; }
.ring-value { fill: var(--text); font: 600 26px var(--display); letter-spacing: -.02em; }
.ring-caption { fill: var(--faint); font: 500 10.5px var(--font); }
.ring-sub { fill: var(--muted); font: 11.5px var(--font); }
.ring-hand { stroke: var(--red); stroke-width: 1.5; }
.ring-hand-dot { fill: var(--red); }

/* Week / month calendar */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; align-content: center; min-height: 240px; }
.cal-head { font-size: 11px; font-weight: 500; color: var(--faint); text-align: center; padding-bottom: 2px; }
.cal-cell {
  position: relative; aspect-ratio: 1; min-height: 34px; border-radius: 8px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; padding: 0; color: var(--text); font-weight: 400;
}
.cal-cell:hover { background: var(--panel-3); filter: none; }
.cal-cell.blank { visibility: hidden; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-cell.future { opacity: .4; }
.cal-day { position: absolute; top: 3px; left: 6px; font-size: 10.5px; color: var(--faint); }
.cal-bubble { aspect-ratio: 1; border-radius: 50%; background: var(--accent); }
.calendar.week .cal-cell { aspect-ratio: auto; height: 150px; }
.calendar.week .cal-value { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Gauge */
.gauge { display: grid; place-items: center; min-height: 190px; }
.gauge svg { width: min(100%, 290px); height: auto; overflow: visible; }
.gauge-track { fill: none; stroke: var(--panel-2); stroke-width: 16; stroke-linecap: round; }
.gauge-tick { stroke: var(--line-2); stroke-width: 1; }
.gauge-value { fill: var(--text); font: 600 34px var(--display); letter-spacing: -.03em; }
.gauge-caption { fill: var(--faint); font: 500 11px var(--font); }
.gauge-end { fill: var(--faint); font: 10.5px var(--font); }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.bar-row .label { overflow: hidden; font-weight: 500; display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-row .label small { color: var(--faint); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.label-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.bar-row .value { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.legend { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.bar-row.stacked .label { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 1px; }
.bar-row.stacked .label > .legend { grid-row: 1 / span 2; align-self: start; margin-top: 6px; }
.bar-row.stacked .label-text { grid-column: 2; }
.bar-row.stacked .label small { grid-column: 2; white-space: normal; overflow-wrap: anywhere; }
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover .label-text { color: var(--accent); }
.bar-row.selected .label-text { color: var(--accent); }
.sub-bars { padding: 4px 0 6px 14px; border-left: 2px solid var(--panel-2); display: flex; flex-direction: column; gap: 10px; }
.sub-bars .bar-track i { opacity: .7; }
.spectrum { display: flex; height: 8px; gap: 2px; border-radius: 999px; overflow: hidden; }
.spectrum i { display: block; height: 100%; min-width: 3px; flex: 1 1 0; }

/* Devices and status */
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; border-radius: 10px; padding: 9px 12px; background: var(--panel-2); }
.device strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; font-weight: 500; }
.device .value { font-weight: 500; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.tracking { background: var(--green); }
.dot.offline { background: var(--faint); opacity: .7; }
.dot.removed, .dot.never_connected { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.dot.online { background: var(--green); }
.dot.local { background: var(--orange); }
.status {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border-radius: 999px;
  padding: 2px 9px; font-size: 12px; color: var(--muted); background: var(--panel-2);
}
.status.tracking { color: var(--text); background: color-mix(in srgb, var(--green) 14%, transparent); }

/* Avatars */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font: 600 12px/1 var(--font); color: var(--accent); background: var(--accent-soft); border: 0 !important;
}
.avatar.large { width: 52px; height: 52px; font-size: 18px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--faint); padding: 8px 18px; border-bottom: .5px solid var(--line-2); white-space: nowrap; }
.table td { padding: 10px 18px; border-bottom: .5px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.people-table tbody tr { cursor: pointer; }
.people-table tbody tr:hover { background: var(--panel-2); }
.person-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person-name { font-weight: 500; }
.person-meta { color: var(--faint); font-size: 12px; }
.active-cell { min-width: 96px; }
.active-cell .num { display: block; font-weight: 500; text-align: left; }
.mini-track { display: block; height: 4px; border-radius: 999px; background: var(--panel-2); margin-top: 5px; overflow: hidden; }
.mini-track i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.mono-cell { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border-radius: 999px; padding: 2px 9px; font-size: 12px; white-space: nowrap; }
.chip button { padding: 0 2px; background: none; color: var(--faint); font-weight: 600; }
.chip button:hover { color: var(--red); filter: none; }
.chip button.chip-name { color: var(--text); font-weight: 400; padding: 0; }
.chip button.chip-name:hover { color: var(--accent); text-decoration: underline; }
.actions-col { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 2px; flex-wrap: nowrap; justify-content: flex-end; }

/* Task log */
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 108px 3px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 10px 6px; border-bottom: .5px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline .swatch { width: 3px; align-self: stretch; min-height: 24px; border-radius: 2px; background: var(--accent); }
.timeline .what { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.timeline .what strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.timeline .what small { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.task-head strong { min-width: 0; }
.steps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.step { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
.step.editing { color: var(--accent); background: var(--accent-soft); }
.step.excluded_sensitive { color: var(--red); }
button.repeat {
  flex: none; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange);
}
button.repeat.first { background: var(--panel-2); color: var(--muted); }
button.repeat:hover { filter: brightness(1.05); }
.timeline li.brief { opacity: .55; }
.timeline .length { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline .length.idle { font-weight: 400; color: var(--faint); }
.timeline li.gap { color: var(--faint); }
.timeline li.gap .swatch { background: var(--panel-3); }
.timeline li.gap .length { font-weight: 400; color: var(--faint); }
.timeline li.day-row { cursor: pointer; }
.timeline li.day-row:hover { background: var(--panel-2); }

/* Connection */
.connection { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.connection .item { background: var(--panel-2); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.connection code, .copy-field code { font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--text); }
.ok { color: var(--good); font-weight: 500; }
.warn { color: var(--warn); font-weight: 500; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }

/* Recording detail */
.detail-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 10px; background: var(--panel-2); cursor: pointer; color: var(--text); font-weight: 400; font-size: 13px; box-shadow: inset 0 0 0 1px transparent; }
.option:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.option input { margin-top: 3px; accent-color: var(--accent); box-shadow: none; }
.option strong { display: block; font-weight: 600; margin-bottom: 2px; }
.option small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.option-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.detail-options .message { grid-column: 1 / -1; }

/* Dialog */
dialog {
  border: 0; border-radius: 14px; padding: 0; background: var(--panel); color: var(--text);
  width: min(560px, calc(100vw - 32px)); box-shadow: 0 0 0 .5px var(--line-2), 0 24px 70px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(0, 0, 0, .25); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { font-size: 17px; }
#dialog-content { display: flex; flex-direction: column; gap: 12px; color: var(--muted); }
#dialog-content input, #dialog-content select { color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.copy-field { display: flex; gap: 8px; align-items: stretch; background: var(--panel-2); border-radius: 8px; padding: 7px 7px 7px 12px; }
.copy-field code { flex: 1; align-self: center; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Getting started */
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.setup-steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; border-radius: 10px; padding: 12px; background: var(--panel-2); }
.setup-steps .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); box-shadow: 0 0 0 .5px var(--line-2); }
.setup-steps li.done .mark { background: var(--green); color: #fff; box-shadow: none; }
.setup-steps .step-text strong { display: block; font-weight: 600; }
.setup-steps .step-text span { color: var(--muted); font-size: 12.5px; word-break: break-word; }
.setup-steps .step-actions { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* Join page: a calm, one-step-at-a-time setup assistant */
.join-page { min-height: 100vh; display: grid; place-items: start center; padding: 6vh 16px 40px; }
.join-card {
  width: min(620px, 100%); background: var(--panel); border-radius: 20px; padding: 32px;
  display: flex; flex-direction: column; gap: 22px; box-shadow: 0 0 0 .5px var(--line), 0 10px 40px rgba(0, 0, 0, .1);
}
.join-state { display: flex; flex-direction: column; gap: 14px; }
.join-state h1 { font-size: 28px; }
.lead { font-size: 15.5px; color: var(--muted); }
.join-note { background: var(--panel-2); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.os-switch { align-self: flex-start; }
.join-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.join-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 16px; padding: 18px; border-radius: 16px; background: var(--panel-2); }
.join-step h2 { font-size: 17px; }
.step-number {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px;
  background: var(--accent); color: var(--accent-text);
}
.join-step.done .step-number { background: var(--green); font-size: 0; }
.join-step.done .step-number::before { content: "✓"; font-size: 16px; }
.step-body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; color: var(--muted); }
.step-body h2 { color: var(--text); }
.step-body em { font-style: normal; font-weight: 600; color: var(--text); }
.button-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; background: var(--accent); color: var(--accent-text);
  border-radius: 8px; padding: 7px 14px; font-weight: 500; text-decoration: none; align-self: flex-start;
}
.button-link:hover { filter: brightness(1.06); }
.button-link.secondary-link { background: var(--panel); color: var(--text); box-shadow: 0 0 0 .5px var(--line-2), 0 1px 1px rgba(0, 0, 0, .05); }
.button-link.big, button.big { padding: 14px 26px; font-size: 16px; font-weight: 600; border-radius: 12px; }
.step-body .button-link.big { align-self: stretch; }
input.large { padding: 12px 14px; font-size: 16px; border-radius: 10px; }
#redeem-form button.big { margin-top: 6px; }
.join-state details.help { width: 100%; }
.join-state details.help p { margin-top: 6px; }
.copy-field-inline { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; }
.copy-field-inline code { font: 11.5px/1.4 var(--mono); word-break: break-all; }

/* Wider and narrower windows */
@media (max-width: 1240px) {
  .grid.grid-wide, .grid.grid-ring { grid-template-columns: minmax(0, 1fr); }
  .grid.three, .connection { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: .5px solid var(--line-2); }
  .sidebar .brand { padding: 0; }
  .sidebar .brand span, .nav-label, .sidebar-foot { display: none; }
  .tabs { flex-direction: row; overflow-x: auto; flex: 1; }
  main { padding: 18px 16px 32px; }
  .grid, .grid.three, .connection { grid-template-columns: minmax(0, 1fr); }
  .kpis, .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline li { grid-template-columns: 90px 3px minmax(0, 1fr); }
  .timeline .length { grid-column: 3; }
  input[type="search"] { min-width: 0; flex: 1 1 100%; }
  h1 { font-size: 22px; }
}
@media (max-width: 520px) {
  .tabs button span { display: none; }
  .kpi strong { font-size: 21px; }
  .join-card { padding: 22px 18px; border-radius: 16px; }
  .join-state h1 { font-size: 24px; }
  .join-step { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .step-number { width: 28px; height: 28px; font-size: 13px; }
  .card { padding: 14px; }
  .card.flush { padding: 0; }
}

/* Toolbars above tables, sortable and selectable people tables */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 18px 12px; }
.toolbar input[type="search"] { flex: 1 1 220px; max-width: 360px; }
.toolbar-spacer { flex: 1 1 0; }
.sort-select { display: none; }
.table th.num { text-align: right; }
.th-sort { background: none; color: inherit; padding: 0; font: inherit; font-weight: 500; gap: 4px; box-shadow: none; }
.th-sort:hover { color: var(--text); filter: none; }
.th-sort::after { content: ""; width: 8px; display: inline-block; }
th[aria-sort="ascending"] .th-sort::after { content: "▲"; font-size: 8px; }
th[aria-sort="descending"] .th-sort::after { content: "▼"; font-size: 8px; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--text); }
.table th.num .th-sort { flex-direction: row-reverse; }
.select-col { width: 1%; padding-right: 0 !important; }
.select-col input { accent-color: var(--accent); box-shadow: none; margin: 0; vertical-align: middle; }
.people-table tbody tr.selected { background: var(--accent-soft); }
.table.compact { font-size: 13px; }
.table.compact .status { font-size: 11.5px; padding: 2px 8px; }
.table.compact .num, .table.compact .mono-cell { font-size: 12.5px; }
.table.compact td, .table.compact th { padding: 8px 6px; }
.table.compact td:first-child, .table.compact th:first-child { padding-left: 16px; }
.table.compact td:last-child, .table.compact th:last-child { padding-right: 16px; }
.empty h3 { font: 600 17px/1.3 var(--display); margin: 0 0 6px; color: var(--text); }
.empty .empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.empty > button { margin-top: 10px; }
.card-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-foot:empty, .card-foot:not(:has(button:not([hidden]))) { display: none; }

/* Devices: platform, OS, tracker version */
.device-lines { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.device-line { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 0 7px; align-items: start; min-width: 0; }
.device-line > .dot { margin-top: 6px; }
.device-line > .plat-icon { margin-top: 2px; }
.device-text { min-width: 0; display: flex; flex-direction: column; }
.device-head { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 7px; }
.plat-icon { width: 15px; height: 15px; color: var(--muted); }
.device-name { font-weight: 500; overflow-wrap: anywhere; }
.device-meta { color: var(--faint); font-size: 12px; }
.outdated-flag {
  font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--warn);
}
.outdated-flag::before { content: "⚠ "; }
.device-info { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.device-info .plat-icon { width: 13px; height: 13px; }
.device-line .chip-name { background: none; color: var(--text); font-weight: 500; padding: 0; white-space: normal; text-align: left; }
.device-line .chip-name:hover { color: var(--accent); text-decoration: underline; filter: none; }
.device-line .chip-x { background: none; color: var(--faint); font-weight: 600; padding: 0 3px; align-self: start; }
.device-line .chip-x:hover { color: var(--red); filter: none; }
.chip-tag { color: var(--faint); margin-left: 2px; }

/* What people did */
.level-note { background: var(--panel-2); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: var(--muted); }
.routines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.routines .empty { grid-column: 1 / -1; }
.routine { background: var(--panel-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.routine-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.routine-head strong { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.routine-where { color: var(--faint); }
.routine-stats { display: flex; flex-wrap: wrap; gap: 5px; }
.stat-chip { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--panel); color: var(--muted); white-space: nowrap; }
.score-pill { flex: none; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--panel); color: var(--muted); }
.score-pill.high { background: var(--accent); color: var(--accent-text); }
.score-pill.medium { background: var(--accent-soft); color: var(--accent); }
.score-meter { display: flex; align-items: center; gap: 10px; }
.score-meter .bar-track { flex: 1; background: var(--panel-3); }
.routine.low .bar-track i { background: var(--faint); }
.score-value { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.routine-hint { color: var(--muted); font-size: 12.5px; }
.action-chips { margin-top: 5px; display: flex; flex-direction: column; gap: 6px; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.action-chip {
  --chip: var(--accent); font-size: 11.5px; padding: 1px 9px 1px 7px; border-radius: 999px; white-space: nowrap;
  color: var(--text); background: var(--panel-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; gap: 6px;
}
.action-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--chip); flex: none; }
.action-chips button.link { font-size: 11.5px; padding: 0 4px; }
.action-detail { list-style: none; margin: 0; padding: 4px 0 0 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.timeline .action-detail li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; padding: 0; border: 0; }
.timeline .action-detail .when { font-size: 11.5px; }

/* Organization */
.org-tabs { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.org-panel { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.invite-created { background: var(--accent-soft); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.invite-list { display: flex; flex-direction: column; gap: 8px; }
.invite-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 240px) auto; gap: 4px 16px; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.invite-row.revoked, .invite-row.expired, .invite-row.full { opacity: .7; }
.invite-head { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.invite-meta { grid-column: 1; color: var(--faint); }
.invite-usage { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 4px; }
.invite-usage .bar-track { background: var(--panel-3); }
.invite-row .row-actions { grid-column: 3; grid-row: 1 / span 2; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.installer-box { background: var(--panel-2); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: var(--text); }
.installer-box .segmented { align-self: flex-start; }
.bulk-options { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.bulk-summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
#bulk-preview, #bulk-result { display: flex; flex-direction: column; gap: 12px; }
#bulk-preview[hidden], #bulk-result[hidden] { display: none; }
.bulk-table { max-height: 420px; overflow: auto; border-radius: 10px; box-shadow: 0 0 0 .5px var(--line-2); }
.bulk-table th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.table tr.invalid td { background: color-mix(in srgb, var(--red) 7%, transparent); }
.bad { color: var(--bad); font-size: 12.5px; }
.links-view { display: flex; flex-direction: column; gap: 12px; }
.links-summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.link-code { font: 11.5px/1.4 var(--mono); color: var(--muted); display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skipped { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.link-button { color: var(--accent); text-decoration: none; font-weight: 500; padding: 2px 4px; }
.link-button:hover { text-decoration: underline; }
.check-list { display: flex; flex-direction: column; max-height: 320px; overflow: auto; border-radius: 10px; background: var(--panel-2); padding: 4px 0; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; }
.check-row[hidden] { display: none; }
.check-row input { accent-color: var(--accent); box-shadow: none; margin: 0; }
.check-row label { flex: 1; color: var(--text); font-size: 13px; font-weight: 400; cursor: pointer; }
.check-row .check-manage { flex: none; color: var(--muted); font-size: 12px; }
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker input[type="search"] { width: 100%; max-width: none; }
dialog.wide { width: min(900px, calc(100vw - 32px)); }
#dialog-content .copy-field code { color: var(--text); }
#dialog-note:empty { display: none; }

/* Tables become stacked cards on narrow screens */
@media (max-width: 760px) {
  .table.cards-narrow, .table.cards-narrow tbody { display: block; }
  .table.cards-narrow thead { display: none; }
  .table.cards-narrow tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 16px; border-bottom: .5px solid var(--line); }
  .table.cards-narrow td[data-label="Person"], .table.cards-narrow td[data-label="Status"], .table.cards-narrow td[data-label="Devices"],
  .table.cards-narrow td[data-label="Actions"], .table.cards-narrow td[data-label="Link"], .table.cards-narrow td[data-label="Check"],
  .table.cards-narrow td.active-cell { grid-column: 1 / -1; }
  .table.cards-narrow td.select-col { position: absolute; top: 14px; right: 14px; }
  .table.cards-narrow tr:last-child { border-bottom: 0; }
  .table.cards-narrow td, .table.cards-narrow.compact td, .table.cards-narrow.compact td:first-child, .table.cards-narrow.compact td:last-child {
    display: block; padding: 2px 0; border: 0; text-align: left; white-space: normal;
  }
  .table.cards-narrow td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 500; color: var(--faint); }
  .table.cards-narrow td[data-label="Person"]::before, .table.cards-narrow td[data-label="Actions"]::before { display: none; }
  .table.cards-narrow td.select-col { width: auto; padding: 0 !important; }
  .table.cards-narrow .actions-col { width: auto; }
  .table.cards-narrow .row-actions { flex-wrap: wrap; justify-content: flex-start; }
  .table.cards-narrow .num { text-align: left; }
  .table.cards-narrow .device-lines { min-width: 0; }
  .link-code { max-width: 100%; }
  .invite-row { grid-template-columns: minmax(0, 1fr); }
  .invite-meta, .invite-usage, .invite-row .row-actions { grid-column: 1; grid-row: auto; }
  .toolbar { padding: 0 16px 12px; }
  .sort-select { display: block; }
  .toolbar input[type="search"] { max-width: none; flex-basis: 100%; }
  .toolbar-spacer { display: none; }
  .timeline .action-detail li { grid-template-columns: minmax(0, 1fr) auto; }
  .timeline .action-detail .when { grid-column: 1 / -1; }
}

/* People table in Organization: actions sit under the name */
.person-cell { min-width: 170px; }
#org-people td:first-child .row-actions { flex-wrap: wrap; justify-content: flex-start; margin: 4px 0 0 -4px; }
#org-people td:first-child { min-width: 230px; }
#org-people td:nth-child(4) { min-width: 210px; }
#org-people .chips { min-width: 110px; }
#org-people .chips .person-meta { white-space: nowrap; }
#org-people select { max-width: 150px; }

/* Teams of one person, edited in the table row */
.inline-teams summary { cursor: pointer; list-style: none; display: inline-flex; align-items: baseline; gap: 5px; color: var(--text); border-radius: 6px; padding: 1px 4px; margin-left: -4px; }
.inline-teams summary::-webkit-details-marker { display: none; }
.inline-teams summary::after { content: "⌄"; color: var(--accent); font-size: 12px; }
.inline-teams[open] summary::after { content: "⌃"; }
.inline-teams summary:hover { background: var(--panel-2); }
.inline-teams summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.check-list.inline { margin-top: 6px; max-height: 220px; min-width: 180px; padding: 2px 0; }
.check-list.inline .check-row { padding: 4px 8px; }
.inline-status { display: block; color: var(--faint); min-height: 1.2em; margin-top: 2px; }

/* Long values never push a layout apart: names, email addresses, team names and addresses wrap
   or are cut with an ellipsis inside their box, on any screen width. */
input, select, textarea { max-width: 100%; }
select { text-overflow: ellipsis; }
.person-cell > div { min-width: 0; }
.person-name, .person-meta { overflow-wrap: anywhere; }
.check-row { min-width: 0; }
.check-row label { min-width: 0; overflow-wrap: anywhere; }
.row-actions { flex-wrap: wrap; }
.bulk-options > .stack { min-width: 0; max-width: 100%; }
.view-head > * { min-width: 0; max-width: 100%; }
.controls { min-width: 0; max-width: 100%; }
.controls select { max-width: min(100%, 340px); }

/* Add many people: the drop area */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 22px 16px; border-radius: 12px; background: var(--panel-2);
  box-shadow: inset 0 0 0 1.5px var(--line-2); transition: background .15s, box-shadow .15s;
}
.dropzone > .icon { width: 26px; height: 26px; color: var(--accent); }
.dropzone span { max-width: 560px; }
.dropzone.dragging { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
#bulk-paste summary { margin-bottom: 8px; }

/* ---- Home, Companies and one Company ------------------------------------------------------ */
.view { display: flex; flex-direction: column; gap: 18px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px; text-align: left; white-space: normal;
  background: var(--panel); color: var(--text); padding: 14px 16px; border-radius: 14px; font-weight: 400;
  box-shadow: 0 0 0 .5px var(--line), var(--shadow); transition: transform .12s, background .12s;
}
.tile:hover { background: var(--panel-2); filter: none; transform: translateY(-1px); }
.tile-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); }
.tile-icon .icon { width: 19px; height: 19px; }
.tile-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tile-text strong { font-size: 14px; }
.tile-text small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.tile.primary { background: var(--accent); color: #fff; box-shadow: none; }
.tile.primary:hover { background: color-mix(in srgb, var(--accent) 90%, #000); }
.tile.primary .tile-icon { background: rgba(255, 255, 255, .22); color: #fff; }
.tile.primary .tile-text small { color: rgba(255, 255, 255, .85); }

.company-tile {
  width: 40px; height: 40px; border-radius: 11px; display: inline-grid; place-items: center; flex: none;
  font: 600 14px/1 var(--font); border: 1px solid transparent;
}
.company-tile.large { width: 56px; height: 56px; border-radius: 15px; font-size: 19px; }
.company-tile.small { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.company-tile.neutral { background: var(--panel-3); color: var(--muted); border-color: var(--line-2); }

.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.company-card {
  display: flex; flex-direction: column; gap: 16px; align-items: stretch; justify-content: flex-start; text-align: left;
  white-space: normal; background: var(--panel); color: var(--text); padding: 18px; border-radius: 16px; font-weight: 400;
  box-shadow: 0 0 0 .5px var(--line), var(--shadow); transition: transform .12s, box-shadow .12s;
}
.company-card:hover { filter: none; transform: translateY(-2px); box-shadow: 0 0 0 .5px var(--line-2), 0 8px 24px rgba(0, 0, 0, .08); }
.company-card-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.company-card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.company-card-title strong { font-size: 15.5px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-card-title small { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.company-chevron { color: var(--faint); }
.company-numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 0; border-top: .5px solid var(--line); border-bottom: .5px solid var(--line); }
.figure { display: flex; flex-direction: column; min-width: 0; }
.figure strong { font: 600 19px/1.2 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.figure small { font-size: 11.5px; }
.company-note { font-size: 12px; }
.company-note.warn { color: var(--warn); }
.company-card .chips .chip.muted { color: var(--faint); }

.toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-box { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 8px; padding: 0 10px;
  box-shadow: 0 0 0 .5px var(--line-2), 0 1px 1px rgba(0, 0, 0, .04); min-width: min(300px, 100%); }
.search-box .icon { color: var(--faint); }
.search-box input { background: none; box-shadow: none; flex: 1; padding: 7px 0; min-width: 0; }
.search-box input:focus-visible { outline: none; }
.search-box:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }

.hero { align-items: flex-start; padding: 28px; gap: 14px; }
.hero h2 { font-size: 21px; letter-spacing: -.02em; }
.hero.compact { padding: 22px; }
.hero p { max-width: 62ch; }
.hero-steps { list-style: none; counter-reset: step; margin: 6px 0 4px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.hero-steps li { counter-increment: step; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; background: var(--panel-2); }
.hero-steps li::before { content: counter(step); width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font: 600 12px/1 var(--font); margin-bottom: 4px; }

.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 12px; justify-content: flex-start; text-align: left; white-space: normal;
  background: none; color: var(--text); padding: 10px 6px; border-radius: 10px; font-weight: 400; }
.mini-row:hover { background: var(--panel-2); filter: none; }
.mini-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mini-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-value { display: flex; flex-direction: column; align-items: flex-end; }
.mini-value strong { font-variant-numeric: tabular-nums; }

.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.attention-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.attention-item > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attention-item.warn .icon { color: var(--orange); }
.attention-item.info .icon { color: var(--accent); }
.attention-item .names { color: var(--muted); overflow-wrap: anywhere; }
.all-good { display: flex; gap: 8px; align-items: center; color: var(--muted); padding: 6px 0; }
.all-good .icon { color: var(--green); }

.company-head { display: flex; flex-direction: column; gap: 10px; }
.back-link { align-self: flex-start; padding-left: 0; }
.back-link .icon { width: 14px; height: 14px; }
.company-view-head { align-items: center; }
.company-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.company-info { white-space: pre-wrap; color: var(--muted); max-width: 80ch; background: var(--panel); border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 0 0 .5px var(--line); }
.org-tabs { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.org-panel { display: flex; flex-direction: column; gap: 16px; }

.free-text { font: 13.5px/1.5 var(--font); }
.create-company input, .create-company textarea { width: 100%; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 8px; }
.chip.removable { background: var(--accent-soft); color: var(--text); padding: 3px 4px 3px 11px; }
.chip.removable .chip-x { background: none; color: var(--muted); padding: 0 6px; border-radius: 999px; font-size: 14px; }
.chip.removable .chip-x:hover { color: var(--red); filter: none; }
.chip-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.suggestion { background: var(--panel-2); color: var(--muted); box-shadow: none; padding: 3px 11px; font-weight: 400; }
.chip.suggestion:hover { background: var(--panel-3); color: var(--text); filter: none; }

.admin-list { display: flex; flex-direction: column; }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: .5px solid var(--line); }
.admin-row > div:nth-child(2) { flex: 1; min-width: 0; }
.callout { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); }
.send-how { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; max-width: 360px; }
.danger-zone { box-shadow: 0 0 0 .5px color-mix(in srgb, var(--red) 40%, transparent); align-items: flex-start; }
.card-foot { padding: 10px 18px 14px; }

@media (max-width: 1240px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-steps { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .company-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .company-numbers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .company-title { flex-wrap: wrap; }
  .hero { padding: 20px; }
}
.mail-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.mail-form input, .mail-form select { width: 100%; }
@media (max-width: 700px) { .mail-form { grid-template-columns: minmax(0, 1fr); } }
.self-note { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.self-note > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }

/* Sign-in modes, remembered devices, phone code ------------------------------------------ */
.signin-card .segmented { align-self: stretch; margin: 4px 0 12px; }
.signin-card .segmented button { flex: 1; padding: 6px 10px; }
.signin-card .check { white-space: normal; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.device-list { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.device-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); }
.device-list .device-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.device-list .device-text strong { font-weight: 500; font-size: 13.5px; }
.device-list .device-text span { color: var(--muted); font-size: 12px; }
.device-list button { flex: none; padding: 4px 10px; }
.device-empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-box svg { width: min(260px, 70vw); height: auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--line-2); background: #fff; }
.qr-steps { margin: 0; padding-left: 18px; color: var(--text); font-size: 13.5px; line-height: 1.5; }
.qr-timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.qr-ok { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 0; }
.qr-ok .big-check { width: 52px; height: 52px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.qr-ok .big-check svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.role-cards { display: grid; gap: 8px; }
.role-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); cursor: pointer; box-shadow: inset 0 0 0 1.5px transparent; }
.role-card:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.role-card input { margin-top: 3px; accent-color: var(--accent); box-shadow: none; }
.role-card .role-title { font-weight: 500; font-size: 13.5px; color: var(--text); }
.role-card .role-text { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.role-card .role-badge { margin-left: 6px; font-size: 11px; font-weight: 500; color: var(--muted); background: var(--panel-3); border-radius: 999px; padding: 1px 8px; }
.role-extra { margin-top: 4px; }
.qr-box ~ .qr-timer, .qr-timer { text-align: center; }
#dialog-content .qr-box ~ div { text-align: center; }
#view-account .grid { align-items: start; }
