:root {
  --bg: #0f1216;
  --panel: #161a20;
  --panel-2: #1c2129;
  --line: #262c36;
  --line-2: #323a46;
  --text: #e6e9ee;
  --muted: #8b94a3;
  --dim: #5f6876;
  --brand: #3b82f6;
  --brand-2: #2563eb;
  --ok: #34c77b;
  --warn: #f2b33d;
  --bad: #f05252;
  --grey: #8b94a3;
  --radius: 10px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
  /* Discord preview palette */
  --dc-bg: #313338; --dc-embed: #2b2d31; --dc-text: #dbdee1; --dc-muted: #949ba4; --dc-link: #00a8fc;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); }
.brand .name { font-weight: 700; line-height: 1.2; font-size: 13.5px; }
.brand .brand-sub { font-size: 11.5px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 520; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(59,130,246,.14); color: #cfe0ff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.side .foot img { width: 28px; height: 28px; border-radius: 50%; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); display: inline-block; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,199,123,.18); }
.status-dot.off { background: var(--bad); }
main { padding: 26px 32px 80px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.topbar { display: none; }

/* ---------- surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2 + * { margin-top: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }

/* ---------- lists / tables */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item:hover { background: rgba(255,255,255,.015); }
.item .title { font-weight: 600; }
.item .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 2px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap; }
.badge.ok { color: var(--ok); background: rgba(52,199,123,.1); border-color: rgba(52,199,123,.25); }
.badge.bad { color: var(--bad); background: rgba(240,82,82,.1); border-color: rgba(240,82,82,.25); }
.badge.warn { color: var(--warn); background: rgba(242,179,61,.1); border-color: rgba(242,179,61,.25); }
.badge.info { color: #8fb8ff; background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.25); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 12.5px; }
.chip.on { background: rgba(59,130,246,.15); border-color: rgba(59,130,246,.5); color: #cfe0ff; }
.role-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- forms */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 550; color: var(--muted); }
label.f .hint { font-weight: 400; color: var(--dim); font-size: 11.5px; }
.f-head { display: flex; justify-content: space-between; gap: 8px; }
.count { font-weight: 400; color: var(--dim); font-variant-numeric: tabular-nums; }
.count.over { color: var(--bad); font-weight: 600; }
input[type=text], input[type=url], input[type=number], input[type=datetime-local], input[type=date], input[type=month], input[type=time], input[type=search], select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13.5px; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
input[type=color] { width: 38px; height: 36px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); cursor: pointer; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b94a3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.check input { margin-top: 3px; accent-color: var(--brand); width: 15px; height: 15px; }
.check .hint { display: block; font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 22px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }
.daypick { display: flex; gap: 6px; flex-wrap: wrap; }
.daypick label { cursor: pointer; }
.daypick input { display: none; }
.daypick span { display: inline-block; min-width: 44px; text-align: center; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-2); color: var(--muted); font-weight: 600; font-size: 12.5px; }
.daypick input:checked + span { background: rgba(59,130,246,.18); color: #cfe0ff; border-color: rgba(59,130,246,.5); }
.picker { border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); }
.picker input[type=search] { border: 0; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; box-shadow: none; }
.picker .opts { max-height: 200px; overflow-y: auto; padding: 4px; }
.picker .opts label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; color: var(--text); font-weight: 450; font-size: 13px; }
.picker .opts label:hover { background: var(--panel-2); }
.picker .opts input { accent-color: var(--brand); }
.picker .sel { padding: 6px 8px 0; display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 560; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s; }
.btn:hover { background: #232934; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: #ffb4b4; border-color: rgba(240,82,82,.35); background: rgba(240,82,82,.08); }
.btn.danger:hover { background: rgba(240,82,82,.16); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.icon { padding: 6px; }
.btn svg { width: 16px; height: 16px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 20px; align-items: start; }
.editor .preview-col { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 12px; }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.section > summary, .section > .s-head { list-style: none; cursor: pointer; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 620; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after { content: "›"; color: var(--muted); font-size: 18px; transform: rotate(90deg); transition: transform .15s; }
.section:not([open]) > summary::after { transform: rotate(0deg); }
.section .s-body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.sub { border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.sub-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 16px; }
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 560; padding: 8px 10px; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--brand); }
.vars { display: flex; gap: 5px; flex-wrap: wrap; }
.vars code { background: var(--panel-2); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 5px; cursor: pointer; }
.vars code:hover { border-color: var(--brand); }
.next-runs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.next-runs li::before { content: "→ "; color: var(--dim); }
.savebar { position: sticky; bottom: 0; z-index: 5; margin-top: 16px; padding: 12px 16px; background: rgba(22,26,32,.92); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.err-box { background: rgba(240,82,82,.08); border: 1px solid rgba(240,82,82,.3); color: #ffc9c9; border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.info-box { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.28); color: #cfe0ff; border-radius: 8px; padding: 9px 12px; font-size: 13px; }

/* ---------- Discord preview */
.dc { background: var(--dc-bg); border-radius: var(--radius); padding: 14px 16px 16px; color: var(--dc-text); font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; line-height: 1.375; border: 1px solid #222327; }
.dc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dc-muted); margin-bottom: 10px; display: flex; justify-content: space-between; }
.dc-msg { display: flex; gap: 14px; }
.dc-av { width: 40px; height: 40px; border-radius: 50%; flex: none; background: #5865f2; object-fit: cover; }
.dc-body { min-width: 0; flex: 1; }
.dc-name { font-weight: 600; color: #f2f3f5; }
.dc-app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 3px; margin-left: 4px; vertical-align: 2px; }
.dc-time { color: var(--dc-muted); font-size: 12px; margin-left: 6px; }
.dc-content { word-wrap: break-word; }
.dc-content p { margin: 0; }
.dc a { color: var(--dc-link); }
.dc code { background: #2b2d31; border: 1px solid #1e1f22; padding: 0 3px; border-radius: 3px; font-size: 13px; }
.dc pre { background: #2b2d31; border: 1px solid #1e1f22; padding: 7px 9px; border-radius: 4px; white-space: pre-wrap; margin: 4px 0; font-size: 13px; }
.dc blockquote { margin: 0; padding-left: 12px; border-left: 4px solid #4e5058; }
.dc .mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc .ts { background: rgba(255,255,255,.06); border-radius: 3px; padding: 0 2px; }
.dc .spoiler { background: #1e1f22; color: transparent; border-radius: 3px; }
.dc .h1 { font-size: 1.5em; font-weight: 700; margin: 6px 0 2px; display: block; }
.dc .h2 { font-size: 1.25em; font-weight: 700; margin: 6px 0 2px; display: block; }
.dc .h3 { font-size: 1.05em; font-weight: 700; margin: 6px 0 2px; display: block; }
.dc .subtext { font-size: 12px; color: var(--dc-muted); display: block; }
.dc ul { margin: 2px 0; padding-left: 22px; }
.dc-embed { display: grid; grid-template-columns: minmax(0,1fr) auto; background: var(--dc-embed); border-left: 4px solid #1e1f22; border-radius: 4px; padding: 8px 16px 14px 12px; margin-top: 6px; max-width: 432px; gap: 0 14px; }
.dc-embed .e-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.dc-embed .e-author { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dc-embed .e-author img { width: 24px; height: 24px; border-radius: 50%; }
.dc-embed .e-title { font-weight: 700; color: #f2f3f5; font-size: 16px; }
.dc-embed .e-desc { font-size: 14px; }
.dc-embed .e-fields { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 2px; }
.dc-embed .e-field { grid-column: 1 / -1; font-size: 14px; min-width: 0; }
.dc-embed .e-field.inline { grid-column: auto; }
.dc-embed .e-fname { font-weight: 600; color: #f2f3f5; margin-bottom: 2px; }
.dc-embed .e-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; margin-top: 8px; }
.dc-embed .e-image { grid-column: 1 / -1; max-width: 100%; border-radius: 4px; margin-top: 12px; }
.dc-embed .e-footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dc-muted); margin-top: 8px; }
.dc-embed .e-footer img { width: 20px; height: 20px; border-radius: 50%; }
.dc-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dc-btn { background: #4e5058; color: #fff; border-radius: 4px; padding: 6px 14px; font-size: 14px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.dc-btn::after { content: "↗"; font-size: 12px; opacity: .8; }

/* ---------- log entries */
.log { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); align-items: start; }
.log:first-child { border-top: 0; }
.log .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; background: var(--panel-2); }
.log .when { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.log details { margin-top: 6px; }
.log summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.log .diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.log .diff div { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.log .diff b { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; letter-spacing: .05em; }
.log pre { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; font-size: 12px; max-height: 260px; overflow: auto; }

/* ---------- overlays */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #222833; border: 1px solid var(--line-2); border-left: 4px solid var(--brand); border-radius: 9px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pop .18s ease-out; font-size: 13.5px; }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast a { font-weight: 600; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(5,7,10,.66); display: grid; place-items: center; z-index: 90; padding: 18px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; width: min(460px, 100%); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 14px; }
.modal.wide { width: min(760px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; }
.modal p { margin: 0; color: var(--muted); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }

/* ---------- responsive */
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor .preview-col { position: static; order: -1; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 40px rgba(0,0,0,.4); }
  .shell.nav-open .side { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 40; }
  .topbar .btn { padding: 6px; }
  main { padding: 18px 14px 80px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .log { grid-template-columns: 30px 1fr; }
  .log .when { grid-column: 2; text-align: left; }
  .log .diff { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .item { flex-wrap: wrap; }
}
.dc-btn.no-arrow::after { content: none; }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.msearch { position: relative; }
.mresults { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.mresults:empty { display: none; }
.mres { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 8px; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.mres:hover { border-color: var(--brand); }
.mres img { width: 22px; height: 22px; border-radius: 50%; }
.permgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 18px; }
.permgrid .check { margin: 3px 0; }
h3 + .grid2, h3 + .grid3 { margin-top: -4px; }
.modal h3 { margin-top: 6px; }

/* ---------- suggestions */
.nav-count { margin-left: auto; background: var(--warn); color: #1b1300; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.sg-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.sg-shell.has-detail, .sg-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 540px); }
.sg-detail-col { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow: auto; padding-bottom: 4px; }
.sg-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.sg-item:first-child { border-top: 0; }
.sg-item:hover { background: rgba(255,255,255,.02); }
.sg-item.sel { background: rgba(59,130,246,.1); box-shadow: inset 3px 0 0 var(--brand); }
.sg-item .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 4px 12px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.sg-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-score { width: 54px; flex: none; text-align: center; border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 0; background: var(--panel-2); }
.sg-score b { display: block; font-size: 16px; }
.sg-score span { display: block; font-size: 10.5px; color: var(--dim); }
.sg-score.pos b { color: var(--ok); } .sg-score.neg b { color: var(--bad); }
.sg-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); white-space: nowrap; }
.sg-author { display: flex; gap: 10px; align-items: center; }
.sg-author img, .sg-av { width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); flex: none; }
.sg-body { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; }
.sg-votes { display: flex; flex-direction: column; gap: 6px; }
.sg-votes.big { font-size: 15px; }
.sg-bar { height: 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; display: flex; }
.sg-bar span { background: var(--ok); } .sg-bar i { background: var(--bad); }
.sg-voters { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; margin-top: 6px; color: var(--muted); max-height: 160px; overflow: auto; }
.sg-statuses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sg-st { font: inherit; font-size: 13px; font-weight: 600; padding: 8px 6px; border-radius: 8px; cursor: pointer; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.sg-st small { font-size: 10px; color: var(--dim); font-weight: 500; }
.sg-st:hover { border-color: var(--c); }
.sg-st.on { background: color-mix(in srgb, var(--c) 22%, transparent); border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.sg-quote { border-left: 3px solid var(--line-2); padding: 2px 8px; margin-top: 3px; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.sg-history, .sg-notes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sg-history li { display: grid; grid-template-columns: 120px 1fr; gap: 8px; font-size: 13px; }
.sg-notes li { background: rgba(242,179,61,.06); border: 1px solid rgba(242,179,61,.22); border-radius: 8px; padding: 8px 10px; }
.danger-text { color: var(--bad) !important; }
.sg-form-preview { margin-top: 12px; }
.sgf { background: #313338; border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; color: #f2f3f5; font-size: 14px; border: 1px solid #222327; }
.sgf label { display: flex; flex-direction: column; gap: 3px; font-weight: 600; font-size: 13px; }
.sgf small { color: #949ba4; font-weight: 400; font-size: 12px; }
.sgf-in { background: #1e1f22; border-radius: 6px; padding: 8px 10px; color: #6d6f78; font-weight: 400; min-height: 34px; }
.sgf-in.tall { min-height: 64px; }
@media (max-width: 1100px) {
  .sg-shell, .sg-shell.has-detail { grid-template-columns: 1fr; }
  .sg-shell.has-detail > :first-child { display: none; }
  .sg-shell:not(.has-detail) .sg-detail-col { display: none; }
  .sg-detail-col { position: static; max-height: none; }
  .sg-statuses { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- financials */
.tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); font-weight: 600; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl tr.cur td { background: rgba(59,130,246,.08); }
.tbl tr.tot td { font-weight: 700; border-top: 1px solid var(--line-2); }
.tbl tr.ended td { opacity: .55; }
.tbl tr.sep td { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); background: var(--panel-2); padding: 6px 16px; }
.tbl td.empty { text-align: center; color: var(--muted); padding: 22px; }
.fin-bar { height: 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin-top: 8px; }
.fin-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #5ee0a0); }
.money { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-2); padding-left: 10px; }
.money span { color: var(--muted); }
.money input { border: 0 !important; background: transparent !important; box-shadow: none !important; }
@media (max-width: 760px) { .tbl th:nth-child(n+4), .tbl td:nth-child(n+4):not(:last-child) { display: none; } }
.sg-quick code { font-family: var(--font); font-size: 12.5px; padding: 4px 9px; border-radius: 999px; color: var(--muted); }
.sg-quick code:hover { color: var(--text); }

/* ---------- personnel */
.p-av { border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line-2); flex: none; object-fit: cover; }
.p-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.p-tree { position: sticky; top: 16px; padding: 6px 0; }
.p-tree-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; color: var(--muted); font-size: 13.5px; border-left: 3px solid transparent; }
.p-tree-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.p-tree-item.on { background: rgba(59,130,246,.12); color: var(--text); border-left-color: var(--c, var(--brand)); }
.p-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }
.p-group-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 10px 16px 6px; background: var(--panel-2); border-top: 1px solid var(--line); }
.p-group:first-child .p-group-h { border-top: 0; }
.p-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--text); }
.p-row:hover { background: rgba(255,255,255,.025); text-decoration: none; }
.p-row .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 4px 12px; flex-wrap: wrap; margin-top: 2px; }
.p-callsign { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 6px; color: var(--muted); }
.p-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 40%; }
.p-head { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; }
.p-positions { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 12px; }
.p-pos { border-top: 3px solid var(--c); }
.p-pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 12px; }
.p-pos-grid > div > span:first-child { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.p-pos-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); border-style: dashed; cursor: pointer; font: inherit; min-height: 130px; }
.p-pos-add:hover { color: var(--text); border-color: var(--brand); }
.p-pos-add svg { width: 22px; height: 22px; }
.p-pos-add small { color: var(--dim); }
.p-history { list-style: none; margin: 0; padding: 12px 16px 16px; display: flex; flex-direction: column; }
.p-history li { display: grid; grid-template-columns: 100px 28px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.p-history li:first-child { border-top: 0; }
.p-hdate { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.p-hicon { text-align: center; }
.p-rec { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--panel-2); }
.p-rec.void { opacity: .6; }
.p-rec.void b { text-decoration: line-through; }
.p-rec-body { margin-top: 8px; font-size: 13.5px; white-space: normal; overflow-wrap: anywhere; }
.p-results { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; max-height: 200px; overflow: auto; }
.p-res { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.p-res:hover { background: var(--panel-2); }
.p-res.on { background: rgba(59,130,246,.12); cursor: default; }
.p-res .btn { margin-left: auto; }
@media (max-width: 1000px) { .p-shell { grid-template-columns: 1fr; } .p-tree { position: static; } .p-head { flex-wrap: wrap; } .p-tags { display: none; } }
input[type=date], input[type=month], input[type=datetime-local] { color-scheme: dark; }

.p-tree-item.out { opacity: .55; cursor: default; }
.p-tree-item.out:hover { background: none; color: var(--muted); }
