/* light_down — oscuro para consultarlo de noche; el color solo comunica estado. */
:root {
  --bg: #14171c;
  --surface: #1d2128;
  --surface-2: #262b34;
  --line: #313844;
  --text: #eef1f5;
  --muted: #98a1ae;
  --accent: #f5b83d;
  --up: #3ecf7a;
  --down: #ff5a52;
  --down-bg: #3a1513;
  --idle: #6b7482;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  max-width: 560px;
  margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; letter-spacing: .01em; }
.brand svg { width: 22px; height: 22px; fill: var(--accent); }

main { max-width: 560px; margin: 0 auto; padding: 0 16px 24px; }
h1 { font-size: 1.05rem; margin: 28px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
h1:first-child { margin-top: 8px; }
ul { list-style: none; margin: 0; padding: 0; }
small { color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); margin: 6px 0; }
.note { color: var(--muted); margin: 16px; text-align: center; }
.note.warn { color: #ffd1ce; }

/* ---- controles ---- */
input, select, button, .button {
  font: inherit;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 14px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
button, .button { cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); border-color: var(--accent); color: #1a1406; }
.danger { background: transparent; border-color: #5a2a28; color: var(--down); min-height: 40px; }
.link { background: none; border: none; color: var(--muted); min-height: 40px; padding: 0 4px; font-weight: 500; }

.alert {
  background: var(--down-bg);
  border: 1px solid #6b2420;
  color: #ffd1ce;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 8px 0 12px;
}

/* ---- login ---- */
.login { display: grid; gap: 14px; margin-top: 12vh; }
.login label { display: grid; gap: 6px; color: var(--muted); font-size: .95rem; }
.login .primary { margin-top: 6px; }
.login-title { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 1.6rem; margin: 0 0 4px; }

/* ---- panel ---- */
.summary { font-size: 1.35rem; font-weight: 700; margin: 8px 0 16px; }
.summary.ok { color: var(--up); }
.summary.bad { color: var(--down); }

.sectors { display: grid; gap: 12px; }
.sector {
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 8px solid var(--idle);
  overflow: hidden;
}
.sector.up { border-left-color: var(--up); }
.sector.down { border-left-color: var(--down); background: var(--down-bg); }
.sector-head { padding: 14px 16px 12px; }
.sector h2 { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--muted); }
.state { margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.state strong { font-size: 1.9rem; line-height: 1.15; letter-spacing: -.01em; }
.state span { font-size: 1.15rem; }
.sector.up .state strong { color: var(--up); }
.sector.down .state span { color: #ffb3ae; }
.sector.down .state strong { color: var(--down); }
.sector.idle .state strong { color: var(--muted); font-size: 1.4rem; }
.sector.idle .state span { color: var(--muted); font-size: .95rem; }

.devs { border-top: 1px solid rgba(255,255,255,.06); padding: 6px 0; }
.dev { display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--idle); }
.dev.on .dot { background: var(--up); }
.dev.off .dot { background: var(--down); }
.dev-name { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; }
.dev-meta { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.updated { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 18px; }
.empty { display: grid; gap: 12px; margin-top: 10vh; text-align: center; }

/* ---- placas ---- */
.cards { display: grid; gap: 12px; }
.approve {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
}
.approve .mac, .approve .muted { grid-column: 1 / -1; margin: 0; }
.mac { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.1rem; font-weight: 600; }
.approve .actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.approve .actions .danger { min-height: 46px; }
.approve select, .approve input { min-width: 0; }
.approve .field { grid-column: 1 / -1; display: grid; gap: 6px; color: var(--muted); font-size: .95rem; }
.rows .dev.editing { display: block; padding: 8px; }
.rows .edit { border-color: var(--line); }
.inline { display: flex; gap: 8px; margin-top: 8px; }
.inline input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chips span { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: .95rem; }
.rows { background: var(--surface); border-radius: var(--radius); padding: 4px 0; }
.rows .dev + .dev { border-top: 1px solid var(--line); }

/* ---- historial ---- */
.history { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.history li { padding: 12px 16px; border-left: 4px solid var(--down); }
.history li + li { border-top: 1px solid var(--line); }
.history li.open { background: var(--down-bg); }
.history li.brief { border-left-color: var(--idle); color: var(--muted); }
.hist-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hist-times { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--muted); font-size: .95rem; margin-top: 4px; }
.dur { margin-left: auto; color: var(--text); font-weight: 600; }
.brief .dur { color: var(--muted); font-weight: 400; }
.badge { font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: #4a1e1b; color: #ffb3ae; }
.brief .badge { background: var(--surface-2); color: var(--muted); }
.open .badge { background: var(--down); color: #200605; font-weight: 700; }

/* ---- pestañas ---- */
.tabs {
  position: fixed;
  inset: auto 0 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(20, 23, 28, .96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.tabs a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .sector.down .state strong { animation: pulse 2s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .65; } }
}
