/*
 * base.css — shared design system for every dashboard page.
 * Loaded by templates/base.html on every page; page-specific rules belong
 * in static/css/pages/<name>.css instead, not here.
 *
 * Contains: CSS variables (light + dark theme, toggled via [data-theme] on
 * <html>) · reset · .app-shell + .sidebar (left nav, collapses to an
 * off-canvas drawer under 900px via #sidebar-toggle/sidebar.js) · role
 * badge colors · .card · buttons (.primary/.ghost/.danger) · table · form
 * fields (input/select/textarea/label) · .badge status pills · .msg helper
 * text · .grid layout helper · shared UI pieces driven by js/ui.js (nav
 * count, .info-tip, toasts) plus .seg buttons, .list-toolbar and the
 * .split list|detail layout (end of file).
 */
:root {
  --ink: #171a21;
  --paper: #f3f1ec;
  --card: #fff;
  --card-2: #faf9f6;
  --border: #e4e0d6;
  --accent: #16707d;
  --accent-ink: #fff;
  --muted: #6b7280;
  --ok: #1c8a4c;
  --bad: #c0392b;
  --warn: #b8860b;
  --sidebar-width: 240px;
  --shadow: 0 3px 16px #0001;
}
html[data-theme="dark"] {
  --ink: #e8ecef;
  --paper: #12161b;
  --card: #1b2129;
  --card-2: #202832;
  --border: #2b333c;
  --accent: #3fb6c4;
  --accent-ink: #0c1216;
  --muted: #93a1ad;
  --ok: #2fbf71;
  --bad: #e0554a;
  --warn: #d3a12f;
  --shadow: 0 3px 16px #0006;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font: 15px/1.5 system-ui, sans-serif;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }

/* ---------------------------------------------------------------- shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width); flex: 0 0 var(--sidebar-width);
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: .9rem;
  padding: 1.1rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: width .2s ease, flex .2s ease, padding .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.brand-name { font-weight: 600; font-size: .95rem; }
.brand-sub { font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }

.sidebar-collapse-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  padding: 0;
  line-height: 1;
  transition: all .15s ease;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--muted);
}

.role-badge {
  align-self: flex-start; text-transform: uppercase; letter-spacing: .04em;
  font-size: .68rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px;
  background: var(--paper); color: var(--muted); border: 1px solid var(--border);
}
.role-badge.role-owner { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.role-badge.role-editor { background: var(--ok); color: #fff; border-color: var(--ok); }
.role-badge.role-viewer { background: var(--paper); color: var(--muted); }

.side-nav { display: flex; flex-direction: column; gap: .1rem; flex: 1; }
.nav-section-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin: .8rem 0 .25rem; padding: 0 .5rem;
}
.side-nav .nav-section-label:first-child { margin-top: 0; }
.nav-link {
  display: flex; align-items: center; gap: .55rem; padding: .5rem .55rem; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-size: .87rem;
}
.nav-link:hover { background: var(--paper); }
.nav-link.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav-icon { width: 1.1em; text-align: center; opacity: .8; }
.nav-note { font-size: .7rem; color: var(--muted); padding: .6rem .5rem 0; border-top: 1px solid var(--border); margin-top: .6rem; }

.sidebar-footer { display: flex; flex-direction: column; gap: .4rem; }
.sidebar-footer button { width: 100%; text-align: left; }

.sidebar-toggle {
  display: none; position: fixed; top: .75rem; left: .75rem; z-index: 30;
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--ink); font-size: 1.1rem;
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: #0007; z-index: 19; }

/* Foldable sidebar (collapsed state on screens > 900px) */
.app-shell.sidebar-collapsed {
  --sidebar-width: 64px;
}
.app-shell.sidebar-collapsed .sidebar {
  padding: 1.1rem .35rem;
  align-items: center;
}
.app-shell.sidebar-collapsed .sidebar-brand {
  width: 100%;
  justify-content: center;
  position: relative;
}
.app-shell.sidebar-collapsed .brand-mark {
  margin: 0 auto;
}
.app-shell.sidebar-collapsed .sidebar-collapse-btn {
  position: absolute;
  right: -2px;
  top: -4px;
  width: 20px;
  height: 20px;
  font-size: .7rem;
  background: var(--card);
}
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .role-badge,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-note,
.app-shell.sidebar-collapsed .footer-btn-label {
  display: none !important;
}
.app-shell.sidebar-collapsed .side-nav {
  width: 100%;
  align-items: center;
  gap: .35rem;
}
.app-shell.sidebar-collapsed .nav-link {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
  position: relative;
}
.app-shell.sidebar-collapsed .nav-icon {
  width: auto;
  font-size: 1.15rem;
  margin: 0;
}
.app-shell.sidebar-collapsed .nav-count {
  position: absolute;
  top: 3px;
  right: 3px;
  margin-left: 0;
  font-size: .62rem;
  padding: 0 .25rem;
  min-width: 1.1em;
}
.app-shell.sidebar-collapsed .sidebar-footer {
  width: 100%;
  align-items: center;
  gap: .35rem;
}
.app-shell.sidebar-collapsed .sidebar-footer button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 10px;
  position: relative;
}

