/* Theme made with the unslop skill (CC BY 4.0, Damir Sokolovsky, github.com/heydamir/unslop),
   ported from web/src/styles.css.
   Direction: steady and exact, like a telecom switchboard. Graphite surfaces, one signal-teal accent.
   Signature: the line lamp, a small status light used for requests, companies, agents and presence.
   Spacing on a 4px grid; radius 8–16; icons 16/18px with a 1.5 stroke. Area styles live in
   chat.css, console.css and calls.css: this file holds tokens, the shell and shared components. */

:root {
  --page: #fafafa;
  --card: #ffffff;
  --raised: #f4f4f5;
  --side: #f4f4f5;
  --text: #171717;
  --text-2: #525252;
  --text-3: #737373;
  --line: rgb(23 23 23 / 0.08);
  --line-strong: rgb(23 23 23 / 0.14);
  --accent: #0f766e;
  --accent-hover: #115e59;
  --on-accent: #ffffff;
  --accent-soft: rgb(15 118 110 / 0.09);
  --ok: #16a34a;
  --wait: #b45309;
  --bad: #dc2626;
  --idle: #a3a3a3;
  --mine: #e7f3f1;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-2: 0 8px 24px rgb(0 0 0 / 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --rail: 64px;
  --ring: var(--card); /* the gap around a presence dot: the surface it sits on */

  /* Avatar tones: background, ink. Chosen by name (avatarColor), so a person keeps theirs. */
  --av1-bg: #d5ece8; --av1-fg: #115e59;
  --av2-bg: #dbe6f5; --av2-fg: #1e4f8a;
  --av3-bg: #e2e2f3; --av3-fg: #3d3f86;
  --av4-bg: #eedfe9; --av4-fg: #7a2e5e;
  --av5-bg: #f5dfdc; --av5-fg: #8f3127;
  --av6-bg: #f3e6cf; --av6-fg: #7c4a0c;
  --av7-bg: #e1ead3; --av7-fg: #3f5a1d;
  --av8-bg: #e7e5e2; --av8-fg: #4a4540;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #141415;
    --card: #19191b;
    --raised: #232325;
    --side: #0f0f10;
    --text: #ededed;
    --text-2: #a1a1a6;
    --text-3: #85858b;
    --line: rgb(237 237 237 / 0.08);
    --line-strong: rgb(237 237 237 / 0.14);
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --on-accent: #04201d;
    --accent-soft: rgb(45 212 191 / 0.12);
    --ok: #4cc38a;
    --wait: #f5a524;
    --bad: #e5484d;
    --idle: #6b6b70;
    --mine: #173230;
    --shadow-1: none;
    --shadow-2: 0 8px 24px rgb(0 0 0 / 0.4);
    --av1-bg: #163533; --av1-fg: #8ee0d3;
    --av2-bg: #18293f; --av2-fg: #9cc3f0;
    --av3-bg: #232442; --av3-fg: #b4b6ef;
    --av4-bg: #36202f; --av4-fg: #e7a9cf;
    --av5-bg: #3b1f1c; --av5-fg: #f0a99f;
    --av6-bg: #372a14; --av6-fg: #ebc27f;
    --av7-bg: #243018; --av7-fg: #b5d38e;
    --av8-bg: #2a2826; --av8-fg: #cdc7c0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 14px/20px var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 36px; font-weight: 500; }
h2 { font-size: 16px; line-height: 24px; font-weight: 500; }
h3 { font-size: 14px; line-height: 20px; font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { flex: none; display: block; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); font-size: 12px; line-height: 16px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prose a, a.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Shell: the sidebar + content. html[data-nav] is "expanded" (icons and labels under headings) or
   "compact" (icons with tooltips); app.js toggles it. Below 1200 px it stays compact and the toggle opens it
   as a drawer over the page ([data-open]); phones get a bottom tab bar with "More" for the rest. */
:root[data-nav="expanded"] { --rail: 224px; }
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: 100%; transition: grid-template-columns 180ms var(--ease); }
.content { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; overflow-y: auto; position: relative; }
.rail {
  --ring: var(--side);
  grid-column: 1; grid-row: 1;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0;
  gap: 8px;
  min-height: 0; min-width: 0;
}
.rail-brand { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; margin-bottom: 8px; }
.rail-brand-name, .rail-heading, .rail-label, .rail-me-text, .rail .rail-more, .rail-toggle-close { display: none; }
.rail-items, .rail-foot, .rail-group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-items { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 0 12px; }
.rail-group + .rail-group { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.rail-foot { padding-top: 8px; }
.rail-foot form { margin: 0; }
.rail-item {
  position: relative; flex: none;
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-2); background: none; border: 0; padding: 0; cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.rail-item:hover { background: var(--line); color: var(--text); }
.rail-item:focus-visible { outline-offset: -2px; }
.rail-item[aria-current="page"] { background: var(--card); color: var(--text); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.rail-item[aria-current="page"] .icon { color: var(--accent); }
.rail-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 12px; width: 3px; height: 16px;
  border-radius: 0 2px 2px 0; background: var(--accent);
}
.rail-me[aria-current="page"] { box-shadow: none; background: none; }
.rail-badge {
  position: absolute; top: 2px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--side);
  font-size: 10px; line-height: 16px; font-weight: 600; text-align: center;
}
/* Compact: a tooltip names the item on hover and keyboard focus (app.js places it; the rail scrolls, so
   a pseudo-element beside the item would be clipped). */
.rail-tip {
  position: fixed; z-index: 45; pointer-events: none; transform: translateY(-50%);
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  background: var(--text); color: var(--page); font-size: 12px; line-height: 16px; font-weight: 500;
  box-shadow: var(--shadow-2); animation: tip-in 120ms var(--ease);
}
@keyframes tip-in { from { opacity: 0; } }

/* Expanded, and the drawer: icons with labels, headings, a badge pill at the end of the row. */
:root[data-nav="expanded"] .rail, .rail[data-open] { align-items: stretch; }
:root[data-nav="expanded"] .rail-brand, .rail[data-open] .rail-brand { width: auto; display: flex; align-items: center; gap: 10px; margin: 0 12px 4px; padding: 0 8px; }
:root[data-nav="expanded"] .rail-brand-name, .rail[data-open] .rail-brand-name { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-nav="expanded"] :is(.rail-items, .rail-foot, .rail-group), .rail[data-open] :is(.rail-items, .rail-foot, .rail-group) { align-items: stretch; gap: 2px; }
:root[data-nav="expanded"] .rail-group + .rail-group, .rail[data-open] .rail-group + .rail-group { margin-top: 12px; padding-top: 0; border-top: 0; }
:root[data-nav="expanded"] .rail-heading, .rail[data-open] .rail-heading { display: block; padding: 4px 10px; color: var(--text-3); font-size: 12px; line-height: 16px; font-weight: 500; }
:root[data-nav="expanded"] .rail-item, .rail[data-open] .rail-item { width: auto; height: 36px; display: flex; align-items: center; gap: 12px; padding: 0 10px; font-weight: 500; text-align: left; }
:root[data-nav="expanded"] .rail-item[aria-current="page"]::before, .rail[data-open] .rail-item[aria-current="page"]::before { top: 10px; }
:root[data-nav="expanded"] .rail-label, .rail[data-open] .rail-label { display: block; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-nav="expanded"] .rail-badge, .rail[data-open] .rail-badge { position: static; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; line-height: 20px; box-shadow: none; }
:root[data-nav="expanded"] .rail-foot, .rail[data-open] .rail-foot { margin: 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
:root[data-nav="expanded"] .rail-me, .rail[data-open] .rail-me { height: 48px; padding: 0 6px; gap: 10px; }
:root[data-nav="expanded"] .rail-me-text, .rail[data-open] .rail-me-text { display: flex; flex-direction: column; min-width: 0; line-height: 16px; }
:root[data-nav="expanded"] .rail-me-text > *, .rail[data-open] .rail-me-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-nav="expanded"] .rail-me-text b, .rail[data-open] .rail-me-text b { color: var(--text); font-weight: 500; }
:root[data-nav="expanded"] .rail-me-text span, .rail[data-open] .rail-me-text span { color: var(--text-3); font-size: 12px; font-weight: 400; }
:root[data-nav="expanded"] :is(.rail-toggle-open, .rail-more), .rail[data-open] :is(.rail-toggle-open, .rail-more) { display: none; }
:root[data-nav="expanded"] .rail-toggle-close, .rail[data-open] .rail-toggle-close { display: block; }

/* The drawer: below 1200 px, and "More" on phones. */
.rail[data-open] {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  width: min(264px, 86vw); padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-2); animation: drawer-in 180ms var(--ease);
}
@keyframes drawer-in { from { transform: translateX(-16px); opacity: 0; } }
.rail-scrim { position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / 0.3); }

