/* apanel stylesheet.
 *
 * One file, embedded in the binary, no build step, no external font. The api
 * serves `default-src 'self'` with no 'unsafe-inline', so nothing here relies
 * on a style attribute: quota bars get their width from a bucket class
 * (.p0 ... .p100) rather than from inline CSS.
 *
 * Colour lives entirely in custom properties. The light palette is defined on
 * bare :root; the dark one is redefined twice - once under
 * prefers-color-scheme for the "system" default, once under [data-theme=dark]
 * so an explicit choice wins in both directions.
 */

:root {
  color-scheme: light dark;

  --bg:        #f4f5f7;
  --bg-raised: #ffffff;
  --bg-sunken: #eceef1;
  --bg-hover:  #e7eaee;
  --bg-side:   #12161d;
  --bg-top:    #ffffff;

  --fg:        #1b2027;
  --fg-muted:  #5d6773;
  --fg-faint:  #8b95a1;
  --fg-side:   #c3ccd8;
  --fg-side-on:#ffffff;

  --line:      #d8dde4;
  --line-soft: #e6e9ee;

  --accent:      #2f6df0;
  --accent-weak: #e4ecfe;
  --accent-fg:   #ffffff;

  --ok:      #17794a;
  --ok-weak: #dcf3e6;
  --warn:      #a15c00;
  --warn-weak: #fdefd6;
  --crit:      #b4231f;
  --crit-weak: #fbe1e0;
  --busy:      #4a4fbf;
  --busy-weak: #e5e6fb;

  --radius: 7px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(16, 22, 32, .07), 0 1px 8px rgba(16, 22, 32, .05);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --sidebar-w: 216px;
  --topbar-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0f1319;
    --bg-raised: #171c24;
    --bg-sunken: #11151b;
    --bg-hover:  #202733;
    --bg-side:   #0b0e13;
    --bg-top:    #171c24;

    --fg:        #e7ecf3;
    --fg-muted:  #9aa5b3;
    --fg-faint:  #6b7686;
    --fg-side:   #96a2b2;
    --fg-side-on:#ffffff;

    --line:      #29313d;
    --line-soft: #1f2630;

    --accent:      #5b8dfa;
    --accent-weak: #1a2540;
    --accent-fg:   #0b0e13;

    --ok:      #4ec98a;
    --ok-weak: #10291d;
    --warn:      #e0a34a;
    --warn-weak: #2e2312;
    --crit:      #ef6f6b;
    --crit-weak: #331817;
    --busy:      #8f93f0;
    --busy-weak: #1d1e3a;

    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 10px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  --bg:        #0f1319;
  --bg-raised: #171c24;
  --bg-sunken: #11151b;
  --bg-hover:  #202733;
  --bg-side:   #0b0e13;
  --bg-top:    #171c24;

  --fg:        #e7ecf3;
  --fg-muted:  #9aa5b3;
  --fg-faint:  #6b7686;
  --fg-side:   #96a2b2;
  --fg-side-on:#ffffff;

  --line:      #29313d;
  --line-soft: #1f2630;

  --accent:      #5b8dfa;
  --accent-weak: #1a2540;
  --accent-fg:   #0b0e13;

  --ok:      #4ec98a;
  --ok-weak: #10291d;
  --warn:      #e0a34a;
  --warn-weak: #2e2312;
  --crit:      #ef6f6b;
  --crit-weak: #331817;
  --busy:      #8f93f0;
  --busy-weak: #1d1e3a;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 10px rgba(0, 0, 0, .35);
}

/* ------------------------------------------------------------ foundations */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 14px/1.5 var(--sans);
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.35rem; }
h2 { font-size: .95rem; letter-spacing: .01em; }
h3 { font-size: .82rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 1rem; }
p  { margin: 0 0 .6rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--fg-muted); }
.small { font-size: .82em; }
.mt { margin-top: 1.2rem; }

.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-fg);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

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

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "top top" "side main";
  min-height: 100vh;
}

.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: .8rem;
  padding: 0 .9rem;
  background: var(--bg-top);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}

.brand { display: flex; align-items: center; gap: .5rem; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brandmark { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.6; }
.brandmark .dot { fill: var(--accent); stroke: none; }
.brandname { font-weight: 650; letter-spacing: -.01em; }
.facetag {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-muted); border: 1px solid var(--line); border-radius: 999px;
  padding: .1rem .5rem;
}

.topright { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.whoami .actor { font-family: var(--mono); font-size: .8rem; color: var(--fg-muted); }

.themectl { display: flex; gap: .1rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 26px; padding: 0;
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--fg-muted); cursor: pointer;
}
.iconbtn:hover { background: var(--bg-hover); color: var(--fg); }
.iconbtn[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent); }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.navtoggle { display: none; }

