/*
 * AiServa platform UI - one stylesheet for the admin and client consoles.
 * Light theme only (project rule), OpenAI-like calm surfaces, #10a37f accent.
 *
 * Tokens: primitive -> semantic -> component.
 * Radius rule: controls 10px, panels 14px, pills and avatars full.
 * Motion: short, critically damped (no overshoot) for UI chrome; reduced motion = fades.
 */

:root {
  /* primitives */
  --white: #ffffff;
  --gray-25: #fbfbfc;
  --gray-50: #f7f7f8;
  --gray-100: #f0f0f2;
  --gray-150: #e9e9ed;
  --gray-200: #e3e3e8;
  --gray-300: #d4d4dc;
  --gray-500: #6b6b7b;
  --gray-700: #3d3d47;
  --gray-900: #0d0d0d;
  --green-50: #e8f6f1;
  --green-500: #10a37f;
  --green-600: #0d8a6a;
  --green-700: #0a6e55;
  --red-50: #fdeeee;
  --red-600: #c9302c;
  --amber-50: #fff5e5;
  --amber-700: #8a4b00;
  --blue-50: #ecf2fe;
  --blue-700: #2a55b8;

  /* semantic */
  --bg: var(--white);
  --side-bg: var(--gray-25);
  --surface: var(--gray-50);
  --surface-2: var(--gray-100);
  --line: var(--gray-150);
  --line-strong: var(--gray-300);
  --text: var(--gray-900);
  --text-2: var(--gray-700);
  --muted: var(--gray-500);
  --accent: var(--green-500);          /* fills */
  --accent-hover: var(--green-600);
  --accent-ink: var(--green-700);      /* accent text: 5.9:1 on white */
  --accent-soft: var(--green-50);
  --ok: var(--green-700);   --ok-soft: var(--green-50);
  --bad: var(--red-600);    --bad-soft: var(--red-50);
  --warn: var(--amber-700); --warn-soft: var(--amber-50);
  --info: var(--blue-700);  --info-soft: var(--blue-50);
  --focus: 0 0 0 3px rgba(16, 163, 127, .28);

  /* layout + shape */
  --side-w: 260px;
  --top-h: 60px;
  --r-ctl: 10px;
  --r-panel: 14px;
  --ctl-h: 40px;
  --sh-1: 0 1px 2px rgba(13, 13, 13, .04);
  --sh-pop: 0 12px 32px rgba(13, 13, 13, .12), 0 2px 8px rgba(13, 13, 13, .06);

  /* motion */
  --ease: cubic-bezier(.25, .9, .3, 1);
  --t-fast: 120ms;
  --t: 200ms;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (pointer: coarse) { :root { --ctl-h: 44px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.vx {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: none; }   /* owner rule 2026-09-28: no hover underlines anywhere */
svg { flex: none; }
.muted { color: var(--muted); }
.pad { padding: 14px 16px; }
.mono { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--text); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
/* One field, one focus ring (owner 2026-09-29): an input inside a container that draws the ring draws none itself. */
:where(.search, .wb-omni, .rail-search, .kbm-search, .quick-ask, .composer, [data-field-ring]) :is(input, textarea, select):is(:focus, :focus-visible) { outline: 0; box-shadow: none; border-radius: 0; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100dvh; }
.side {
  background: var(--side-bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.side-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center; flex: none;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: 12px; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 16px; }
.nav-group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 18px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; margin: 1px 0;
  border-radius: var(--r-ctl); color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item:active { transform: scale(.985); }
.nav-item.is-active { background: var(--white); color: var(--text); box-shadow: 0 0 0 1px var(--line), var(--sh-1); }
.nav-item.is-active svg { color: var(--accent); }
.side-foot { padding: 8px 10px 14px; border-top: 1px solid var(--line); }
.icon-btn.side-close { display: none; margin-left: auto; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px; min-height: var(--top-h);
  padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.icon-btn.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; font-size: 14px; }
.crumbs a { color: var(--muted); white-space: nowrap; }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs span[aria-current] { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--gray-300); display: inline-flex; }
.top-actions { display: flex; align-items: center; gap: 4px; }

.content { outline: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 28px 28px 64px; }
.page.wide { max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; margin: 0; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.viewas-bar, .notice-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.viewas-bar { background: var(--info-soft); color: var(--info); }
.viewas-bar form { margin-left: auto; }
.notice-bar { background: var(--warn-soft); color: var(--warn); }

/* Desktop: the right panel scrolls, the header does not (no fixed/sticky needed). */
@media (min-width: 1024px) {
  body.vx { overflow: hidden; }
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100dvh; }
  .side { height: 100dvh; }
  .main { height: 100dvh; }
  .topbar, .viewas-bar, .notice-bar { flex: none; }
  .content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-padding-top: 16px; }
  .scrim { display: none !important; }
}

/* Phone + tablet: header in normal flow, menu is a slide-in sheet. */
@media (max-width: 1023.98px) {
  .icon-btn.menu-btn { display: inline-flex; }
  .icon-btn.side-close { display: inline-flex; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 40;
    transform: translateX(-102%); transition: transform 260ms var(--ease);
    box-shadow: var(--sh-pop); padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  body.menu-open .side { transform: translateX(0); }
  body.menu-open { overflow: hidden; }
  .scrim { position: fixed; inset: 0; background: rgba(13, 13, 13, .38); z-index: 30; opacity: 0; transition: opacity 200ms var(--ease); }
  body.menu-open .scrim { opacity: 1; }
  .topbar { padding: calc(env(safe-area-inset-top, 0px)) 12px 0; }
  .page { padding: 20px 16px calc(48px + env(safe-area-inset-bottom, 0px)); }
  .page-head h1 { font-size: 21px; }
  .viewas-bar, .notice-bar { padding: 8px 16px; flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .crumbs > :not([aria-current]) { display: none; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ctl-h); padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-strong); background: var(--white); color: var(--text);
  font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  touch-action: manipulation;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn.primary:hover { background: #2a2a2f; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: #f0c9c8; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .5; pointer-events: none; }
form.inline { display: inline; margin: 0; }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-ctl); border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; transition: background var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 28px; height: 28px; }
.dot-count {
  position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.avatar-btn { border: 0; background: transparent; padding: 4px; margin-left: 4px; border-radius: 999px; cursor: pointer; }
.avatar {
  width: 32px; height: 32px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------------------------------------------------------------- popovers */
.pop { position: relative; }
.pop-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--sh-pop);
  transform-origin: top right; animation: popIn var(--t) var(--ease);
}
.pop-panel[hidden] { display: none; }
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
.pop-title { font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 16px 6px; }
.apps-panel { width: 320px; }
.app-launch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px 10px 12px; }
.launch-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px;
  border-radius: var(--r-ctl); color: var(--text); font-size: 12.5px; text-align: center;
}
.launch-item:hover { background: var(--surface); text-decoration: none; }
.launch-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); }
.bell-panel { width: 340px; }
.bell-list { max-height: 60vh; overflow-y: auto; padding-bottom: 6px; }
.bell-item { display: block; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.bell-item.unread { background: var(--gray-25); }
.bell-item strong { display: block; font-weight: 600; }
.bell-item small { color: var(--muted); }
.profile-panel { width: 280px; padding-bottom: 6px; }
.profile-head { display: flex; gap: 12px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.profile-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.profile-id strong { font-size: 14px; }
.profile-id small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-panel a, .profile-panel button {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 12px); margin: 0 6px; padding: 9px 10px;
  border: 0; background: transparent; border-radius: 8px; color: var(--text); font: 14px var(--font); cursor: pointer; text-align: left;
}
.profile-panel a:hover, .profile-panel button:hover { background: var(--surface); text-decoration: none; }
.profile-panel .danger { color: var(--bad); }
.profile-panel form { margin: 0; }
.profile-panel .menu-two { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.profile-panel .menu-two small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
@media (max-width: 560px) {
  .pop-panel { position: fixed; left: 8px; right: 8px; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); width: auto; }
  .apps-panel, .bell-panel, .profile-panel { width: auto; }
}

/* ---------------------------------------------------------------- alerts + badges */
.alert {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; margin-bottom: 16px;
  border-radius: var(--r-ctl); font-size: 14px; border: 1px solid transparent;
}
.alert > span { flex: 1; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: #c6ebdf; }
.alert.bad { background: var(--bad-soft); color: var(--bad); border-color: #f3cdcc; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: #f5dcb0; }
.alert.info { background: var(--info-soft); color: var(--info); border-color: #cddbf8; }
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--text); color: #fff; }

/* ---------------------------------------------------------------- panels */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); margin-bottom: 16px; box-shadow: var(--sh-1); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
/* Exactly four stats: one row of four, two by two on mid widths, never three plus an orphan. */
.stats:has(> .stat:nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .stats:has(> .stat:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .stats:has(> .stat:nth-child(4):last-child) { grid-template-columns: minmax(0, 1fr); } }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px 18px; }
.stat small { color: var(--muted); font-size: 13px; display: block; }
.stat b { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat a { font-size: 13px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--text); border-bottom-color: var(--text); }

/* ---------------------------------------------------------------- tables */
.toolbar { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; margin-bottom: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 240px; min-height: var(--ctl-h); padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--white); color: var(--muted);
}
.search input { border: 0; outline: 0; flex: 1; min-width: 0; font: 15px var(--font); background: transparent; color: var(--text); height: calc(var(--ctl-h) - 2px); }
.search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.toolbar .input { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--gray-25); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--gray-25); }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions > * + * { margin-left: 6px; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main strong { display: block; font-weight: 600; }
.cell-main small { display: block; color: var(--muted); font-size: 13px; }
.row-link { color: var(--text); }
.row-link:hover { text-decoration: none; }
@media (max-width: 720px) {
  table.tbl.stack thead { display: none; }
  table.tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .tbl.stack td { border: 0; padding: 3px 0; }
  .tbl.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
  .tbl.stack td.actions { display: flex; flex-wrap: wrap; gap: 6px; text-align: left; padding-top: 10px; }
  .tbl.stack .actions > * + * { margin-left: 0; }
  .tbl.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .tbl.stack td:first-child, .tbl.stack td.actions { grid-column: 1 / -1; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.pager-links { display: flex; align-items: center; gap: 10px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 20px; color: var(--muted); }
.empty strong { color: var(--text); font-size: 15px; }
.empty p { margin: 0 0 8px; font-size: 14px; max-width: 42ch; }
.empty-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); margin-bottom: 4px; }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.req { color: var(--bad); }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  background: var(--white); color: var(--text); font: 15px var(--font);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
@media (pointer: coarse) { .input, select.input, textarea.input { font-size: 16px; } }
textarea.input { padding: 10px 12px; min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: var(--focus); }
.input[readonly] { background: var(--surface); color: var(--muted); }
select.input { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b7b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.err { margin: 6px 0 0; font-size: 13px; color: var(--bad); font-weight: 500; }
.has-error .input { border-color: var(--bad); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
fieldset.group { border: 0; padding: 0; margin: 0 0 16px; }
fieldset.group legend { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; padding: 0; }

/* permission matrix */
.matrix { width: 100%; border-collapse: collapse; font-size: 14px; }
.matrix th, .matrix td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.matrix th { font-size: 12.5px; color: var(--muted); font-weight: 600; text-align: center; background: var(--gray-25); }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix td { text-align: center; }
.matrix .grp td { background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: left; }
.matrix input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.matrix select.input { min-height: 32px; font-size: 13px; padding: 0 28px 0 8px; width: auto; }
.cell-yes { color: var(--ok); }
.cell-no { color: var(--gray-300); }

/* ---------------------------------------------------------------- modal (global shell rule) */
dialog.modal { padding: 0; border: 0; background: transparent; max-width: calc(100vw - 32px); width: 520px; }
dialog.modal.wide { width: 760px; }
dialog.modal::backdrop { background: rgba(13, 13, 13, .42); }
dialog.modal[open] { animation: modalIn var(--t) var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.mcard {
  display: flex; flex-direction: column; overflow: hidden; max-height: min(88vh, 760px);
  background: var(--white); border-radius: 16px; box-shadow: var(--sh-pop); margin: 0;
}
.mhead { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 14px 20px; border-bottom: 1px solid var(--line); }
.mhead h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.mbody { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; }
.mfoot { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--gray-25); }
.mbody p:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- auth pages */
body.center-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px 40px;
  background: var(--surface) url("auth-bg.jpg") center / cover no-repeat fixed; }
@supports (background-image: image-set(url("auth-bg.webp") type("image/webp"))) {
  body.center-page { background-image: image-set(url("auth-bg.webp") type("image/webp"), url("auth-bg.jpg") type("image/jpeg")); }
}
/* Auth pages float over the background: a touch more lift so the card reads as the one surface. */
body.center-page .auth-card { box-shadow: 0 1px 2px rgba(13, 13, 13, .04), 0 18px 48px rgba(13, 40, 32, .08); }
@media (max-width: 560px) { body.center-page { background-attachment: scroll; background-position: 18% center; } }
.auth-card { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px 28px; box-shadow: var(--sh-1); }
.auth-brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 22px; }
.auth-brand svg { color: var(--accent); }
.auth-brand .vx-logo { width: 28px; height: 28px; object-fit: contain; }
.vx-logo { display: block; object-fit: contain; }
.auth-title { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pw-toggle:hover { color: var(--text); background: var(--surface); }

/* app grid (tiles) */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.app-card { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--white); color: var(--text); transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.app-card:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--sh-1); }
.app-card:active { transform: scale(.985); }
.app-card .launch-ico { width: 46px; height: 46px; }
.app-card strong { display: block; font-size: 15px; }
.app-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }

