/* HuupaSocial operator UI.
 *
 * No CSS framework on purpose. The whole surface is four pages and one table;
 * Tailwind would add a build step this project does not have, and Bootstrap
 * would be fought rather than used. The tokens below were already here and
 * already handled dark mode correctly -- this extends them.
 *
 * Two audiences, which is why it is not purely utilitarian: JB operating the
 * fleet, and platform reviewers who are shown the OAuth flow on video during
 * app review.
 */

/* Brand: JBKlutse Ventures / Huupa.
 *
 * These values are NOT invented here. They are the Huupa brand system already
 * in use by the portal at huupa.jbklutseventures.com -- teal #008080, the
 * Inter type stack, the 12/8px radii and the neutral ramp. The portal's
 * `app/static/style.css` and `app/services/branding.py` are the source of
 * truth; `portal/deploy/make-favicon.py` documents the mark.
 *
 * Duplicated rather than shared because the two services deploy
 * independently and features here do not reach into each other's folders.
 * If the brand accent changes, it changes in both places -- which is the
 * cost of that separation, recorded so it is not a surprise.
 */

/* Self-hosted, like htmx and Alpine. The portal pulls Inter from Google
 * Fonts; this page does not, because it claims no external request carries
 * the operator's referrer, and a webfont request would break that. */
@font-face {
  font-family: "Inter";
  src: url("/static/vendor/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f6f7f9; --panel: #fff; --panel-2: #f1f3f6;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b;
  --line: #e5e8ee; --line-2: #d3d8e2;

  --accent: #008080; --accent-hover: #0a6f6f;
  --accent-ink: #fff; --accent-soft: #e0f2f1;

  --ok: #16a34a; --ok-soft: #e7f6ec;
  --warn: #d97706; --warn-soft: #fdf1df;
  --bad: #dc2626; --bad-soft: #fdeaea;

  --shadow: 0 1px 2px rgba(16, 24, 40, .03), 0 6px 20px rgba(16, 24, 40, .05);
  --shadow-lift: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --r: 12px; --r-sm: 8px; --r-pill: 999px;
  /* Cards only. The brand radii above are unchanged. */
  --r-lg: 18px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* The portal switches on [data-theme]; this page follows the system and also
 * honours an explicit attribute, so a toggle can be added without a reshuffle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f14; --panel: #111827; --panel-2: #172033;
    --ink: #e5e7eb; --ink-2: #cbd5e1; --muted: #94a3b8;
    --line: #1f2937; --line-2: #334155;

    --accent: #14b8a6; --accent-hover: #2dd4bf;
    --accent-ink: #04211d; --accent-soft: rgba(20, 184, 166, .12);

    --ok: #22c55e; --ok-soft: rgba(34, 197, 94, .12);
    --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .14);
    --bad: #ef4444; --bad-soft: rgba(239, 68, 68, .14);

    --shadow: none;
    --shadow-lift: 0 12px 34px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f14; --panel: #111827; --panel-2: #172033;
  --ink: #e5e7eb; --ink-2: #cbd5e1; --muted: #94a3b8;
  --line: #1f2937; --line-2: #334155;
  --accent: #14b8a6; --accent-hover: #2dd4bf;
  --accent-ink: #04211d; --accent-soft: rgba(20, 184, 166, .12);
  --ok: #22c55e; --ok-soft: rgba(34, 197, 94, .12);
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .14);
  --bad: #ef4444; --bad-soft: rgba(239, 68, 68, .14);
  --shadow: none; --shadow-lift: 0 12px 34px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  /* Fixes the iOS Safari habit of inflating text in landscape. */
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 920px; margin: 0 auto; padding: 22px 16px 72px; }

/* ------------------------------------------------------------------ shell */
/* The portal's shell, so the two Huupa products read as one: a fixed sidebar
 * with the mark and menu, theme switch and account at its foot, and a sticky
 * top bar over the content. Under 900px the sidebar becomes a drawer. */
