/* ═══════════════════════════════════════════════════════════
   ALVATOWASH · main.css
   Variables globales, layout base, sidebar, topbar, login
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Colores */
  --bg:          #FFFFFF;
  --bg-soft:     #F5F5F7;
  --bg-hover:    rgba(0,0,0,.035);
  --card:        #FFFFFF;
  --ink:         #1D1D1F;
  --ink-2:       #3C3C43;
  --ink-3:       #6E6E73;
  --muted:       #86868B;
  --hair:        rgba(0,0,0,.07);
  --hair-2:      rgba(0,0,0,.04);

  /* Accent principal */
  --accent:      #DC2626;
  --accent-dk:   #991B1B;
  --accent-soft: rgba(220,38,38,.08);
  --accent-mid:  rgba(220,38,38,.15);

  /* Semánticos */
  --green:       #1A7F37;
  --green-soft:  rgba(26,127,55,.10);
  --green-mid:   rgba(26,127,55,.15);
  --orange:      #E37400;
  --orange-soft: rgba(227,116,0,.10);
  --blue:        #0A84FF;
  --blue-soft:   rgba(10,132,255,.08);
  --purple:      #8B5CF6;
  --purple-soft: rgba(139,92,246,.08);
  --gold:        #C9A227;
  --gold-soft:   rgba(201,162,39,.10);

  /* Sombras */
  --shadow-card: 0 0 0 .5px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.06);
  --shadow-pop:  0 12px 32px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.05);
  --shadow-sm:   0 1px 4px rgba(0,0,0,.08);

  /* Layout */
  --sb-w:        272px;
  --topbar-h:    52px;
  --radius:      13px;
  --radius-sm:   9px;
  --radius-lg:   18px;
}

/* ─── Reset base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  background: var(--bg-soft);
  color: var(--ink);
  min-height: 100dvh;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
}
button  { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14.5px; color: var(--ink); }
a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
img { display: block; }

/* ─── Loading global ─── */
#loading {
  position: fixed; inset: 0; background: white;
  z-index: 300; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
#loading.show { display: flex; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--hair); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-label { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ─── Login ─── */
#loginScreen {
  position: fixed; inset: 0; background: var(--bg-soft);
  z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px;
}
#loginScreen.show { display: flex; }
.login-box {
  background: white; border-radius: 24px; padding: 40px 32px 36px;
  max-width: 360px; width: 100%; box-shadow: var(--shadow-pop);
}
.login-logo {
  width: 56px; height: 56px; border-radius: 15px;
  background: linear-gradient(135deg, #DC2626, #991B1B);
  color: white; font-weight: 800; font-size: 21px; letter-spacing: -1px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; box-shadow: 0 8px 20px rgba(220,38,38,.28);
}
.login-title { font-size: 22px; font-weight: 800; text-align: center; letter-spacing: -.5px; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 28px; }

/* ─── App shell ─── */
#app { display: none; height: 100dvh; overflow: hidden; }
#app.show { display: flex; }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sb-w); flex-shrink: 0;
  background: white; border-right: 1px solid var(--hair);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 50;
}
.sb-head {
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--hair); flex-shrink: 0;
}
.sb-logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sb-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #DC2626, #991B1B);
  color: white; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(220,38,38,.22);
}
.sb-brand    { font-size: 13px; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; }
.sb-role     { font-size: 10.5px; color: var(--muted); }
.sb-user     { font-size: 11.5px; color: var(--muted); }
.sb-logout {
  margin-left: auto; padding: 5px 10px; flex-shrink: 0;
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--hair); border-radius: 7px;
  transition: all .15s; cursor: pointer;
}
.sb-logout:hover { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }

.sb-section {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 14px 14px 6px;
}
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 8px 12px; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--hair); border-radius: 99px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  margin-bottom: 2px; transition: background .12s; font-size: 13.5px; font-weight: 500;
}
.nav-item:hover   { background: var(--bg-soft); }
.nav-item.active  { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg     { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; flex-shrink: 0; }
.nav-item.active svg { stroke: var(--accent); }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: white; border-radius: 99px;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ─── Main panel ─── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--hair-2);
  padding: 0 20px; display: flex; align-items: center; gap: 10px; z-index: 10;
}
.tb-menu {
  display: none; width: 34px; height: 34px;
  border-radius: 9px; background: var(--bg-soft);
  align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer;
}
.tb-menu svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2; }
.tb-title    { font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.tb-breadcrumb { font-size: 13.5px; color: var(--muted); }
.tb-breadcrumb b { color: var(--ink); font-weight: 600; }
.tb-actions  { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { flex: 1; overflow-y: auto; padding: 24px 28px 60px; }
.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-thumb { background: var(--hair); border-radius: 99px; }

/* ─── Sections ─── */
.section { display: none; animation: fadeUp .2s ease both; }
.section.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.sec-head   { margin-bottom: 20px; }
.sec-title  { font-size: 26px; font-weight: 800; letter-spacing: -.7px; line-height: 1.2; margin-bottom: 4px; }
.sec-sub    { font-size: 13.5px; color: var(--ink-3); }
.sec-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }

/* ─── Overlay mobile sidebar ─── */
.sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.38); z-index: 40;
  backdrop-filter: blur(2px);
}
.sb-overlay.show { display: block; }

/* ─── Toast ─── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: white;
  padding: 10px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; z-index: 400;
  opacity: 0; transition: opacity .2s, bottom .2s;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ─── Mobile ─── */
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .tb-menu { display: flex; }
  .content { padding: 16px 14px 60px; }
  .topbar  { padding: 0 14px; }
  .sec-title { font-size: 22px; }
}
