/* Loduchand control panel. One stylesheet, no build step. */

:root {
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --r-sm: 6px;
  --r: 9px;
  --r-lg: 13px;
  --accent: #8b93ff;
  --pad-card: 20px;
  --pad-row: 16px;
  --gap: 16px;
  --sidebar: 256px;
  --topbar: 60px;

  /* dark (default) */
  --bg: #0b0d12;
  --bg-side: #0f1117;
  --surface: #14171f;
  --surface-2: #191d27;
  --surface-3: #212633;
  --hover: #1d212c;
  --line: #232835;
  --line-2: #2e3444;
  --text: #e8eaf0;
  --text-2: #b6bccb;
  --muted: #8a91a3;
  --faint: #626a7d;
  --ok: #4cc38a;
  --warn: #e8ab4f;
  --danger: #f0625c;
  --shadow: 0 16px 40px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --accent-text: color-mix(in srgb, var(--accent) 82%, white);
  --accent-ink: #0c0e16;
  --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 48%, transparent);
  --mention-bg: color-mix(in srgb, var(--accent) 22%, transparent);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f4f7;
  --bg-side: #ebedf2;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eceef3;
  --hover: #f0f2f6;
  --line: #e1e4eb;
  --line-2: #d1d6df;
  --text: #141720;
  --text-2: #3b4252;
  --muted: #5f6678;
  --faint: #939aa9;
  --ok: #178a55;
  --warn: #a8660c;
  --danger: #cf3530;
  --shadow: 0 18px 44px rgba(20, 24, 40, .14), 0 2px 6px rgba(20, 24, 40, .06);
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, .06);
  --accent-text: color-mix(in srgb, var(--accent) 72%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 55%, transparent);
  color-scheme: light;
}

[data-density="compact"] {
  --pad-card: 14px;
  --pad-row: 10px;
  --gap: 12px;
  --topbar: 52px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[data-density="compact"] body { font-size: 13.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); }

.skip { position: absolute; left: 12px; top: -40px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r); }
.skip:focus { top: 12px; }
.noscript { padding: 40px; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { display: inline-flex; width: 16px; height: 16px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* --- boot and sign-in ----------------------------------------------------------- */

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .brand-mark { width: 44px; height: 44px; font-size: 22px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }

.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 75%, white), var(--accent));
  color: var(--accent-ink);
  font-weight: 800; font-size: 17px; letter-spacing: -.04em;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 6px 18px color-mix(in srgb, var(--accent) 25%, transparent);
}

.signin {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--bg);
}
.signin-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.signin-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.signin-brand .brand-mark { width: 42px; height: 42px; font-size: 21px; border-radius: 12px; }
.signin-brand strong { display: block; font-size: 17px; }
.signin-brand small { display: block; color: var(--muted); font-size: 13px; }
.signin h1 { font-size: 22px; margin-bottom: 8px; }
.signin-lead { color: var(--text-2); margin-bottom: 22px; }
.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; color: var(--text-2); }
.steps b { color: var(--text); font-weight: 600; }
.step-n {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text);
  font-size: 12px; font-weight: 700;
}
.slash { font-family: var(--mono); background: var(--surface-3); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 5px; color: var(--text); }
.signin-note { color: var(--faint); font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; display: flex; gap: 8px; }
.signin-note .icon { margin-top: 2px; }
.signin-busy { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 12px 0 6px; }

.spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- shell ------------------------------------------------------------------------ */

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  overflow: hidden;
  z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 16px 16px 12px; }
.side-brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.side-brand small { display: block; color: var(--faint); font-size: 12px; margin-top: -1px; }
.side-server {
  margin: 0 12px 6px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
}
.side-server .avatar { border-radius: 8px; }
.side-server b { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-server .srv-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.25; }
.side-server .online { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-left: auto; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); flex: none; }

.side-nav { flex: 1; overflow-y: auto; padding: 6px 10px 14px; scrollbar-width: thin; }
.nav-group { margin-top: 14px; }
.nav-label { display: block; padding: 0 10px 5px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 34px;
  padding: 0 8px 0 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-weight: 500;
}
[data-density="compact"] .nav-item { min-height: 30px; }
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .icon { color: var(--muted); }
.nav-item[aria-current="page"] .icon { color: var(--accent-text); }
.nav-emoji { width: 18px; text-align: center; font-size: 14px; line-height: 1; flex: none; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-tag { font-size: 10.5px; font-weight: 600; color: var(--faint); border: 1px solid var(--line-2); padding: 0 5px; border-radius: 5px; line-height: 16px; text-transform: uppercase; letter-spacing: .03em; }
.nav-count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pin-btn {
  display: grid; place-items: center;
  width: 24px; height: 24px; margin-right: -2px;
  border: 0; border-radius: 6px; background: transparent; color: var(--faint);
  opacity: 0;
}
.nav-item:hover .pin-btn, .pin-btn:focus-visible, .pin-btn[aria-pressed="true"] { opacity: 1; }
.pin-btn:hover { color: var(--text); background: var(--surface-3); }
.pin-btn[aria-pressed="true"] { color: var(--accent-text); }
.pin-btn .icon { width: 14px; height: 14px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 2px; }
.side-version { padding: 4px 10px 0; font-size: 11.5px; color: var(--faint); display: flex; justify-content: space-between; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--line);
}
.btn.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; color: var(--text); }
.search-box input::placeholder { color: var(--faint); }
kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  max-height: min(70vh, 480px); overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 6px;
}
.result-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.result {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 10px; border-radius: 8px; color: var(--text); cursor: pointer;
}
.result[aria-selected="true"] { background: var(--accent-soft); }
.result-icon { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 14px; }
.result-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-hint { color: var(--faint); font-size: 12px; }
.result mark { background: transparent; color: var(--accent-text); font-weight: 650; }
.search-empty { padding: 18px; text-align: center; color: var(--muted); }

