/* ============================================================
   INTRANET COCINA MODERNA — Identidad visual
   Fondo dark · Hueso · Rojo CM · Cobre Pathay
   ============================================================ */

:root {
  /* Paleta */
  --cm-dark: #07010f;
  --cm-dark-2: #120819;
  --cm-dark-3: #1a0f24;
  --cm-hueso: #f0ede6;
  --cm-hueso-dim: rgba(240, 237, 230, 0.7);
  --cm-hueso-mute: rgba(240, 237, 230, 0.45);
  --cm-rojo: #e8001d;
  --cm-rojo-glow: rgba(232, 0, 29, 0.35);
  --pathay-cobre: #b87333;
  --pathay-cobre-hi: #d89458;
  --pathay-cobre-lo: #8a5624;
  --pathay-dorado: #d4af37;

  /* Estados */
  --ok: #2dd4bf;
  --warn: #f59e0b;
  --err: #ef4444;

  /* Tipografía */
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  /* Sombras y efectos */
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(240, 237, 230, 0.06);
  --shadow-glow-cobre: 0 0 30px rgba(184, 115, 51, 0.25);
  --shadow-glow-rojo: 0 0 30px var(--cm-rojo-glow);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--cm-dark);
  color: var(--cm-hueso);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Textura sutil de fondo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at top left, rgba(184, 115, 51, 0.08), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(232, 0, 29, 0.06), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* Tipografía */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
h3 { font-size: 1.4rem; }

a { color: var(--pathay-cobre-hi); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--pathay-dorado); }

/* ========== LAYOUT PRINCIPAL ========== */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--cm-dark-2), var(--cm-dark));
  border-right: 1px solid rgba(240, 237, 230, 0.08);
  padding: 2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(240, 237, 230, 0.1);
}

.sidebar-brand .brand-mark {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.15em;
  color: var(--cm-hueso);
}

.sidebar-brand .brand-mark em {
  color: var(--cm-rojo);
  font-style: normal;
}

.sidebar-brand small {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--cm-hueso-mute);
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  color: var(--cm-hueso-dim);
  font-size: 0.95rem;
  border-left: 2px solid transparent;
  transition: all 0.2s;
}

.nav a:hover { background: rgba(240, 237, 230, 0.04); color: var(--cm-hueso); }

.nav a.active {
  background: rgba(184, 115, 51, 0.1);
  color: var(--pathay-cobre-hi);
  border-left-color: var(--pathay-cobre);
}

.nav a .ico {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0.8;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(240, 237, 230, 0.08);
  font-size: 0.8rem;
  color: var(--cm-hueso-mute);
}

.sidebar-footer .user-chip {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem;
  background: rgba(240, 237, 230, 0.04);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pathay-cobre), var(--cm-rojo));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  color: var(--cm-hueso);
  font-size: 0.9rem;
}

.main {
  padding: 2rem 2.5rem;
  max-width: 1400px;
}

/* ========== PAGE HEADER ========== */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(240, 237, 230, 0.08);
}

.page-head .title-block small {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--pathay-cobre);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.page-head h1 { color: var(--cm-hueso); }

/* ========== CARDS ========== */
.card {
  background: linear-gradient(180deg, var(--cm-dark-3), var(--cm-dark-2));
  border: 1px solid rgba(240, 237, 230, 0.06);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s;
}

.card:hover { border-color: rgba(184, 115, 51, 0.2); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-head h3 {
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat {
  background: var(--cm-dark-2);
  border: 1px solid rgba(240, 237, 230, 0.06);
  border-radius: 6px;
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--pathay-cobre);
}

.stat.urgent::before { background: var(--cm-rojo); }
.stat.urgent .value { color: var(--cm-rojo); }

.stat .label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--cm-hueso-mute);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.stat .value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--pathay-cobre-hi);
}

.stat .sub {
  font-size: 0.8rem;
  color: var(--cm-hueso-dim);
  margin-top: 0.25rem;
}