@media (min-width: 901px) {
  .app-shell:not(.sidebar-collapsed) .side-nav .nav-link::after,
  .app-shell:not(.sidebar-collapsed) .sidebar-footer button::after {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .sidebar-collapse-btn { display: none !important; }
  .app-shell.sidebar-collapsed {
    --sidebar-width: 240px;
  }
  .app-shell.sidebar-collapsed .sidebar {
    padding: 1.1rem .9rem;
    align-items: stretch;
  }
  .app-shell.sidebar-collapsed .sidebar-brand {
    justify-content: flex-start;
  }
  .app-shell.sidebar-collapsed .brand-mark {
    margin: 0;
  }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .role-badge,
  .app-shell.sidebar-collapsed .nav-section-label,
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .footer-btn-label {
    display: inline !important;
  }
  .app-shell.sidebar-collapsed .nav-section-label {
    display: block !important;
  }
  .app-shell.sidebar-collapsed .side-nav {
    align-items: stretch;
    gap: .1rem;
  }
  .app-shell.sidebar-collapsed .nav-link {
    width: auto;
    height: auto;
    padding: .5rem .55rem;
    justify-content: flex-start;
  }
  .app-shell.sidebar-collapsed .nav-icon {
    font-size: inherit;
    width: 1.1em;
  }
  .app-shell.sidebar-collapsed .nav-count {
    position: static;
    margin-left: auto;
  }
  .app-shell.sidebar-collapsed .sidebar-footer {
    align-items: stretch;
  }
  .app-shell.sidebar-collapsed .sidebar-footer button {
    width: 100%;
    height: auto;
    padding: .45rem .8rem;
    justify-content: flex-start;
    font-size: .8rem;
  }
  .sidebar-toggle { display: block; }
  .sidebar {
    position: fixed; z-index: 20; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: var(--shadow);
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .page { padding-top: 3.5rem; }
}

.page { flex: 1; min-width: 0; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; width: 100%; }

/* ---------------------------------------------------------------- misc */
.card {
  background: var(--card); padding: 1.15rem 1.25rem; border-radius: 12px;
  box-shadow: var(--shadow); margin-bottom: 1rem; border: 1px solid var(--border);
}

button, .button { font: inherit; cursor: pointer; border-radius: 7px; }
button.primary {
  padding: .55rem 1.1rem; background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 600;
}
button.ghost {
  padding: .45rem .8rem; background: transparent; border: 1px solid var(--border);
  color: var(--ink); font-size: .8rem;
}
button.danger { padding: .4rem .8rem; background: var(--bad); color: #fff; border: 0; font-size: .8rem; }
button:disabled { opacity: .45; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; margin-top: .75rem; font-size: .85rem; }
td, th { padding: .55rem .5rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--card-2); }

.badge { padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; color: #fff; white-space: nowrap; font-weight: 600; }
.badge.queued, .badge.pending { background: var(--warn); }
.badge.running, .badge.generating { background: var(--accent); }
.badge.succeeded, .badge.ready, .badge.ready_for_review, .badge.approved, .badge.ok { background: var(--ok); }
.badge.failed, .badge.invalid, .badge.cancelled { background: var(--bad); }
.badge.retrying { background: var(--warn); }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .7rem; }
@media (max-width: 640px) { .grid { grid-template-columns: minmax(0, 1fr); } }

input, select, textarea {
  width: 100%; padding: .5rem .55rem; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: var(--card); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { font-size: .8rem; color: var(--muted); display: block; margin-bottom: .85rem; }

.msg { font-size: .85rem; color: var(--muted); min-height: 1.2em; }
/* A truncated error (showError(), api.js) - dashed underline + pointer cursor
 * hints there's more to see; clicking toggles the full message, hovering
 * shows it immediately via the element's native `title` tooltip. */
.msg-error { cursor: pointer; text-decoration: underline dashed; text-underline-offset: .2em; }
.pill { display: inline-block; background: var(--paper); border-radius: 6px; padding: .1rem .4rem; font-size: .75rem; margin-right: .25rem; }

.locked-note {
  font-size: .78rem; color: var(--muted); background: var(--card-2); border: 1px dashed var(--border);
  border-radius: 8px; padding: .55rem .7rem; margin: .5rem 0;
}
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- panel-style settings components
 * Ported from the news_man sibling repo's Settings page design
 * (app/web/static/style.css's .panel-head/.field-grid/.option-row/
 * .toggle-switch/.status-badge/.btn-save/.btn-pill/.subpanel), for
 * consistency across the two dashboards' settings-shaped pages. Colors are
 * re-expressed through this file's own --ok/--bad/--warn/--accent/--border
 * variables instead of news_man's hardcoded hex, so every ported component
 * still respects this app's light/dark theme toggle - news_man has no
 * equivalent. Used by engines.html, settings.html, triggers.html, and
 * accounts.html.
 */
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .3rem; }
.panel-head h2 { margin-bottom: .15rem; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; margin-top: .4rem; }

.status-badge { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--muted); flex: none; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--muted); }
.status-badge.status-connected .status-dot { background: var(--ok); }
.status-badge.status-unreachable .status-dot { background: var(--bad); }
.status-badge.status-checking .status-dot { background: var(--warn); }