.top-spacer { flex: 1; }
.userbtn {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 6px 0 4px;
  border: 1px solid transparent; border-radius: 999px;
  background: transparent;
}
.userbtn:hover, .userbtn[aria-expanded="true"] { background: var(--surface); border-color: var(--line); }
.userbtn .name { font-weight: 550; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbtn .icon { color: var(--muted); width: 14px; }

.menu {
  position: fixed; z-index: 70;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 6px;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b { display: block; }
.menu-head span { color: var(--muted); font-size: 12.5px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); color: var(--text); text-decoration: none; }
.menu-item.danger { color: var(--danger); }

.content { width: 100%; max-width: 1080px; margin: 0 auto; padding: 28px 28px 120px; outline: none; }
[data-density="compact"] .content { padding-top: 20px; }

/* --- banners ---------------------------------------------------------------------- */

.banner {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 28px 0;
  padding: 10px 12px 10px 14px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
  color: var(--text);
}
.banner .icon { color: var(--warn); }
.banner p { flex: 1; }
.banner p span { color: var(--text-2); }
.banner.inline { margin: 0 0 18px; width: auto; }
.banner.info { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.banner.info .icon { color: var(--accent-text); }
@media (min-width: 1136px) { .banner:not(.inline) { max-width: 1024px; margin-left: auto; margin-right: auto; width: calc(100% - 56px); } }

/* --- page head ------------------------------------------------------------------ */

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; line-height: 1.25; }
[data-density="compact"] .page-head h1 { font-size: 21px; }
.page-head .lead { color: var(--muted); margin-top: 4px; max-width: 680px; }
.page-head .grow { flex: 1; min-width: 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.feature-icon {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* --- buttons ------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 550; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
[data-density="compact"] .btn { height: 30px; padding: 0 11px; }
.btn:hover:not(:disabled) { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .45; }
.btn .icon { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, white); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn.danger-solid { background: var(--danger); color: white; border-color: transparent; }
.btn.danger-solid:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 88%, black); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; border-radius: 7px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.sm.icon-only { width: 28px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14.5px; }

/* --- cards --------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--pad-card);
  min-height: 56px;
}
[data-density="compact"] .card-head { min-height: 46px; padding-top: 10px; padding-bottom: 10px; }
.card-head h2 { font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-head .grow { flex: 1; min-width: 0; }
.collapse-btn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); }
.collapse-btn:hover { background: var(--hover); color: var(--text); }
.collapse-btn .icon { transition: transform .18s; }
.card.collapsed .collapse-btn .icon { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card-body { border-top: 1px solid var(--line); }
.card-body.pad { padding: var(--pad-card); }
.card.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }

.section-title { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { font-size: 15px; }
.section-title span { color: var(--muted); font-size: 13px; }
.section-title a { margin-left: auto; font-size: 13px; }

/* --- badges and chips ------------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  background: transparent;
  line-height: 1;
}
.badge .icon { width: 11px; height: 11px; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.restart { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.badge.src-panel { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.badge.src-env { color: var(--text-2); }
.badge.src-default { border-style: dashed; color: var(--muted); }
.badge.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.off { color: var(--muted); border-style: dashed; }
.badge.who-admins { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge.who-captains { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.who-everyone { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge.paused { color: var(--muted); border-style: dashed; }
.badge.unsaved { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }

[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 7px);
  transform: translateX(-50%);
  z-index: 60;
  width: max-content; max-width: 280px;
  padding: 6px 9px;
  border-radius: 7px;
  background: #05060a; color: #eef0f5;
  font: 500 12px/1.4 var(--font);
  text-transform: none; letter-spacing: 0;
  white-space: normal; word-break: break-word;
  box-shadow: var(--shadow);
  pointer-events: none;
}
[data-theme="light"] [data-tip]:hover::after { background: #1b1f2a; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; max-width: 100%;
  padding: 0 4px 0 9px;
  border-radius: 7px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-weight: 500;
}
.chip .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .glyph { color: var(--muted); font-weight: 600; }
.chip .avatar { margin-left: -5px; }
.chip-x { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.chip-x:hover { background: var(--line-2); color: var(--text); }
.chip-x .icon { width: 12px; height: 12px; }
.chip.missing { border-style: dashed; color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset; background: var(--faint); }
.inline-ref { display: inline-flex; align-items: center; gap: 4px; font-weight: 550; color: var(--text); }
.inline-ref .glyph { color: var(--muted); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  color: white; font-size: 11px; font-weight: 700;
  overflow: hidden;
}
.avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.avatar.xs { width: 18px; height: 18px; font-size: 9px; }

/* --- form controls ------------------------------------------------------------------ */

.input, .select, .textarea {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
[data-density="compact"] .input, [data-density="compact"] .select { height: 32px; }
.textarea { height: auto; min-height: 64px; padding: 8px 11px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.invalid { border-color: color-mix(in srgb, var(--danger) 65%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent); }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
[data-density="compact"] .select { background-position: calc(100% - 17px) 13px, calc(100% - 12px) 13px; }
input[type="time"].input, input[type="datetime-local"].input { font-variant-numeric: tabular-nums; }
input[type="time"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.6); cursor: pointer; }
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator, [data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: none; opacity: .6; }
.input-group { display: flex; align-items: stretch; width: 100%; }
.input-group .input { border-radius: 8px 0 0 8px; min-width: 0; }
.input-group .addon {
  display: flex; align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line-2); border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--surface-3);
  color: var(--muted); font-size: 13px; white-space: nowrap;
}
.hint { color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.error-text { color: var(--danger); font-size: 12.5px; margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.label .opt { color: var(--faint); font-weight: 400; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }

.picker-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; height: 36px;
  padding: 0 10px 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  text-align: left;
}
[data-density="compact"] .picker-btn { height: 32px; }
.picker-btn:hover { border-color: var(--faint); }
.picker-btn .value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-btn .placeholder { color: var(--faint); }
.picker-btn .glyph { color: var(--muted); font-weight: 600; }
.picker-btn .icon { color: var(--muted); }
.picker-btn.missing { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.picker-row { display: flex; gap: 6px; align-items: center; }
.picker-row .picker-btn { flex: 1; min-width: 0; }

.switch {
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; background: transparent; padding: 2px 0;
  color: var(--text-2); font-weight: 550;
}
.switch .track {
  position: relative; width: 38px; height: 22px; flex: none;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  transition: background .16s, border-color .16s;
}
.switch .thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted);
  transition: transform .16s cubic-bezier(.3,.7,.4,1), background .16s;
  display: grid; place-items: center;
}
.switch[aria-checked="true"] .track { background: var(--accent); border-color: transparent; }
.switch[aria-checked="true"] .thumb { transform: translateX(16px); background: var(--accent-ink); }
[data-theme="light"] .switch[aria-checked="true"] .thumb { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch .state { min-width: 22px; text-align: left; font-size: 13px; }
.switch[aria-checked="true"] .state { color: var(--text); }
.switch:disabled { opacity: .55; }
.switch.sm .track { width: 32px; height: 18px; }
.switch.sm .thumb { width: 12px; height: 12px; }
.switch.sm[aria-checked="true"] .thumb { transform: translateX(14px); }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: 9px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  max-width: 100%; flex-wrap: wrap;
}
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--muted); font-weight: 550; font-size: 13px;
}
[data-density="compact"] .segmented button { height: 24px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line-2); }
.segmented .icon { width: 14px; height: 14px; }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.range::-moz-range-track { height: 4px; border-radius: 99px; background: var(--surface-3); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent-line); }
.range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent); }

/* --- settings rows -------------------------------------------------------------------- */

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 10px 28px;
  padding: var(--pad-row) var(--pad-card);
  border-top: 1px solid var(--line);
  position: relative;
  transition: background .3s;
}
.field:first-child { border-top: 0; }
.field.dirty::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.field.flash { background: var(--accent-soft); }
.field-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-label label, .field-label .name { font-weight: 600; color: var(--text); }
.field-help { color: var(--muted); margin-top: 3px; font-size: 13px; }
.field-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.field-key { font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-left: 2px; }
.field-control { min-width: 0; }
.field-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 10px; min-height: 28px; }
.field-actions .grow { flex: 1; }
.field-actions .muted-note { font-size: 12.5px; color: var(--faint); }

.weights { display: grid; gap: 8px; }
.weight-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(70px, 1fr) 54px 48px 28px; gap: 8px; align-items: center; }
.weight-row .input { height: 32px; padding: 0 6px; text-align: center; }
.weight-row .picker-btn { height: 32px; }
.weight-share { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.weight-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin-top: 2px; }
.weight-bar span { display: block; height: 100%; }

.savebar {
  position: fixed; left: calc(var(--sidebar) + 50%); bottom: 20px; transform: translateX(calc(-50% - var(--sidebar) / 2));
  z-index: 35;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: rise .18s ease-out;
}
.savebar p { font-weight: 550; margin-right: 10px; white-space: nowrap; }
.savebar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 8px; }
@keyframes rise { from { transform: translate(calc(-50% - var(--sidebar) / 2), 12px); opacity: 0; } }

/* --- commands ----------------------------------------------------------------------- */

.cmd {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) auto;
  gap: 6px 18px;
  align-items: baseline;
  padding: 12px var(--pad-card);
  border-top: 1px solid var(--line);
}
.cmd:first-child { border-top: 0; }
.cmd-name { font-family: var(--mono); font-weight: 600; color: var(--text); font-size: 13.5px; }
.cmd-name .sl { color: var(--accent-text); }
.cmd-what { color: var(--text-2); }
.cmd-usage { display: inline-block; margin-top: 4px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 7px; border-radius: 5px; word-break: break-word; }
.cmd .badge { justify-self: end; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search-box { flex: 1; min-width: 220px; max-width: 420px; }
.toolbar .count { color: var(--muted); font-size: 13px; margin-left: auto; }
.group-head { display: flex; align-items: center; gap: 10px; }
.group-head .emoji { font-size: 18px; }

/* --- overview ---------------------------------------------------------------------- */

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: 8px; }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  min-width: 0;
}
.tile-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.tile-label .icon { width: 14px; height: 14px; }
.tile-value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-density="compact"] .tile-value { font-size: 20px; margin-top: 2px; }
.tile-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub .ok { color: var(--ok); }

.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: var(--gap); }
.feature {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 14px 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  min-width: 0;
  transition: border-color .15s;
}
.feature:hover { border-color: var(--line-2); }
.feature-top { display: flex; align-items: center; gap: 12px; }
.feature-top .emoji { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-3); font-size: 18px; flex: none; }
.feature-top a { color: var(--text); font-weight: 650; }
.feature-top .meta { display: block; color: var(--muted); font-size: 12.5px; }
.feature-top .grow { flex: 1; min-width: 0; }
.feature-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.feature.is-off .feature-top .emoji { filter: grayscale(1); opacity: .6; }
.feature .no-switch { font-size: 12.5px; color: var(--faint); }
.open-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 550; }
.open-link .icon { width: 13px; height: 13px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--gap); align-items: start; margin-top: 28px; }
.two-col .card { margin-bottom: 0; }

