/* Icons: a subset of Material Symbols Outlined (only the names in
   public/fonts/icons.txt, about 6 KB) served by the panel itself. A new icon
   needs its name added there and the font fetched again (design.md). */
@font-face { font-family: 'Material Symbols Outlined'; font-style: normal; font-weight: 400; font-display: block; src: url(/public/fonts/material-symbols.woff2?v=20261123) format('woff2'); }
.material-symbols-outlined { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr; font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased; }
/* ============================================================
   landworker.ai admin panel.
   Self-contained (independent of the Tailwind build) and written with the
   same tokens as the React app's shadcn "zinc" theme (client/src/index.css):
   white surfaces, zinc-950 text, zinc-200 hairlines, zinc-900 primary
   buttons, 0.5rem radius, the system sans stack. The rust wordmark is the
   only accent, as on the landing page.
   ============================================================ */
:root {
  --bg: #f1f1f3;        /* neutral light grey: the page behind the white cards */
  --bg-muted: #f7f7f8;
  --surface: #ffffff;
  --secondary: #f4f4f5;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --text: #09090b;
  --text-muted: #71717a;
  --text-subtle: #a1a1aa;
  --primary: #18181b;
  --primary-hover: #27272a;
  --primary-fg: #fafafa;
  --ring: #a1a1aa;
  --brand: #9a3412;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #b91c1c;
  --success-soft: #f0fdf4;
  --success-border: #bbf7d0;
  --success-text: #15803d;
  --info-soft: #f4f4f5;
  --info-text: #3f3f46;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;
  --radius: 0;           /* sharp corners on cards, tables, modals */
  --radius-md: 6px;      /* buttons and inputs keep a soft edge */
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, .05);
  --shadow-lg: 0 10px 15px -3px rgba(9, 9, 11, .1), 0 4px 6px -4px rgba(9, 9, 11, .1);
  --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.material-symbols-outlined {
  font-variation-settings: 'wght' 400, 'opsz' 20;
  vertical-align: middle;
  line-height: 1;
  font-size: 20px;
}
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---- Brand ---- */
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { height: 28px; width: 28px; border-radius: 0; flex-shrink: 0; }
.avatar-img { object-fit: cover; }
.user-cell { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--brand); }
.brand-tag { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--secondary); border-radius: 0; padding: 2px 8px; }
.brand-light .brand-mark { color: #fdba74; }
.brand-light .brand-tag { color: #d4d4d8; background: rgba(255, 255, 255, .12); }

/* ---- Sign-in (split panel) ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 45% 1fr; }
.auth-panel {
  background: var(--primary);
  color: #fafafa;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 48px 48px;
}
.auth-panel-line { margin: 20px 0 0; font-size: 18px; color: #d4d4d8; max-width: 26ch; }
.auth-panel-foot { margin: 0; font-size: 12px; color: #71717a; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-form { width: 100%; max-width: 400px; }
.auth-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.auth-sub { color: var(--text-muted); margin: 6px 0 24px; }
.auth-help { color: var(--text-muted); font-size: 13px; margin: 20px 0 0; }
@media (max-width: 800px) {
  .auth { grid-template-columns: 1fr; }
  .auth-panel { padding: 28px 24px; }
  .auth-panel-foot { display: none; }
}

/* ---- App shell (classic sidebar) ---- */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.sidebar {
  background: var(--primary);
  color: var(--primary-fg);
  border-right: 1px solid var(--primary);
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0; min-width: 0; }
.sidebar-head .brand-icon { height: 24px; width: 24px; }
.sidebar-head .brand { min-width: 0; gap: 6px; }
.sidebar-head .brand-mark { font-size: 16px; flex-shrink: 0; white-space: nowrap; }
.sidebar-head .brand-tag { flex-shrink: 0; }
.sidebar-toggle { flex-shrink: 0; }
/* Collapsed sidebar: icons only, labels hidden. */
.app-collapsed { grid-template-columns: 64px 1fr; }
.app-collapsed .sidebar { padding: 24px 12px; }
.app-collapsed .sidebar-head { padding: 0; justify-content: center; }
.app-collapsed .brand, .app-collapsed .nav-label, .app-collapsed .me-text { display: none; }
.app-collapsed .nav-item, .app-collapsed .btn-ghost { justify-content: center; padding-left: 0; padding-right: 0; }
.app-collapsed .me { justify-content: center; padding: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
  color: rgba(250, 250, 250, .75); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); color: var(--primary-fg); }
.nav-item-active { background: rgba(255, 255, 255, .14); color: var(--primary-fg); }
.nav-item .material-symbols-outlined { color: inherit; }
.sidebar .brand-mark { color: var(--primary-fg); }
.sidebar .brand-tag { background: rgba(255, 255, 255, .14); color: rgba(250, 250, 250, .8); font-size: 10px; padding: 1px 6px; }
.sidebar .btn-ghost, .sidebar .btn-icon, .sidebar .sidebar-toggle { color: rgba(250, 250, 250, .75); }
.sidebar .btn-ghost .material-symbols-outlined, .sidebar .sidebar-toggle .material-symbols-outlined { color: inherit; }
.sidebar .btn-ghost:hover, .sidebar .sidebar-toggle:hover { background: rgba(255, 255, 255, .08); color: var(--primary-fg); }
.sidebar .me-email { color: rgba(250, 250, 250, .6); }
.sidebar .avatar { background: rgba(255, 255, 255, .14); color: var(--primary-fg); }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 12px; }
/* One account row: the avatar centred on the menu icons, sign-out at the end. */
.me { display: flex; align-items: center; gap: 10px; padding: 4px 0 4px 6px; min-width: 0; }
.me-text { flex: 1; min-width: 0; line-height: 1.3; }
.me-signout { flex-shrink: 0; }
.app-collapsed .me { flex-direction: column; gap: 8px; padding: 0; }
.me-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-email { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { height: 32px; width: 32px; border-radius: 999px; background: var(--secondary); color: var(--text); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
/* One fixed column: past 1280 px of content the page centres instead of
   stretching, so cards and tables keep the same edges on any screen. */
.content { padding: 24px max(28px, calc((100% - 1280px) / 2)) 64px; min-width: 0; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
@media (max-width: 900px) {
  .app, .app-collapsed { grid-template-columns: 1fr; }
  .sidebar-toggle { display: none; }
  .app-collapsed .brand, .app-collapsed .nav-label, .app-collapsed .me-text { display: revert; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 16px; gap: 12px; }
  .nav { flex-direction: row; }
  .sidebar-foot { border-top: none; padding-top: 0; }
  .content { padding: 24px 16px 48px; }
  .nav { flex-wrap: wrap; }
  .page-head { flex-wrap: wrap; }
}

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { padding: 14px 18px; }
.stat-link { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.stat-link:hover { border-color: var(--ring); box-shadow: var(--shadow-lg); }
.stat-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.stat-link .user-email { margin-top: 2px; }
.toolbar-field.toolbar-clear { min-width: 0; }
.toolbar-clear:has(> .hidden) { display: none; }
.table a.user-link { color: inherit; text-decoration: none; }
.table a.user-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.table-users .th-btn { padding: 9px 12px; }
.empty .btn { margin-top: 12px; }
.stat-label { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: 2px; }
.stat-card .user-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Toolbar ---- */
.toolbar { display: flex; gap: 12px; padding: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.toolbar-field { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.toolbar-search { flex: 1; min-width: 240px; }
.search { position: relative; }
.search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 18px; pointer-events: none; }
.search .input { padding-left: 36px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; font: inherit; font-size: 14px; font-weight: 500;
  border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .material-symbols-outlined { font-size: 18px; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--text-subtle); }
.btn-outline:hover { background: var(--secondary); }
.btn-ghost { background: transparent; color: var(--text); justify-content: flex-start; }
.btn-ghost:hover { background: var(--secondary); }
.btn-ghost .material-symbols-outlined { color: var(--text-muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; width: 32px; border-radius: var(--radius-md);
  border: none; background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--secondary); color: var(--text); }
.btn-icon .material-symbols-outlined { font-size: 19px; }
.btn-icon-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon-success:hover { background: var(--success-soft); color: var(--success-text); }
.btn-icon-placeholder { cursor: default; }
.spinner { height: 16px; width: 16px; }

/* ---- Forms ---- */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.input, .select {
  width: 100%; height: 38px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--input); border-radius: var(--radius-md);
  padding: 0 12px; outline: none; transition: box-shadow .15s, border-color .15s;
}
.input::placeholder { color: var(--text-muted); }
.input:hover, .select:hover { border-color: var(--ring); }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24, 24, 27, .08); }
.select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
.input-group {
  display: flex; align-items: center; height: 38px;
  border: 1px solid var(--input); border-radius: var(--radius-md); padding: 0 4px 0 12px;
  background: var(--surface); transition: box-shadow .15s;
}
.input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24, 24, 27, .08); }
.input-group input { flex: 1; min-width: 0; border: none; outline: none; height: 100%; font: inherit; font-size: 14px; background: transparent; color: var(--text); }
.input-group input::placeholder { color: var(--text-muted); }
.input-group .toggle { height: 32px; width: 32px; border: none; background: none; color: var(--text-muted); cursor: pointer; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; }
.input-group .toggle:hover { color: var(--text); background: var(--secondary); }
.input-group .toggle .material-symbols-outlined { font-size: 19px; }
/* A browser's autofill paints its own pale blue over a field. Paint ours
   back, so a remembered email or password looks like any other value. */