/* Phones: the rail becomes a tab bar along the bottom. BVD see their daily items there; More opens the rest. */
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .content { grid-column: 1; grid-row: 1; }
  .rail:not([data-open]) {
    grid-column: 1; grid-row: 2; flex-direction: row; padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
  }
  .rail:not([data-open]) :is(.rail-brand, .rail-signout, .rail-toggle, .rail-group[data-group="manage"]) { display: none; }
  .rail:not([data-open]) .rail-items { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 0; justify-content: space-around; min-width: 0; }
  .rail:not([data-open]) .rail-group { display: contents; }
  .rail:not([data-open]) .rail-more { display: grid; }
  .rail:not([data-open]) .rail-foot { flex-direction: row; padding: 0; }
  .rail:not([data-open]) .rail-item { width: 44px; height: 44px; }
  .rail:not([data-open]) .rail-item[aria-current="page"]::before { left: 14px; top: auto; bottom: -4px; width: 16px; height: 3px; border-radius: 2px 2px 0 0; }
}

/* Pages */
.page { max-width: 1040px; width: 100%; margin-inline: auto; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.page-narrow { max-width: 640px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
@media (max-width: 720px) { .page { padding: 16px; gap: 16px; } h1 { font-size: 24px; line-height: 32px; } }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.brand-mark { width: 24px; height: 24px; flex: none; display: block; }
.brand-mark .bm-bg { fill: var(--accent); }
.brand-mark .bm-fg { fill: var(--on-accent); }

.auth-page {
  min-height: 100%; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(60rem 36rem at 12% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(48rem 30rem at 110% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--page);
}
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.auth-card > .auth {
  max-width: none; padding: 32px; border-radius: 20px; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 24px 48px -12px rgb(15 118 110 / 0.14); gap: 18px;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 4px; }
.auth-brand h1 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; margin: 8px 0 0; }
.auth-brand .muted { max-width: 36ch; text-wrap: balance; }
.auth-mark { display: block; border-radius: 14px; }
.auth-mark .brand-mark { width: 52px; height: 52px; filter: drop-shadow(0 6px 14px rgb(15 118 110 / 0.25)); }
.auth-done { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.auth .field label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.auth-link { color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 4px; }
.auth-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; align-self: center; }
.input-lg { height: 44px; font-size: 15px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; width: 100%; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--text-3); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--raised); }
.pw-toggle .pw-hide, .pw-toggle[aria-pressed="true"] .pw-show { display: none; }
.pw-toggle[aria-pressed="true"] .pw-hide { display: contents; }
.auth-check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.auth-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.auth-check .faint { font-size: 13px; }
.auth-error {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 20px;
  color: var(--bad); background: color-mix(in srgb, var(--bad) 9%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent);
}
.auth-error .icon { flex: none; margin-top: 2px; }
.auth-note { font-size: 14px; color: var(--text-2); text-align: center; margin: 0; }
.auth-foot { font-size: 13px; color: var(--text-3); text-align: center; margin: 0; }
.input[aria-invalid="true"] { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.btn-lg { height: 44px; font-size: 15px; border-radius: 10px; }
.btn-spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.85; }
.btn[aria-busy="true"] .btn-spinner { display: inline-block; }
@keyframes spin { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 2s; } }
@media (max-width: 480px) { .auth-card > .auth { padding: 24px 20px; border-radius: 16px; } }
.auth { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 24px; }
.auth-head { display: flex; flex-direction: column; gap: 4px; }
.auth-head .lamp { margin-bottom: 8px; }
.empty-state { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 48px 0; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), transform 100ms var(--ease);
}
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--line); color: var(--text); }
.btn-danger:hover { color: var(--bad); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-block { width: 100%; }
.input, .select, .textarea {
  height: 36px; padding: 0 12px; border-radius: 8px; width: 100%;
  border: 1px solid var(--line-strong); background: var(--card);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.input[readonly] { background: var(--raised); color: var(--text-2); }
.textarea { height: auto; padding: 8px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-2); font-size: 13px; font-weight: 500; }
.field > span.faint { font-weight: 400; font-size: 12px; color: var(--text-3); }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1; min-width: 0; }
.error { color: var(--bad); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.note { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); display: flex; align-items: center; gap: 8px; }
.flash .icon { color: var(--accent); }

/* Surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-1); }
.card-pad { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); min-height: 60px; }
.card-head:last-child { border-bottom: 0; }
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); min-height: 56px; }
.item:first-child { border-top: 0; }
a.item:hover { background: var(--raised); }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: 5px; background: var(--raised); color: var(--text-2); font-size: 12px; font-weight: 500; }
.empty { padding: 48px 24px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.count {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; flex: none;
  background: var(--accent); color: var(--on-accent); font-size: 11px; line-height: 18px; font-weight: 600; text-align: center;
  font-variant-numeric: tabular-nums;
}
.count[data-mention] { background: var(--bad); color: #fff; }
.tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }

/* Avatars: circles for people, rounded squares for AI agents */
.avatar {
  --size: 36px;
  position: relative; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%;
  display: grid; place-items: center;
  font-size: calc(var(--size) * 0.36); font-weight: 500; line-height: 1; letter-spacing: 0.01em;
  background: var(--av-bg, var(--raised)); color: var(--av-fg, var(--text-2));
  user-select: none;
}
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.avatar-sm { --size: 28px; }
.avatar-md { --size: 36px; }
.avatar-lg { --size: 48px; }
.avatar-xl { --size: 72px; }
.avatar[data-agent] { border-radius: 30%; }
.avatar[data-color="1"] { --av-bg: var(--av1-bg); --av-fg: var(--av1-fg); }
.avatar[data-color="2"] { --av-bg: var(--av2-bg); --av-fg: var(--av2-fg); }
.avatar[data-color="3"] { --av-bg: var(--av3-bg); --av-fg: var(--av3-fg); }
.avatar[data-color="4"] { --av-bg: var(--av4-bg); --av-fg: var(--av4-fg); }
.avatar[data-color="5"] { --av-bg: var(--av5-bg); --av-fg: var(--av5-fg); }
.avatar[data-color="6"] { --av-bg: var(--av6-bg); --av-fg: var(--av6-fg); }
.avatar[data-color="7"] { --av-bg: var(--av7-bg); --av-fg: var(--av7-fg); }
.avatar[data-color="8"] { --av-bg: var(--av8-bg); --av-fg: var(--av8-fg); }
.presence {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--idle); box-shadow: 0 0 0 2px var(--ring);
  transition: background 200ms var(--ease);
}
.presence[data-state="online"] { background: var(--ok); }
.avatar-lg .presence, .avatar-xl .presence { width: 12px; height: 12px; right: 1px; bottom: 1px; }
.profile-photo { display: flex; align-items: center; gap: 16px; }