/* One on/off (or icon-tagged, control-less) row - reused for a single
 * toggleable setting (Publishing Mode, Ngrok Tunnel) and for a list of
 * read-only rows with a badge/control on the right (Engine Status,
 * Setup Guide, per-account active state). */
.option-row {
  display: flex; align-items: center; gap: .9rem; border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .85rem; margin-bottom: .5rem; background: var(--card);
}
.option-row.option-row-on { border-left: 3px solid var(--ok); }
.option-row-icon {
  flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--paper);
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.option-row-text { flex: 1 1 auto; min-width: 0; }
.option-row-title { font-weight: 600; font-size: .85rem; }
.option-row-desc { font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.option-row-control { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; }
.option-row-control .status-badge { flex: 0 1 auto; min-width: 0; }
.option-row-control .status-text { min-width: 0; overflow-wrap: anywhere; }

/* A styled checkbox (not a custom widget) - stays keyboard/AT accessible
 * for free. Wrap: <label class="toggle-switch"><input type=checkbox>
 * <span class="toggle-track"></span></label>. */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-switch .toggle-track {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background-color .15s ease;
}
.toggle-switch .toggle-track::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform .15s ease; box-shadow: 0 1px 2px #0004;
}
.toggle-switch input:checked + .toggle-track { background: var(--ok); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(18px); }
.toggle-switch input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-switch input:disabled + .toggle-track { opacity: .45; cursor: not-allowed; }