.input:-webkit-autofill, .input:-webkit-autofill:hover, .input:-webkit-autofill:focus,
.input-group input:-webkit-autofill, .input-group input:-webkit-autofill:hover, .input-group input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  box-shadow: 0 0 0 1000px var(--surface) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}
.input-group:has(input:-webkit-autofill) { background: var(--surface); }

/* ---- Table ---- */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table thead th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-muted); background: var(--bg-muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* One line per row: a cell never wraps; a long name or note is cut with
   "…" (the whole text shows on hover, admin-ui.js) and wraps only where a
   cell opts in with .wrap. */
.table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table tbody td.wrap { white-space: normal; }
.table td.cut { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; }
/* A long list shows its first 15 rows (views.ShowFirst) until "Show all". */
.table-more:not(.table-open) tbody tr:nth-child(n+16) { display: none; }
.table .user-cell > div { min-width: 0; }
.table .user-name, .table .user-email { display: block; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .user-email { font-size: 12px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-muted); }
.ta-right { text-align: right; }
.user-name { font-weight: 500; }
.user-email { color: var(--text-muted); font-size: 13px; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; }
.table-foot { flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager-per { display: flex; align-items: center; gap: 8px; }
.select-sm { height: 32px; width: auto; padding-right: 28px; font-size: 13px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-sm .material-symbols-outlined { font-size: 16px; }
.row-inactive .user-name, .row-inactive .user-email { color: var(--text-muted); }

/* ---- Badges ---- */
/* Badges are tinted by meaning, the word always on them (design.md §2):
   grey a label, green done or fine, amber check this, red wrong or sent
   back, muted grey off; a fraud sign is a solid red chip. */
.badge { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid var(--border); background: var(--secondary); color: var(--text); }
.badge-role { }
.badge-active { background: var(--success-soft); border-color: var(--success-border); color: var(--success-text); }
.badge-inactive { color: var(--text-muted); background: var(--secondary); border-color: transparent; }
.badge-attention { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }

/* ---- Skeletons (first load) and in-flight dimming (htmx requests) ---- */
.skeleton { background: var(--secondary); border-radius: var(--radius-md); animation: pulse 1.6s ease-in-out infinite; }
.skeleton-text { height: 14px; margin: 4px 0; }
.skeleton-sm { height: 12px; }
.skeleton-value { height: 30px; width: 56px; margin-top: 8px; }
.skeleton-pill { height: 22px; width: 72px; border-radius: 0; }
.skeleton-icon { height: 24px; width: 24px; }
.skeleton-row { display: flex; align-items: center; gap: 20px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.skeleton-head { background: var(--bg-muted); }
.skeleton-cell { display: flex; flex-direction: column; justify-content: center; }
.skeleton-actions { margin-left: auto; flex-direction: row; gap: 8px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
#users-container.htmx-request { opacity: .6; transition: opacity .15s; }

/* ---- Empty / loading ---- */
.empty { text-align: center; padding: 56px 24px; color: var(--text-muted); }
.empty-icon { font-size: 36px; color: var(--text-subtle); display: block; margin: 0 auto 8px; }
.empty p { margin: 0; }
.loading { padding: 24px 0; color: var(--text-muted); }

/* ---- Alerts ---- */
.alert { border-radius: var(--radius-md); padding: 10px 12px; font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: var(--success-border); }
.alert-info { background: var(--info-soft); color: var(--info-text); border-color: var(--border); }

/* ---- Modal ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(9, 9, 11, .5); padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; padding: 24px; position: relative; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; padding-right: 28px; }
.modal-sub { font-size: 14px; color: var(--text-muted); margin: 0 0 20px; }
.modal-close { position: absolute; top: 14px; right: 14px; color: var(--text-muted); cursor: pointer; background: none; border: none; display: inline-flex; padding: 4px; border-radius: var(--radius-md); }
.modal-close:hover { color: var(--text); background: var(--secondary); }
.modal-close .material-symbols-outlined { font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---- Toast ---- */
.toast-area { position: fixed; bottom: 24px; right: 24px; z-index: 60; width: calc(100% - 32px); max-width: 360px; pointer-events: none; }
.toast-area .alert { pointer-events: auto; box-shadow: var(--shadow-lg); }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--primary); color: var(--primary-fg);
  border-radius: var(--radius-md); padding: 12px 14px; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out;
}
.toast .material-symbols-outlined { color: #86efac; font-size: 18px; }
.toast-problem { background: var(--danger); color: #fff; }
.toast-problem .material-symbols-outlined { color: #fecaca; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Spinner ---- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }

/* A link inside a table cell, to another section of the panel. It keeps the
   table's own colour and says it is a link with an underline, not with blue. */
.table a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.table a:hover { color: var(--text); }

/* ---- Activity section ---- */
:root { --spark: rgba(24, 24, 27, .55); }
.page-actions { display: flex; align-items: center; gap: 8px; }
.page-head-text { display: flex; flex-direction: column; gap: 4px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); text-decoration: none; font-size: 13px; }
.crumb:hover { color: var(--text); }
.crumb .material-symbols-outlined { font-size: 16px; }
.avatar-sm { height: 28px; width: 28px; font-size: 12px; }
.avatar-lg { height: 56px; width: 56px; font-size: 22px; }
.presence { padding: 14px 20px; margin-bottom: 16px; }
.presence-head { display: flex; align-items: center; gap: 10px; }
.presence-title { font-weight: 600; }
.presence-dot { height: 8px; width: 8px; border-radius: 999px; background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.presence-list { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; }
.presence-item { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 6px 10px 6px 6px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.presence-item:hover { background: var(--bg-muted); }
.presence-text { display: flex; flex-direction: column; min-width: 0; }
.spark { display: block; }
.table-activity thead th, .table-activity tbody td { padding: 8px 10px; }
.table-activity .th-btn { padding: 9px 10px; }
/* The person stays in view while the numbers scroll sideways. */
.table-activity th:first-child, .table-activity td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: inset -1px 0 0 var(--border); }
.table-activity th:first-child { background: var(--bg-muted); }
.table-activity tbody tr:hover td:first-child { background: var(--bg-muted); }
.table-activity .user-name, .table-activity .user-email { max-width: 22ch; }
.table-activity .badge + .badge { margin-left: 4px; }
.cell-sub { margin-right: 6px; color: var(--text-muted); font-size: 12px; }
.table-activity .user-cell { gap: 8px; }
/* People table: each cell a value over a grey line saying what it is made of. */
.table-people tbody td { padding-top: 12px; padding-bottom: 12px; vertical-align: middle; }
.table-people .cell-main { font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.3; }
.table-people .cell-note { font-size: 12px; color: var(--text-muted); white-space: nowrap; line-height: 1.3; }
.table-people .group-row th { position: static; padding: 8px 12px; background: var(--bg-muted); box-shadow: none; border-top: 1px solid var(--border); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); text-align: left; }
.table-people tbody:first-of-type .group-row th { border-top: none; }
.table-people .group-row .muted { margin-left: 4px; font-weight: 500; }
.table-people .group-row:hover th { background: var(--bg-muted); }
.time-cell { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.meter { width: 64px; height: 4px; margin: 6px 0 0 auto; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: inherit; }
.meter-good { background: var(--success-text); }
.meter-warn { background: #d97706; }
.meter-bad { background: var(--danger); }
.flag-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.th-sort { padding: 0 !important; }
.th-btn { display: inline-flex; align-items: center; gap: 2px; padding: 12px 20px; font: inherit; font-weight: 500; color: inherit; background: none; border: none; cursor: pointer; white-space: nowrap; }
.th-btn:hover { color: var(--text); background: var(--secondary); }
/* A number column lines up on the right, heading included. */
.table thead th.ta-right { text-align: right; }
.th-sort.ta-right .th-btn { width: 100%; justify-content: flex-end; }
.th-btn .th-arrow { font-size: 16px; width: 16px; height: 16px; line-height: 16px; flex-shrink: 0; overflow: hidden; color: var(--text-muted); opacity: 0; transition: opacity .15s, transform .15s; }
.th-sort:hover .th-arrow, .sort-desc .th-arrow, .sort-asc .th-arrow { opacity: 1; }
.sort-asc .th-arrow { transform: rotate(180deg); }
.sort-desc .th-btn, .sort-asc .th-btn { color: var(--text); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-weight: 600; font-size: 15px; }
.card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.empty-sm { padding: 32px 24px; }
.flags-card { margin-top: 16px; margin-bottom: 16px; }
.flag-list { list-style: none; margin: 0; padding: 0; }
/* Columns: kind | what happened | when | Dismiss, the same on every row. */
.flag-item { display: grid; grid-template-columns: 112px minmax(0, 1fr) 104px 84px; align-items: center; column-gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.flag-item:last-child { border-bottom: none; }
.flag-item .badge { justify-self: start; }
.flag-item > .btn { justify-self: end; }
.flag-when { color: var(--text-muted); font-size: 13px; text-align: right; white-space: nowrap; }
.flag-message .user-link { color: inherit; font-weight: 500; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.flag-message .user-link:hover { text-decoration-color: currentColor; }
.flag-body { flex: 1; min-width: 0; }
.flag-message { line-height: 1.45; }
.flag-dismissed .flag-message { color: var(--text-muted); }
.badge-flag { background: var(--warning-soft); color: var(--warning-text); border-color: var(--warning-border); }
.badge-serious { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Now panel: three columns, one dot per state. */
/* One card split in three, so the columns share a height. */
.now-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; padding: 0; }
.now-col { padding: 12px 16px; }
.now-col + .now-col { border-left: 1px solid var(--border); }
@media (max-width: 900px) {
  .now-grid { grid-template-columns: 1fr; }
  .now-col + .now-col { border-left: none; border-top: 1px solid var(--border); }
}
.now-head { display: flex; align-items: center; gap: 8px; }
.now-count { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-muted); }
.now-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.now-item { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 4px 6px; border-radius: var(--radius-md); }
.now-item:hover { background: var(--bg-muted); }
.now-empty { padding: 12px 0 4px; font-size: 13px; }
.dot { display: inline-block; height: 8px; width: 8px; border-radius: 999px; background: var(--text-subtle); vertical-align: middle; }
.dot-working { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.dot-away { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.dot-off { background: #d4d4d8; }
.dot-serious { background: var(--primary); }

/* Charts: one grid, thin cards, a fixed plot height so the layout never jumps. */
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
.chart-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .chart-grid, .chart-grid-3 { grid-template-columns: 1fr; } }
.chart-grid > .card { min-width: 0; }
.chart-card { padding: 12px 16px 8px; }
.chart-grid-1 { grid-template-columns: 1fr; }
.chart-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; }
.card-title-row { display: flex; align-items: center; gap: 6px; }
/* Info icon with a hover/focus tooltip; keeps explanations off the page. */
.info { position: relative; display: inline-flex; align-items: center; color: var(--text-subtle); cursor: help; outline: none; }
.info .material-symbols-outlined { font-size: 16px; }
.info:hover, .info:focus-visible { color: var(--text-muted); }
.info-tip { position: absolute; left: -4px; top: calc(100% + 6px); z-index: 30; width: max-content; max-width: 280px; padding: 6px 10px; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-fg); font-size: 12px; font-weight: 400; line-height: 1.4; white-space: normal; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: opacity .12s; pointer-events: none; }
.info:hover .info-tip, .info:focus-visible .info-tip { opacity: 1; visibility: visible; }
.chart-box { position: relative; height: 220px; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; }
/* A chart with nothing to draw shrinks to one line instead of a blank box. */
html { overflow-anchor: none; }
.chart-card-empty .chart-box { height: 0; overflow: hidden; }
.chart-card-empty .chart-empty { position: static; justify-content: flex-start; padding: 2px 0 6px; }
.chart-total { white-space: nowrap; margin-left: auto; color: var(--text-muted); font-size: 12px; font-weight: 400; }
.chart-card { position: relative; }
.person-head { display: flex; align-items: center; gap: 16px; padding: 20px 24px; margin-bottom: 16px; }
.person-text { flex: 1; min-width: 0; }
.person-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.person-spark { text-align: right; }
.stack { display: grid; gap: 16px; margin-bottom: 16px; }
.stack > * { min-width: 0; }
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.timeline { padding: 8px 20px 12px; }
.timeline-day { padding: 8px 0; }
.timeline-day-head { display: flex; justify-content: space-between; font-weight: 600; padding: 6px 0; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.timeline-session { display: flex; gap: 14px; padding: 8px 0 8px 10px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline-slow { border-left-color: #f59e0b; }
/* Log page: the server's message sits under the action, in ink, not colour. */
.table-log td { vertical-align: top; padding-top: 10px; padding-bottom: 10px; }
.log-error { margin-top: 2px; font-size: 13px; color: var(--text-muted); max-width: 720px; overflow-wrap: anywhere; white-space: normal; }
.log-failed td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.log-scope { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); font-weight: 500; }
.page-actions a.btn { text-decoration: none; }
.timeline-short { padding: 4px 0 4px 10px; border-left-style: dashed; }
.timeline-more > summary { cursor: pointer; color: var(--text-muted); font-size: 13px; padding: 8px 0; list-style: none; }
.timeline-more > summary::before { content: "▸ "; }
.timeline-more[open] > summary::before { content: "▾ "; }
.timeline-time { width: 96px; flex-shrink: 0; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline-body { min-width: 0; }
.timeline-body .badge { margin-left: 6px; }
.modal-wide { max-width: 560px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.field-text { flex: 1; min-width: 0; }
.field-text .label { margin-bottom: 2px; }
.input-num { width: 110px; flex-shrink: 0; text-align: right; }
#activity-container.htmx-request, #person-container.htmx-request { opacity: .6; transition: opacity .15s; }

/* Last, so it wins over the rules above at the same specificity. */
/* A phone: the title row and the tiles take one column, and nothing in a
   grid is allowed to push the page wider than the screen. */
@media (max-width: 600px) {
  .page-title { font-size: 22px; }
  .page-head { gap: 12px; margin-bottom: 16px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 20px; }
  .stat-grid > *, .now-grid > *, .chart-grid > * { min-width: 0; }
  .page-actions { flex-wrap: wrap; }
  /* A tooltip opens as a strip along the bottom of the screen: placed under
     its icon it could run off the side (and, hidden, still widen the page). */
  .info-tip { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-width: none; }
}

/* Organizations (2026-10-26): a note under a field, the line under a page
   title, and the organization's name in the sidebar and on the sign-in page. */
.field-help { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
.page-lead { margin: -12px 0 20px; font-size: 14px; max-width: 72ch; }

/* Organizations (superadmin): one organization's page, the superadmins and
   the history. */
.org-section { margin-top: 16px; }
.org-link { color: inherit; text-decoration: none; }
.org-link:hover { text-decoration: underline; }
.page-title .badge { vertical-align: middle; margin-left: 8px; }
.org-textarea { height: auto; min-height: 72px; padding-top: 8px; padding-bottom: 8px; resize: vertical; font: inherit; }
.stat-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .stat-grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .stat-grid-5 { grid-template-columns: repeat(2, 1fr); } }

/* Packages (superadmin): a dialog taller than the screen scrolls inside
   itself, price / turnaround / place sit side by side (one column on a
   phone), and a long description stays readable in the list. */
.modal-scroll { max-height: calc(100dvh - 32px); overflow-y: auto; }
.pkg-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.pkg-description { max-width: 48ch; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) { .pkg-fields { grid-template-columns: 1fr; } }

/* Settings cards (Document reader): a row per setting, its name and
   explanation on the left, the control on the right; the save button in a
   footer of its own. */
.settings-card { margin-bottom: 16px; }
.settings-card .card-head .field-help { margin-top: 2px; }
.settings-notice { display: flex; gap: 8px; align-items: flex-start; margin: 16px 20px 0; padding: 10px 12px; border: 1px solid var(--warning-border); background: var(--warning-soft); color: var(--warning-text); font-size: 13px; border-radius: var(--radius-md); }
.settings-notice .material-symbols-outlined { font-size: 18px; }
/* Reader + model side by side, then the limits as tiles across the card. */
.settings-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); border-bottom: 1px solid var(--border); }
.settings-split > .setting-block + .setting-block { border-left: 1px solid var(--border); }
.setting-block { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 20px; min-width: 0; }
.setting-block > .label { margin: 0; }
.setting-block .field-help { margin: 0; line-height: 1.5; }
.setting-block .select { width: 100%; }
.setting-limits { align-items: stretch; border-bottom: 1px solid var(--border); }
.settings-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: var(--bg-muted); }
.limit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 4px; }
.limit { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-muted); }
.limit .label { display: block; font-size: 13px; margin-bottom: 6px; }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit .input { width: 100%; max-width: 120px; text-align: right; background: var(--surface); }
.input-unit span { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
/* A switch built on a real checkbox. */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 36px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--text-subtle); transition: background .15s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 999px; background: #fff; transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(24, 24, 27, .2); }
/* One organization per row, the same columns as the heading row. */
.org-limit { display: grid; grid-template-columns: minmax(0, 1fr) 120px 96px 132px 96px 120px 72px; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.org-limit:last-child { border-bottom: none; }
.org-limit-head { background: var(--bg-muted); padding-top: 9px; padding-bottom: 9px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.org-limit-name { min-width: 0; }
.org-limit-name .user-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.org-limit-name .user-email { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input-sm { height: 32px; font-size: 13px; }
.org-limit .input-num { width: 100%; text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
@media (max-width: 900px) {
  .settings-split { grid-template-columns: 1fr; }
  .settings-split > .setting-block + .setting-block { border-left: none; border-top: 1px solid var(--border); }
  .setting-block { padding: 16px; }
  .limit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org-limit-head { display: none; }
  .org-limit { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 16px; }
  .org-limit-name { grid-column: 1 / -1; }
  .org-limit > .ta-right:nth-last-child(2) { grid-column: 1 / 3; text-align: left; }
  .org-limit [data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 12px; color: var(--text-muted); text-align: left; }
}
@media (max-width: 480px) { .limit-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .flag-item { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; padding: 12px 16px; }
  .flag-item .flag-body { grid-column: 1 / -1; grid-row: 2; }
  .flag-item .flag-when { grid-row: 3; text-align: left; }
  .flag-item > .btn, .flag-item > span:last-child { grid-row: 3; }
}

/* Sections: a page in a few named groups, each a title over its cards. */
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.section-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.section-head .muted { font-size: 13px; }

/* Phone: filters share a row, the search takes its own. */
@media (max-width: 600px) {
  .toolbar-field { flex: 1 1 140px; min-width: 0; }
  .toolbar-search { flex-basis: 100%; }
}
