/* Revueltapp · Panel — mismos colores y tipografía que la app y revueltapp.com (design/tokens.css) */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --lime: #C4FF4D; --ink: #0B1014;
  /* oscuro (por defecto) */
  color-scheme: dark;
  --bg: #0B1014; --side: #070B0E; --card: #151D23; --card-2: #11161A; --ring: #24303A; --ring-2: #34414A;
  --text: #F3F6F4; --soft: #C9D2D6; --muted: #8B9AA3;
  --green: #96D61E; --green-tint: rgba(150, 214, 30, .14); --turq: #2EC4B6; --turq-tint: rgba(46, 196, 182, .13);
  --gold: #F2B230; --gold-tint: rgba(242, 178, 48, .14); --red: #FF6B5E; --red-tint: rgba(255, 107, 94, .13);
  --violet: #A78BFA;
  --shadow: 0 0 0 1px var(--ring);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F3F5F2; --side: #E9EDEA; --card: #FFFFFF; --card-2: #F6F8F6; --ring: #D3DAD6; --ring-2: #B9C3BF;
    --text: #0D1418; --soft: #34424A; --muted: #5C6A72;
    --green: #3F7F00; --green-tint: rgba(150, 214, 30, .18); --turq: #008378; --turq-tint: rgba(0, 131, 120, .10);
    --gold: #9A6700; --gold-tint: rgba(242, 178, 48, .18); --red: #C2362B; --red-tint: rgba(194, 54, 43, .10);
    --violet: #6D4AD8;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F3F5F2; --side: #E9EDEA; --card: #FFFFFF; --card-2: #F6F8F6; --ring: #D3DAD6; --ring-2: #B9C3BF;
  --text: #0D1418; --soft: #34424A; --muted: #5C6A72;
  --green: #3F7F00; --green-tint: rgba(150, 214, 30, .18); --turq: #008378; --turq-tint: rgba(0, 131, 120, .10);
  --gold: #9A6700; --gold-tint: rgba(242, 178, 48, .18); --red: #C2362B; --red-tint: rgba(194, 54, 43, .10);
  --violet: #6D4AD8;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--turq); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--turq); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.ico { width: 18px; height: 18px; flex: none; fill: currentColor; }
.m { color: var(--muted); } .g { color: var(--green); } .t { color: var(--turq); } .o { color: var(--gold); } .r { color: var(--red); }
.small { font-size: 12px; } .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }

/* estructura */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 232px, var(--ring) 232px 233px, transparent 233px); }
.side { background: var(--side); border-right: 1px solid var(--ring); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-size: 16px; font-weight: 600; color: var(--text); }
.brand svg { width: 30px; height: 30px; } .brand .g { color: var(--green); } .brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--soft); font-weight: 500; }
.nav a:hover { background: var(--card); text-decoration: none; }
.nav a[aria-current] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.nav a[aria-current] .ico { color: var(--green); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 12px 6px 0; display: flex; gap: 6px; align-items: center; }
.main { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.head .grow { flex: 1; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* tarjetas y rejillas */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card > h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card > h2 .grow { flex: 1; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.hl .v { color: var(--green); }
.section { margin-top: 18px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* tablas */
.tw { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--ring); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--ring); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--card-2); }
td.num, th.num { text-align: right; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }

/* piezas */
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { font-weight: 600; } .who span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--card-2); box-shadow: var(--shadow); flex: none; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--muted); overflow: hidden; }
.av.big { width: 76px; height: 76px; font-size: 26px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--card-2); color: var(--soft); box-shadow: var(--shadow); white-space: nowrap; }
.pill.on { background: var(--green-tint); color: var(--green); box-shadow: none; }
.pill.drive { background: var(--turq-tint); color: var(--turq); box-shadow: none; }
.pill.gold { background: var(--gold-tint); color: var(--gold); box-shadow: none; }
.pill.bad { background: var(--red-tint); color: var(--red); box-shadow: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 3px var(--green-tint); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.badge.ok { background: var(--green); color: var(--ink); }
.bar { height: 6px; background: var(--card-2); border-radius: 99px; overflow: hidden; box-shadow: var(--shadow); min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; }

/* controles */
.btn { height: 34px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--card-2); box-shadow: var(--shadow); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font-weight: 500; white-space: nowrap; }
.btn:hover { box-shadow: 0 0 0 1px var(--ring-2); }
.btn.pri { background: var(--lime); color: var(--ink); box-shadow: none; }
.btn.pri:hover { filter: brightness(1.05); }
.btn.danger { color: var(--red); } .btn.danger.solid { background: var(--red); color: #fff; box-shadow: none; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input { height: 34px; padding: 0 12px; border-radius: 10px; border: 0; background: var(--card-2); box-shadow: var(--shadow); min-width: 0; }
textarea.input { height: auto; padding: 8px 12px; resize: vertical; }
.input:focus { outline: 2px solid var(--turq); outline-offset: 0; }
.search { width: 280px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--card-2); padding: 3px; border-radius: 11px; box-shadow: var(--shadow); flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tabs button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.field { display: grid; gap: 4px; } .field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* gráficas */
.chart { width: 100%; height: 160px; display: block; }
.chart .b { fill: var(--green); } .chart .b2 { fill: var(--turq); } .chart .b3 { fill: var(--gold); }
.chart .gl { stroke: var(--ring); stroke-width: 1; } .chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr max-content; gap: 6px 10px; align-items: center; font-size: 13px; }
.cal { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.cal i { aspect-ratio: 1; border-radius: 3px; background: var(--card-2); box-shadow: var(--shadow); }
.cal i.on { background: var(--green); box-shadow: none; }

/* registro */
.log { background: var(--card-2); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.log .err { color: var(--red); }

/* ventanas y avisos */
dialog { border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--ring), 0 20px 60px rgba(0,0,0,.4); width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(7, 11, 14, .6); backdrop-filter: blur(3px); }
dialog form { padding: 20px; display: grid; gap: 14px; }
dialog .acts { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 500; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); color: #fff; }

/* acceso */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(60% 50% at 50% 0%, var(--green-tint), transparent) var(--bg); }
.gate .box { width: min(380px, 100%); text-align: center; display: grid; gap: 16px; justify-items: center; }
.gate .box svg.logo { width: 72px; height: 72px; }
.gate .print { width: 64px; height: 64px; color: var(--green); }
.gate .btn.pri { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 14px; width: 100%; justify-content: center; }
.gate p { color: var(--muted); }
.boot { min-height: 100vh; }
.foot { color: var(--muted); font-size: 12px; margin-top: 30px; text-align: center; }

@media (max-width: 1100px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell { background: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; z-index: 20; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 12px; gap: 4px; align-items: center; }
  .brand { padding: 0 8px 0 0; } .brand small, .brand .word { display: none; }
  .nav { display: flex; gap: 2px; } .nav a { padding: 7px 9px; } .nav a span.lbl { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .main { padding: 18px 16px 50px; }
  .g2, .g3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form { grid-template-columns: 1fr; } .search { width: 100%; }
}