.changes { list-style: none; margin: 0; padding: 0; }
.change { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 11px var(--pad-card); border-top: 1px solid var(--line); align-items: start; }
.change:first-child { border-top: 0; }
.change .avatar { width: 28px; height: 28px; margin-top: 1px; }
.change-line { color: var(--text-2); }
.change-line b { color: var(--text); font-weight: 600; }
.change-diff { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; }
.change-time { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.val { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.val.old { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.val.none { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); font-style: italic; }
.arrow { color: var(--faint); }
.empty { padding: 32px var(--pad-card); text-align: center; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; color: var(--faint); margin-bottom: 8px; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }

.restart-body { display: grid; gap: 14px; }
.restart-body p { color: var(--text-2); }
.warn-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.warn-list li { display: grid; grid-template-columns: 16px 1fr; gap: 9px; color: var(--text-2); font-size: 13.5px; }
.warn-list .icon { color: var(--warn); width: 15px; height: 15px; margin-top: 2px; }

/* --- reminders ---------------------------------------------------------------------- */

.reminders { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--gap); }
.reminder {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  min-width: 0;
  transition: border-color .15s, transform .15s;
}
.reminder:hover { border-color: var(--line-2); }
.reminder-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 10px 16px; }
.reminder-head h3 { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.reminder-head .grow { flex: 1; min-width: 0; }
.reminder-head .sub { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.reminder-facts { list-style: none; margin: 0; padding: 0 16px 12px; display: grid; gap: 7px; }
.reminder-facts li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; align-items: center; color: var(--text-2); font-size: 13.5px; }
.reminder-facts li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-facts .icon { color: var(--faint); width: 15px; height: 15px; }
.reminder-quote { margin: 0 16px 14px; padding: 8px 11px; border-left: 3px solid var(--line-2); background: var(--surface-2); border-radius: 0 7px 7px 0; color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-inline { font-family: var(--mono); font-size: .9em; color: var(--accent-text); }
.reminder-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.reminder-foot .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder.is-off { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.reminder.is-off h3, .reminder.is-off .reminder-facts, .reminder.is-off .reminder-quote { opacity: .62; }
.new-card {
  display: grid; place-items: center; align-content: center; gap: 8px;
  min-height: 200px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--muted); font-weight: 550;
}
.new-card:hover { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-soft); }
.new-card .icon { width: 22px; height: 22px; }

/* drawer */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(4, 6, 10, .55); animation: fade .15s ease-out; }
[data-theme="light"] .scrim { background: rgba(20, 24, 36, .32); }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 55;
  width: min(640px, 100%);
  display: flex; flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  animation: slide .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.drawer-head h2 { font-size: 17px; }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head .sub { color: var(--muted); font-size: 12.5px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; display: grid; gap: 14px; align-content: start; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.drawer-foot .grow { flex: 1; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 14px; }
.form-card > h3 { font-size: 13px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.form-card > h3 .icon { width: 15px; height: 15px; }
.form-card > h3 .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.lines { display: grid; gap: 8px; }
.line-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.line-n { font-size: 12px; color: var(--faint); text-align: right; padding-top: 9px; font-variant-numeric: tabular-nums; }
.line-row .textarea { min-height: 38px; height: 38px; }
.line-tools { display: flex; gap: 2px; padding-top: 3px; }
.line-count { font-size: 11.5px; color: var(--faint); text-align: right; margin-top: 2px; }
.line-count.over { color: var(--danger); }
.placeholders { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }
.ph { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); }
.ph:hover { border-color: var(--accent-line); color: var(--accent-text); }
.times { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.time-add { display: flex; gap: 6px; }
.time-add .input { width: 128px; }

.preview {
  border-radius: 10px;
  background: #313338;
  color: #dbdee1;
  padding: 14px 16px;
  font-family: "gg sans", "Noto Sans", var(--font);
  border: 1px solid #1e1f22;
}
[data-theme="light"] .preview { background: #ffffff; color: #313338; border-color: var(--line); }
.msg { display: grid; grid-template-columns: 40px 1fr; gap: 14px; }
.msg + .msg { margin-top: 14px; }
.msg .brand-mark { width: 40px; height: 40px; border-radius: 50%; font-size: 18px; box-shadow: none; }
.msg-head { display: flex; align-items: center; gap: 6px; line-height: 1.3; }
.msg-head b { color: #f2f3f5; font-weight: 600; }
[data-theme="light"] .msg-head b { color: #060607; }
.msg-bot { background: #5865f2; color: white; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.msg-time { color: #949ba4; font-size: 12px; margin-left: 2px; }
.msg-text { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
[data-theme="light"] .mention { background: rgba(88, 101, 242, .15); color: #505cdc; }
.preview-tools { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.preview-tools .grow { flex: 1; }
.next-note { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.next-note .icon { color: var(--accent-text); width: 15px; height: 15px; }

/* --- activity ------------------------------------------------------------------------ */

.log { width: 100%; border-collapse: collapse; }
.log th { text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.log tr:first-child td { border-top: 0; }
.log th:first-child, .log td:first-child { padding-left: var(--pad-card); }
.log .when { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.log .when small { display: block; color: var(--faint); font-size: 12px; }
.log .who { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 550; }
.log .what b { font-weight: 600; }
.log .what small { display: block; color: var(--muted); font-size: 12.5px; }
.log .diff { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .select { width: auto; min-width: 180px; }

/* --- settings page ----------------------------------------------------------------- */

.pref { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: var(--pad-row) var(--pad-card); border-top: 1px solid var(--line); }
.pref:first-child { border-top: 0; }
.pref b { display: block; font-weight: 600; }
.pref span.help { color: var(--muted); font-size: 13px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background-clip: padding-box; position: relative; padding: 0; display: grid; place-items: center; color: #0c0e16; }
.swatch::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--sw); }
.swatch[aria-checked="true"] { border-color: var(--sw); }
.swatch .icon { position: relative; width: 14px; height: 14px; opacity: 0; }
.swatch[aria-checked="true"] .icon { opacity: 1; }
.pins { list-style: none; margin: 0; padding: 0; }
.pins li { display: flex; align-items: center; gap: 10px; padding: 8px var(--pad-card); border-top: 1px solid var(--line); }
.pins li:first-child { border-top: 0; }
.pins .emoji { width: 22px; text-align: center; }
.pins .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; padding: var(--pad-card); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* --- popovers, dialogs, toasts ----------------------------------------------------- */

.popover {
  position: fixed; z-index: 80;
  width: 320px; max-width: calc(100vw - 16px);
  display: flex; flex-direction: column;
  max-height: 380px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.popover .search-box { margin: 8px; height: 34px; background: var(--surface-2); }
.pop-list { overflow-y: auto; padding: 0 6px 6px; }
.pop-group { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); position: sticky; top: 0; background: var(--surface); }
.pop-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; text-align: left; color: var(--text-2); min-height: 32px; }
.pop-item[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.pop-item .glyph { color: var(--muted); width: 14px; text-align: center; font-weight: 600; }
.pop-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item small { color: var(--faint); }
.pop-item .check-mark { color: var(--accent-text); }
.pop-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }

.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.modal-wrap .scrim { z-index: auto; position: absolute; }
.modal {
  position: relative;
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: pop .15s ease-out;
}
.modal-body { padding: 22px 22px 8px; display: grid; gap: 10px; }
.modal-body h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.modal-body h2 .icon { width: 20px; height: 20px; }
.modal-body h2 .icon.danger { color: var(--danger); }
.modal-body h2 .icon.warn { color: var(--warn); }
.modal-body > p, .modal-body .body { color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 12px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: rise-t .18s ease-out;
}
@keyframes rise-t { from { transform: translateY(8px); opacity: 0; } }
.toast .icon { width: 18px; height: 18px; }
.toast.ok .icon { color: var(--ok); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line-2)); }
.toast.error .icon { color: var(--danger); }
.toast.info .icon { color: var(--accent-text); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .2s; }

.restarting { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.restarting .modal { text-align: center; padding: 30px 26px; display: grid; gap: 12px; justify-items: center; }
.restarting .spinner { width: 28px; height: 28px; border-width: 3px; }
.restarting p { color: var(--muted); }

/* --- responsive -------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { z-index: 60; position: fixed; left: 0; top: 0; bottom: 0; width: min(292px, 86vw); transform: translateX(-102%); transition: transform .22s cubic-bezier(.2,.8,.3,1); box-shadow: var(--shadow); }
  .app.nav-open .sidebar { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; gap: 8px; }
  .content { padding: 20px 16px 110px; }
  .banner { margin: 12px 16px 0; }
  .field { grid-template-columns: minmax(0, 1fr); }
  .field-actions { justify-content: flex-start; }
  .savebar { left: 50%; transform: translateX(-50%); bottom: 14px; width: calc(100% - 24px); justify-content: flex-end; }
  .savebar p { margin-right: auto; }
  @keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }
  .pin-btn { opacity: 1; }
  .nav-item .pin-btn[aria-pressed="false"] { color: var(--line-2); }
  .userbtn .name, .userbtn > .icon { display: none; }
  .search kbd { display: none; }
}

@media (max-width: 640px) {
  .page-head { flex-wrap: wrap; }
  .page-head h1 { font-size: 21px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .feature-icon { width: 40px; height: 40px; font-size: 20px; }
  .tiles { gap: 10px; }
  .tile { padding: 12px; }
  .tile-value { font-size: 20px; }
  .features { grid-template-columns: minmax(0, 1fr); }
  .reminders { grid-template-columns: minmax(0, 1fr); }
  .cmd { grid-template-columns: minmax(0, 1fr) auto; }
  .cmd-body { grid-column: 1 / -1; grid-row: 2; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .line-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
  .line-n { display: none; }
  .line-tools { gap: 0; }
  .line-tools .btn.sm.icon-only { width: 26px; }
  .form-card { padding: 14px 12px; }
  .weight-row { grid-template-columns: minmax(0, 1fr) 54px 44px 28px; }
  .weight-row .range { grid-column: 1 / -1; grid-row: 2; }
  .log thead { display: none; }
  .log, .log tbody, .log tr, .log td { display: block; width: 100%; }
  .log tr { border-top: 1px solid var(--line); padding: 10px var(--pad-card); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .log tr:first-child { border-top: 0; }
  .log td { border: 0; padding: 0 !important; }
  .log td.when { grid-column: 2; grid-row: 1; text-align: right; }
  .log td.who { grid-column: 1; grid-row: 1; }
  .log td.what, .log td.change-cell { grid-column: 1 / -1; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .drawer-body { padding: 14px 12px 24px; }
  .drawer-head, .drawer-foot { padding-left: 14px; padding-right: 14px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
  .popover.sheet { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-width: none; max-height: 70vh; }
  .filters .select { flex: 1; min-width: 0; }
  .pref { grid-template-columns: minmax(0, 1fr); }
}


/* --- chart palette (validated: dataviz reference order, light and dark steps) ------ */

:root {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}
[data-theme="light"] {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}

.nav-live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); margin-right: 6px; }
.link-banner { text-decoration: none !important; color: var(--text); }
.link-banner:hover { border-color: var(--accent); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.label-row .label { margin: 0; }
.hint-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.range-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.pad-sm { padding: 14px var(--pad-card) 16px; }
.muted { color: var(--faint); }
.modal.wide { width: min(780px, 100%); }
.modal.wide .modal-body { max-height: min(70vh, 640px); overflow-y: auto; }

/* auto-responses */
.master {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-bottom: 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
}
.master b { display: block; font-size: 15px; }
.master p { color: var(--muted); font-size: 13px; }
.master .grow { flex: 1; min-width: 0; }
.master-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.master-icon .icon { width: 18px; height: 18px; }
.master.is-on { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.master.is-on .master-icon { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.master.is-off { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.master.is-off .master-icon { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.triggers { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 16px 12px; }
.trigger { font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-line); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trigger.mono { font-family: var(--mono); font-size: 12px; }
.trigger.more { background: transparent; color: var(--muted); border-color: var(--line-2); }
.rule.master-off:not(.is-off) h3, .rule.master-off:not(.is-off) .triggers { opacity: .75; }
.reaction-row { display: inline-flex !important; align-items: center; gap: 6px; }
.emoji-img { width: 18px; height: 18px; object-fit: contain; vertical-align: -3px; }
.emoji-text { font-size: 15px; line-height: 1; }
.chip-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 38px; padding: 4px 6px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2);
  cursor: text;
}
.chip-input:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip-input input { flex: 1; min-width: 150px; border: 0; outline: 0; background: transparent; height: 28px; padding: 0 4px; color: var(--text); }
.chip-input input::placeholder { color: var(--faint); }
.chip-input .chip { height: 26px; }
.chip-input.mono .chip-text { font-family: var(--mono); font-size: 12.5px; }
.ghost-chip { background: transparent; border-style: dashed; color: var(--muted); padding-right: 9px; }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mode {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; align-items: start;
  text-align: left; padding: 10px 12px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2);
}
.mode:hover { border-color: var(--faint); }
.mode b { display: block; font-weight: 600; font-size: 13.5px; }
.mode small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 1px; }
.mode code { display: block; margin-top: 5px; font-size: 11.5px; color: var(--faint); }
.mode-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); margin-top: 2px; }
.mode[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mode[aria-checked="true"] .mode-dot { border: 5px solid var(--accent); }
.msg-ref { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #949ba4; margin: -2px 0 3px; min-width: 0; }
.msg-ref .icon { width: 13px; height: 13px; transform: scaleX(-1); }
.msg-ref-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reactions { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.msg-reaction { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 8px; background: rgba(88, 101, 242, .18); border: 1px solid rgba(88, 101, 242, .6); font-size: 13px; }
.msg-reaction b { font-size: 12px; color: #c9cdfb; font-weight: 600; }
[data-theme="light"] .msg-reaction { background: rgba(88, 101, 242, .1); }
[data-theme="light"] .msg-reaction b { color: #505cdc; }
.preview .avatar { width: 40px; height: 40px; font-size: 16px; }
.tester-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 8px; }
.tester-result { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); font-size: 13.5px; }
.tester-result .icon { margin-top: 2px; }
.tester-result small { color: var(--muted); }
.tester-result.yes { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.tester-result.yes .icon, .tester-result.yes b { color: var(--ok); }
.tester-result.no .icon { color: var(--danger); }
.tester-result.maybe { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.tester-result.maybe .icon, .tester-result.maybe b { color: var(--warn); }
.tester-result.idle .icon { color: var(--faint); }

/* house cup */
.cup-toolbar { margin-top: -6px; }
.cup-toolbar .grow { flex: 1; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.live-pill .icon { width: 14px; height: 14px; }
.live-pill.paused { color: var(--muted); }
.live-pill.err { color: var(--danger); white-space: normal; }
.live-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
.cup-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; justify-content: center; }
.cup-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.cup-card {
  position: relative; overflow: hidden;
  padding: 16px 16px 14px;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--house) 55%, var(--line));
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--house) 38%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--house) 22%, var(--surface)), var(--surface) 75%);
  min-width: 0;
}
[data-theme="light"] .cup-card {
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--house) 20%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--house) 10%, #fff), #fff 75%);
}
.cup-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--house), var(--house-2)); }
.cup-top { display: flex; align-items: center; gap: 10px; }
.cup-top .grow { flex: 1; min-width: 0; }
.cup-top h3 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crest { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--house) 30%, var(--surface-3)); flex: none; }
.cup-members { display: block; font-size: 12px; color: var(--muted); }
.rank { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.rank .icon { width: 12px; height: 12px; }
.rank.first { background: color-mix(in srgb, #e8b923 22%, transparent); border-color: color-mix(in srgb, #e8b923 60%, transparent); color: color-mix(in srgb, #e8b923 75%, var(--text)); }
.cup-total { font-size: 34px; font-weight: 700; letter-spacing: -.03em; margin-top: 12px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cup-total small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.cup-total.bump { animation: bump .9s ease-out; }
@keyframes bump { 0% { color: var(--ok); transform: translateY(-2px); } 100% { color: var(--text); transform: none; } }
.cup-gap { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.cup-captain { display: flex; align-items: center; gap: 7px; margin-top: 12px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--house) 25%, var(--line)); font-size: 13px; min-width: 0; }
.cup-captain span { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cup-captain small { color: var(--muted); margin-left: auto; }
.card.share { padding: 14px var(--pad-card) 16px; }
.share-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.share-head h2 { font-size: 15px; }
.share-head .sub { color: var(--muted); font-size: 13px; }
.share-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.share-bar span { background: var(--house); min-width: 2px; }
.share-labels { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.share-label { display: inline-flex; align-items: center; gap: 7px; }
.share-label i { width: 10px; height: 10px; border-radius: 3px; background: var(--house); }
.share-label b { color: var(--text); font-variant-numeric: tabular-nums; }
.cup-cols { margin-top: 0; margin-bottom: var(--gap); grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 14px; font-size: 12.5px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; }
.stack-chart { display: grid; gap: 12px; }
.stack-row { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 12px; align-items: center; }
.stack-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stack-track { display: flex; gap: 2px; height: 22px; min-width: 0; }
.stack-seg { min-width: 3px; height: 100%; outline-offset: 1px; }
.stack-seg:first-child { border-radius: 0; }
.stack-seg:last-child { border-radius: 0 4px 4px 0; }
.stack-seg:hover { filter: brightness(1.12); }
.stack-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viz-tip { position: fixed; z-index: 120; pointer-events: none; background: #05060a; color: #eef0f5; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow); max-width: 260px; }
[data-theme="light"] .viz-tip { background: #1b1f2a; }
.viz-tip b { display: block; margin-bottom: 2px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table td { padding: 6px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.mini-table tr:first-child td { border-top: 0; }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table tr.total td { font-weight: 650; border-top: 1px solid var(--line-2); }
.mini-table.heat td.num { background: color-mix(in srgb, var(--s1) calc(var(--heat, 0%) * .4), transparent); }
.card#cup-today .card-body, .card .card-body > .mini-table { }
#card-cup-today { padding: 6px 10px 10px; }
.th-crest { font-size: 16px; }
.scorer-tabs { padding: 12px var(--pad-card) 0; }
.scorers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.scorer-col { padding: 12px 14px 14px; border-left: 1px solid var(--line); min-width: 0; }
.scorer-col:first-child { border-left: 0; }
.scorer-col h3 { display: flex; align-items: center; gap: 7px; font-size: 13.5px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 2px solid var(--house); }
.scorer-col ol { list-style: none; margin: 0; padding: 0; }
.scorer-col li { display: grid; grid-template-columns: 18px 18px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 5px 0; font-size: 13px; }
.scorer-col .pos { color: var(--faint); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.scorer-col .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorer-col .src { font-size: 13px; }
.scorer-col b { font-variant-numeric: tabular-nums; font-weight: 650; }
.scorer-col li:nth-child(-n+3) .pos { color: var(--text); font-weight: 700; }
.empty-small { color: var(--muted); font-size: 13px; padding: 10px 0; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 620px; overflow-y: auto; }
.feed-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px var(--pad-card); border-top: 1px solid var(--line); }
.feed-row:first-child { border-top: 0; }
.feed-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: color-mix(in srgb, var(--src, var(--faint)) 18%, var(--surface-2)); box-shadow: inset 3px 0 0 var(--src, var(--line-2)); }
.feed-main { min-width: 0; }
.feed-main > div { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.feed-main b { font-weight: 600; }
.feed-main small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.feed-src { color: var(--muted); font-size: 12.5px; }
.house-chip { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--house) 22%, transparent); border: 1px solid color-mix(in srgb, var(--house) 55%, transparent); color: var(--text); white-space: nowrap; }
.feed-side { text-align: right; }
.feed-side small { display: block; color: var(--faint); font-size: 12px; white-space: nowrap; }
.pts { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ok); }
.pts.neg { color: var(--danger); }

/* bot behaviour */
.reads { margin-top: 12px; color: var(--muted); font-size: 13px; }
.reads q { color: var(--text-2); font-style: italic; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.preset { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font); font-size: 12.5px; padding: 4px 9px; border-radius: 99px; }
.preset .icon { width: 12px; height: 12px; }
.prompt-editor { min-height: 300px; font-size: 14px; line-height: 1.6; padding: 12px 14px; resize: vertical; }
[data-density="compact"] .prompt-editor { min-height: 240px; }
.editor-foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.editor-foot .grow { flex: 1; }
.text-count { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.text-count.edited { color: var(--accent-text); }
.chatty .label-row { align-items: center; }
.chatty-title { font-size: 18px; letter-spacing: -.01em; }
.chatty .range { margin-top: 14px; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.review { display: grid; gap: 16px; }
.review-item h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.diff { border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; max-height: 320px; overflow-y: auto; }
.diff-line { display: grid; grid-template-columns: 22px minmax(0, 1fr); white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-line span:last-child { padding-right: 10px; }
.diff-mark { text-align: center; color: var(--faint); user-select: none; }
.diff-line.add { background: color-mix(in srgb, var(--ok) 13%, transparent); }
.diff-line.add .diff-mark { color: var(--ok); }
.diff-line.del { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.diff-line.del .diff-mark { color: var(--danger); }
.diff-line.same { color: var(--muted); }
.diff-skip { padding: 2px 10px; font-size: 11.5px; color: var(--faint); background: var(--surface-2); font-family: var(--font); }

@media (max-width: 1080px) {
  .cup-cols { grid-template-columns: minmax(0, 1fr); }
  .cup-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scorers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scorer-col:nth-child(3) { border-left: 0; }
  .scorer-col:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .scorers { grid-template-columns: minmax(0, 1fr); }
  .scorer-col { display: none; border: 0 !important; }
  .scorer-col.shown { display: block; }
  .scorer-col h3 { display: none; }
  .scorer-tabs .segmented { width: 100%; }
}
@media (max-width: 640px) {
  .cup-cards { gap: 10px; }
  .cup-card { padding: 12px; }
  .crest { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
  .cup-total { font-size: 26px; margin-top: 8px; }
  .cup-members, .cup-captain small { display: none; }
  .cup-top { flex-wrap: wrap; row-gap: 6px; gap: 8px; }
  .cup-top .grow { flex: 1 0 calc(100% - 40px); }
  .cup-top .rank { font-size: 11px; padding: 1px 6px; margin-left: 40px; order: 3; }
  .cup-gap { font-size: 12px; }
  .cup-captain { margin-top: 8px; padding-top: 8px; font-size: 12px; }
  .stack-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .modes { grid-template-columns: minmax(0, 1fr); }
  .tester-row { grid-template-columns: minmax(0, 1fr); }
  .master { flex-wrap: wrap; }
  .feed-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px; }
  .feed-icon { width: 28px; height: 28px; }
  .prompt-editor { min-height: 240px; font-size: 13.5px; }
  .cup-toolbar .segmented { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .cup-toolbar .segmented button { flex: 1 0 auto; padding: 0 10px; white-space: nowrap; }
  .cup-toolbar .grow { display: none; }
}


/* --- tabs, scorers ---------------------------------------------------------------- */

.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; overflow-x: auto; scrollbar-width: none; }
.page-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px 10px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.page-tabs a:hover { color: var(--text); text-decoration: none; }
.page-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.page-tabs .icon { width: 15px; height: 15px; }
.scorers-toolbar .select { width: auto; min-width: 150px; }
.scorers-toolbar .search-box { max-width: 240px; min-width: 160px; }
.scorers-toolbar .grow { flex: 1; }
.act-legend-wrap { margin: -4px 0 14px; }
.act-legend-wrap summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; width: max-content; }
.act-legend-wrap[open] summary { margin-bottom: 8px; }
.act-legend-wrap:not([open]) summary { margin-bottom: 0; }
.act-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; font-size: 12.5px; color: var(--muted); align-items: center; }
.act-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.act {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 8px 2px 6px;
  border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface-2);
  font-size: 12.5px; font-weight: 550; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.act-icon { font-size: 13px; line-height: 1; }
.act-text { display: inline-flex; align-items: center; gap: 3px; }
.act-text .icon { width: 12px; height: 12px; }
.act-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: color-mix(in srgb, var(--line-2) 70%, transparent); }
.act-bar i { display: block; height: 100%; background: var(--accent); }
.act.zero { color: var(--faint); background: transparent; border-style: dashed; }
.act.zero .act-icon { filter: grayscale(1); opacity: .55; }
.act.zero .act-bar { display: none; }
.act.reached { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }
.act.reached .act-bar { display: none; }
.act.extra { border-color: color-mix(in srgb, #e8b923 50%, transparent); background: color-mix(in srgb, #e8b923 10%, var(--surface)); }
.scorers-card { overflow: hidden; }
.scorers-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px var(--pad-card); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.scorers-head b { color: var(--text); font-size: 14px; }
.scorers-head .open-link { margin-left: auto; }
.scorer-list { list-style: none; margin: 0; padding: 0; }
.scorer-row { display: grid; grid-template-columns: 34px minmax(170px, 230px) 64px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px var(--pad-card); border-top: 1px solid var(--line); position: relative; }
.scorer-row:first-child { border-top: 0; }
.scorer-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--house, transparent); opacity: .85; }
.sr-rank { text-align: right; color: var(--faint); font-weight: 650; font-variant-numeric: tabular-nums; }
.scorer-row:nth-child(-n+3) .sr-rank { color: var(--text); }
.sr-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sr-who .avatar.lg { width: 34px; height: 34px; }
.sr-name { display: block; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-who .house-chip { display: inline-block; margin-top: 2px; }
.sr-total { text-align: right; line-height: 1.15; }
.sr-total b { font-size: 18px; font-variant-numeric: tabular-nums; }
.sr-total small { display: block; font-size: 11.5px; color: var(--muted); }
.sr-acts { display: flex; flex-wrap: wrap; gap: 5px; }
.sr-acts.wide { gap: 7px; }
.sr-acts.wide .act { height: 30px; font-size: 13px; padding: 0 10px 2px 8px; }

/* --- members ------------------------------------------------------------------------- */

.search-box.big { height: 46px; font-size: 15px; border-radius: 12px; padding: 0 14px; }
.search-box.big .icon { width: 18px; height: 18px; }
.member-search { position: relative; max-width: 640px; }
.member-results { list-style: none; margin: 8px 0 0; padding: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.member-hit { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 9px; color: var(--text); text-decoration: none !important; }
.member-hit:hover, .member-hit:focus-visible { background: var(--hover); }
.member-hit .grow { flex: 1; min-width: 0; }
.member-hit b { display: block; font-weight: 600; }
.member-hit small { color: var(--muted); }
.member-hit > .icon { color: var(--faint); }
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--gap); }
.note-card { display: grid; gap: 10px; align-content: start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text); text-decoration: none !important; }
.note-card:hover { border-color: var(--line-2); }
.note-card p { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-card.is-off { opacity: .75; }
.note-card-top { display: flex; align-items: center; gap: 10px; }
.note-card-top .grow { flex: 1; min-width: 0; }
.note-card-top b { display: block; }
.note-card-top small { color: var(--muted); font-size: 12px; }
.note-card .badge.paused { justify-self: start; }
.badge.tone-roast { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge.tone-light_roast { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.tone-gentle { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin: -8px 0 12px; }
.back-link .icon { width: 14px; height: 14px; }
.avatar.xl { width: 72px; height: 72px; font-size: 28px; border-radius: 20px; }
.profile-head { display: flex; gap: 18px; align-items: flex-start; padding: 20px var(--pad-card); position: relative; overflow: hidden;
  background: linear-gradient(120deg, color-mix(in srgb, var(--house, var(--accent)) 16%, var(--surface)), var(--surface) 55%); }
.profile-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--house, var(--accent)); }
.profile-head .grow { flex: 1; min-width: 0; }
.profile-head h1 { font-size: 24px; }
.profile-sub { color: var(--muted); display: flex; gap: 10px; align-items: baseline; margin-top: 1px; }
.profile-dates { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.profile-dates span { display: inline-flex; align-items: center; gap: 6px; }
.profile-dates .icon { width: 14px; height: 14px; color: var(--faint); }
.role-chips { margin-top: 12px; }
.role-chip { height: 24px; font-size: 12.5px; padding: 0 9px 0 8px; }
.house-chip.big { font-size: 13px; padding: 3px 10px; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--gap); align-items: start; }
.profile-side { position: sticky; top: calc(var(--topbar) + 16px); }
.profile-main .page-tabs { margin-top: 0; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-row.five { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 0; }
.stat-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }
.stat { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.stat-label { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat b { display: block; font-size: 20px; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.stat small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.hbars li { display: grid; grid-template-columns: 140px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.hbars.compact li { grid-template-columns: 110px minmax(0, 1fr) 40px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hb-track { height: 8px; border-radius: 0 4px 4px 0; background: var(--surface-3); overflow: hidden; }
.hb-track i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.hbars b { text-align: right; font-variant-numeric: tabular-nums; }
.two-mini { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 18px; }
.mini-title { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 10px; }
.mini-title span { color: var(--muted); font-weight: 500; }
.hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; height: 72px; align-items: end; }
.hour { display: block; height: var(--v); background: color-mix(in srgb, var(--s1) 45%, var(--surface-3)); border-radius: 3px 3px 0 0; min-height: 2px; }
.hour.peak { background: var(--s1); }
.hour:hover { filter: brightness(1.2); }
.seen, .memories { list-style: none; margin: 0; padding: 0; }
.seen li, .memories li { padding: 12px var(--pad-card); border-top: 1px solid var(--line); }
.seen li:first-child, .memories li:first-child { border-top: 0; }
.seen-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.seen-meta .grow { flex: 1; }
.seen-meta small { color: var(--faint); font-size: 12px; }
.seen-text { margin-top: 6px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.seen-text mark, .memory-full mark { background: color-mix(in srgb, #e8b923 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.memory-title { font-size: 14px; }
.memory-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.memory-foot small { color: var(--faint); }
.memory-full { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; font-size: 13px; color: var(--text-2); max-height: 360px; overflow-y: auto; }
.notes-card { border-color: var(--accent-line); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow-sm); }
.notes-card .card-head .sub { display: flex; align-items: center; gap: 4px; }
.notes-card .card-head .sub .icon { width: 13px; height: 13px; }
.notes-body { display: grid; gap: 16px; }
.tones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tone { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 7px; align-items: start; padding: 8px 9px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); text-align: left; }
.tone:hover { border-color: var(--faint); }
.tone b { display: block; font-size: 13px; font-weight: 600; }
.tone small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.tone-icon { font-size: 15px; line-height: 1.3; }
.tone[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.text-count.over { color: var(--danger); }
.ai-preview { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); max-height: 220px; overflow-y: auto; }
.ai-preview.empty-preview { color: var(--faint); font-family: var(--font); font-style: italic; }
.notes-status { font-size: 12.5px; color: var(--muted); min-height: 20px; }
.notes-actions { display: flex; gap: 8px; align-items: center; margin-top: -6px; }
.notes-actions .grow { flex: 1; }

@media (max-width: 1180px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr) 330px; }
  .stat-row.five { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .tones { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-side { position: static; order: -1; }
  .tones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scorer-row { grid-template-columns: 28px minmax(0, 1fr) 56px; }
  .sr-acts { grid-column: 2 / -1; }
}
@media (max-width: 640px) {
  .profile-head { flex-direction: column; gap: 12px; padding: 16px; }
  .avatar.xl { width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
  .profile-head h1 { font-size: 21px; }
  .stat-row, .stat-row.five, .stat-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-mini { grid-template-columns: minmax(0, 1fr); }
  .hbars li { grid-template-columns: 110px minmax(0, 1fr) 40px; }
  .tones { grid-template-columns: minmax(0, 1fr); }
  .scorer-row { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px 10px; padding: 10px 12px; }
  .sr-acts { grid-column: 1 / -1; padding-left: 32px; }
  .scorers-toolbar .segmented { width: 100%; }
  .scorers-toolbar .segmented button { flex: 1; }
  .scorers-toolbar .select, .scorers-toolbar .search-box { flex: 1 1 40%; max-width: none; min-width: 0; }
  .scorers-toolbar .grow { display: none; }
  .act-legend { gap: 6px 14px; }
}


/* --- most active + analyses ------------------------------------------------------------ */

.active-wrap .section-title { margin-top: 0; }
.active-card { overflow: hidden; }
.active-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px var(--pad-card); border-bottom: 1px solid var(--line); }
.active-toolbar .grow { flex: 1; }
.active-explain { display: flex; gap: 8px; align-items: flex-start; padding: 10px var(--pad-card); font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.active-explain .icon { width: 14px; height: 14px; margin-top: 2px; color: var(--faint); }
.active-explain b { color: var(--text-2); }
.active-head, .active-row { display: grid; grid-template-columns: 22px 26px minmax(160px, 1.4fr) repeat(3, minmax(90px, 1fr)) 108px; gap: 12px; align-items: center; padding: 0 var(--pad-card); }
.active-head { padding-top: 8px; padding-bottom: 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line); }
.active-head span { display: inline-flex; align-items: center; gap: 6px; }
.active-head i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.active-list { list-style: none; margin: 0; padding: 0; }
.active-row { padding-top: 9px; padding-bottom: 9px; border-top: 1px solid var(--line); }
.active-row:first-child { border-top: 0; }
.active-check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.active-row .sr-who .avatar.lg { width: 32px; height: 32px; }
.active-tags { display: flex; gap: 5px; margin-top: 2px; flex-wrap: wrap; }
.metric { display: grid; gap: 4px; min-width: 0; font-size: 13px; }
.metric b { font-weight: 550; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.metric.sorted b { color: var(--text); font-weight: 650; }
.metric-bar { height: 6px; border-radius: 0 3px 3px 0; background: var(--surface-3); overflow: hidden; }
.metric-bar i { display: block; height: 100%; border-radius: 0 3px 3px 0; }
.active-status { justify-self: end; }
.analysis-chip { text-decoration: none !important; }
.more-row { display: flex; justify-content: center; padding: 8px; border-top: 1px solid var(--line); }
.job { margin: 12px var(--pad-card); padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); }
.job.running { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.job-head { display: flex; align-items: center; gap: 10px; }
.job-head .grow { flex: 1; min-width: 0; }
.job-head b { display: block; font-size: 13.5px; }
.job-head small { color: var(--muted); font-size: 12.5px; }
.job-head > .icon { color: var(--ok); }
.job-bar { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 10px 0 8px; }
.job-bar i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.job-items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; max-height: 110px; overflow-y: auto; }
.job-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); }
.job-item a { color: var(--text-2); }
.job-item small { color: var(--faint); }
.job-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.job-item.running .job-dot { background: var(--accent); animation: pulse 1s infinite; }
.job-item.done .job-dot { background: var(--ok); }
.job-item.failed { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.job-item.failed .job-dot { background: var(--danger); }
.job-item.skipped .job-dot, .job-item.cancelled .job-dot { background: transparent; border: 1px solid var(--faint); }
.analysis-card .card-head { align-items: flex-start; }
.analysis-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.analysis-privacy { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); padding: 9px 12px; border-radius: 9px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.analysis-privacy .icon { color: var(--accent-text); width: 15px; height: 15px; }
.analysis-body { display: grid; gap: 14px; }
.analysis-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -4px 0 -4px; font-size: 13px; color: var(--muted); }
.analysis-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 6px; }
.afields { display: grid; gap: 12px; }
.afield { padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.afield.edited { border-color: var(--accent-line); }
.afield-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.afield-head .grow { flex: 1; }
.afield .textarea { background: var(--surface); min-height: 44px; resize: vertical; }
.afield .chip-input { background: var(--surface); }
.afield-count { text-align: right; margin-top: 2px; }
.afield-original { margin-top: 10px; padding: 10px 12px; border-radius: 8px; border: 1px dashed var(--line-2); background: var(--surface); display: grid; gap: 6px; justify-items: start; }
.afield-original p { color: var(--text-2); font-size: 13px; white-space: pre-wrap; }
.afield-original-label { font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.analysis-save { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.analysis-save .grow, .analysis-actions .grow { flex: 1; }
.analysis-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
.analysis-empty { display: grid; justify-items: center; gap: 10px; }
.analysis-empty p { max-width: 520px; }
.analysis-empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.apply-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.check.muted { opacity: .55; }
.prompt-preview { max-height: 52vh; font-size: 11.5px; }
.afield .segmented { flex-wrap: wrap; }

@media (max-width: 1180px) {
  .active-head, .active-row { grid-template-columns: 22px 24px minmax(140px, 1.3fr) repeat(3, minmax(70px, 1fr)) 96px; gap: 10px; }
}
@media (max-width: 900px) {
  .active-head { display: none; }
  .active-row { grid-template-columns: 22px 22px minmax(0, 1fr) auto; row-gap: 6px; }
  .active-row .metric { grid-row: 2; }
  .active-row .metric:nth-of-type(1) { grid-column: 3 / 4; }
  .active-row .active-status { grid-column: 4; grid-row: 1; }
  .active-row { grid-template-areas: none; }
}
@media (max-width: 640px) {
  .active-row { grid-template-columns: 20px minmax(0, 1fr) auto; padding: 10px 12px; }
  .active-row .sr-rank { display: none; }
  .active-row .metric { grid-row: auto; grid-column: 2 / -1 !important; grid-template-columns: 90px minmax(0, 1fr); align-items: center; }
  .active-toolbar .segmented { width: 100%; }
  .active-toolbar .segmented button { flex: 1; }
  .active-toolbar .grow { display: none; }
  .active-toolbar .btn { flex: 1; }
  .apply-fields { grid-template-columns: minmax(0, 1fr); }
  .analysis-card .card-head { flex-wrap: wrap; }
}


/* --- tiers, auto-filled notes -------------------------------------------------------------- */

.tier-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px var(--pad-card); border-bottom: 1px solid var(--line); }
.tier-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-weight: 550; font-size: 13px; }
.tier-chip b { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.tier-chip i { width: 8px; height: 8px; border-radius: 50%; }
.tier-chip[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.tier-chip[aria-checked="true"] b { color: var(--text); }
.tier-very i { background: var(--ok); }
.tier-fair i { background: var(--warn); }
.tier-less i { background: transparent; border: 1.5px solid var(--faint); }
.tier-rule { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.tier-rule .icon { width: 13px; height: 13px; }
.badge.tier-badge.tier-very { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.tier-badge.tier-fair { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.tier-badge.tier-less { color: var(--faint); border-style: dashed; }
.estimate { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.estimate .icon { color: var(--accent-text); width: 15px; height: 15px; }
.estimate small { color: var(--muted); }
.nav-badge { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px; background: var(--warn); color: #1b1300; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.auto-banner { display: flex; gap: 10px; align-items: flex-start; margin: 0 var(--pad-card); margin-top: 14px; padding: 11px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); font-size: 13px; }
.auto-banner > .icon { color: var(--warn); margin-top: 2px; }
.auto-banner .grow { flex: 1; min-width: 0; }
.auto-banner p { color: var(--text); }
.auto-banner-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.auto-banner-actions .open-link { white-space: nowrap; }
.ai-preview.off-preview { opacity: .5; }
.off-note { color: var(--warn) !important; }
.review-card { overflow: hidden; margin-bottom: 28px; border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.review-list { list-style: none; margin: 0; padding: 0; }
.review-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px var(--pad-card); border-top: 1px solid var(--line); }
.review-row:first-child { border-top: 0; }
.review-main { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); text-decoration: none !important; }
.review-main .grow { flex: 1; min-width: 0; }
.review-main p { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.review-main small { color: var(--faint); white-space: nowrap; }
.review-main > .icon { color: var(--faint); }
@media (max-width: 640px) {
  .tier-rule { margin-left: 0; }
  .review-main small { display: none; }
}


/* --- insights ------------------------------------------------------------------------------ */

.insight-counts { color: var(--muted); margin: -6px 0 14px; }
.insight-counts b { color: var(--text); }
.tidbits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.tidbit { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 14px; line-height: 1.5; }
button.tidbit:hover { border-color: var(--accent-line); }
.tidbit b { color: var(--text); font-weight: 650; }
.tidbit-emoji { font-size: 22px; line-height: 1.2; flex: none; }
.duo-list, .rank-list, .plain-list, .conn-list, .exchanges { list-style: none; margin: 0; padding: 0; }
.duo { width: 100%; display: grid; grid-template-columns: 28px minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(0, 1.1fr) 80px; gap: 12px; align-items: center; padding: 10px var(--pad-card); border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; color: var(--text); }
.duo-list li:first-child .duo { border-top: 0; }
.duo:hover { background: var(--hover); }
.duo-names { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.duo-names b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.duo-amp { color: var(--faint); }
.duo-amp.big { font-size: 22px; }
.duo-bar { display: grid; grid-template-columns: 26px minmax(0, 1fr) 26px; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.duo-bar small:first-child { text-align: right; }
.duo-bar small { color: var(--text-2); font-size: 12.5px; }
.duo-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }
.duo-last { text-align: right; color: var(--faint); font-size: 12px; }
.twoway { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; height: 10px; }
.tw-left, .tw-right { display: flex; background: var(--surface-3); overflow: hidden; }
.tw-left { justify-content: flex-end; border-radius: 4px 0 0 4px; }
.tw-right { border-radius: 0 4px 4px 0; }
.tw-left i { background: var(--s1); height: 100%; border-radius: 4px 0 0 4px; }
.tw-right i { background: var(--s2); height: 100%; border-radius: 0 4px 4px 0; }
.ins-cols { margin-top: 0; margin-bottom: var(--gap); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.talk-tabs { padding: 12px var(--pad-card) 4px; }
.talk-tabs .segmented { flex-wrap: wrap; }
.rank-list li { display: grid; grid-template-columns: 22px 18px minmax(80px, 1fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; padding: 7px var(--pad-card); font-size: 13.5px; }
.rank-list small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.who-link { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plain-list li { border-top: 1px solid var(--line); }
.plain-list li:first-child { border-top: 0; }
.line-btn { width: 100%; display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px var(--pad-card); border: 0; background: transparent; text-align: left; color: var(--text-2); }
.line-btn:hover { background: var(--hover); }
.line-btn b { color: var(--text); }
.line-btn small { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rival { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 1.1fr) minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px var(--pad-card); }
.rival-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rival-name.left { justify-content: flex-end; }
.rival-name b { font-variant-numeric: tabular-nums; }
.rival-bar { display: flex; gap: 2px; height: 10px; }
.rival-bar i { display: block; height: 100%; }
.rival-bar .l { background: var(--s1); border-radius: 4px 0 0 4px; }
.rival-bar .r { background: var(--s2); border-radius: 0 4px 4px 0; }
.ins-stack { display: grid; gap: var(--gap); align-content: start; }
.ins-stack .card { margin-bottom: 0; }
.owls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.owls > div + div { border-left: 1px solid var(--line); }
.owls .rank-list li { grid-template-columns: 18px 18px minmax(60px, 1fr) minmax(40px, .7fr) auto; gap: 8px; padding: 6px 14px; }
.data-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--muted); font-size: 13px; }
.data-note > .icon { margin-top: 2px; color: var(--faint); }
.data-note .grow { flex: 1; }
.rebuild-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.rebuild-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.pair-head { display: flex; align-items: center; justify-content: center; gap: 16px; }
.pair-person { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.pair-run { color: var(--text-2); }
.mirror { display: flex; gap: 2px; height: 140px; align-items: stretch; }
.mirror-col { flex: 1; display: grid; grid-template-rows: 1fr 1fr; gap: 2px; min-width: 2px; }
.mirror-up { display: flex; align-items: flex-end; border-bottom: 1px solid var(--line-2); }
.mirror-down { display: flex; align-items: flex-start; }
.mirror-up i, .mirror-down i { display: block; width: 100%; }
.mirror-up i { background: var(--s1); border-radius: 3px 3px 0 0; }
.mirror-down i { background: var(--s2); border-radius: 0 0 3px 3px; }
.mirror-col:hover i { filter: brightness(1.2); }
.exchanges li { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.exchanges li:first-child { border-top: 0; }
.exchanges small { color: var(--muted); }
.ex-ch { text-align: right; }
.conn { width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; gap: 12px; align-items: center; padding: 10px var(--pad-card); border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; color: var(--text); }
.conn-list li:first-child .conn { border-top: 0; }
.conn:hover { background: var(--hover); }
.conn > .icon { color: var(--faint); }
.conn-main { display: grid; gap: 4px; min-width: 0; }
.conn-bar { display: grid; grid-template-columns: 38px minmax(0, 260px) 38px; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.conn-bar small { color: var(--text-2); font-size: 12px; }
.conn-bar small:first-child { text-align: right; }
.conn-facts { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
@media (max-width: 1080px) {
  .tidbits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ins-cols { grid-template-columns: minmax(0, 1fr); }
  .duo { grid-template-columns: 24px minmax(0, 1fr) minmax(120px, .8fr) 64px; }
  .duo-meta { grid-column: 2 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  .tidbits { grid-template-columns: minmax(0, 1fr); }
  .duo { grid-template-columns: 20px minmax(0, 1fr) auto; padding: 10px 12px; }
  .duo-bar { grid-column: 2 / -1; grid-row: 2; }
  .duo-meta { grid-column: 2 / -1; grid-row: 3; }
  .duo-last { grid-column: 3; grid-row: 1; }
  .owls { grid-template-columns: minmax(0, 1fr); }
  .owls > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .rank-list li { grid-template-columns: 18px 18px minmax(0, 1fr) auto; }
  .rank-list .hb-track { display: none; }
  .rival { grid-template-columns: minmax(0, 1fr) 60px minmax(0, 1fr); padding: 9px 12px; }
  .exchanges li { grid-template-columns: 90px minmax(0, 1fr) auto; }
  .exchanges .ex-ch { display: none; }
  .conn-bar { grid-template-columns: 34px minmax(0, 1fr) 34px; }
}

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

/* --- reminders: scheduled posts and members' reminders ---------------------------------- */

.tab-count { font-size: 11.5px; font-weight: 650; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.tab-count.is-live { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.show-sm { display: none; }

button.new-card { font: inherit; width: 100%; cursor: pointer; }
.new-card small { font-weight: 400; font-size: 12.5px; color: var(--faint); }
.badge.kind { color: var(--text-2); }
.badge .swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.reminder-thumb { position: relative; flex: none; width: 46px; height: 46px; border-radius: 9px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: block; }
.reminder-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reminder-thumb span { position: absolute; right: 2px; bottom: 2px; font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 5px; background: rgba(0, 0, 0, .66); color: #fff; }
.reminder-quote.ai { border-left-color: var(--accent); }
.reminder-quote.ai .icon { width: 12px; height: 12px; color: var(--accent-text); vertical-align: -1px; }

/* the Discord preview: pictures and cards */
.msg-attach { margin-top: 6px; }
.post-img { display: block; max-width: min(100%, 400px); max-height: 300px; border-radius: 8px; object-fit: contain; background: rgba(0, 0, 0, .15); }
.embed { margin-top: 4px; max-width: 432px; background: #2b2d31; border-left: 4px solid var(--embed, #8b93ff); border-radius: 4px; padding: 8px 16px 14px 12px; display: grid; gap: 6px; }
[data-theme="light"] .embed { background: #f2f3f5; }
.embed-title { font-weight: 600; font-size: 15.5px; color: #f2f3f5; line-height: 1.35; overflow-wrap: anywhere; margin-top: 2px; }
[data-theme="light"] .embed-title { color: #060607; }
.embed-desc { font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; color: #dbdee1; }
[data-theme="light"] .embed-desc { color: #313338; }
.embed-image { margin-top: 8px; }
.embed-image .post-img { max-width: 100%; border-radius: 4px; }
.embed-footer { font-size: 12px; color: #949ba4; margin-top: 2px; }
[data-theme="light"] .embed-footer { color: #5c5e66; }

/* picture section and library */
.pic-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.pic { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: var(--surface-2); }
.pic-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic-n { position: absolute; left: 5px; top: 5px; font-size: 11px; font-weight: 700; min-width: 18px; text-align: center; padding: 0 4px; border-radius: 6px; background: rgba(0, 0, 0, .62); color: #fff; }
.pic-x { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border: 0; border-radius: 7px; display: grid; place-items: center; background: rgba(0, 0, 0, .62); color: #fff; cursor: pointer; }
.pic-x:hover { background: var(--danger); }
.pic-x .icon { width: 13px; height: 13px; }
.pic-tools { display: flex; gap: 8px; align-items: stretch; }
.pic-tools .btn { height: auto; }
.dropzone { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px dashed var(--line-2); border-radius: var(--r); background: transparent; color: var(--text-2); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone .icon { width: 20px; height: 20px; flex: none; color: var(--accent-text); }
.dropzone b { display: block; font-weight: 600; }
.dropzone small { display: block; color: var(--muted); font-size: 12.5px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lib-tile { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); min-width: 0; }
.lib-tile.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.lib-pick { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: var(--surface-2); cursor: pointer; }
.lib-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-check { position: absolute; right: 6px; top: 6px; display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px 2px 4px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; }
.lib-check .icon { width: 12px; height: 12px; }
.lib-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 4px; padding: 6px 4px 6px 9px; align-items: center; }
.lib-name { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta small { grid-column: 1; color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta .btn { grid-column: 2; grid-row: 1 / span 2; }

/* style and extras */
.colour-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.colour-pick { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; }
.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.swatch-btn { width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); cursor: pointer; padding: 0; }
.swatch-btn.is-on { border-color: var(--text); }
.ai-block { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 10px; background: var(--surface-2); }
.ai-block.is-on { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.ai-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.ai-label .icon { width: 14px; height: 14px; color: var(--accent-text); }
.ai-edit { display: grid; gap: 4px; padding-left: 26px; }
.ai-out { flex: 1; min-width: 0; color: var(--muted); font-size: 12.5px; }
.ai-wait { display: inline-flex; align-items: center; gap: 8px; }

/* templates */
.tpl-list { display: grid; gap: 8px; }
.tpl { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.tpl:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.tpl .grow { flex: 1; min-width: 0; display: grid; gap: 3px; }
.tpl b { font-weight: 600; }
.tpl small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.tpl-icon { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-size: 19px; }
.tpl-icon .icon { width: 18px; height: 18px; color: var(--muted); }
.tpl-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }

/* members' reminders */
.memo-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text-2); font-size: 13.5px; }
.memo-note .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent-text); }
.memo-note p { margin: 0; }
.memo-note code { font-size: 12.5px; }
.memo-note.is-off { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.memo-note.is-off .icon { color: var(--warn); }
.memo-list { padding: 0; overflow: hidden; }
.memo-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 190px 96px; gap: 14px; align-items: start; padding: 14px var(--pad-card, 16px); border-top: 1px solid var(--line); }
.memo-row:first-child { border-top: 0; }
.memo-avatar { display: block; line-height: 0; }
.memo-who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.memo-who > a, .memo-who > b { font-weight: 600; color: var(--text); }
.memo-by { color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.memo-by .inline-ref { font-weight: 500; color: var(--text-2); }
.memo-text { margin: 3px 0 7px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.memo-text.private { color: var(--muted); font-style: italic; }
.memo-text.private .icon { width: 14px; height: 14px; vertical-align: -2px; }
.memo-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--muted); font-size: 12.5px; }
.memo-fact { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.memo-fact .icon { width: 13px; height: 13px; color: var(--faint); }
.memo-when { display: grid; gap: 2px; font-size: 13.5px; padding-top: 1px; }
.memo-when b { font-weight: 600; font-variant-numeric: tabular-nums; }
.memo-when small { color: var(--muted); font-size: 12.5px; }
.memo-actions { display: flex; justify-content: flex-end; }
.memo-row.is-cancelled .memo-text, .memo-row.is-cancelled .memo-who { opacity: .6; }
.badge.waiting { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.badge.failed { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.quick-when { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.when-note.ok { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--text-2); }
.when-note.ok .icon { width: 14px; height: 14px; color: var(--ok); }
.when-note.ok b { color: var(--text); }

@media (max-width: 900px) {
  .memo-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .memo-when { grid-column: 2; grid-row: 2; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .memo-actions { grid-column: 3; grid-row: 1; }
}
@media (max-width: 640px) {
  .hide-sm, .btn.hide-sm { display: none; }
  .show-sm { display: inline; }
  .form-card > h3:has(.segmented) { flex-wrap: wrap; row-gap: 10px; }
  .form-card > h3 .right:has(.segmented) { margin-left: 0; width: 100%; }
  .form-card > h3 .right .segmented { width: 100%; }
  .form-card > h3 .right .segmented button { flex: 1; }
  .pic-tools .btn { height: 38px; }
  .memo-row { gap: 10px; padding: 12px; }
  .pic-tools { flex-direction: column; }
  .pic { width: 76px; height: 76px; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-edit { padding-left: 0; }
  .drawer-foot { flex-wrap: wrap; }
}