:root { --sidebar-w: 240px; --topbar-h: 60px; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
}
.brandmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brandmark .mark { width: 30px; height: 30px; flex: none; display: block; }
.wordmark { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.sidebar .brandmark { padding: 6px 10px 18px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; font-size: 14px;
  text-decoration: none; transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ic {
  width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.count {
  margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 1px 7px;
  border-radius: var(--r-pill); font-variant-numeric: tabular-nums;
}
.count.bad { background: var(--bad); color: #fff; }

.sidebar-foot {
  margin-top: auto; display: flex; flex-direction: column; gap: 6px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.themebtn {
  justify-content: flex-start; border-color: transparent; background: none;
  color: var(--ink-2); font-size: 13.5px; padding: 8px 10px; width: 100%;
}
.themebtn:hover:not(:disabled) { background: var(--panel-2); border-color: transparent; }
.themebtn.icononly { width: auto; padding: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.user-chip .initial {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px;
}
.user-chip .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout { font-size: 13px; color: var(--muted); padding: 2px 10px 4px; }

/* Which theme-switch label shows. Follows the explicit choice when there is
 * one, and the system otherwise -- the same rule the colour tokens use. */
.only-dark { display: none; }
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .only-light { display: none; }
  :root:not([data-theme]) .only-dark { display: inline-flex; }
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; font-weight: 600; }
.hamburger { display: none; padding: 7px; border-color: transparent; background: none; }
.content { padding: 24px 28px 72px; max-width: 1040px; width: 100%; margin: 0 auto; }
.scrim { display: none; }

/* Signed out: no menu, so no shell. */
.plainbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
a { color: var(--accent); text-underline-offset: 2px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); z-index: 40;
    transform: translateX(-100%); transition: transform .2s var(--ease);
    box-shadow: 0 0 40px rgba(0, 0, 0, .2);
  }
  .app.drawer-open .sidebar { transform: none; }
  .app.drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 30; }
  .hamburger { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .content { padding: 18px 14px 64px; }
}

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card > h2 {
  font-size: 14px; margin: 0 0 3px; font-weight: 650; letter-spacing: -.005em;
  display: flex; align-items: center; gap: 8px;
}
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.card .sub:last-child { margin-bottom: 0; }
.note { color: var(--muted); font-size: 13px; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 5px;
}

/* --------------------------------------------------------------- progress */
/* The page exists to answer one question: what still blocks cancelling
 * Metricool. That answer gets the top of the page, not a sentence in prose. */
.cutover { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cutover .big { font-size: 26px; font-weight: 680; letter-spacing: -.02em; line-height: 1; }
.cutover .of { color: var(--muted); font-size: 13px; }
.bar {
  height: 7px; border-radius: var(--r-pill); background: var(--line);
  overflow: hidden; margin: 14px 0 12px;
}
.bar > span {
  display: block; height: 100%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  width: var(--pct, 0%);
  animation: grow .9s var(--ease) both;
}
@keyframes grow { from { width: 0; } to { width: var(--pct, 0%); } }

.tallies { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.tally { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.tally b { color: var(--ink); font-weight: 620; font-variant-numeric: tabular-nums; }
.tally .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* ---------------------------------------------------------------- filters */
.filters { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 14px; }
.chip {
  font: inherit; font-size: 13px; padding: 5px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
  cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease),
    color .15s var(--ease), transform .1s var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--line-2); background: var(--panel-2); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 580;
}
.chip .n {
  font-variant-numeric: tabular-nums; font-size: 11.5px; opacity: .75;
  background: color-mix(in srgb, currentColor 14%, transparent);
  padding: 0 5px; border-radius: var(--r-pill);
}

/* -------------------------------------------------------- connection rows */
.conns { display: flex; flex-direction: column; }
.conn {
  display: grid; align-items: center; gap: 12px;
  /* Five columns for five children: network, account, credential, route,
   * actions. A short count silently wraps the buttons onto their own row. */
  /* The first column is a fixed width: each row is its own grid, so a
   * flexible one let the account names start at a different place per row. */
  grid-template-columns: 150px minmax(0, 1fr) auto auto auto;
  padding: 11px 2px; border-top: 1px solid var(--line);
}
.conn:first-child { border-top: 0; }
.conn.is-attention { background: var(--bad-soft); border-radius: var(--r-sm); padding-inline: 10px; }

.net { display: flex; align-items: center; gap: 9px; min-width: 0; }
.net svg { width: 17px; height: 17px; flex: none; }
.net .name { font-weight: 560; text-transform: capitalize; }

.acct { min-width: 0; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--panel-2); border: 1px solid var(--line);
}
.avatar.none { border-style: dashed; border-color: var(--line-2); }
.acct code {
  display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  font-weight: 600; padding: 2.5px 9px; border-radius: var(--r-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.badge.bad { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.none { color: var(--muted); background: var(--panel-2); border-color: var(--line); }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 2.5px 10px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); white-space: nowrap;
}
.pill.native { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, transparent); background: var(--ok-soft); }
.pill.off { opacity: .65; }

.acts { display: flex; gap: 7px; align-items: center; justify-content: flex-end; }
.acts form { display: contents; }

/* Why a button is disabled has to be readable where the button is. The old
 * title= attribute does not exist on a touch screen. */
.whynot {
  border: 0; background: none; padding: 0; margin: 0; cursor: help; color: var(--muted);
  font: inherit; font-size: 12px; display: inline-flex; align-items: center; gap: 4px;
}
.reason {
  grid-column: 1 / -1; font-size: 12.5px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 11px; margin-top: -2px;
}
.reason.bad { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }

/* ---------------------------------------------------------------- buttons */
button, .btn {
  font: inherit; font-size: 13.5px; padding: 6.5px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
  gap: 6px; white-space: nowrap; position: relative;
  transition: background .15s var(--ease), border-color .15s var(--ease),
    transform .08s var(--ease), box-shadow .15s var(--ease);
}
button:hover:not(:disabled), .btn:hover { background: var(--panel-2); border-color: var(--muted); }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 560;
}
button.primary:hover:not(:disabled) {
  background: var(--accent-hover); border-color: var(--accent-hover);
  box-shadow: var(--shadow-lift);
}
button.go { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); font-weight: 560; }
button.go:hover:not(:disabled) { background: var(--ok-soft); border-color: var(--ok); }
button.quiet { color: var(--muted); font-size: 13px; }
button:disabled { opacity: .42; cursor: not-allowed; }
:where(button, .btn, .chip, input, a):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* htmx adds .htmx-request to the element issuing the request. The spinner is
 * what tells you a click registered during an OAuth round trip. */
button.htmx-request { color: transparent !important; pointer-events: none; }
button.htmx-request::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: var(--ink); animation: spin .6s linear infinite;
}
button.primary.htmx-request::after { border-top-color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- forms */
label { display: block; font-size: 13px; font-weight: 560; margin-bottom: 5px; }
input[type=email], input[type=text], input[type=password] {
  font: inherit; padding: 9px 11px; border-radius: var(--r-sm); width: 100%;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus {
  outline: 0; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field { margin-bottom: 14px; }
.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* ----------------------------------------------------------- flash + toast */
.flash {
  border-radius: var(--r-sm); padding: 11px 14px; margin-bottom: 16px;
  border: 1px solid; font-size: 14px; display: flex; align-items: center; gap: 9px;
  animation: drop .3s var(--ease) both;
}
.flash.ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash.bad { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

#toasts {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 50;
  width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--ok); border-radius: var(--r-sm);
  padding: 11px 14px; font-size: 13.5px; box-shadow: var(--shadow-lift);
  animation: rise .28s var(--ease) both;
}
.toast.bad { border-left-color: var(--bad); }
.toast.leaving { animation: sink .2s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes sink { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* A row that just changed is briefly marked, so the eye finds it after an
 * in-place swap instead of re-reading the whole table. */
.settled { animation: settle 1.5s var(--ease) both; }
@keyframes settle {
  0%, 30% { background: var(--accent-soft); }
  100% { background: transparent; }
}

.empty { text-align: center; padding: 26px 10px; color: var(--muted); font-size: 13.5px; }

/* ------------------------------------------------------------------ small */
/* The old stylesheet hid the third column under 620px. That column is the
 * credential state -- the single most important field on the page, and the
 * one that says a connection cannot actually publish. Rows reflow instead. */
@media (max-width: 680px) {
  .wrap { padding-top: 20px; }
  .conn {
    grid-template-columns: 1fr auto; gap: 8px 12px;
    padding: 13px 2px; align-items: start;
  }
  .conn .net { grid-column: 1; }
  .conn .acct { grid-column: 1 / -1; order: 3; }
  .conn .st { grid-column: 2; grid-row: 1; justify-self: end; }
  .conn .rt { order: 4; }
  .conn .acts { grid-column: 1 / -1; order: 5; justify-content: flex-start; }
  .conn .reason { order: 6; }
  .acts button, .acts .btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .bar > span { width: var(--pct, 0%); }
}

/* ------------------------------------------------- network logo colours */
/* Brand colour where it reads on both themes. Threads, X and TikTok are
 * pure black, so they follow the ink token instead of vanishing. */
.ni { color: var(--ink); }
.ni-bluesky { color: #0285FF; }
.ni-facebook { color: #0866FF; }
.ni-instagram { color: #E4405F; }
.ni-linkedin { color: #0A66C2; }
.ni-pinterest { color: #BD081C; }
.ni-youtube { color: #FF0000; }

/* ------------------------------------------------------------ the filter */
/* Driven entirely by one attribute on the wrapper. The rows never leave the
 * document, so switching is instant, needs no request, and cannot paint the
 * wrong set before JavaScript has run. :has() hides a brand card whose rows
 * have all been filtered out, which a JS implementation would have to track. */
.nomatch { display: none; }

[data-filter="attention"] .conn:not([data-tags~="attention"]),
[data-filter="metricool"] .conn:not([data-tags~="metricool"]),
[data-filter="native"] .conn:not([data-tags~="native"]),
[data-filter="unconnected"] .conn:not([data-tags~="unconnected"]) { display: none; }

[data-filter="attention"] .brandcard:not(:has(.conn[data-tags~="attention"])),
[data-filter="metricool"] .brandcard:not(:has(.conn[data-tags~="metricool"])),
[data-filter="native"] .brandcard:not(:has(.conn[data-tags~="native"])),
[data-filter="unconnected"] .brandcard:not(:has(.conn[data-tags~="unconnected"])) { display: none; }

[data-filter="attention"]:not(:has(.conn[data-tags~="attention"])) .nomatch,
[data-filter="metricool"]:not(:has(.conn[data-tags~="metricool"])) .nomatch,
[data-filter="unconnected"]:not(:has(.conn[data-tags~="unconnected"])) .nomatch,
[data-filter="native"]:not(:has(.conn[data-tags~="native"])) .nomatch { display: block; }

/* Going from display:none back to a grid restarts this, which is what makes
 * a filter change read as a change rather than a jump cut. */
.conn { animation: fade .22s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(-3px); } }

/* Dividers only in the unfiltered list. CSS has no "first visible child", so
 * under a filter the top border would float above whichever row happened to
 * survive. A filtered view is short, so it drops the rules for spacing
 * instead -- deliberate, rather than a stray line that reads as a bug. */
.conns > .conn:first-child { border-top: 0; }
[data-filter]:not([data-filter="all"]) .conns { gap: 5px; }
[data-filter]:not([data-filter="all"]) .conn { border-top: 0; }

/* --------------------------------------------------------- sign in / forms */
.signin { max-width: 440px; margin: 6vh auto 0; padding: 24px 24px 20px; }
.signin > h2 { font-size: 17px; margin-bottom: 6px; }
.signin > h2 svg { width: 18px; height: 18px; }
.signin .note { margin: 12px 0 0; }
.wide { width: 100%; justify-content: center; padding-block: 9px; }
.or {
  display: flex; align-items: center; gap: 12px; margin: 16px 0;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
}
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* --------------------------------------------------------------- activity */
.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; padding: 0 12px 9px 0; white-space: nowrap;
}
table.list td { padding: 10px 12px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.list td.when { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
table.list .excerpt { color: var(--ink-2); max-width: 38ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.list .why { color: var(--bad); font-size: 12.5px; margin-top: 3px; max-width: 46ch; }
.netcell { display: flex; align-items: center; gap: 7px; white-space: nowrap; text-transform: capitalize; }
.netcell svg { width: 15px; height: 15px; flex: none; }
.badge.sched { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
a.chip { text-decoration: none; }

/* -------------------------------------------------------------- analytics */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.stat { margin: 0; }
.stat .who { display: flex; align-items: center; gap: 9px; min-width: 0; margin-bottom: 12px; }
.stat .who .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .who .sub2 { color: var(--muted); font-size: 12px; text-transform: capitalize; display: flex; align-items: center; gap: 5px; }
.stat .who .sub2 svg { width: 12px; height: 12px; }
.stat .num { font-size: 28px; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.spark { width: 100%; height: 44px; margin-top: 12px; display: block; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark polygon { fill: var(--accent-soft); stroke: none; }

/* --------------------------------------------------------- brand switcher */
.switcher { position: relative; margin: 0 0 10px; }
.switcher > summary {
  list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2); transition: border-color .15s var(--ease);
}
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > summary:hover { border-color: var(--line-2); }
.switcher .chev { margin-left: auto; color: var(--muted); transition: transform .15s var(--ease); }
.switcher[open] .chev { transform: rotate(180deg); }
.swname { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.swmenu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow-lift); padding: 5px; max-height: 60vh; overflow-y: auto;
  animation: drop .16s var(--ease) both;
}
.swmenu a {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px;
  text-decoration: none; color: var(--ink-2);
}
.swmenu a:hover { background: var(--panel-2); color: var(--ink); }
.swmenu a.on { background: var(--accent-soft); color: var(--accent); }
.swmenu .swname { font-weight: 500; }
.avatar.initial {
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border-color: transparent;
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none; }
.dot.bad { background: var(--bad); }

/* ------------------------------------------------------------ brand tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.tile {
  margin: 0; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.tile:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.tilehead { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tilename { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.netstrip { display: flex; gap: 7px; flex-wrap: wrap; }
.netdot {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; position: relative;
  background: var(--panel-2); border: 1px solid var(--line);
}
.netdot svg { width: 15px; height: 15px; }
.netdot::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 9px; height: 9px;
  border-radius: 50%; border: 2px solid var(--panel); background: var(--muted);
}
.netdot.live::after { background: var(--ok); }
.netdot.bad::after { background: var(--bad); }
.netdot.off { opacity: .45; }
.netdot.off::after { display: none; }
.tilefoot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

/* ---------------------------------------------------------- row "more" menu */
.more { position: relative; }
.more > summary {
  list-style: none; cursor: pointer; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--r-sm); color: var(--muted); border: 1px solid transparent;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary:hover, .more[open] > summary { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
.more > summary .ic { fill: currentColor; stroke: none; }
.more .menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 210px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow-lift); padding: 5px; display: flex; flex-direction: column; gap: 2px;
  animation: drop .14s var(--ease) both;
}
.more .menu form { display: block; }
.more .menu button, .more .menu .btn {
  width: 100%; justify-content: flex-start; border-color: transparent; background: none;
  font-size: 13.5px; color: var(--ink-2); padding: 8px 10px;
}
.more .menu button:hover:not(:disabled), .more .menu .btn:hover { background: var(--panel-2); border-color: transparent; color: var(--ink); }
.rt:empty { display: none; }

/* -------------------------------------------------------------- dashboard */
.topright { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topright .scope {
  font-size: 12.5px; color: var(--muted); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 4px 11px; background: var(--panel-2);
}
.content { max-width: 1120px; }

.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border-radius: var(--r-lg); padding: 26px 28px; margin-bottom: 16px; color: #fff;
  background:
    radial-gradient(520px 220px at 100% 0%, rgba(255, 255, 255, .16), transparent 60%),
    linear-gradient(120deg, #008080, #0a6f6f);
  box-shadow: 0 10px 30px rgba(0, 128, 128, .22);
  animation: drop .35s var(--ease) both;
}
.hero h2 { margin: 2px 0 6px; font-size: 24px; font-weight: 680; letter-spacing: -.02em; }
.herodate { margin: 0; font-size: 12.5px; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }
.heroline { margin: 0 0 16px; font-size: 14.5px; opacity: .92; max-width: 56ch; }
.heroacts { display: flex; gap: 9px; flex-wrap: wrap; }
.btn.onhero { background: #fff; color: #0a6f6f; border-color: #fff; font-weight: 600; }
.btn.onhero:hover { background: #f0fbfb; border-color: #f0fbfb; }
.btn.onhero.ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.onhero.ghost:hover { background: rgba(255, 255, 255, .2); }
.heroavatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid rgba(255, 255, 255, .7); }

.strip { display: flex; gap: 18px; overflow-x: auto; padding: 6px 2px 14px; margin-bottom: 4px; }
.stripitem { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-2); width: 76px; flex: none; }
.ring { width: 62px; height: 62px; border-radius: 50%; padding: 2px; display: grid; place-items: center; border: 2px solid var(--accent); transition: transform .15s var(--ease); }
.ring.bad { border-color: var(--bad); }
.stripitem:hover .ring { transform: scale(1.06); }
.ring img, .ringinitial { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 18px; }
.stripname { font-size: 12px; text-align: center; line-height: 1.25; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { margin: 0; display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden; padding: 18px; }
.kicon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.kicon .ic { width: 21px; height: 21px; }
.kicon.ok { background: var(--ok-soft); color: var(--ok); }
.kicon.bad { background: var(--bad-soft); color: var(--bad); }
.kicon.accent { background: var(--accent-soft); color: var(--accent); }
.kicon.info { background: color-mix(in srgb, #2563eb 12%, transparent); color: #3b82f6; }
.kicon.quiet { background: var(--panel-2); color: var(--muted); }
.klabel { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.knum { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kof { font-size: 15px; color: var(--muted); font-weight: 550; }
.ksub { font-size: 12px; color: var(--muted); }
.spark.mini { position: absolute; right: 0; bottom: 0; width: 46%; height: 34px; margin: 0; opacity: .8; }
.spark.tiny { width: 70px; height: 24px; margin: 0; flex: none; }

.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.cols .card { margin-bottom: 16px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cardhead h2 { font-size: 15px; margin: 0; font-weight: 650; }
.cardhead a { font-size: 12.5px; text-decoration: none; font-weight: 550; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feedicon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--panel-2); border: 1px solid var(--line); }
.feedicon svg { width: 16px; height: 16px; }
.feedicon.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.feed .avatar { width: 34px; height: 34px; }
.feedbody { min-width: 0; flex: 1; }
.feedtext { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedmeta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feednum { font-variant-numeric: tabular-nums; font-size: 14px; }

.donutrow { display: flex; align-items: center; gap: 22px; padding: 6px 0 2px; }
.donut { width: 150px; height: 150px; flex: none; transform: rotate(0deg); }
.donut circle { transition: stroke-dasharray .6s var(--ease); }
.donutnum { font-size: 7.5px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.donutlbl { font-size: 3px; text-anchor: middle; fill: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.legend li:first-child { border-top: 0; }
.legend b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .hero { padding: 20px; } .hero h2 { font-size: 20px; } .heroavatar { display: none; } .donutrow { flex-direction: column; align-items: stretch; } .donut { margin: 0 auto; } .topright .scope { display: none; } }
/* Each row is its own stacking context (its entrance animation uses a
 * transform), so a later row paints over an open menu. Lift the row whose
 * menu is open above its neighbours. */
.conn:has(details.more[open]) { position: relative; z-index: 6; }

/* ---------------------------------------------------------------- account */
a.user-chip { text-decoration: none; border-radius: var(--r-sm); transition: background .15s var(--ease); }
a.user-chip:hover, a.user-chip.active { background: var(--panel-2); }
.user-chip .who b { color: var(--ink); font-weight: 600; }
.user-chip .who { line-height: 1.3; }
.acctgrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.acctgrid .card { margin-bottom: 16px; }
.avatarrow { display: flex; align-items: center; gap: 16px; margin: 4px 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.avatar.xl { width: 72px; height: 72px; font-size: 26px; }
.file { font: inherit; font-size: 13px; max-width: 230px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.facts { margin: 0 0 12px; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.facts dt { color: var(--muted); white-space: nowrap; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 860px) { .acctgrid, .two { grid-template-columns: 1fr; } .avatarrow { align-items: flex-start; } }

/* --------------------------------------------------------------- settings */
.cols.even { grid-template-columns: 1fr 1fr; }
.cardhead .badge { margin-left: auto; }
select {
  font: inherit; padding: 9px 11px; border-radius: var(--r-sm); width: 100%;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
}
input[type=number] {
  font: inherit; padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
}
.inlineform { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.inlineform .field { margin: 0; }
.reveal { border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; font-size: 14px; }
.tokenvalue { font-size: 13.5px; padding: 8px 10px; user-select: all; overflow-wrap: anywhere; background: var(--panel); }
.brandrows { display: flex; flex-direction: column; }
.brandrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.brandrow:first-child { border-top: 0; }
.plainlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
@media (max-width: 860px) { .cols.even, .inlineform { grid-template-columns: 1fr; } .brandrow { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------------- team */
.rolechip {
  display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: var(--r-pill);
  text-transform: capitalize; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.rolechip.owner { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.rolechip.manager { background: color-mix(in srgb, #2563eb 12%, transparent); color: #3b82f6; border-color: color-mix(in srgb, #3b82f6 28%, transparent); }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.levels p { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.member { display: flex; align-items: center; gap: 11px; min-width: 0; }
.member .avatar { width: 32px; height: 32px; }
table.members td { vertical-align: middle; }
@media (max-width: 760px) { .levels { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ feeds */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.pagehead .note { margin: 0; max-width: 62ch; }
.btn.primarylink { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 560; flex: none; }
.btn.primarylink:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.statusbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
textarea {
  font: inherit; padding: 9px 11px; border-radius: var(--r-sm); width: 100%; resize: vertical;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
}
input[type=time] { font: inherit; padding: 9px 11px; border-radius: var(--r-sm); width: 100%; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); }
input[type=number] { width: 100%; }
input:disabled, textarea:disabled, select:disabled { opacity: .6; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 7px 11px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r-pill); font-weight: 500; font-size: 13px;
}
.check svg { width: 14px; height: 14px; }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check input { accent-color: var(--accent); margin: 0; }
.sample { padding: 14px 0; border-top: 1px solid var(--line); }
.sample:first-of-type { border-top: 0; }
.samplehead { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.samplehead img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; border: 1px solid var(--line); }
.sampletext { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; margin-top: 8px; align-items: start; }
.sampletext pre {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px;
}
@media (max-width: 600px) { .sampletext { grid-template-columns: 1fr; } .pagehead { flex-direction: column; align-items: flex-start; } }

/* -------------------------------------------------------------- recycling */
button.toggle { min-width: 46px; justify-content: center; font-weight: 600; }
button.toggle.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }

/* ------------------------------------------------------------- best times */
.timecard .who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.timecard .who .name { font-weight: 600; }
.timecard .who .sub2 { color: var(--muted); font-size: 12px; text-transform: capitalize; display: flex; align-items: center; gap: 5px; }
.timecard .who .sub2 svg { width: 12px; height: 12px; }
.verdict { font-size: 15.5px; margin: 0 0 14px; }
.verdict b { color: var(--accent); }
.verdict .note { display: block; margin-top: 3px; }
.verdict.quiet { color: var(--ink-2); font-size: 14px; }
.timegrid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: end; }
.minihead { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 92px; align-items: end; border-bottom: 1px solid var(--line); }
.hourcol { height: 100%; display: flex; align-items: flex-end; }
.hourcol span { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--accent); transition: height .5s var(--ease); }
.hourcol.thin span { background: var(--line-2); }
.houraxis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
table.heat { border-collapse: separate; border-spacing: 3px; width: 100%; table-layout: fixed; }
table.heat th { font-size: 10.5px; color: var(--muted); font-weight: 500; text-align: center; padding: 0; font-variant-numeric: tabular-nums; }
table.heat tbody th { text-align: left; width: 30px; }
table.heat td { height: 17px; padding: 0; border-radius: 4px; background: var(--panel-2); position: relative; overflow: hidden; }
table.heat td span { position: absolute; inset: 0; background: var(--accent); }
@media (max-width: 800px) { .timegrid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- signals */
.signals { list-style: none; margin: 0; padding: 0; }
.signal { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.signal:first-child { border-top: 0; padding-top: 4px; }
.sigmark { width: 4px; border-radius: 4px; flex: none; background: var(--line-2); }
.signal.bad .sigmark { background: var(--bad); }
.signal.warn .sigmark { background: var(--warn); }
.signal.info .sigmark { background: #3b82f6; }
.signal.good .sigmark { background: var(--ok); }
.sigbody { min-width: 0; }
.sigwho { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.sigwho svg { width: 12px; height: 12px; }
.sigtitle { font-weight: 650; font-size: 15px; }
.sigdetail { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; overflow-wrap: anywhere; }
.sigaction { font-size: 13.5px; margin-top: 6px; }
.sigaction a { margin-left: 6px; font-weight: 550; white-space: nowrap; }

/* ------------------------------------------------------------ automations */
.statusdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--line-2); vertical-align: 1px; }
.statusdot.on { background: var(--ok); }
.statusdot.bad { background: var(--bad); }
table.autos td:first-child { max-width: 0; width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.autos a { text-decoration: none; color: var(--ink); font-weight: 500; }
table.autos a:hover { color: var(--accent); text-decoration: underline; }

/* ---------------------------------------------------------- telegram bots */
.bothead { display: flex; align-items: center; gap: 12px; }
.botname { font-weight: 650; font-size: 15px; }
.botstatus { margin-left: auto; }
.botcard .reason { margin-top: 12px; }
.more.inline > summary.btn { width: auto; height: auto; display: inline-flex; padding: 6.5px 13px; border: 1px solid var(--line-2); color: var(--ink); }
.more .menu.wide { min-width: min(420px, 86vw); padding: 14px; left: 0; right: auto; }
.more .menu.wide button.primary { width: auto; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); justify-content: center; }
.more .menu.wide label { font-size: 12.5px; }
.steps { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }
.botcard:has(details.more[open]) { position: relative; z-index: 6; }

/* Retry sits under the Failed badge, small enough not to compete with it. */
form.retry { margin-top: 6px; }
form.retry button { padding: 3px 10px; font-size: 12.5px; }

/* ------------------------------------------------- composer and calendar */
.newpost { display: flex; justify-content: center; gap: 7px; margin: 0 0 12px; text-decoration: none; }
.newpost .ic { width: 15px; height: 15px; }
.newpost.on { box-shadow: 0 0 0 3px var(--accent-soft); }
.check .via { font-size: 11px; color: var(--muted); border-left: 1px solid var(--line-2); padding-left: 7px; margin-left: 2px; }
.counter { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.counter .overlimit { color: var(--bad); font-weight: 600; }
label.radio { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-weight: 500; color: var(--ink); cursor: pointer; }
label.radio input { accent-color: var(--accent); margin: 0; }
input[type="file"] { width: 100%; font: inherit; font-size: 13px; color: var(--ink-2); }
.flash .plainlist { margin-top: 8px; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
button.danger:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }

.calhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.calhead h2 { margin: 0 4px; font-size: 18px; font-weight: 650; min-width: 9.5em; text-align: center; }
.calcard { padding: 0; overflow: hidden; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.caldow { padding: 9px 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--line); }
.calday { min-height: 118px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.calday:nth-child(7n) { border-right: 0; }
.calday.out { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.calday.out .num { color: var(--muted); opacity: .7; }
.calday.chosen { box-shadow: inset 0 0 0 2px var(--accent); }
.caldate { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.caldate .num { font-size: 12.5px; font-weight: 600; color: var(--ink-2); width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.calday.today .num { background: var(--accent); color: var(--accent-ink); }
.caldate .long { display: none; }
.caldate .add { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--muted); font-size: 16px; line-height: 1; opacity: 0; transition: opacity .12s; }
.calday:hover .add, .caldate .add:focus-visible { opacity: 1; }
.caldate .add:hover { background: var(--accent-soft); color: var(--accent); }
.calpost { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 6px; font-size: 12px;
  text-decoration: none; color: var(--ink); background: var(--panel-2); border-left: 3px solid var(--line-2); min-width: 0; }
.calpost:hover { background: var(--accent-soft); }
.calpost .t { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.calpost .nets { display: inline-flex; gap: 2px; flex: none; }
.calpost .nets svg { width: 12px; height: 12px; }
.calpost .x { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.calpost.scheduled { border-left-color: var(--accent); }
.calpost.published { border-left-color: var(--ok); }
.calpost.failed { border-left-color: var(--bad); background: var(--bad-soft); }
.calpost.cancelled { opacity: .6; }
.calpost.cancelled .x { text-decoration: line-through; }
.calmore { font-size: 11.5px; font-weight: 600; text-decoration: none; padding: 1px 6px; }
.daylist { display: flex; flex-direction: column; gap: 6px; }
.calpost.wide { padding: 8px 10px; font-size: 13.5px; gap: 10px; }
.calpost.wide .nets svg { width: 14px; height: 14px; }
.calpost.wide .x { flex: 1; }
.calpost.wide .s { flex: none; font-size: 12px; color: var(--muted); }

.posttext { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-size: 15px; line-height: 1.55; }
.postmedia { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.postmedia img { width: 132px; height: 132px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); display: block; }
.partlist { list-style: none; margin: 0; padding: 0; }
.partlist li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px;
  padding: 10px 0; border-top: 1px solid var(--line); }
.partlist li:first-child { border-top: 0; padding-top: 0; }
.partlist .why { flex-basis: 100%; color: var(--bad); font-size: 12.5px; }
.partlist form.retry { margin: 0; }
.moveform { display: flex; align-items: flex-end; gap: 9px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.moveform .field { margin: 0; flex: 1; }

/* A phone cannot show seven columns of posts. The month becomes a list of
   the days that have something on them, plus today. */
@media (max-width: 760px) {
  .calgrid { display: block; }
  .caldow, .calday.out, .calday.blank:not(.today) { display: none; }
  .calday { min-height: 0; border-right: 0; padding: 10px 12px; }
  .caldate .num { display: none; }
  .caldate .long { display: inline; font-size: 13px; font-weight: 600; }
  .calday.today .long { color: var(--accent); }
  .caldate .add { opacity: 1; }
  .calhead h2 { min-width: 0; }
}

/* ------------------------------------------------------ brand-level access */
.brandtags { display: flex; flex-wrap: wrap; gap: 4px; }
.brandtags .tag { font-size: 12px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--panel-2); border: 1px solid var(--line); }
.brandedit { margin-top: 6px; }
.brandedit > summary { cursor: pointer; font-size: 12.5px; font-weight: 550; color: var(--accent); list-style: none; }
.brandedit > summary::-webkit-details-marker { display: none; }
.brandedit form { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); max-width: 340px; }
.inlineform.teamadd { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.inlineform.teamadd .checks { grid-column: 1 / -1; }
@media (max-width: 860px) { .inlineform.teamadd { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ short links */
.linkhead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.linkhead .card { margin: 0; }
@media (max-width: 860px) { .linkhead { grid-template-columns: 1fr; } }
.prefixed { display: flex; align-items: stretch; }
.prefixed > span { display: flex; align-items: center; padding: 0 10px; font-size: 12.5px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line-2); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.prefixed > input { border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 0; }
.linkname { font-weight: 600; text-decoration: none; color: var(--ink); }
.linkname:hover { color: var(--accent); }
.shortline span { color: var(--accent); font-weight: 550; }
.dest { max-width: 52ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.numcol { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shortbig { font-size: 18px; font-weight: 650; color: var(--accent); overflow-wrap: anywhere; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .kpis.three { grid-template-columns: 1fr; } }
.kpi .num { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; }
.daybars { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 6px; }
.daybars span { flex: 1; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; }
.daybars span.none { background: var(--line); }
.daybars-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.barlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.barlist li { display: grid; grid-template-columns: minmax(0, 10em) minmax(0, 1fr) 3.5em 3em; gap: 10px; align-items: center; font-size: 13.5px; }
.barlist .who { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist .who svg { width: 14px; height: 14px; flex: none; }
.barlist .track { height: 8px; border-radius: var(--r-pill); background: var(--panel-2); overflow: hidden; }
.barlist .track span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.barlist .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.barlist .p { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- link page */
.pagegrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.pagegrid .card { margin-bottom: 16px; }
.phonewrap { position: sticky; top: 76px; }
.phone { width: 300px; height: 600px; margin: 0 auto; border-radius: 34px; border: 9px solid #1b2230; background: #1b2230;
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, .18)); overflow: hidden; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 25px; background: #fff; display: block; }
@media (max-width: 1100px) { .pagegrid { grid-template-columns: 1fr; } .phonewrap { position: static; order: -1; } .phone { height: 460px; } }
.itemlist { list-style: none; margin: 0 0 4px; padding: 0; }
.itemlist li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.itemlist li:first-child { border-top: 0; }
.itemlist li.off .lab { color: var(--muted); }
.mover { display: flex; flex-direction: column; gap: 2px; flex: none; }
.mover button { padding: 0 7px; height: 20px; line-height: 1; font-size: 13px; }
.itemedit { flex: 1; min-width: 0; }
.itemedit > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 8px 10px;
  border-radius: var(--r-sm); min-width: 0; }
.itemedit > summary::-webkit-details-marker { display: none; }
.itemedit > summary:hover { background: var(--panel-2); }
.itemedit[open] > summary { background: var(--panel-2); }
.itemedit .kind { flex: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); width: 5.2em; }
.itemedit .lab { flex: 1; min-width: 0; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itemedit .clicks { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.itemedit form { padding: 12px 10px 4px; }
.additem { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 12px; align-items: end;
  margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.additem .field { margin: 0; }
@media (max-width: 860px) { .additem { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- reports */
.reportbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.report .card { margin-bottom: 16px; }
.reporthead { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.reporthead .avatar { width: 52px; height: 52px; }
.reporthead h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.reporthead p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.delta { font-size: 12.5px; margin-top: 4px; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.report .kpi { align-items: flex-start; }
.bignum { font-size: 22px; font-weight: 680; font-variant-numeric: tabular-nums; }
.was { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.report .track { display: block; height: 8px; border-radius: var(--r-pill); background: var(--panel-2); overflow: hidden; }
.report .track span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.notelist { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 14.5px; }
.toplist { list-style: none; margin: 0; padding: 0; }
.toplist li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.toplist li:first-child { border-top: 0; padding-top: 2px; }
.toplist .rank { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.toplist .what { flex: 1; min-width: 0; }
.toplist .cap { overflow-wrap: anywhere; }
.toplist .score { flex: none; font-weight: 680; font-size: 16px; font-variant-numeric: tabular-nums; }
.barlist.plain li { grid-template-columns: minmax(0, 1fr) 4em; }
.sentrow { display: flex; flex-wrap: wrap; gap: 10px 32px; font-size: 14.5px; }
.sentrow strong { font-size: 18px; margin-right: 4px; font-variant-numeric: tabular-nums; }
.sentrow .isbad strong { color: var(--bad); }
.reportfoot { text-align: center; }
body.sharedreport { background: var(--bg); }
body.sharedreport .content { max-width: 1000px; margin: 0 auto; padding: 28px 18px 40px; }

/* Paper: the report and nothing else, in ink, with no card split across pages. */
@media print {
  .sidebar, .topbar, .noprint, .flash, .toasts { display: none !important; }
  .app, .main, .content { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .card { box-shadow: none !important; border: 1px solid #cfd4dc !important; break-inside: avoid; background: #fff !important; }
  .report .kpis { grid-template-columns: repeat(4, 1fr) !important; }
  .cols.even { grid-template-columns: 1fr 1fr !important; }
  .daybars span, .track span, .barlist .track span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
  @page { margin: 14mm; }
}

/* --------------------------------------------------------- ask about a signal */
[x-cloak] { display: none !important; }
.ask { margin-top: 8px; }
.askopen { color: var(--accent); font-weight: 560; padding-left: 0; border-color: transparent; background: none; }
.askopen:hover:not(:disabled) { background: none; border-color: transparent; text-decoration: underline; }
.askpanel { margin-top: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2);
  display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.askmsg { display: flex; gap: 10px; align-items: flex-start; }
.askmsg .who { flex: none; width: 34px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding-top: 3px; }
.askmsg.assistant .who { color: var(--accent); }
.askmsg .txt { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.askmsg.user .txt { font-weight: 560; }
.askmsg .thinking { color: var(--muted); animation: askpulse 1.4s ease-in-out infinite; }
@keyframes askpulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .askmsg .thinking { animation: none; } }
.asksuggest { display: flex; flex-wrap: wrap; gap: 6px; }
.asksuggest .chip { cursor: pointer; font: inherit; font-size: 12.5px; }
.askform { display: flex; gap: 8px; }
.askform input { flex: 1; min-width: 0; }
.askpanel .note { margin: 0; font-size: 12px; }