.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; }

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

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

/* Phase 2: servers, models, providers, app setup */
small.block { display: block; margin-top: 2px; }
.tbl tr.dim td { opacity: .6; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; }
.panel.app-setup { margin-bottom: 16px; }
.panel.app-setup .panel-head .check { flex: 0 0 auto; }
h3.sub { font-size: 14px; font-weight: 600; margin: 20px 0 8px; }

/* Phase 3: knowledge bases */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--gray-100, #f4f4f5); border-radius: var(--r-ctl); margin-bottom: 16px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--white); color: var(--text); box-shadow: var(--sh-1); }
.seg button:focus-visible { outline: 2px solid var(--accent, #10a37f); outline-offset: 1px; }
.row-inline { display: flex; gap: 8px; align-items: stretch; }
.row-inline .input { flex: 1; min-width: 0; }
.row-inline.wrap { flex-wrap: wrap; }
.passage { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px 14px; margin-top: 12px; }
.passage-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 13px; }
.passage p { margin: 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.alert form.inline { margin-left: auto; }
@media (max-width: 640px) { .row-inline:not(.wrap) { flex-direction: column; } }

.small { font-size: 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--bad); font: inherit; cursor: pointer; text-decoration: underline; }
}
.app-tile { display: flex; flex-direction: column; gap: 6px; }
.app-tile .app-card { flex: 1; }
.app-tile .app-set { align-self: flex-start; }