.btn-save {
  display: inline-block; margin-top: 1rem; padding: .6rem 1.5rem; border-radius: 8px; border: 0;
  background: var(--ok); color: #fff; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.btn-save:hover { filter: brightness(.92); }
.btn-save:disabled { opacity: .45; cursor: not-allowed; }

/* Same wide-rounded-pill shape/weight as .btn-save, for an action that
 * isn't literally "save" (Add account, Connect via OAuth). */
.btn-pill { display: inline-block; padding: .55rem 1.2rem; border-radius: 8px; border: 0; font-weight: 600; font-size: .82rem; cursor: pointer; text-decoration: none; }
.btn-pill-primary { background: var(--ok); color: #fff; }
.btn-pill-primary:hover { filter: brightness(.92); }
.btn-pill-neutral { background: var(--card); color: var(--ink); border: 1px solid var(--border); }
.btn-pill-neutral:hover { background: var(--card-2); }
.btn-pill-danger { background: var(--bad); color: #fff; }
.btn-pill-danger:hover { filter: brightness(.92); }
.btn-pill:disabled { opacity: .45; cursor: not-allowed; }

/* A lighter nested card inside a .card - one notch quieter so it doesn't
 * compete with the outer card's border (e.g. the Ngrok Tunnel card's
 * detail line, sitting below that card's own option-row toggle). */
.subpanel { margin-top: .7rem; padding: .7rem .85rem; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; font-size: .85rem; }

/* ---------------------------------------------------------------- shared UI (js/ui.js)
 * See .claude/skills/smm-dashboard-ui/SKILL.md. */

/* The count pill on a nav link (e.g. workflows waiting for review). */
.nav-count {
  margin-left: auto; min-width: 1.4em; padding: 0 .4rem; border-radius: 999px; text-align: center;
  font-size: .7rem; font-weight: 700; line-height: 1.5; background: var(--warn); color: #fff;
}
.nav-link.active .nav-count { background: var(--accent-ink); color: var(--accent); }

/* A small "i" whose text shows on hover or keyboard focus - built by
 * ui.js from <p class="explain"> or by infoTip(text). */
.info-tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: .4rem; padding: 0; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card-2); color: var(--muted);
  font: italic 700 .68rem/1 Georgia, serif; vertical-align: middle; cursor: help;
}
.info-tip:hover, .info-tip:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.info-tip::after {
  content: attr(data-tip); position: absolute; z-index: 40; left: -8px; top: calc(100% + 6px);
  width: max-content; max-width: min(320px, 70vw); padding: .5rem .65rem; border-radius: 8px;
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow);
  font: 400 .78rem/1.45 system-ui, sans-serif; text-align: left; white-space: normal;
  display: none; pointer-events: none; /* display, not opacity: a hidden bubble would still widen the page */
}
.info-tip:hover::after, .info-tip:focus-visible::after { display: block; }

/* Toasts: top-right, success fades (ui.js), errors stay until closed. */
.toast-host { position: fixed; top: 1rem; right: 1rem; z-index: 50; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast {
  display: flex; align-items: flex-start; gap: .6rem; padding: .65rem .75rem; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--ok);
  box-shadow: var(--shadow); font-size: .85rem;
}
.toast-error { border-left-color: var(--bad); }
.toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { border: 0; background: none; color: var(--muted); padding: 0 .2rem; font-size: .8rem; }

/* Segmented buttons for a small exclusive choice (list filters). */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg-item {
  border: 0; border-right: 1px solid var(--border); border-radius: 0; background: var(--card); color: var(--ink);
  padding: .4rem .55rem; font-size: .78rem; display: inline-flex; align-items: center; gap: .3rem;
}
.seg-item:last-child { border-right: 0; }
.seg-item:hover { background: var(--card-2); }
.seg-item[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg-count { font-size: .7rem; opacity: .8; }

/* A list's toolbar: filters, search, count, then actions on the right. */
.list-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .3rem 0 .6rem; }
.list-toolbar input[type="search"] { width: auto; flex: 1 1 180px; max-width: 280px; padding: .4rem .55rem; }
.list-toolbar .list-count { font-size: .78rem; color: var(--muted); margin-left: auto; }