/* -------------------------------------------------------------- sidebar */

.sidebar {
  grid-area: side;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  padding: .8rem .55rem;
  overflow-y: auto;
}

.navlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.navlink {
  display: block; padding: .45rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--fg-side); font-size: .88rem;
}
.navlink:hover { background: rgba(255, 255, 255, .06); color: var(--fg-side-on); text-decoration: none; }
.navlink.on { background: var(--accent); color: #fff; font-weight: 550; }
.navnote { margin: 1rem .6rem 0; font-size: .8rem; }
.navnote a { color: var(--fg-side); }

/* ----------------------------------------------------------------- main */

.main {
  grid-area: main;
  padding: 1.1rem 1.2rem 2rem;
  min-width: 0;
}
.main:focus { outline: none; }

.pagehead { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-bottom: .3rem; }
.pagehead .btn { margin-left: auto; }
.pagetitle { margin: 0; }
.sub { color: var(--fg-muted); margin: 0 0 1rem; }

.foot {
  margin-top: 2.5rem; padding-top: .8rem;
  border-top: 1px solid var(--line-soft);
  display: flex; gap: .6rem;
  color: var(--fg-faint); font-size: .78rem;
}

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

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem 1rem;
  margin-bottom: 1rem;
}
.card.danger { border-color: var(--crit); }
.card.secret { border-color: var(--warn); background: var(--warn-weak); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.cards .card { margin: 0; }

.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }

.stat .big { font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; margin: .1rem 0 .2rem; }
.stat .unit { font-size: .9rem; color: var(--fg-muted); margin-left: .1rem; }

/* --------------------------------------------------------------- tables */

.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); }
.card .tblwrap { border: 0; border-radius: 0; }