/* Phase 7: bug reports and feature requests */
.tbl tr.unread td:nth-child(2) strong::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }
.shot-drop { margin-top: 8px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-ctl); padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.shot-drop.over { border-color: var(--accent); background: var(--gray-100); }
.shot-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.shot-chip { font-size: 12px; background: var(--gray-100); border-radius: 999px; padding: 3px 10px; }
.rep-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.rep-thread { display: flex; flex-direction: column; margin-bottom: 16px; }
.rep-msg { align-self: flex-start; width: fit-content; min-width: min(280px, 100%); max-width: 82%; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); border-bottom-left-radius: 6px; padding: 14px 16px; margin-bottom: 12px; }
.rep-msg.plat { border-color: #cddbf8; background: #f8faff; }
.rep-msg.own { align-self: flex-end; border-radius: var(--r-panel); border-bottom-right-radius: 6px; background: #f3f4f6; border-color: #e4e4e7; }
.rep-msg.own.plat { background: #eef3ff; border-color: #cddbf8; }
@media (max-width: 640px) { .rep-msg { max-width: 92%; } }
.rep-msg header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 14px; }
.rep-body { line-height: 1.6; overflow-wrap: anywhere; }
.rep-shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rep-shots img { width: 140px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.rep-edit { margin-top: 10px; font-size: 13px; }
.rep-reply { margin-top: 4px; }
.rep-reply .form-actions select { width: auto; }
.rep-side .kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0 0 16px; font-size: 14px; }
.rep-side .kv dt { color: var(--muted); }
.rep-side .kv dd { margin: 0; overflow-wrap: anywhere; }
.stack-sm { margin: 0 0 12px; }
.rep-side form.inline { display: block; margin-bottom: 8px; }
@media (max-width: 1023px) { .rep-grid { grid-template-columns: 1fr; } }
.menu-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* Phase 8: developers */
code.keyshow { display: inline-block; margin-top: 6px; padding: 6px 10px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; word-break: break-all; user-select: all; }
.docs h2 { font-size: 16px; margin: 24px 0 8px; }
.docs h2:first-child { margin-top: 0; }
.docs h3 { font-size: 14px; margin: 0 0 4px; }
.docs pre { background: var(--gray-100); border-radius: 8px; padding: 12px 14px; overflow-x: auto; overflow-y: hidden; font-size: 13px; line-height: 1.5; }
.docs ul { padding-left: 20px; line-height: 1.7; }
.doc-ep { border-top: 1px solid var(--line); padding: 12px 0; }

/* Phase 5: security */
form.narrow { max-width: 460px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* Two-step sign-in */
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 8px; }
.codes code { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; text-align: center; user-select: all; }
ol.steps { padding-left: 20px; line-height: 1.7; margin: 0 0 16px; }
ol.steps li { margin-bottom: 8px; }

/* Sign-up */
.auth-card.wide { max-width: 460px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ok-text { color: var(--ok); }
.err-text { color: var(--bad); }
.auth-links .muted { margin-right: 4px; }
.brand-row { display: flex; gap: 16px; align-items: flex-start; }
.brand-row .grow { flex: 1; min-width: 0; }
.brand-logo { max-height: 64px; max-width: 160px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--white); }
.auth-brand img { max-height: 40px; max-width: 180px; }

/* Getting started */
ol.onboard { list-style: none; margin: 0; padding: 4px 20px 12px; }
ol.onboard li { display: grid; grid-template-columns: 28px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
ol.onboard li:first-child { border-top: 0; }
ol.onboard p { margin: 2px 0 0; font-size: 13px; }
.onboard-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--gray-100); color: var(--text); }
ol.onboard li.done .onboard-mark { background: var(--ok-soft); color: var(--ok); }
ol.onboard li.done strong { color: var(--muted); }
@media (max-width: 640px) { ol.onboard li { grid-template-columns: 28px 1fr; } ol.onboard li .btn { grid-column: 2; justify-self: start; } }

/* Older app pages inside the portal shell (includes/header.php shell mode).
   The app's own .page keeps its layout; it becomes the single scroll region inside
   <main>, so full-height apps (Ask AI's pinned composer) keep working. No tab bar. */
body.vxl { --tabbar-h: 0px; display: block; height: auto; }
body.vxl .content { display: flex; flex-direction: column; }
body.vxl .content > .page { flex: 1 1 auto; min-height: 0; width: 100%; }
.top-extra { display: flex; align-items: center; gap: 6px; margin-right: 6px; }
@media (min-width: 1024px) {
  body.vxl .content { overflow: hidden; }
  body.vxl .content > .page { overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 1023.98px) {
  body.vxl { height: 100dvh; overflow: hidden; }
  body.vxl .shell { height: 100dvh; display: flex; flex-direction: column; }
  body.vxl .main { flex: 1 1 auto; min-height: 0; }
  body.vxl .content { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  body.vxl .content > .page { overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}
.top-extra .btn { white-space: nowrap; margin: 0; }   /* older pages style bare buttons (margin-top); not in the top bar */
body.vxl .topbar button, body.vxl .topbar a { margin: 0; }
/* Phones: the top bar keeps one line. Extra actions become equal-size icon buttons
   (their accessible name stays via aria-label). */
@media (max-width: 640px) {
  .top-extra .btn { display: inline-flex; align-items: center; width: 44px; height: 44px; padding: 0; justify-content: center; }   /* same as the phone .icon-btn beside them */
  .top-extra .btn .lbl { display: none; }
  .top-extra { gap: 4px; margin-right: 2px; }
}

/* Usage: requests by day */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.usage-bars { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-end; gap: 2px; height: 160px; }
.usage-bars li { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.usage-bar { position: relative; display: block; width: 100%; height: var(--h); min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; overflow: hidden; }
.usage-err { position: absolute; left: 0; right: 0; bottom: 0; height: var(--h); background: #d9534f; }
.usage-axis { display: flex; justify-content: space-between; margin-top: 6px; }
.usage-key { margin: 10px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.usage-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.usage-swatch.err { background: #d9534f; margin-left: 10px; }
.map-group { margin-bottom: 16px; }

/* ---------------------------------------------------------------- pair a server + model manager */
.pair-lead { margin: 0 0 18px; color: var(--text-2); font-size: 14px; }
.pair-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 20px; }
.pair-steps > li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.pair-n { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 650; }
.pair-c { min-width: 0; }
.pair-c > strong { display: block; margin: 3px 0 10px; font-size: 14px; }
.pair-c .seg { margin-bottom: 0; }
.pair-c .seg button[aria-checked="true"] { background: var(--white); color: var(--text); box-shadow: var(--sh-1); }
.pair-where { margin: -4px 0 8px; }
.cmdbox { margin: 0 0 10px; padding: 12px 14px; background: var(--gray-900); color: #e8e8ec; border-radius: var(--r-ctl); font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; user-select: all; }
.cmdbox:focus-visible { outline: none; box-shadow: var(--focus); }
.pair-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pair-actions .btn.accent { flex: 1 1 180px; }
.pair-wait { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-ctl); font-size: 14px; color: var(--text-2); }
.pair-wait.is-found { border-style: solid; border-color: #bfe5d8; background: var(--ok-soft); color: var(--ok); }
.pulse { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 999px; background: var(--line-strong); animation: vxPulse 1.4s ease-in-out infinite; }
.pair-wait.is-found .pulse { background: var(--accent); animation: none; }
@keyframes vxPulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
a.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.test-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.test-msg { font-size: 13px; color: var(--muted); }
.test-msg.ok { color: var(--ok); } .test-msg.bad { color: var(--bad); }

/* ---------------------------------------------------------------- Manage Models (assets/models.js)
   Server view + Add a Model (Provider > Model > Set Up). Shared modal shell: only .mbody
   scrolls. The card keeps ONE height across steps so the footer never jumps. */
.mm-dlg .mcard { height: min(88vh, 740px); }
.mm-top { display: flex; gap: 8px 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.mm-top .field { flex: 1 1 240px; margin: 0; }
.mm-top [data-mm-status] { flex: 999 1 280px; min-height: var(--ctl-h); display: flex; align-items: center; }
.mm-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.mm-fact { white-space: nowrap; }
.mm-foot-r { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mm-view > * + * { margin-top: 0; }
.mm-view > .mm-note:first-child { margin-bottom: 16px; }
.mm-view.mm-in-fwd { animation: mmFwd var(--t) var(--ease); }
.mm-view.mm-in-back { animation: mmBack var(--t) var(--ease); }
.mm-view.mm-in-fade { animation: mmFade var(--t) ease; }
@keyframes mmFwd { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes mmBack { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes mmFade { from { opacity: 0; } to { opacity: 1; } }
.mm-sec { margin: 0 0 22px; }
.mm-sec:last-child { margin-bottom: 4px; }
.mm-sec h3 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.mm-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.mm-sec-head h3 { margin: 0; }
.mm-title { margin: 0 0 4px; font-size: 18px; font-weight: 650; letter-spacing: -.012em; outline: 0; }
.mm-lede { margin: 0 0 14px; color: var(--text-2); font-size: 14px; max-width: 62ch; }
.mm-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 0 0 12px; font-size: 13px; }
.mm-crumb { border: 0; background: none; padding: 2px 0; font: inherit; color: var(--accent-ink); cursor: pointer; }
.mm-crumb.is-here { color: var(--muted); cursor: default; text-decoration: none; }
.mm-sep { color: var(--line-strong); }
.mm-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 10px 0 16px; }
.mm-toolbar .seg { margin: 0; }
.mm-list { display: grid; gap: 8px; }
.mm-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--white); width: 100%; text-align: left; font: inherit; color: inherit; }
.mm-row .mm-main { flex: 1 1 auto; min-width: 0; display: block; }
.mm-row .mm-main strong { display: block; font-size: 14px; }
.mm-row .mm-main small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mm-row .mm-act, .mm-act { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.mm-row.is-reco { border-color: #bfe5d8; }
.mm-row.is-job { background: var(--gray-25); }
.mm-confirm { font-size: 13px; color: var(--text-2); margin-right: 2px; }
.mm-err { color: var(--bad) !important; }
button.mm-pick { cursor: pointer; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, transform var(--t-fast) ease; }
button.mm-pick:hover { border-color: var(--line-strong); box-shadow: var(--sh-1); }
button.mm-pick:active { transform: scale(.995); }
button.mm-pick:focus-visible, .mm-card:focus-visible { outline: 0; box-shadow: var(--focus); border-color: var(--accent); }
.mm-pick.is-blocked .mm-main strong { color: var(--text-2); }
.mm-pick.is-done { background: var(--gray-25); }
.mm-pick-end { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.mm-chev { width: 8px; height: 8px; border-right: 1.8px solid var(--muted); border-top: 1.8px solid var(--muted); transform: rotate(45deg); margin-right: 4px; }
.mm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mm-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 500; }
.mm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mm-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--white); text-align: left; font: inherit; color: inherit; cursor: pointer; min-height: 132px; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, transform var(--t-fast) ease; }
.mm-card:hover { border-color: var(--line-strong); box-shadow: var(--sh-1); }
.mm-card:active { transform: scale(.99); }
.mm-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mm-card-top strong { font-size: 15px; }
.mm-card-fam { font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.mm-card-blurb { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.mm-card-foot { margin-top: auto; padding-top: 10px; font-size: 12.5px; color: var(--muted); }
.mm-hero { margin-bottom: 18px; }
.mm-checks { display: grid; border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; }
.mm-check { display: grid; grid-template-columns: 1.1fr 1.3fr 1.6fr; gap: 12px; padding: 10px 14px; font-size: 13.5px; border-top: 1px solid var(--line); align-items: center; }
.mm-check.head { border-top: 0; background: var(--gray-25); font-size: 12.5px; font-weight: 600; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.mm-check > span:first-child { font-weight: 600; }
.mm-check.is-ok > span:last-child { color: var(--ok); }
.mm-check.is-warn > span:last-child { color: var(--warn); }
.mm-check.is-bad > span:last-child { color: var(--bad); font-weight: 600; }
.mm-verdict { margin: 10px 0 0; padding: 10px 14px; border-radius: var(--r-ctl); background: var(--surface); font-size: 13.5px; color: var(--text-2); }
.mm-verdict.ok { background: var(--ok-soft); color: var(--ok); }
.mm-verdict.warn { background: var(--warn-soft); color: var(--warn); }
.mm-verdict.bad { background: var(--bad-soft); color: var(--bad); }
.mm-inline { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-top: 10px; }
.mm-inline:first-child { margin-top: 0; }
.mm-lic { font-size: 14px; }
.mm-steps { margin: 12px 0; padding-left: 20px; font-size: 13.5px; color: var(--text-2); }
.mm-steps li + li { margin-top: 4px; }
.mm-token { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.mm-token .field { flex: 1 1 260px; margin: 0; }
.mm-token .btn { height: var(--ctl-h); }
.mm-callout { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-ctl); margin-bottom: 18px; }
.mm-callout.info { background: var(--info-soft); color: var(--info); }
.mm-callout strong { display: block; font-size: 14px; }
.mm-callout small { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; max-width: 60ch; }
.mm-skel { height: 58px; border-radius: var(--r-ctl); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: mmShimmer 1.3s ease-in-out infinite; margin-bottom: 8px; }
.mm-skel.short { width: 60%; }
@keyframes mmShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.mm-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.mm-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
.mm-bar.indet > span { width: 35%; animation: vxIndet 1.2s ease-in-out infinite; }
@keyframes vxIndet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.mm-note { margin: 0; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--surface); color: var(--text-2); font-size: 13.5px; }
.mm-note.bad { background: var(--bad-soft); color: var(--bad); }
.mm-note.ok { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 560px) {
  .mm-row { flex-wrap: wrap; }
  .mm-row .mm-act { width: 100%; justify-content: flex-start; }
  .mm-pick-end { width: 100%; justify-content: space-between; }
  .mm-check { grid-template-columns: 1fr 1fr; }
  .mm-check > span:first-child { grid-column: 1 / -1; }
  .mm-check.head > span:first-child { display: none; }
  .mm-dlg .mfoot { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse, .mm-bar.indet > span, .mm-skel { animation: none; }
  .mm-view.mm-in-fwd, .mm-view.mm-in-back { animation: mmFade var(--t) ease; }
  .mm-card, button.mm-pick { transition: none; }
}
.row-gap { display: inline-flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- sign-in background catalog (core/authbg.php) */
body.center-page.bg-neural { background-image: url("auth-bg-neural.jpg"); background-image: image-set(url("auth-bg-neural.webp") type("image/webp"), url("auth-bg-neural.jpg") type("image/jpeg")); }
body.center-page.bg-tokens { background-image: url("auth-bg-tokens.jpg"); background-image: image-set(url("auth-bg-tokens.webp") type("image/webp"), url("auth-bg-tokens.jpg") type("image/jpeg")); }
body.center-page.bg-chip { background-image: url("auth-bg-chip.jpg"); background-image: image-set(url("auth-bg-chip.webp") type("image/webp"), url("auth-bg-chip.jpg") type("image/jpeg")); }
body.center-page.bg-server { background-image: url("auth-bg-server.jpg"); background-image: image-set(url("auth-bg-server.webp") type("image/webp"), url("auth-bg-server.jpg") type("image/jpeg")); }
body.center-page.bg-vision { background-image: url("auth-bg-vision.jpg"); background-image: image-set(url("auth-bg-vision.webp") type("image/webp"), url("auth-bg-vision.jpg") type("image/jpeg")); }
body.center-page.bg-harbour { background-image: url("auth-bg-harbour.jpg"); background-image: image-set(url("auth-bg-harbour.webp") type("image/webp"), url("auth-bg-harbour.jpg") type("image/jpeg")); }
.bg-help { margin: 0 0 14px; }
.bg-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.bg-opt { position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.bg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.bg-thumb { display: block; aspect-ratio: 3 / 2; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface) center / cover no-repeat;
  transition: box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.bg-opt:hover .bg-thumb { border-color: var(--line-strong); }
.bg-opt:active .bg-thumb { transform: scale(.98); }
.bg-opt input:checked + .bg-thumb { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-opt input:focus-visible + .bg-thumb { box-shadow: var(--focus); }
.bg-opt input:disabled ~ * { cursor: default; }
.bg-name { font-size: 13px; color: var(--text-2); }
.bg-opt input:checked ~ .bg-name { color: var(--text); font-weight: 600; }
@media (max-width: 560px) { .bg-pick { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------------- user page: role template + personal changes */
.stat b.stat-sm { font-size: 17px; }
.checks.col { flex-direction: column; align-items: flex-start; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.cell-changed-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--info); }
.matrix label.cell { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.matrix label.cell.is-changed { background: var(--info-soft); }
.matrix label.cell.is-changed::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 999px; background: var(--info); }
.check.is-changed { background: var(--info-soft); border-radius: 8px; padding: 2px 8px; margin-left: -8px; }
.form-actions.spread { justify-content: space-between; margin-bottom: 32px; }
/* Access tab summary: follows the role, or N personal changes (live), with Reset to Role and Save at the top too */
.acc-sum { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; margin-bottom: 16px; }
.acc-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.acc-sum.has-changes .acc-ico { background: var(--info-soft); color: var(--info); }
.acc-sum-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-sum-t strong { font-size: 15.5px; }
.acc-sum-t small { color: var(--muted); line-height: 1.5; }
.acc-dirty { color: var(--warn); font-weight: 600; }
.acc-sum-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.legend .cell-same { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--line-strong); margin-left: 4px; }
.legend .cell-changed-dot { margin-left: 10px; }
.acc-matrix td.acc-row-act { width: 1%; white-space: nowrap; text-align: right; }
.acc-row-reset { visibility: hidden; gap: 4px; }
.acc-matrix tr:has(.is-changed) .acc-row-reset { visibility: visible; }
.tool-use-row.is-changed { box-shadow: inset 3px 0 0 var(--info); background: var(--info-soft); }
@media (max-width: 720px) {
  .acc-sum { grid-template-columns: 40px minmax(0, 1fr); }
  .acc-sum-act { grid-column: 1 / -1; justify-content: stretch; }
  .acc-sum-act .btn { flex: 1; }
}
.role-note { margin: 0 0 14px; }

/* ---------------------------------------------------------------- pair: live install progress */
.pair-prog { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--white); }
.pp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.pp-eta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pair-prog .mm-bar { margin-top: 0; height: 8px; }
.pp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.pp-steps li { display: flex; align-items: center; gap: 8px; }
.pp-steps li::before { content: ""; flex: 0 0 auto; width: 14px; height: 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); box-sizing: border-box; }
.pp-steps li.is-done { color: var(--text-2); }
.pp-steps li.is-done::before { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 10px no-repeat; }
.pp-steps li.is-now { color: var(--text); font-weight: 600; }
.pp-steps li.is-now::before { border-color: var(--accent); border-top-color: transparent; animation: vxSpin .9s linear infinite; }
.pp-steps li.is-bad { color: var(--bad); font-weight: 600; }
.pp-steps li.is-bad::before { border-color: var(--bad); background: var(--bad); }
.pair-prog.is-error .mm-bar > span { background: var(--bad); }
@keyframes vxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pp-steps li.is-now::before { animation: none; border-top-color: var(--accent); } }
.pair-wait[hidden], .pair-prog[hidden] { display: none; }

/* ---------------------------------------------------------------- soft navigation (menu stays, right panel swaps) */
.shell > .main { position: relative; }
.shell > .main.is-loading::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 5;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat;
  animation: vxLoadBar 1s ease-in-out infinite; }
.shell > .main.is-loading > *:not(.topbar) { opacity: .55; transition: opacity .15s ease .12s; }
@keyframes vxLoadBar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (prefers-reduced-motion: reduce) { .shell > .main.is-loading::before { animation: none; background: var(--accent); opacity: .5; } }
.vx-confirm-type { margin-top: 16px; } .vx-confirm-type label { display: block; margin: 0 0 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }

/* Models: Add a Model chooser (Cloud / Local) + ability tags in tables */
.add-choices { display: grid; gap: 12px; }
.add-choice { display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 16px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .1s ease; }
.add-choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.add-choice:active { transform: scale(.99); }
.add-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.add-choice strong { display: block; font-size: 15px; margin-bottom: 2px; }
.add-choice small { display: block; color: var(--text-2); line-height: 1.45; }
.add-choice-ico { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .add-choice { transition: none; } .add-choice:active { transform: none; } }

/* Cloud Models steps: [hidden] must beat the flex/grid display rules above */
.mm-dlg [data-cv][hidden], .mm-dlg [data-cv-foot][hidden], .mm-dlg [data-if-custom][hidden] { display: none; }

/* On/Off switch (ui_switch() in PHP, and the Local Models rows in models.js).
   A real button with role=switch: focusable, Space/Enter toggle, state in aria-checked. */
.switch { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 550; color: var(--text-2); cursor: pointer; border-radius: 999px; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-track { position: relative; width: 36px; height: 20px; flex: 0 0 auto; border-radius: 999px; background: var(--line-strong); transition: background-color .2s ease; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .22s cubic-bezier(.3, 1.3, .6, 1); }
.switch[aria-checked="true"] { color: var(--accent-ink); }
.switch[aria-checked="true"] .switch-track { background: var(--accent); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(16px); }
.switch:active .switch-thumb { width: 19px; }
.switch[aria-checked="true"]:active .switch-thumb { transform: translateX(13px); }
.switch.is-busy { opacity: .6; pointer-events: none; }
.switch-text { min-width: 22px; text-align: left; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-thumb { transition: none; } }

/* Add a Model: ability filter (All / Text / Image / Embedding), shared by Cloud and Local */
.mm-filter { display: flex; flex-wrap: wrap; gap: 6px; overflow-x: auto; overflow-y: hidden; }
.mm-chip { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.mm-chip:hover { border-color: var(--line-strong); color: var(--text); }
.mm-chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.mm-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mm-chip .n { opacity: .65; margin-left: 4px; font-weight: 500; }
.mm-row.is-off .mm-main strong { color: var(--text-2); }
.mm-dlg [data-cp-caps][hidden], .mm-dlg [data-cp-group][hidden] { display: none; }
/* Text sub-filter (Text Only / Reads Images): sits under the main chips */
.mm-subfilter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -4px 0 14px; }
.mm-subfilter .seg { margin: 0; }
.mm-subfilter .seg .n { opacity: .65; margin-left: 2px; }
.mm-subfilter .help { margin: 0; }
.mm-dlg [data-cf-sub][hidden] { display: none; }

/* ---------------------------------------------------------------- People > Users (redesign 2026-09-25) */
/* Summary chips double as quick filters. */
.u-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.u-stat { display: flex; flex-direction: column; gap: 2px; min-width: 120px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s ease, background-color .15s ease; }
.u-stat b { font-size: 22px; font-weight: 650; letter-spacing: -.01em; line-height: 1.1; }
.u-stat small { font-size: 12.5px; color: var(--text-2); }
.u-stat:hover { border-color: var(--line-strong); }
.u-stat.is-on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.u-stat.warn b { color: var(--warn); }
.u-stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.u-link { color: inherit; text-decoration: none; }
.u-table td { vertical-align: middle; }
.u-grid { margin-top: 16px; }
.u-grid > .panel { margin-bottom: 16px; }

/* Person header */
.u-head { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.u-head .avatar.lg { width: 52px; height: 52px; font-size: 18px; flex: 0 0 auto; }
.u-head-main { min-width: 0; }
.u-head-sub { margin: 0 0 8px; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.u-head-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.u-head-act { margin-left: auto; flex: 0 0 auto; }
@media (max-width: 640px) { .u-head { flex-wrap: wrap; } .u-head-act { margin-left: 0; width: 100%; } }

/* Settings-style rows: label + explanation on the left, the control on the right. */
.u-sec { list-style: none; margin: 0; padding: 0; }
.u-sec > li { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 16px 20px; border-top: 1px solid var(--line); }
.u-sec > li:first-child { border-top: 0; }
.u-sec > li > div:first-child { min-width: 0; flex: 1 1 320px; }
.u-sec strong { display: block; font-size: 14px; }
.u-sec small { display: block; margin-top: 3px; font-size: 13px; color: var(--text-2); max-width: 70ch; }
.u-sec-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.u-sec-act .inline { margin: 0; }
.u-sec-wide > div:first-child { flex-basis: 100%; }
.u-sec-wide .input { margin-top: 10px; max-width: 560px; }
.u-sec .err { margin-top: 6px; }
.u-num { width: 96px; }
.u-danger { margin-top: 16px; }
.u-danger .panel-head h2 { color: var(--bad); }
.panel-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }

/* Add User: how they sign in */
.u-how { border: 0; padding: 0; margin: 4px 0 12px; display: grid; gap: 8px; }
.u-how legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.u-how-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.u-how-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.u-how-opt input { margin-top: 3px; accent-color: var(--accent); }
.u-how-opt strong { display: block; font-size: 14px; }
.u-how-opt small { display: block; color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* Checkbox rendered as a switch (policy page); the real checkbox stays for forms + a11y */
.switch-field { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch-field input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: inherit; }
.switch-field input:checked + .switch-track { background: var(--accent); }
.switch-field input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch-field input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-field input:disabled + .switch-track { opacity: .5; }

@media (max-width: 640px) {
  .u-stat { min-width: calc(50% - 5px); flex: 1 1 calc(50% - 5px); }
  .u-sec > li { flex-direction: column; align-items: stretch; padding: 14px 16px; }
  .u-sec > li > div:first-child { flex: 0 0 auto; }   /* the 320px basis is a WIDTH; in a column it would become height */
  .u-sec-act { justify-content: flex-start; }
}
.u-go-col { width: 36px; text-align: right; }
.u-go { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.u-row:hover { background: var(--surface); }
.u-row:hover .u-go { background: var(--surface-2); }
@media (max-width: 640px) {
  /* Filter selects share the row evenly instead of stacking at random widths */
  .toolbar > select.input { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .toolbar > .btn { flex: 1 1 calc(50% - 4px); }
}

/* Demo clients (migration 020) */
.demo-bar { background: var(--info-soft); color: var(--info); }
.demo-panel { margin-top: 16px; }
.demo-panel.is-demo { border-color: var(--info); }
.demo-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.demo-row strong { display: block; font-size: 14px; }
.demo-row small { display: block; margin-top: 3px; font-size: 13px; color: var(--text-2); max-width: 70ch; }

/* Server page (?p=server) */
.srv-ico { display: grid; place-items: center; color: var(--accent-ink); background: var(--accent-soft); }
.srv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 16px; }
.srv-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg, #fff); display: grid; gap: 8px; }
.srv-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.srv-card-top small { color: var(--text-2); font-size: 13px; }
.srv-card-top b { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.srv-meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.srv-meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.srv-meter.warn > span { background: var(--warn); }
.srv-meter.bad > span { background: var(--bad); }
.srv-card .muted { font-size: 12.5px; }
.mm-top .field[hidden] { display: none; }
.srv-row { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .srv-meter > span { transition: none; } }

/* Back to the previous page (detail pages). Quiet, above the title, 36px tap target. */
.back-link { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px; margin: 0 0 6px -8px;
  border-radius: 10px; color: var(--text-2); font-size: 14px; font-weight: 550; text-decoration: none; transition: background-color .15s ease, color .15s ease; }
.back-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.back-link:active { background: var(--surface-2); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.back-link svg { transition: transform .15s ease; }
.back-link:hover svg { transform: translateX(-2px); }
@media (prefers-reduced-motion: reduce) { .back-link, .back-link svg { transition: none; } .back-link:hover svg { transform: none; } }

/* One underline only: the row link itself never underlines; its name does on hover. */
.u-link, .u-link:hover, .row-link:hover { text-decoration: none; }
.cp-panel { margin-top: 16px; }

/* Row action buttons: icon buttons and plain buttons share one middle line. */
td.actions .btn, td.actions form.inline { vertical-align: middle; }

/* ---------------------------------------------------------------- knowledge bases */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-panel); background: var(--gray-25); text-align: center; cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { color: var(--accent-ink); }
.dropzone span { font-size: 13.5px; max-width: 60ch; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone:focus-within { box-shadow: var(--focus); }
.kb-queue { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.kb-queue:empty { display: none; }
.kb-queue li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 14px; }
.kb-queue li strong { font-weight: 600; overflow-wrap: anywhere; }
.kb-queue li.ok span { color: var(--ok); }
.kb-queue li.bad span { color: var(--bad); }
.kb-queue li.warn span { color: var(--warn); }

/* Built-in feature tiles: a tile opens the feature's settings; the gear on the right says so. */
.app-card .app-card-text { flex: 1; min-width: 0; }
.app-card .app-card-text strong .badge { margin-left: 6px; vertical-align: 1px; }
.app-card .app-card-go { color: var(--muted); flex: none; }
.app-card:hover .app-card-go { color: var(--text); }

/* Knowledge Base > Search Test (029). The button matches the input's height (row stretch). */
.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-row .input { flex: 1 1 auto; min-width: 0; }
.search-row .btn { flex: 0 0 auto; }
.kb-passage { max-height: 10.5em; overflow-y: auto; overscroll-behavior: contain; font-size: 13px; line-height: 1.5; color: var(--text); }
.head-actions { align-items: center; }
@media (max-width: 640px) { .search-row { flex-wrap: wrap; } .search-row .btn { flex: 1 1 100%; } }

/* Agentic AI > Tools (030): the expandable setup guide. */
details.guide > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
details.guide > summary::-webkit-details-marker { display: none; }
details.guide > summary::before { content: "+"; display: inline-block; width: 16px; font-weight: 600; color: var(--muted); }
details.guide[open] > summary::before { content: "-"; }
.guide-steps { margin: 14px 0 8px; padding-left: 22px; line-height: 1.6; }
.guide-steps li { margin-bottom: 12px; }
.guide-steps code, .help code { font-size: 12.5px; background: var(--gray-100); padding: 1px 5px; border-radius: 5px; }
pre.code { margin: 8px 0 0; padding: 12px 14px; background: var(--gray-900); color: #e8e8ec; border-radius: var(--r-ctl); font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; overflow-y: hidden; white-space: pre; }

/* Left panel: logo only at the top; organisation + where-you-are badge at the bottom. */
.side-logo, .side-logo:hover { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.logo-word { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.side-foot { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); }
.where { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; border-radius: var(--r-ctl); background: var(--white); box-shadow: 0 0 0 1px var(--line); min-width: 0; }
.where-org { font-size: 14px; font-weight: 600; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.where-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.where-admin { background: #18181b; color: #fff; }
.where-client { background: #ecf2fe; color: #2a55b8; }
.where-client_portal { background: #e8f6f1; color: #0a6e55; }
.where-user_portal { background: #f0f0f2; color: #3d3d47; }

/* Centred logo at the top of the left panel: the organisation's own logo (or its initials). */
.side-head, .rail-head { position: relative; justify-content: center; min-height: 64px; padding: 14px 44px 10px; margin: 0; }
.side-head .side-close, .rail-head .rail-close { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.side-logo, .side-logo:hover { display: inline-flex; align-items: center; justify-content: center; gap: 10px; color: var(--text); text-decoration: none; max-width: 100%; }
.org-logo { display: block; max-width: 170px; max-height: 44px; width: auto; height: auto; object-fit: contain; }
.org-mono { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--text); color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .02em; }

/* ---------- App launcher, Google Workspace style: colourful tiles in a 3-column grid ----------
   Each app has one fixed gradient (app_tile_class() in core/icons.php) so it is recognised by
   colour everywhere. Name under the icon; the description is the hover tooltip. */
.apps-panel { width: 352px; padding: 8px; border-radius: 22px; }
.wapps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 8px; margin-top: 2px; border-radius: 16px; background: var(--surface, #f6f7f9); }
.pop-panel a.wapp, a.wapp { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; width: auto; min-height: 96px; padding: 12px 2px 10px; border-radius: 14px; color: var(--text); text-align: center; text-decoration: none; transition: background 160ms ease, transform 160ms ease; }
.pop-panel a.wapp:hover, a.wapp:hover { background: var(--bg, #fff); box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 2px 8px rgba(16,24,40,.06); text-decoration: none; }
.pop-panel a.wapp:active, a.wapp:active { transform: scale(.97); }
a.wapp:focus-visible, .pop-panel a.wapp:focus-visible { outline: none; background: var(--bg, #fff); box-shadow: 0 0 0 2px rgba(26,115,232,.28); }
.pop-panel a.wapp.is-active, a.wapp.is-active { background: var(--bg, #fff); box-shadow: inset 0 0 0 1.5px #1a73e8; }
.wapp-ico { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: #fff; box-shadow: 0 1px 1px rgba(16,24,40,.08), 0 4px 10px -4px var(--wapp-glow, rgba(16,24,40,.35)), inset 0 1px 0 rgba(255,255,255,.28); flex: none; }
.wapp-ico svg { filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.wapp-name { max-width: 100%; font-size: 12.5px; font-weight: 600; line-height: 1.3; overflow-wrap: normal; word-break: normal; hyphens: manual; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wapp-count { position: absolute; top: -5px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #d93025; color: #fff; border: 2px solid var(--bg, #fff); font-size: 10.5px; font-weight: 700; line-height: 14px; text-align: center; }
.wapp-c0 { background: linear-gradient(145deg, #4f8ff7, #1a5fd8); --wapp-glow: rgba(26,95,216,.55); }
.wapp-c1 { background: linear-gradient(145deg, #34c26b, #148a3f); --wapp-glow: rgba(20,138,63,.5); }
.wapp-c2 { background: linear-gradient(145deg, #ffc233, #f08c00); --wapp-glow: rgba(240,140,0,.5); }
.wapp-c3 { background: linear-gradient(145deg, #a970ff, #6d3fe0); --wapp-glow: rgba(109,63,224,.5); }
.wapp-c4 { background: linear-gradient(145deg, #22c3d6, #0b8b9b); --wapp-glow: rgba(11,139,155,.5); }
.wapp-c5 { background: linear-gradient(145deg, #ff6b5e, #d93025); --wapp-glow: rgba(217,48,37,.5); }
.wapp-c6 { background: linear-gradient(145deg, #6f7ff0, #3949ab); --wapp-glow: rgba(57,73,171,.5); }
.wapp-c7 { background: linear-gradient(145deg, #f06ba1, #c2185b); --wapp-glow: rgba(194,24,91,.5); }
@media (max-width: 480px) { .apps-panel { width: calc(100vw - 24px); } }
@media (prefers-reduced-motion: reduce) { a.wapp, .pop-panel a.wapp { transition: none; } a.wapp:active { transform: none; } }

/* Tools page: one card per category (Web Search, Email, Web Page Reader), jumps to its section. */
.tool-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tool-cat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s ease, background-color .15s ease; }
.tool-cat:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.tool-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-cat strong { display: block; font-size: 15px; }
.tool-cat small { display: block; color: var(--text-2); }
.tool-cat-ico { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }

/* Agentic AI > Tools > Web Browser: the Install Browser control under the status. */
.bw-inst { margin-top: 6px; }

/* Profile menu: where you are (badge under your name) and a Switch To group (moved from the left panel). */
.profile-id .where { padding: 0; margin-top: 6px; background: none; box-shadow: none; flex-direction: row; }
.profile-id .where-org { display: none; }
.menu-label { padding: 6px 12px 2px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }

/* Tools a role / person can use (Roles, Users). */
.tool-use { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tool-use-row { display: grid; grid-template-columns: 18px 36px minmax(0, 1fr); gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; background: var(--white); }
.tool-use-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tool-use-row:has(input:disabled) { cursor: default; }
.tool-use-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.tool-use-ico { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2, #f2f2f2); color: var(--text-2); }
.tool-use-row strong { display: block; font-size: 14px; }
.tool-use-row small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
@media (max-width: 900px) { .tool-use { grid-template-columns: 1fr; } }
/* Skills (Agentic AI > Skills, client/pages/skills.php, core/skills.php) */
.sk-ta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; min-height: 240px; resize: vertical; }
.sk-view summary { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--accent-ink, var(--accent)); cursor: pointer; list-style: none; }
.sk-view summary::-webkit-details-marker { display: none; }
.sk-body { margin: 8px 0 0; padding: 10px 12px; background: var(--surface, #f7f7f8); border-radius: var(--r-ctl, 10px); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; max-height: 320px; overflow-y: auto; max-width: 60ch; }
.sk-how { margin: 0 0 12px; padding-left: 20px; line-height: 1.55; color: var(--text-2, inherit); max-width: 80ch; }
.sk-how li { margin-bottom: 6px; }
/* Skill Library (055): admin review + library cards (console Agentic AI > Skills) */
.skl-rules { margin-top: 4px; padding: 12px 14px; border-radius: var(--r-ctl, 10px); background: var(--surface, #f7f7f8); font-size: 13px; line-height: 1.5; }
.skl-rules p { margin: 4px 0 0; color: var(--text-2, inherit); }
.skl-find { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.skl-find li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.skl-find li > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.skl-find code { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; white-space: normal; }
.skl-h3 { font-size: 13px; font-weight: 600; margin: 18px 0 8px; }
.skl-drop { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.skl-drop li { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.skl-drop code { overflow-wrap: anywhere; }
.skl-body { max-width: none; max-height: 480px; }
.skl-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.skl-diff { margin: 12px 0 0; border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); max-height: 420px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }
.skl-diff .d { display: flex; gap: 8px; padding: 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.skl-diff .d > span { flex: 0 0 12px; color: var(--muted); user-select: none; }
.skl-diff .add { background: var(--ok-soft); }
.skl-diff .del { background: var(--bad-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.skl-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; margin-bottom: 16px; }
.skl-bar .input { height: 40px; }
.skl-bar .skl-q { flex: 1 1 260px; min-width: 0; }
.skl-bar select.input { flex: 0 1 220px; }
.skl-bar .btn { height: 40px; }
.skl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.skl-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card, #fff); min-width: 0; transition: border-color .15s ease, box-shadow .15s ease; }
.skl-card:hover { border-color: color-mix(in srgb, var(--text) 18%, var(--line)); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.04); }
.skl-card-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.skl-card-top strong { font-size: 15px; line-height: 1.3; }
.skl-card code { font-size: 12px; }
.skl-sum { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2, inherit); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.skl-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.skl-card-foot { margin-top: auto; padding-top: 6px; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.skl-card-foot .inline { margin: 0; }
@media (prefers-reduced-motion: reduce) { .skl-card { transition: none; } }
.skl-bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); background: var(--surface, #f7f7f8); }
/* Memories (Agentic AI > Memories and Admin > Memories, core/memory.php layers) */
.mem-stack { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mem-stack li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); }
.mem-stack li.is-on { border-color: var(--accent, #10a37f); background: var(--accent-soft, #eef9f5); }
.mem-stack strong { display: block; font-size: 14px; }
.mem-stack small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }
.mem-stack-ico { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2, #f4f4f5); color: var(--text-2, inherit); }
.seg a.seg-btn { display: inline-block; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); text-decoration: none; }
.seg a.seg-btn.is-on { background: var(--white, #fff); color: var(--text); box-shadow: var(--sh-1); }
.seg a.seg-btn:focus-visible { outline: 2px solid var(--accent, #10a37f); outline-offset: 1px; }
@media (max-width: 900px) { .mem-stack { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .mem-stack { grid-template-columns: 1fr; } }
/* A settings panel's own checkboxes stack one per line (they used to run together on one line when no help text sat between them). */
.panel-body > label.check { display: flex; width: fit-content; max-width: 100%; }
.mem-stack.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .mem-stack.three { grid-template-columns: 1fr; } }

/* Agent Runs (client/pages/agentruns.php) */
.runs-tbl td { vertical-align: top; }
.runs-tbl .badge { margin-top: 2px; }
.run-steps summary { cursor: pointer; font-weight: 500; }
.run-steps ol { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; max-width: 460px; }
/* Settings rows (account.php): what used to crowd the profile menu */
.set-grid { margin-top: 16px; }
.set-list { display: flex; flex-direction: column; }
.set-list form { margin: 0; }
.set-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 12px 16px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); text-align: left; font: inherit; cursor: pointer; text-decoration: none; }
.set-list > :first-child.set-row, .set-list > form:first-child .set-row { border-top: 0; }
.set-row:hover { background: var(--surface); text-decoration: none; }
.set-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--text); }
.set-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.set-t small { color: var(--muted); font-size: 12px; }
.set-go { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
/* Memories (client/pages/memories.php): layer cards + memory rows */
.mem-layers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.mem-layer { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--white); color: var(--text); text-decoration: none; }

.mem-layer.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mem-layer-ico { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); }
.mem-layer.is-on .mem-layer-ico { background: var(--accent); color: #fff; }
.mem-layer-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.mem-layer-t strong { font-size: 14px; }
.mem-layer-t small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-order { margin: 0 2px 16px; }
.mem-intro { padding-top: 0; }
.mem-intro .help { margin: 0; }
.mem-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.mem-item { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.mem-item:last-child { border-bottom: 0; }
.mem-item.is-off .mem-text { color: var(--muted); }
.mem-main { min-width: 0; flex: 1 1 auto; }
.mem-text { margin: 0 0 6px; line-height: 1.55; overflow-wrap: anywhere; }
.mem-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.mem-acts { display: flex; flex: 0 0 auto; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 1100px) { .mem-layers { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .mem-layers { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mem-item { flex-direction: column; } .mem-acts { justify-content: flex-start; } }

/* Choose Models (cloud provider picker): one model per row, only ticked ones are added. */
.pick-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pick-list .check { display: flex; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line, #e5e5e5); border-radius: 8px; }
.pick-list .check input { margin-top: 3px; flex: 0 0 auto; }
.pick-list .check code { font-size: 12px; word-break: break-all; }
.pick-list [hidden] { display: none !important; }
.pick-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.pick-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 2px 0; }
.pick-group-head .muted { font-size: 12px; }
.pick-group > .help { margin: 0 2px 4px; }

/* Which Records They See, per person (058): a level changed for this person is tinted like a changed tick. */
.matrix span.cell { position: relative; display: block; }
.matrix span.cell.is-changed select { background-color: var(--info-soft); border-color: var(--info); }
.matrix span.cell.is-changed::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 999px; background: var(--info); }

/* ---------- Apps (core/apps_ui.php) ---------- */
.app-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.app-type { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-2, var(--text)); font-size: 13px; font-weight: 600; text-decoration: none; background: var(--white, #fff); transition: background .15s ease, border-color .15s ease; }
.app-type:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--line)); text-decoration: none; }
.app-type.is-on { background: var(--text); border-color: var(--text); color: #fff; }
.app-head { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.app-head strong { overflow-wrap: anywhere; }
.app-tile { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; color: #fff; }
.app-parts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.app-parts li { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--surface-2, #f2f2f4); color: var(--text-2, #444); }
.app-card2 .skl-card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.app-also { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.app-also-i { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; background: var(--white, #fff); transition: border-color .15s ease; }
.app-also-i:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--line)); text-decoration: none; }
.app-also-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-also-i > .badge { flex: none; }
.app-also-i small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.app-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.app-fs[hidden] { display: none; }
@media (max-width: 640px) { .app-types { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; } .app-type { flex: none; } }

/* Agentic AI > Memories (2026-09-28): memory files on the left like Claude Code's /memory, the chosen file as a document. */
.mf { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 32px; }
.mf-nav { min-width: 0; }
.mf-cap { margin: 0 4px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.mf-files { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 2px; }
.mf-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-ctl, 10px); color: var(--text); text-decoration: none; min-width: 0; }
.mf-file:hover { background: var(--surface); }
.mf-file.is-on { background: var(--accent-soft); }
.mf-ico { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); color: var(--text); }
.mf-file.is-on .mf-ico { background: var(--accent); color: #fff; }
.mf-ft { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.mf-ft strong { font-size: 14px; }
.mf-ft code, .mf-title code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-n { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mf-doc { min-width: 0; margin: 0; }
.mf-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mf-head .help { flex: 1 0 100%; margin: 0; }
.mf-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.mf-title h2 { margin: 0; font-size: 18px; }
.mf-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mf-cnt { font-size: 12.5px; }
.mf-seg { display: inline-flex; gap: 4px; }
.mf-body { padding: 8px 20px 20px; }
.mf-sec { margin-top: 14px; }
.mf-h { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--text); }
.mf-h span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 500; }
.mf-h small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.mf-offsec summary { cursor: pointer; list-style: none; }
.mf-offsec summary::-webkit-details-marker { display: none; }
.mf-offsec .help { margin: 0 0 4px; }
.mf-lines { list-style: none; margin: 0; padding: 0; }
.mf-line { position: relative; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0 10px 18px; border-bottom: 1px solid var(--line); }
.mf-line:last-child { border-bottom: 0; }
.mf-line::before { content: ""; position: absolute; left: 4px; top: 19px; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.mf-line.is-off .mf-text { color: var(--muted); text-decoration: line-through; }
.mf-main { min-width: 0; flex: 1 1 auto; }
.mf-text { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.mf-meta { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.mf-acts { display: flex; flex: 0 0 auto; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.mf-pre { margin: 12px 0 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 70vh; overflow-y: auto; }
@media (max-width: 900px) {
  .mf { grid-template-columns: 1fr; }
  .mf-files { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
  .mf-file { border: 1px solid var(--line); }
  .mf-line { flex-direction: column; }
  .mf-acts { justify-content: flex-start; }
}

/* Table row actions are icon-only (assets/ui.js, owner rule 2026-09-28). Square, same height as other small buttons. */
table td .btn.btn-ico { width: 32px; min-width: 32px; min-height: 32px; padding: 0; justify-content: center; gap: 0; }
table td .btn.btn-ico svg { margin: 0; }

/* AI Agent Settings: risk note under the Voice Dictation switch */
.voice-risk { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 4px; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 1.5; }
.voice-risk strong { font-size: 13.5px; }
.voice-risk span { color: var(--text-2); max-width: 75ch; }
.voice-risk.is-ok { background: var(--ok-soft); color: var(--ok); }
.voice-risk[hidden] { display: none; }
.voice-set { margin-top: 14px; }

/* Client Console top-right app icons (owner 2026-09-29): each app's management view opens from here, in the console; the left
   menu's Apps section is their settings. On narrow screens the icons fold into one Apps menu so the top bar keeps its room. */
.top-apps { display: flex; align-items: center; gap: 2px; }
.top-apps-more { display: none; }
.top-apps-more .pop-panel { min-width: 240px; padding-bottom: 6px; }
.top-apps-more .menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: var(--text); text-decoration: none; font-size: 14px; }
.top-apps-more .menu-item:hover { background: var(--surface); text-decoration: none; }
/* Console Apps (2026-09-30): the mirror apps are icons; the menu holds the console-only apps on wide screens, everything below 760px */
.top-apps-more.has-console { display: block; }
.top-apps-more .capp-mirror { display: none; }
@media (max-width: 760px) {
  .top-apps { display: none; }
  .top-apps-more { display: block; }
  .top-apps-more .menu-item.capp-item.capp-mirror { display: flex; }
  .top-apps-more .menu-sep.capp-mirror { display: block; }
}
.top-apps::after { content: ""; width: 1px; height: 20px; background: var(--line); margin: 0 6px 0 4px; }
.top-apps .icon-btn.is-on { background: var(--surface-2); color: var(--text); }
/* App overviews (client/pages/overview.php): a simple bar list */
.ov-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ov-bars li { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.ov-bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ov-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent, #10a37f); }
.ov-bars b { font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
@media (max-width: 640px) { .ov-bars li { grid-template-columns: 1fr auto; } .ov-bar { grid-column: 1 / -1; order: 3; } }
/* App overviews: daily trend columns + management call-out */
.ov-trend { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.ov-trend i { flex: 1 1 0; min-width: 2px; border-radius: 3px 3px 0 0; background: var(--accent, #10a37f); }
.ov-trend i.z { background: var(--surface-2); }
.ov-trend-ax { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.ov-attn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); font-size: 14px; }
.ov-attn > span { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) { .ov-attn { flex-wrap: wrap; } }
/* Usage > Tokens and Cost by Model: the price form (fields and the Save button share one height) */
.price-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; }
.price-form label { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; color: var(--muted); }
.price-form .input { width: 84px; height: 32px; padding: 4px 8px; font-size: 13px; }
.price-form select.input { width: 76px; }
.price-form .btn.sm { height: 32px; }
@media (max-width: 640px) { .price-form .input { font-size: 16px; } }

/* Console Apps (081): the Client Console's own management apps (client/pages/consoleapps.php, capp.php) */
.capp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.capp-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); }
.capp-card.is-off .wapp-ico { filter: grayscale(1); opacity: .55; }
.capp-top { display: flex; align-items: center; gap: 14px; }
.capp-id { flex: 1 1 auto; min-width: 0; }
.capp-id h2 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.capp-what { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1 1 auto; }
.capp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.wapp-ico.sm { width: 32px; height: 32px; border-radius: 10px; }
.top-apps-more .menu-item.capp-item { align-items: flex-start; gap: 12px; padding: 10px 16px; white-space: normal; }
.top-apps-more .menu-item.capp-item small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.top-apps-more .menu-item.capp-item.is-on { background: var(--surface); }
.top-apps-more:has(.capp-item) .pop-panel { width: 320px; max-width: calc(100vw - 24px); }
/* Ten apps are taller than a phone: the menu scrolls inside itself (it is fixed under 560px, so the page cannot scroll it into view) */
.top-apps-more .pop-panel { max-height: calc(100vh - var(--top-h, 56px) - 24px); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 560px) { .top-apps-more:has(.capp-item) .pop-panel { width: auto; max-width: none; } }
.ov-meter { display: inline-block; vertical-align: middle; width: 88px; height: 8px; margin-right: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ov-meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent, #10a37f); }
.ann-body { white-space: pre-line; }
.panel-head .muted { font-size: 13px; }
@media (max-width: 640px) { .capp-grid { grid-template-columns: minmax(0, 1fr); } .ov-meter { width: 60px; } }
/* Settings > Console Apps: the two tiers, and the placeholder of a Console App not built yet (client/pages/capp.php $capSoon) */
.capp-tier { margin: 24px 0 12px; font-size: 15px; font-weight: 650; }
.capp-soon-act { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }

/* Tools > Calculator (2026-09-29): Try It console, examples and the full reference (assets/calc.js) */
.calc { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; margin-top: 16px; align-items: start; }
.calc h3 { margin: 0; font-size: 15px; font-weight: 650; }
.calc-try { min-width: 0; }
.calc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.calc-head .muted { font-size: 13px; }
.calc-in { width: 100%; min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.55; }
.calc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.calc-out { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); overflow: hidden; }
.calc-rows { list-style: none; margin: 0; padding: 0; }
.calc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.calc-row:last-child { border-bottom: 0; }
.calc-row-in { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; background: none; padding: 0; }
.calc-row-val { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.calc-row.is-bad { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.calc-row.is-bad .calc-row-val { font-weight: 500; color: var(--bad, #b42318); text-align: left; font-size: 13px; }
.calc-err { margin: 0; padding: 12px 14px; color: var(--bad, #b42318); font-size: 14px; }
.calc-ex { min-width: 0; }
.calc-ex-list { display: grid; gap: 8px; }
.calc-ex-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 10px 12px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); background: var(--white, #fff); color: var(--text); font: inherit; cursor: pointer; transition: background 140ms ease, border-color 140ms ease; }
.calc-ex-btn:hover { background: var(--surface); border-color: var(--line-2, var(--line)); }
.calc-ex-btn:focus-visible { outline: 2px solid var(--accent, #10a37f); outline-offset: 2px; }
.calc-ex-btn strong { font-size: 14px; }
.calc-ex-btn code { font-size: 12px; color: var(--muted); background: none; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.calc-ref { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.calc-ref summary { cursor: pointer; }
.calc-ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 16px 0; }
.calc-ref-grid h4, .calc-units-h { margin: 0 0 6px; font-size: 13px; font-weight: 700; }
.calc-units-h { margin-bottom: 8px; }
.calc-ref-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.calc-ref-grid code { font-size: 12.5px; }
@media (max-width: 860px) { .calc { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .calc-ex-btn { transition: none; } }

/* Organisation > Usage > Tokens (2026-09-29): tokens per day (input + output stacked) and the price dialog */
.usage-sub { margin: 20px 0 10px; font-size: 14px; font-weight: 650; }
.usage-bars.tok { height: 120px; }
.usage-bar .usage-out { background: #1d4ed8; }
.usage-swatch.out { background: #1d4ed8; margin-left: 10px; }
.price-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 520px) { .price-grid { grid-template-columns: minmax(0, 1fr); } }

/* Phone menu sheet (2026-09-29): a fading scrim never catches taps, and notice bars keep their icon beside the text. */
@media (max-width: 1023.98px) {
  .scrim { pointer-events: none; }
  body.menu-open .scrim { pointer-events: auto; }
  .notice-bar { flex-wrap: nowrap; align-items: flex-start; }
  .notice-bar > svg { flex: none; margin-top: 2px; }
  .notice-bar > span { flex: 1 1 auto; min-width: 0; }
}

/* Agentic AI > Memories (082): overview stack, flow, stats and per-entry history */
.mo-stack { list-style: none; margin: 8px 0 20px; padding: 0; display: grid; gap: 8px; counter-reset: mo; }
.mo-stack li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); background: var(--white, #fff); }
.mo-stack li:nth-child(2) { margin-left: 12px; } .mo-stack li:nth-child(3) { margin-left: 24px; } .mo-stack li:nth-child(4) { margin-left: 36px; } .mo-stack li:nth-child(5) { margin-left: 48px; }
.mo-l { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.mo-l small { color: var(--muted); font-size: 12.5px; }
.mo-n { display: flex; flex-direction: column; align-items: flex-end; flex: none; line-height: 1.2; }
.mo-n b { font-size: 18px; font-variant-numeric: tabular-nums; }
.mo-n small { color: var(--muted); font-size: 11.5px; }
.mo-stats { margin: 0 0 8px; }
.mo-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; counter-reset: flow; }
.mo-flow li { counter-increment: flow; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--r-ctl, 10px); background: var(--surface); font-size: 13px; color: var(--text-2); }
.mo-flow li strong { color: var(--text); font-size: 14px; }
.mo-flow li strong::before { content: counter(flow) ". "; color: var(--muted); }
.mf-hist { margin-top: 6px; font-size: 12.5px; }
.mf-hist summary { cursor: pointer; color: var(--accent-ink, var(--accent)); font-weight: 600; }
.mf-hist ol { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 6px; }
@media (max-width: 640px) { .mo-stack li { margin-left: 0 !important; flex-wrap: wrap; } .mo-n { align-items: flex-start; } }
.mf-note { margin: -8px 4px 16px; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* Agentic AI > Memories (2026-09-30): Memory Service console after the reference design (Overview, Records, Context, History, Policy, People) */
.mem2-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.mem2-flow li { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-ctl, 10px); background: var(--surface); position: relative; }
.mem2-flow li b { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mem2-flow li span { font-size: 12.5px; color: var(--muted); }
.mem2-scopes { margin-bottom: 12px; }
.mem2-scopes a.stat { color: var(--text); text-decoration: none; transition: border-color 140ms ease, background 140ms ease; }
.mem2-scopes a.stat:hover { background: var(--surface); }
.mem2-scopes a.stat.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mem2-filters { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mem2-filters input[type=search] { flex: 1 1 220px; min-width: 0; }
.mem2-text { display: block; line-height: 1.5; overflow-wrap: anywhere; margin-bottom: 2px; }
.mem2-tbl td[data-label="Record"] { min-width: 260px; }
.mem2-hist { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
.mem2-hist p { margin: 4px 0 0; overflow-wrap: anywhere; }
.mem2-never { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
@media (max-width: 640px) { .mem2-tbl td[data-label="Record"] { min-width: 0; } }
@media (prefers-reduced-motion: reduce) { .mem2-scopes a.stat { transition: none; } }
.mem2-asof { flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.mem2-asof label { font-size: 13px; font-weight: 600; }
.mem2-asof input[type=date] { width: auto; }
.run-act { font-size: 13px; line-height: 1.5; margin-bottom: 4px; }

/* Memory Health (088): label first, number, then what it means */
.mem2-health { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mem2-health > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.mem2-health dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mem2-health dd { margin: 2px 0 0; display: grid; gap: 1px; }
.mem2-health b { font-size: 20px; line-height: 1.2; }
.mem2-health small { color: var(--muted); font-size: 12px; line-height: 1.35; }

/* Agent Runs, 103 (client/pages/agentruns.php): one tbody per run (the row, then Show Details), trace-style sections inside. */
.run-bar .run-date { flex: 0 1 190px; }
.run-bar .run-date > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.run-bar .run-date input { font-size: 14px; }
.run-bar .run-trace { flex: 1 1 170px; }
.runs-tbl tbody.run:hover td { background: var(--gray-25); }
.runs-tbl tr.run-row td { border-bottom: 0; padding-bottom: 6px; }
.runs-tbl tbody.run tr.run-more td { padding-top: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.runs-tbl tbody.run:last-child tr.run-more td { border-bottom: 0; }
.run-who { display: inline-flex; align-items: center; gap: 4px; }
.run-who + small { display: block; }
.run-h { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.run-trace-id { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.run-trace-id:hover { color: var(--accent-ink); }
.run-x > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; margin-left: -10px; border-radius: 8px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; color: var(--text-2); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.run-x > summary::-webkit-details-marker { display: none; }
.run-x > summary:hover { background: var(--surface-2); color: var(--text); }
.run-x > summary:focus-visible { outline: 0; box-shadow: var(--focus); }
.run-x > summary svg { transition: transform var(--t) var(--ease); }
.run-x[open] > summary svg { transform: rotate(90deg); }
.run-x .when-open, .run-x[open] .when-closed { display: none; }
.run-x[open] .when-open { display: inline; }
.run-x-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.run-x-sec { border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--white); padding: 12px 14px; min-width: 0; }
.run-x-sec h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.run-x-sec p { margin: 0; font-size: 13px; }
.run-x-wide { grid-column: 1 / -1; }
.run-list { margin: 0; padding: 0 0 0 18px; display: grid; gap: 6px; font-size: 13px; line-height: 1.45; }
ul.run-list { list-style: none; padding-left: 0; }
.run-list .badge { margin-left: 4px; vertical-align: 1px; height: 20px; font-size: 11.5px; }
.run-d { display: block; overflow-wrap: anywhere; }
.run-tools li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.run-tools li > span:first-child { overflow-wrap: anywhere; }
.run-tools li .badge { margin-left: 0; }
.run-tools li.is-sub { padding-left: 12px; border-left: 2px solid var(--line); }
.run-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13px; }
.run-kv dt { color: var(--muted); }
.run-kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.run-caps { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; align-items: start; margin-top: 10px; }
.run-caps-k { font-size: 12.5px; color: var(--muted); padding-top: 3px; }
.run-x-sec .run-caps-mode { display: flex; gap: 6px; }
.run-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.run-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); }
.run-chip.is-off { background: var(--bad-soft); color: var(--bad); }
.run-chip.is-flag { background: var(--accent-soft); color: var(--accent-ink); }
.run-x-sec .run-caps-go { margin-top: 12px; font-size: 13px; }
.run-caps-go a { display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 720px) {
  .runs-tbl.stack tbody.run { border-bottom: 1px solid var(--line); }
  .runs-tbl.stack tr.run-row, .runs-tbl.stack tr.run-more { border-bottom: 0; }
  .runs-tbl.stack tr.run-row { padding-bottom: 4px; }
  .runs-tbl.stack tr.run-more { padding-top: 0; }
  .runs-tbl.stack tbody.run tr.run-more td { border-bottom: 0; padding: 0; }
  .run-caps { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .run-bar .run-date, .run-bar .run-trace { flex: 1 1 calc(50% - 4px); min-width: 0; }
}

/* What AI Agent Can Use, 103 (client/pages/appset.php tab agentcan): the person picker, Status tiles, one table per group. */
.panel-head-r { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.caps-pick { margin: 0 0 12px; }
.caps-pick .input { flex: 1 1 260px; max-width: 420px; }
.caps-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.caps-status { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 16px; }
.caps-tile { display: flex; flex-direction: column; gap: 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px 16px; min-width: 0; }
.caps-tile-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.caps-tile-h strong { font-size: 14px; font-weight: 600; }
.caps-tile p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.caps-tile .caps-bg { font-size: 12px; color: var(--muted); }
.caps-tile a.caps-fix { font-size: 13px; margin-top: auto; }
.caps-count { display: flex; gap: 6px; flex-wrap: wrap; }
.caps-tbl td { vertical-align: top; }
.caps-tbl td[data-label="Why"] { color: var(--text-2); font-size: 13.5px; line-height: 1.5; min-width: 260px; overflow-wrap: anywhere; }
.caps-tbl td[data-label="Scheduled Tasks and API"] small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; }
@media (max-width: 720px) {
  .caps-tbl td[data-label="Why"] { min-width: 0; grid-column: 1 / -1; }
  .caps-pick .input { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .run-x > summary, .run-x > summary svg { transition: none; } }

/* Console Apps > Calendar (client/capps/calendar.php, package C): the Free/Busy grid and event replies (moved from an inline block) */
.cfb-grid td { vertical-align: middle; }
.cfb-person { min-width: 150px; }
.cfb-track { position: relative; height: 30px; border-radius: 8px; background: var(--white); border: 1px solid var(--line); overflow: hidden; min-width: 60px; }
.cfb-off { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--surface-2) 6px 8px); }
.cfb-busy { position: absolute; top: 4px; bottom: 4px; border-radius: 5px; background: var(--accent); opacity: .85; min-width: 3px; }
.cfb-scale { position: relative; height: 18px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cfb-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.cfb-scale span:first-child { transform: none; }
.cfb-day { font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.cfb-week td.cfb-cell { padding-left: 6px; padding-right: 6px; }
.cfb-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.cfb-legend i { display: inline-block; width: 18px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 6px; border: 1px solid var(--line); }
.cfb-legend .k-busy { background: var(--accent); border-color: transparent; }
.cfb-legend .k-off { background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--surface-2) 6px 8px); }
.cal-replies { display: flex; flex-wrap: wrap; gap: 6px; }
.cfb-nav { display: flex; gap: 8px; flex: 0 1 auto; min-width: 0; }
.cfb-nav .btn { padding: 0 12px; flex: 0 0 auto; }
.cfb-nav .input { min-width: 0; width: auto; flex: 1 1 150px; }
@media (max-width: 640px) { .cfb-nav { flex: 1 1 100%; } }
@media (max-width: 760px) { .cfb-scale { display: none; } .cfb-person { min-width: 0; } }
@media (max-width: 720px) { .tbl.stack.cfb-grid td.cfb-cell, .tbl.stack.cfb-grid td.cfb-note { grid-column: 1 / -1; } .cfb-week td.cfb-cell { padding-left: 0; padding-right: 0; } }