/* List | detail workspace (Workflows review). Stacks under 900px. */
.split { display: grid; grid-template-columns: minmax(380px, 460px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.split > .card { margin-bottom: 0; min-width: 0; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* Tabs (js/ui.js): .page-tabs (page level, [data-page-panel] panels) and
 * [data-tab-strip] (inside a card, sibling [data-panel] panels) share one
 * look: a row of ghost buttons, the open one filled with the accent. */
.page-tabs, [data-tab-strip] { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
[data-tab-strip] { margin-bottom: .8rem; }
.tab-button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* uiConfirm() (js/ui.js): the shared confirm dialog. */
.ui-confirm {
  border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.2rem; max-width: min(440px, calc(100vw - 2rem));
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.ui-confirm::backdrop { background: #0008; }
.ui-confirm-text { margin: 0 0 1rem; white-space: pre-line; font-size: .92rem; }
.ui-confirm-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* A wide table scrolls inside its card instead of widening the page. */
.table-scroll { overflow-x: auto; max-width: 100%; }

/* Visible keyboard focus everywhere. */
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- icons & icon buttons
 * Line icons from static/icons.svg (<svg class="icon"><use href=...#i-name>),
 * and icon-only buttons whose label shows on hover/focus from data-tip
 * (also their aria-label) - ui.js's iconSvg()/iconButton() build them from
 * page JS. data-tip-pos="right" puts the label beside the button (for a
 * vertical tool rail). */
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: 8px; flex: none;
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
}
.icon-btn:hover:not(:disabled) { background: var(--card-2); border-color: var(--muted); }
.icon-btn.icon-btn-sm { width: 26px; height: 26px; border-radius: 6px; }
.icon-btn.icon-btn-sm .icon { width: 15px; height: 15px; }
.icon-btn.danger { background: var(--card); color: var(--bad); }
[data-tip]:not(.info-tip)::after {
  content: attr(data-tip); position: absolute; z-index: 45; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  width: max-content; max-width: 260px; padding: .3rem .55rem; border-radius: 6px;
  background: var(--ink); color: var(--paper); font: 500 .74rem/1.35 system-ui, sans-serif; text-align: center;
  white-space: normal; pointer-events: none; display: none;
}
[data-tip]:not(.info-tip):hover::after, [data-tip]:not(.info-tip):focus-visible::after { display: block; }
[data-tip][data-tip-pos="right"]::after { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
button.btn-with-icon { display: inline-flex; align-items: center; gap: .45rem; }

/* Sound control toggles near generate clip */
.clip-sound-toggles { display: inline-flex; align-items: center; gap: 4px; }
.btn-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.3px;
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  cursor: pointer; transition: all 0.15s ease; user-select: none;
}
.btn-toggle:hover:not(:disabled) { border-color: var(--muted); color: var(--ink); }
.btn-toggle.active {
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  border-color: var(--accent); color: var(--ink);
}
.btn-toggle:not(.active) {
  opacity: 0.55; text-decoration: line-through; background: var(--card);
}

/* A workspace page (Compose) uses the whole window width. */
.page.page-wide { max-width: none; }

/* Progress & Publishing Feedback components */
.progress-container {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.progress-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
}
.progress-percent {
  font-family: monospace, system-ui;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 700;
}
.progress-bar-track {
  height: 8px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-bar-fill.indeterminate {
  width: 40% !important;
  position: absolute;
  animation: progress-indeterminate 1.5s infinite ease-in-out;
}
.progress-bar-fill.success {
  background: var(--ok);
}
.progress-bar-fill.failed {
  background: var(--bad);
}
@keyframes progress-indeterminate {
  0% { left: -40%; }
  50% { left: 40%; }
  100% { left: 100%; }
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.progress-estimate {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  color: var(--warn);
}
.progress-pulse {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.2s infinite ease-in-out;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Under 900px the fixed menu button sits over the page's top-left corner -
 * this must come after the .page rule above, which would otherwise reset
 * the extra top padding back to 1.5rem on every page. */
@media (max-width: 900px) { .page { padding-top: 3.5rem; } }
