:root {
  --bg: #08090a;
  --panel: #0f1011;
  --surface: #191a1b;
  --border-subtle: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.12);
  --text: #f7f8f8;
  --text-silver: #d0d6e0;
  --text-muted: #8a8f98;
  --text-dim: #62666d;
  --brand: #5e6ad2;
  --brand-accent: #7170ff;
  --brand-hover: #828fff;
  --brand-subtle: rgba(94,106,210,0.1);
  --success: #27a644;
  --success-emerald: #10b981;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 6px;
  --radius-card: 8px;
  --radius-pill: 9999px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; max-width: 100vw; font-feature-settings: 'cv01', 'ss03'; }
a { color: var(--brand-accent); text-decoration: none; }

.centered { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.card { background: rgba(255,255,255,0.02); border-radius: var(--radius-card); padding: 28px; position: relative; }
.login-card { width: 340px; max-width: 92vw; }
.brand { font-weight: 590; font-size: 22px; letter-spacing: -0.02em; margin-bottom: 4px; color: var(--text); }
.brand span { color: var(--brand-accent); }
.subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
label { display: block; font-size: 11px; color: var(--text-muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 510; }
input, select { width: 100%; background: rgba(255,255,255,0.02); border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: var(--radius); font-size: 14px; font-family: inherit; transition: border-color 0.12s ease; }
input:focus, select:focus { outline: none; border-color: var(--brand); }
button { cursor: pointer; border: 1px solid transparent; border-radius: var(--radius); padding: 8px 16px; font-size: 13px; font-weight: 510; background: rgba(255,255,255,0.04); color: var(--text); font-family: inherit; transition: all 0.12s ease; }
button:hover { background: rgba(255,255,255,0.06); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button[type="submit"] { background: var(--brand); color: white; }
button[type="submit"]:hover { background: var(--brand-hover); }
button.secondary { background: rgba(255,255,255,0.04); color: var(--text); border: 1px solid var(--border); }
button.danger { background: rgba(248,113,113,0.12); color: var(--danger); }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 16px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 224px; background: var(--panel); border-right: 1px solid var(--border-subtle); padding: 18px 12px; display: flex; flex-direction: column; position: relative; }
.sidebar .brand { padding: 0 8px 20px; }
.brand-switcher { position: relative; margin: 0 8px 16px; }
.brand-switcher-trigger { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px; text-transform: none; font-weight: 400; }
.brand-switcher-trigger:hover { border-color: var(--border-strong); }
.brand-switcher-eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.brand-switcher-row { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.brand-switcher-name { font-size: 14px; font-weight: 510; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-switcher-caret { color: var(--text-dim); font-size: 11px; transition: transform 0.15s ease; flex-shrink: 0; }
.brand-switcher.open .brand-switcher-caret { transform: rotate(180deg); }
.brand-switcher-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,0.4); z-index: 70; overflow: hidden; }
.brand-switcher-menu[hidden] { display: none; }
.brand-switcher-option { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-size: 13px; color: var(--text); cursor: pointer; }
.brand-switcher-option:hover { background: rgba(255,255,255,0.03); }
.brand-switcher-option.active { color: var(--brand-accent); }
.brand-switcher-option.active::after { content: "✓"; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--text-muted); font-size: 13px; font-weight: 510; cursor: pointer; border: none; background: none; width: 100%; text-align: left; transition: all 0.12s ease; }
.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text-silver); }
.nav-item.active { background: var(--brand-subtle); color: var(--brand-hover); }
.nav-item.disabled { opacity: 0.35; cursor: default; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-subtle); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 52px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; padding: 0 20px; justify-content: space-between; background: var(--bg); }
.topbar strong { font-weight: 510; font-size: 14px; color: var(--text); }
.content { flex: 1; padding: 24px; overflow: auto; }

.dashboard-section + .dashboard-section { margin-top: 36px; }
.dashboard-section-title { display: flex; align-items: baseline; gap: 10px; font-size: 12px; font-weight: 510; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 0 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; transition: all 0.15s ease; }
.tile:hover { border-color: var(--border-strong); }
.tile h3 { margin: 0 0 6px; font-weight: 510; font-size: 14px; letter-spacing: -0.01em; }
.tile p { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; }
.tile.tile-disabled { opacity: 0.5; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 510; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: var(--radius-pill); background: rgba(255,255,255,0.04); color: var(--text-muted); border: 1px solid var(--border); }
.badge::before { content: "●"; font-size: 8px; }
.badge.ok { color: var(--success-emerald); background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.2); }
.badge.soon { border-style: dashed; }
.badge.soon::before { content: "○"; }
.tile.tile-soon { border-style: dashed; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border-subtle); }
th { color: var(--text-muted); font-weight: 510; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(255,255,255,0.02); }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 380px; max-width: 92vw; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.sidebar-toggle { display: none; background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text); width: 34px; height: 34px; border-radius: 5px; font-size: 18px; align-items: center; justify-content: center; }
.sidebar-backdrop { display: none; }

/* ── Pills de marca + stats del Inicio (2026-08-19) ── */
.brand-pills { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.brand-pill { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 510; background: rgba(255,255,255,0.02); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; transition: all 0.15s ease; font-family: inherit; }
.brand-pill:hover { border-color: var(--border-strong); color: var(--text-silver); }
.brand-pill.active { color: var(--text); }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 18px; }
.stat-card:hover { border-color: var(--border-strong); }
.stat-label { font-size: 11px; font-weight: 510; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.stat-change { font-size: 11px; font-weight: 510; margin-top: 4px; }
.stat-change.positive { color: var(--success-emerald); }
.stat-change.negative { color: var(--danger); }
.stat-change.neutral { color: var(--text-dim); }

#terminal, #desktop-canvas { width: 100%; height: 100%; }
.full-pane { position: absolute; inset: 0; display: flex; flex-direction: column; }
.full-pane .content { padding: 0; }
.app-window { display: flex; flex-direction: column; height: 100vh; }
.app-header-left { display: flex; align-items: center; gap: 14px; }
.app-header-right { display: flex; align-items: center; gap: 10px; }
#app-back-btn::before { content: "◂ "; }

@media (max-width: 860px) {
  .sidebar-toggle { display: inline-flex; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 12px 0 30px rgba(0,0,0,0.45); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 55; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; gap: 10px; flex-wrap: wrap; height: auto; min-height: 52px; }
  .toolbar { flex-wrap: wrap; gap: 10px; align-items: flex-start; }
  .toolbar > div { flex-wrap: wrap; }
  .app-header-right { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
}