.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th, .tbl td { padding: .5rem .65rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
.tbl thead th {
  position: sticky; top: 0;
  background: var(--bg-sunken); color: var(--fg-muted);
  font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; border-bottom: 1px solid var(--line);
}
.tbl tbody tr:last-child th, .tbl tbody tr:last-child td { border-bottom: 0; }
.tbl.striped tbody tr:hover { background: var(--bg-hover); }
.tbl.dense th, .tbl.dense td { padding: .34rem .55rem; }
.tbl .narrow { min-width: 150px; }
.tbl .sparkcell { width: 120px; }
.tbl tr.rowwarn { background: var(--warn-weak); }

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

.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .75rem;
  font: inherit; font-size: .85rem; font-weight: 500;
  color: var(--fg); background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn.small { padding: .22rem .55rem; font-size: .8rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.warn { border-color: var(--warn); color: var(--warn); }
.btn.danger { border-color: var(--crit); color: var(--crit); }
.btn.disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.btnrow { display: flex; flex-wrap: wrap; gap: .5rem; }
.inlineform { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }

input[type="text"], input[type="email"], input[type="search"], input[type="number"], select {
  font: inherit; font-size: .86rem;
  padding: .35rem .5rem;
  color: var(--fg); background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  max-width: 100%;
}
input:disabled, select:disabled { opacity: .6; }

.searchbar { display: flex; gap: .5rem; margin: .8rem 0; }
.searchbar input { flex: 1 1 auto; min-width: 0; }

.form { display: grid; gap: .9rem; max-width: 660px; }
.form.inline { max-width: none; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.field { display: grid; gap: .25rem; min-width: 0; }
.field > label { font-size: .82rem; font-weight: 550; color: var(--fg-muted); }
.field.bad input, .field.bad select { border-color: var(--crit); }
.field.check { display: flex; align-items: center; gap: .45rem; }
.field.check > label { font-weight: 400; color: var(--fg); }
.checkrow { display: flex; flex-wrap: wrap; gap: 1rem; }
.hint { margin: 0; font-size: .78rem; color: var(--fg-faint); }
.actions { display: flex; gap: .6rem; align-items: center; }

fieldset { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .8rem .9rem; margin: 0; }
legend { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); padding: 0 .35rem; }
fieldset.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem; }

/* --------------------------------------------------------------- pieces */

.badge {
  display: inline-block; padding: .1rem .45rem;
  font-size: .75rem; font-weight: 600; border-radius: 999px;
  background: var(--bg-sunken); color: var(--fg-muted);
  white-space: nowrap;
}
.badge.ok   { background: var(--ok-weak);   color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.crit { background: var(--crit-weak); color: var(--crit); }
.badge.busy { background: var(--busy-weak); color: var(--busy); }

.tag {
  display: inline-block; padding: .05rem .4rem;
  font-size: .74rem; font-family: var(--mono);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--fg-muted);
}
.tags { display: inline-flex; gap: .35rem; align-items: center; }

.banner {
  padding: .55rem .8rem; margin: 0 0 1rem;
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
}
.banner.ok   { border-left-color: var(--ok);   background: var(--ok-weak); }
.banner.warn { border-left-color: var(--warn); background: var(--warn-weak); }
.banner.err  { border-left-color: var(--crit); background: var(--crit-weak); }
.banner.demo { border-left-color: var(--busy); background: var(--busy-weak); font-size: .82rem; }

.note {
  margin: .7rem 0 0; padding-left: .7rem;
  border-left: 2px solid var(--line);
  color: var(--fg-muted); font-size: .82rem;
}

.empty { color: var(--fg-faint); font-style: italic; padding: 1rem 0; margin: 0; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: .25rem .9rem; margin: 0; }
.kv dt { color: var(--fg-muted); font-size: .82rem; }
.kv dd { margin: 0; }
.kv.tight { gap: .1rem .8rem; }

.plainlist, .sitelist, .joblist, .alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.sitelist li, .joblist li {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .4rem 0; border-bottom: 1px solid var(--line-soft);
}
.sitelist li:last-child, .joblist li:last-child { border-bottom: 0; }
.joblist li { display: block; }
.joblist li > * { margin-right: .5rem; }

.alerts .alert { display: flex; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.alerts .alert:last-child { border-bottom: 0; }
.alerts .alert p { margin: .1rem 0; color: var(--fg-muted); font-size: .85rem; }
.alerts .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; flex: 0 0 auto; background: var(--fg-faint); }
.alerts .alert.info .dot { background: var(--busy); }
.alerts .alert.warn .dot { background: var(--warn); }
.alerts .alert.crit .dot { background: var(--crit); }
.alertlink { font-size: .82rem; }

.pager { display: flex; align-items: center; gap: .8rem; padding: .6rem .2rem 0; flex-wrap: wrap; }
.pagerbtns { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.pagenum { font-size: .82rem; color: var(--fg-muted); }

.errorcard { max-width: 480px; }
.errorcode { font-size: 2.4rem; font-weight: 700; color: var(--fg-faint); margin: 0; }

.placeholder { text-align: center; padding: 2rem 1rem; }
.placeholdermark { width: 56px; height: 56px; fill: none; stroke: var(--fg-faint); stroke-width: 1.5; stroke-linecap: round; margin-bottom: .6rem; }

.secretvalue {
  font-size: 1.05rem; letter-spacing: .02em;
  padding: .5rem .7rem; margin: .4rem 0;
  background: var(--bg-raised); border: 1px dashed var(--warn);
  border-radius: var(--radius-sm);
  word-break: break-all; user-select: all;
}

/* --------------------------------------------------------------- charts */

.spark { width: 100%; height: 40px; display: block; overflow: visible; }
.sparkline { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.sparkarea { fill: var(--accent); opacity: .12; stroke: none; }
.sparkdot { fill: var(--accent); }

.bars { width: 100%; height: 52px; display: block; }
.bar { fill: var(--accent); }
.bar.warn { fill: var(--warn); }
.bar.crit { fill: var(--crit); }

.meter { display: grid; gap: .2rem; min-width: 130px; }
.meterbar {
  height: 6px; border-radius: 999px;
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  overflow: hidden;
}
.meterfill { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.meterfill.warn { background: var(--warn); }
.meterfill.crit { background: var(--crit); }
.metertext { font-size: .78rem; color: var(--fg); white-space: nowrap; }

/* Quota widths come from bucket classes, not inline styles: the panel's CSP
 * has no 'unsafe-inline', and this way the bar is correct with JS disabled. */
.p0{width:0}.p5{width:5%}.p10{width:10%}.p15{width:15%}.p20{width:20%}
.p25{width:25%}.p30{width:30%}.p35{width:35%}.p40{width:40%}.p45{width:45%}
.p50{width:50%}.p55{width:55%}.p60{width:60%}.p65{width:65%}.p70{width:70%}
.p75{width:75%}.p80{width:80%}.p85{width:85%}.p90{width:90%}.p95{width:95%}
.p100{width:100%}

/* -------------------------------------------------------------- htmx bits */

[data-hx-indicator] { opacity: .55; }
.hx-busy { opacity: .55; transition: opacity .1s linear; }

/* --------------------------------------------------------------- mobile */

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "main";
  }
  .navtoggle { display: inline-flex; }
  .sidebar {
    position: fixed; inset: var(--topbar-h) auto 0 0;
    width: var(--sidebar-w); z-index: 30;
    transform: translateX(-100%);
    transition: transform .16s ease-out;
  }
  .sidebar.open { transform: translateX(0); }
  .facetag { display: none; }
  .whoami { display: none; }
  .main { padding: .9rem .8rem 2rem; }
  .cols2 { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- login
   Served by internal/api (GET /login), not by the UI's layout, so these
   classes must stand on their own: no sidebar, no topbar, no JS. */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}
.login-card {
  width: min(22rem, calc(100vw - 2rem));
  padding: 2rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}
.login-title {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--fg);
}
.login-error {
  margin: 0 0 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: var(--danger-bg, #fde8e8);
  color: var(--danger, #a12626);
  font-size: 0.875rem;
}
.login-form { display: grid; gap: 0.35rem; }
.login-form label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-dim);
}
.login-form label + input { margin-bottom: 0.75rem; }
.login-form input {
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.login-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.login-form button {
  margin-top: 0.5rem;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.login-form button:hover { filter: brightness(1.08); }

/* ---------------------------------------------------------------------------
 * File manager (internal/web/files.go).
 *
 * No style attribute anywhere here either: the CSP has no 'unsafe-inline', so
 * anything that would have been an inline width is a class instead.
 * ------------------------------------------------------------------------- */

.crumbs { margin: .6rem 0 1rem; }
.crumblist {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .25rem .1rem; margin: 0; padding: 0; list-style: none;
  font-size: .92rem;
}
.crumblist li + li::before {
  content: "/"; margin: 0 .35rem; color: var(--fg-faint);
}
.crumblist [aria-current="page"] { font-weight: 600; }

.filesquota .cardlinks,
.cardlinks { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 0; }

.filestoolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.25rem;
}
.filestoolbar form { display: flex; align-items: center; gap: .4rem; margin: 0; }
.filestoolbar input[type="text"],
.filestoolbar input[type="search"] { min-width: 12rem; }
.toolbarlinks { display: flex; gap: .5rem; margin: 0; }
.btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }

.uploadcard.dragover { border-color: var(--accent); background: var(--accent-weak); }
.uploadform { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.progressline { margin: .5rem 0 0; font-size: .88rem; color: var(--fg-muted); }

.filestable td, .filestable th { vertical-align: top; }
.filestable .pick { width: 1.8rem; }
.filestable .num { text-align: right; white-space: nowrap; }
.filestable .fname { word-break: break-all; }
.filestable .rowactions {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: flex-start;
}
.rowmenu > summary { list-style: none; cursor: pointer; display: inline-block; }
.rowmenu > summary::-webkit-details-marker { display: none; }
.rowform {
  display: flex; gap: .35rem; align-items: center;
  margin-top: .35rem; padding: .4rem;
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.ftype {
  display: inline-block; padding: .05rem .4rem; border-radius: 999px;
  font-size: .75rem; background: var(--bg-sunken); color: var(--fg-muted);
  white-space: nowrap;
}
.ftype.dir { background: var(--accent-weak); color: var(--accent); }
.ftype.archive { background: var(--warn-weak); color: var(--warn); }
.ftype.link { background: var(--busy-weak); color: var(--busy); }
.ftype.special { background: var(--crit-weak); color: var(--crit); }

.bulkform { display: flex; flex-wrap: wrap; gap: 1rem; }
.bulkgroup {
  flex: 1 1 15rem; margin: 0; padding: .7rem .8rem;
  border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.bulkgroup legend { padding: 0 .3rem; font-size: .82rem; color: var(--fg-muted); }
.bulkgroup label { display: block; font-size: .82rem; margin-bottom: .2rem; }
.bulkgroup label.check { display: flex; align-items: center; gap: .35rem; margin: .4rem 0; }
.bulkgroup input[type="text"], .bulkgroup select { width: 100%; margin-bottom: .5rem; }
.bulkgroup.danger { border-color: var(--crit); }

/* The editor: a gutter and a textarea, side by side, scrolling together. */
.editor {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-sunken); overflow: hidden;
}
.editor .gutter {
  margin: 0; padding: .6rem .5rem; list-style: none;
  text-align: right; color: var(--fg-faint);
  font-family: var(--mono); font-size: .82rem; line-height: 1.5;
  background: var(--bg-hover); border-right: 1px solid var(--line-soft);
  overflow: hidden; user-select: none; min-width: 2.6rem;
}
.editor textarea.code {
  flex: 1; min-height: 26rem; padding: .6rem .7rem;
  border: 0; outline-offset: -2px; resize: vertical;
  font-family: var(--mono); font-size: .82rem; line-height: 1.5;
  color: var(--fg); background: var(--bg-raised);
  white-space: pre; overflow: auto; tab-size: 4;
}
.editoractions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 .3rem; }
.kv.inline { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin: 0; }
.kv.inline dt { color: var(--fg-muted); font-size: .82rem; }
.kv.inline dd { margin: 0 1rem 0 0; }