/* The line lamp */
.lamp { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.lamp::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--tone, var(--idle));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone, var(--idle)) 18%, transparent);
}
.lamp[data-tone="ok"] { --tone: var(--ok); }
.lamp[data-tone="wait"] { --tone: var(--wait); }
.lamp[data-tone="bad"] { --tone: var(--bad); }
.lamp[data-tone="live"] { --tone: var(--accent); }
.lamp[data-tone="live"]::before { animation: lamp 1.6s var(--ease) infinite; }
@keyframes lamp { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--tone) 8%, transparent); } }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--card); color: var(--text); box-shadow: var(--shadow-2); width: min(440px, calc(100% - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 0.3); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.checks { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.checks label { display: flex; align-items: center; gap: 10px; min-height: 32px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 12px 20px 8px; }
td { padding: 12px 20px; border-top: 1px solid var(--line); vertical-align: middle; }
.table-wrap { overflow-x: auto; }

/* Toasts: portal.toast(text) */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 360px; padding: 10px 14px; border-radius: 10px;
  background: var(--text); color: var(--page); box-shadow: var(--shadow-2);
  animation: toast-in 200ms var(--ease);
}
.toast[data-tone="bad"] { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(4px); } }
/* A notification's toast opens its item (notify.js); urgent ones in red. */
a.toast { display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
a.toast:hover { box-shadow: var(--shadow-2), 0 0 0 2px var(--accent); }
a.toast:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toast small { opacity: 0.8; font-size: 12px; overflow-wrap: anywhere; }

/* Notification banner (notify.js) */
.notify-banner {
  display: flex; align-items: flex-start; gap: 10px; margin: 6px 12px 4px; padding: 10px 10px 10px 12px; border-radius: 12px;
  background: var(--accent-soft); font-size: 13px; line-height: 18px; animation: toast-in 160ms var(--ease);
}
.notify-banner > .icon { color: var(--accent); margin-top: 1px; }
.notify-banner-text { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.notify-banner-text .row { gap: 6px; }
.notify-slot:empty { display: none; }
.notify-slot .notify-banner { margin: 12px 24px 0; }
@media (max-width: 720px) { .notify-slot .notify-banner { margin: 12px 16px 0; } }
@media (max-width: 720px) { .toasts { left: 16px; bottom: 72px; } .toast { max-width: none; } }

.scrim { position: fixed; inset: 0; z-index: 19; background: rgb(0 0 0 / 0.3); }

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

/* v2.4.17: two sites, passkeys */
.auth-moved {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 20px;
  color: var(--text); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.auth-moved .icon { flex: none; margin-top: 2px; color: var(--accent); }
.auth-moved a, .auth-foot a { color: var(--accent); font-weight: 600; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth-passkey { gap: 8px; }
.auth-alt { margin: -6px 0 0; text-align: center; }
.auth-error[hidden] { display: none; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; padding: 14px 16px; list-style: none;
  border-radius: 10px; background: var(--raised); border: 1px dashed var(--line-strong); font-family: var(--mono, ui-monospace, monospace); font-size: 15px; }
.pk-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; }
.pk-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.pk-row + .pk-row { border-top: 1px solid var(--line); }
.pk-row > .icon { color: var(--accent); flex: none; }
.pk-name { display: flex; gap: 8px; align-items: center; flex: 1 1 220px; min-width: 0; }
.pk-name .input { flex: 1; min-width: 0; }
.pk-meta { font-size: 13px; color: var(--text-3); flex: 1 1 100%; padding-left: 30px; margin-top: -6px; }
.pk-add { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.pk-add .field { flex: 1 1 220px; margin: 0; }
.mono-input { font-family: var(--mono); letter-spacing: 0.04em; }
