:root {
  color-scheme: dark;
  --bg: #0e1017;
  --sidebar: #12141e;
  --panel: #151824;
  --panel-raised: #1b1e2d;
  --line: #292d3e;
  --text: #f4f4fa;
  --muted: #a9adc2;
  --faint: #8f94ae;
  --accent: #b4a1ff;
  --teal: #75e0c3;
  --amber: #f0c378;
  --danger: #ffadb8;
  --radius: 16px;
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 3.2vw, 3.3rem); font-weight: 700; line-height: 1.08; letter-spacing: -.055em; }
h2 { font-size: 1.18rem; font-weight: 650; letter-spacing: -.02em; }
h3 { font-size: 1rem; font-weight: 650; }
p, small { color: var(--muted); }
.skip { position: fixed; top: 8px; left: 12px; z-index: 5; transform: translateY(-150%); background: var(--panel); padding: 8px 12px; }
.skip:focus { transform: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 221px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; background: var(--sidebar); border-right: 1px solid var(--line); padding: 28px 17px 20px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; width: fit-content; font-size: 1.14rem; font-weight: 710; line-height: 1; letter-spacing: -.02em; }
.sidebar .brand { margin: 0 10px 41px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #21163e; background: linear-gradient(145deg,#e0d4ff,#aa8efa); font-size: 1.42rem; font-weight: 820; box-shadow: 0 4px 16px #8662e43b; }
.brand-detail { display: block; color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-top: 5px; }
nav { display: grid; gap: 5px; }
nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 13px; border: 1px solid transparent; border-radius: 10px; font-weight: 600; color: var(--muted); }
nav a span { min-width: 18px; text-align: center; font: 1.12rem/1 system-ui, sans-serif; }
nav a:hover { background: #1d2030; color: var(--text); }
nav a[aria-current] { color: #e2d9ff; background: #25213a; border-color: #3b3256; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); font-size: .84rem; font-weight: 600; }
.sidebar-foot small { display: block; color: var(--faint); padding-left: 15px; margin-top: 4px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 100%; background: var(--faint); }
.status-dot[data-state="online"] { background: var(--teal); box-shadow: 0 0 8px #75e0c35c; }
.status-dot[data-state="offline"] { background: var(--danger); }
.topbar { min-height: 67px; padding: 12px clamp(18px, 3.3vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #10121a; border-bottom: 1px solid var(--line); }
.breadcrumb, .top-actions { display: flex; align-items: center; gap: 11px; }
.breadcrumb { color: var(--faint); font-size: .88rem; white-space: nowrap; }
.breadcrumb strong { color: var(--text); }
.environment { border: 1px solid #57482a; color: #f4cf8d; background: #2a2419; border-radius: 30px; font-size: .76rem; font-weight: 650; padding: 4px 10px; white-space: nowrap; }
.environment i { display: inline-block; background: #e8bc72; width: 6px; height: 6px; margin-right: 3px; vertical-align: 2px; border-radius: 50%; }
.button { border: 1px solid var(--line); background: var(--panel-raised); color: var(--text); border-radius: 9px; font-weight: 650; font-size: .87rem; cursor: pointer; padding: 8px 13px; white-space: nowrap; min-height: 38px; }
.button:hover:not(:disabled) { background: #292e42; }
.button.quiet { background: transparent; }
.button.primary { color: #1b1330; background: #bba8ff; border-color: #c9b9ff; }
.button.primary:hover:not(:disabled) { background: #d1c3ff; }
#refresh { font-size: 1.22rem; padding: 3px 10px; }
main#content { max-width: 1550px; margin-inline: auto; padding: 32px clamp(18px, 3.3vw, 48px) 48px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 27px; }
.page-head .button { margin-bottom: 3px; }
.overline { font-family: ui-monospace, "Cascadia Code", monospace; color: var(--accent); font-size: .73rem; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 10px; }
.lead { font-size: .97rem; margin-top: 11px; }
.metrics, .business-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; }
.metric, .panel, .business { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.metric { padding: 16px 18px; min-height: 123px; }
.metric > div { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--muted); font-size: .81rem; font-weight: 600; }
.metric strong { display: block; font-size: clamp(1.34rem, 2.2vw, 2.2rem); font-weight: 680; line-height: 1.1; letter-spacing: -.05em; margin: 9px 0 5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric small { font-size: .77rem; }
.tile-icon { display: grid; place-items: center; border-radius: 9px; width: 30px; height: 30px; flex: 0 0 auto; font-size: .92rem; }
.tile-icon.violet { color: #c6b4ff; background: #2c2449; }
.tile-icon.mint { color: var(--teal); background: #1e3c3c; }
.tile-icon.amber { color: var(--amber); background: #3b2d20; }
.tile-icon.blue { color: #94c5ff; background: #1e314a; }
.section-head { margin: 25px 0 12px; }
.section-head p, .panel-head p { font-size: .82rem; margin-top: 2px; }
.business { display: flex; flex-direction: column; padding: 15px 16px; gap: 11px; }
.business h3 { margin-top: 1px; }
.business .scope { display: flex; align-items: center; justify-content: space-between; }
.business p, .business small { font-size: .79rem; overflow-wrap: anywhere; }
.business .plan { min-height: 40px; }
.business small { color: var(--faint); display: block; margin-top: 2px; }
.business .business-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; border-top: 1px solid var(--line); padding-top: 9px; margin-top: auto; font-size: .76rem; }
.business-meta b { color: var(--text); }
.subtle-link { font-size: .78rem; white-space: nowrap; color: var(--accent); font-weight: 650; }
.subtle-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.overview-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.15fr); gap: 13px; }
.business-grid + .overview-grid { margin-top: 15px; }
.panel-head { padding: 17px 18px 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.queue { display: grid; gap: 11px; padding: 4px 18px 19px; }
.queue-row { display: grid; grid-template-columns: 108px minmax(0,1fr) 28px; gap: 10px; align-items: center; color: var(--muted); font-size: .82rem; }
.queue-row b { text-align: end; color: var(--text); font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 8px; color: var(--accent); accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #272c40; border-radius: 20px; }
progress::-webkit-progress-value { background: #a38aef; border-radius: 20px; }
.activity { margin: 0; list-style: none; padding: 0 18px 11px; }
.activity li { padding: 10px 0; display: flex; align-items: flex-start; gap: 10px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.activity li:first-child { border-top: 0; }
.activity li .tile-icon { width: 27px; height: 27px; }
.activity li > div { min-width: 0; flex: 1; }
.activity strong { font-size: .85rem; font-weight: 600; }
.activity small, .activity time { font-size: .73rem; display: block; }
.activity time { margin-left: auto; color: var(--faint); white-space: nowrap; }
.empty { color: var(--muted); padding: 12px 0; font-size: .86rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; padding: 0 18px 16px; gap: 10px; }
.filters label { min-width: 120px; flex: 1; }
.filters label:first-child { flex: 1.35; }
label { color: var(--muted); display: grid; gap: 6px; font-size: .82rem; font-weight: 600; }
label :is(input,select,textarea) { color: var(--text); background: #10121c; border: 1px solid #363a4e; border-radius: 9px; min-height: 41px; padding: 8px 10px; width: 100%; }
label input::placeholder, label textarea::placeholder { color: #8d92aa; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: .84rem; text-align: left; min-width: 610px; }
th { padding: 10px 13px; color: var(--muted); background: #1a1d2a; font-size: .77rem; font-weight: 600; }
td { padding: 11px 13px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
td:first-child, th:first-child { padding-left: 18px; }
td:last-child, th:last-child { padding-right: 18px; }
td small { display: block; }
td:last-child { white-space: nowrap; }
thead + tbody:empty { display: none; }
tr:hover td { background: #191d2b; }
.task-link { border: 0; color: var(--text); font: inherit; font-weight: 650; background: transparent; cursor: pointer; text-align: left; padding: 0; }
.task-link:hover { color: var(--accent); }
.pill { display: inline-block; white-space: nowrap; font-size: .75rem; font-weight: 650; padding: 3px 8px; border-radius: 20px; color: #d0c8f4; background: #2a2540; }
.pill.good { color: var(--teal); background: #1d3936; }
.pill.warn { color: var(--amber); background: #3f301c; }
.pill.bad { color: var(--danger); background: #442534; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cell-actions .button { min-height: 31px; padding: 4px 8px; font-size: .74rem; }
.pagination { display: flex; flex-wrap: wrap; justify-content: end; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.finance-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin-bottom: 14px; }
.finance { padding: 18px; min-height: 133px; }
.finance h2 { font-size: .9rem; color: var(--muted); }
.finance strong { display: block; font-size: 1.65rem; margin: 5px 0; letter-spacing: -.04em; }
.finance p { font-size: .83rem; }
#view-cuentas > .panel + .panel { margin-top: 14px; }
.publication-panel, .ideas-panel { margin-top: 14px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 1px 18px 18px; color: var(--muted); font: .84rem/1.7 "Segoe UI", system-ui, sans-serif; }
dialog { width: min(490px, calc(100vw - 30px)); max-height: 90dvh; border: 1px solid #373d54; border-radius: 18px; background: var(--panel); color: var(--text); padding: 22px; box-shadow: 0 18px 70px #0008; }
dialog::backdrop { background: #080910cc; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; gap: 14px; overflow-wrap: anywhere; }
.dialog-head h2 { font-size: 1.38rem; }
.dialog-head .quiet { font-size: 1.24rem; }
dialog label { margin-top: 12px; }
dialog footer { display: flex; justify-content: end; gap: 8px; margin-top: 17px; }
dl { margin: 0; display: grid; grid-template-columns: 105px minmax(0,1fr); gap: 8px 12px; overflow-wrap: anywhere; }
dt { color: var(--muted); }
dd { margin: 0; white-space: pre-wrap; }
.form-error, .system-error { color: var(--danger); background: #3a202c; border: 1px solid #583245; padding: 9px 12px; border-radius: 9px; }
.system-error { margin: 0 0 16px; }
#toast { position: fixed; z-index: 5; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); padding: 11px 15px; border-radius: 10px; background: #212c39; border: 1px solid #40526a; font-size: .9rem; box-shadow: 0 8px 26px #0007; overflow-wrap: anywhere; }
#toast.error { color: var(--danger); background: #3a202c; border-color: #633647; }
.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 20% 10%,#27203e 0%,transparent 52%),var(--bg); }
.login-card { width: min(100%, 420px); padding: clamp(25px, 6vw, 39px); border: 1px solid #36334a; border-radius: 22px; background: var(--panel); box-shadow: 0 22px 65px #0006; }
.login-card .brand { margin-bottom: 35px; }
.login-card h1 { font-size: 2.4rem; }
.login-card form { display: grid; gap: 15px; margin-top: 24px; }
.login-card .button { display: flex; align-items: center; justify-content: space-between; margin-top: 5px; }
@media (max-width: 1140px) {
  .shell { grid-template-columns: 174px minmax(0, 1fr); }
  .metric, .business { padding-inline: 12px; }
  .panel-head { padding-inline: 14px; }
}
@media (max-width: 950px) {
  .metrics, .business-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .overview-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 680px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 12px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { margin: 0 0 10px 4px; }
  nav { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 8px; }
  nav a { flex: 1 0 auto; justify-content: center; min-height: 38px; padding: 5px 8px; font-size: .82rem; gap: 4px; }
  nav a span { display: none; }
  .sidebar-foot, .breadcrumb > span { display: none; }
  .topbar { min-height: 51px; padding-block: 6px; }
  .top-actions { gap: 5px; }
  .top-actions .button, .environment { font-size: .75rem; }
  main#content { padding-top: 24px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 11px; margin-bottom: 17px; }
  .metric { min-height: 106px; }
  .finance-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 355px) {
  .metrics, .business-grid { grid-template-columns: minmax(0,1fr); }
}