/* ========== COUNTDOWN HERO ========== */
.countdown-hero {
  background: linear-gradient(135deg, var(--cm-dark-3) 0%, var(--cm-dark) 100%);
  border: 1px solid rgba(184, 115, 51, 0.3);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.countdown-hero::after {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(184, 115, 51, 0.15), transparent 60%);
  pointer-events: none;
}

.countdown-hero .tag {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--pathay-cobre);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.countdown-hero h2 {
  color: var(--cm-hueso);
  margin-bottom: 0.5rem;
}

.countdown-hero .days {
  font-family: var(--font-display);
  font-size: 5rem;
  line-height: 1;
  color: var(--pathay-dorado);
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}

.countdown-hero .days-label {
  font-size: 1rem;
  color: var(--cm-hueso-dim);
  margin-left: 0.5rem;
}

/* ========== BOTONES ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--pathay-cobre);
  color: var(--cm-dark);
}

.btn-primary:hover {
  background: var(--pathay-cobre-hi);
  box-shadow: var(--shadow-glow-cobre);
}

.btn-danger {
  background: var(--cm-rojo);
  color: var(--cm-hueso);
}

.btn-danger:hover { box-shadow: var(--shadow-glow-rojo); }

.btn-ghost {
  background: transparent;
  color: var(--cm-hueso);
  border: 1px solid rgba(240, 237, 230, 0.2);
}

.btn-ghost:hover {
  border-color: var(--pathay-cobre);
  color: var(--pathay-cobre-hi);
}

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }

/* ========== FORMS ========== */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--cm-hueso-mute);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--cm-dark);
  border: 1px solid rgba(240, 237, 230, 0.15);
  border-radius: 4px;
  color: var(--cm-hueso);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--pathay-cobre);
  box-shadow: 0 0 0 3px rgba(184, 115, 51, 0.1);
}

/* ========== TABLA ========== */
.table-wrap {
  background: var(--cm-dark-2);
  border: 1px solid rgba(240, 237, 230, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  background: var(--cm-dark-3);
}

th {
  text-align: left;
  padding: 0.9rem 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--cm-hueso-mute);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(240, 237, 230, 0.08);
}

td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(240, 237, 230, 0.04);
  font-size: 0.9rem;
}

tbody tr:hover { background: rgba(240, 237, 230, 0.02); }

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.badge-ok { background: rgba(45, 212, 191, 0.15); color: var(--ok); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge-err { background: rgba(239, 68, 68, 0.15); color: var(--err); }
.badge-pend { background: rgba(184, 115, 51, 0.15); color: var(--pathay-cobre-hi); }

/* ========== MODAL ========== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(7, 1, 15, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--cm-dark-2);
  border: 1px solid rgba(184, 115, 51, 0.2);
  border-radius: 10px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: var(--cm-dark-3);
  color: var(--cm-hueso);
  padding: 1rem 1.5rem;
  border-radius: 6px;
  border-left: 3px solid var(--pathay-cobre);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  transform: translateX(120%);
  transition: transform 0.3s;
  z-index: 1000;
}

.toast.show { transform: translateX(0); }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10;
    flex-direction: row;
    padding: 1rem;
    gap: 1rem;
    overflow-x: auto;
  }
  .sidebar-brand { border: none; padding: 0; }
  .nav { flex-direction: row; gap: 0.25rem; }
  .nav a { white-space: nowrap; padding: 0.5rem 0.8rem; font-size: 0.85rem; }
  .sidebar-footer { display: none; }
  .main { padding: 1.5rem 1rem; }
}

/* ========== UTILIDADES ========== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 1rem; }
.mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; } .mb-2 { margin-bottom: 2rem; }
.text-mute { color: var(--cm-hueso-mute); }
.text-sm { font-size: 0.85rem; }
.hidden { display: none !important; }

@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
