:root {
  --azul: #0F2A47;
  --azul-2: #1B3A60;
  --naranja: #F97A4D;
  --naranja-2: #E8643A;
  --crema: #FAF7F2;
  --texto: #15202B;
  --muted: #6B7785;
  --linea: #E6E2DA;
  --verde: #10B981;
  --rojo: #E11D48;
  --radio: 12px;
  --radio-lg: 18px;
  --shadow: 0 6px 24px rgba(15, 42, 71, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Outfit', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--crema);
  color: var(--texto);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--linea);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
}
.brand {
  font-weight: 800; font-size: 22px; color: var(--azul); letter-spacing: -0.02em;
  display: inline-flex; align-items: center;
}
.brand-logo { width: 28px; height: 28px; display: block; margin-right: 8px; }
.brand-text span { color: var(--naranja); }
.topbar-nav { display: flex; align-items: center; gap: 18px; }
.topbar-nav a { color: var(--texto); font-weight: 500; }
.topbar-nav a.muted { color: var(--muted); font-weight: 400; }
.tenant-pill {
  background: var(--crema);
  border: 1px solid var(--linea);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
}

/* Main */
.main {
  max-width: 1100px; margin: 0 auto; padding: 32px 22px 80px;
}
.footer {
  border-top: 1px solid var(--linea); background: #fff; margin-top: 60px;
}
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 22px; color: var(--muted); font-size: 14px; }

/* Typography */
h1 { font-size: 36px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 24px; letter-spacing: -0.01em; margin: 0 0 12px; }
h3 { font-size: 18px; margin: 0 0 8px; }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; }
.muted { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border-radius: var(--radio); border: 1px solid transparent;
  font-family: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  text-decoration: none; transition: transform .05s ease, background .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--naranja); color: #fff; }
.btn-primary:hover { background: var(--naranja-2); }
.btn-dark { background: var(--azul); color: #fff; }
.btn-dark:hover { background: var(--azul-2); }
.btn-ghost { background: #fff; color: var(--azul); border-color: var(--linea); }
.btn-ghost:hover { background: var(--crema); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-danger { background: #fff; color: var(--rojo); border-color: var(--rojo); }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--linea);
  border-radius: var(--radio-lg); padding: 24px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

/* Forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; color: var(--texto); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--linea);
  border-radius: var(--radio); font-family: inherit; font-size: 16px;
  background: #fff; color: var(--texto);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(15, 42, 71, .1);
}
.field-hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Hero (landing) */
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 60px; align-items: center;
  padding: 40px 0 30px;
}
.hero h1 { font-size: 52px; line-height: 1.05; }
.hero h1 em { font-style: normal; color: var(--naranja); }
.hero .cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-art {
  background: linear-gradient(135deg, var(--azul), var(--azul-2));
  color: #fff; padding: 28px; border-radius: 22px;
  box-shadow: 0 20px 60px rgba(15, 42, 71, 0.25);
}
.hero-art .row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.hero-art .row:last-child { border-bottom: 0; }
.hero-art .row .who { font-weight: 600; }
.hero-art .row .when { color: rgba(255,255,255,.7); font-size: 14px; }
.hero-art .row .tag { background: var(--naranja); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 999px; }

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; gap: 30px; }
  .hero h1 { font-size: 36px; }
}

/* Features grid */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 50px 0; }
.feature { background: #fff; border: 1px solid var(--linea); padding: 22px; border-radius: var(--radio-lg); }
.feature .icon { width: 38px; height: 38px; background: var(--crema); border-radius: 10px; display: grid; place-items: center; font-size: 20px; margin-bottom: 12px; }
@media (max-width: 800px) { .features { grid-template-columns: 1fr; } }

/* Auth pages */
.auth-wrap { max-width: 420px; margin: 30px auto; }
.auth-wrap .card { padding: 32px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: var(--radio); margin-bottom: 18px; border: 1px solid; font-size: 14px; }
.flash-ok { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.flash-err { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.flash-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }

/* Lists / tables */
.list { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio-lg); overflow: hidden; }
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--linea); }
.list-item:last-child { border-bottom: 0; }
.list-item .meta { color: var(--muted); font-size: 14px; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--crema); color: var(--azul);
}
.badge-owner { background: #FEE4D7; color: #9A3412; }
.badge-manager { background: #DBEAFE; color: #1E3A8A; }
.badge-employee { background: #E6E2DA; color: #44403C; }

/* Dashboard hero */
.dash-greet { font-size: 28px; letter-spacing: -0.01em; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
@media (max-width: 800px) { .dash-grid { grid-template-columns: 1fr; } }
.stat { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio-lg); padding: 22px; }
.stat .num { font-size: 32px; font-weight: 700; color: var(--azul); }
.stat .lbl { color: var(--muted); font-size: 14px; }

/* Day chips (lun-dom) */
.dias-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dia-chip { position: relative; cursor: pointer; }
.dia-chip input { position: absolute; opacity: 0; pointer-events: none; }
.dia-chip span {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--linea); border-radius: 50%;
  font-weight: 600; font-size: 13px; color: var(--muted); background: #fff;
  transition: all .1s ease;
}
.dia-chip:hover span { border-color: var(--azul); }
.dia-chip input:checked + span { background: var(--azul); border-color: var(--azul); color: #fff; }

/* Checkbox lists */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.check {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--linea); border-radius: 8px; cursor: pointer; background: #fff;
  font-size: 14px;
}
.check input { width: auto; margin-top: 3px; }
.check:hover { border-color: var(--azul); }

/* Tabla simple */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; padding: 10px 12px; background: var(--crema); font-weight: 600; border-bottom: 1px solid var(--linea); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--linea); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row-unassigned td { background: #FFF7ED; }

/* Swap rows (en /app/swaps.php) */
.swap-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; background: #fff; border: 1px solid var(--linea); border-radius: 12px;
  flex-wrap: wrap;
}
.swap-row .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.badge-abierto   { background: #FEE4D7; color: #9A3412; }
.badge-tomado    { background: #FEF3C7; color: #92400E; }
.badge-aprobado  { background: #D1FAE5; color: #065F46; }
.badge-rechazado { background: #FEE2E2; color: #991B1B; }
.badge-cancelado { background: #E5E7EB; color: #374151; }

/* Pill de swap dentro del cal-shift */
.swap-pill {
  display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; background: var(--naranja); color: #fff;
}
.swap-pill-pending { background: #F59E0B; }
.cal-shift.has-swap { border-left-width: 4px; }

/* Calendario */
.cal-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.cal {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px;
}
.cal-day {
  background: #fff; border: 1px solid var(--linea); border-radius: var(--radio);
  min-height: 220px; padding: 12px; display: flex; flex-direction: column;
}
.cal-day .hd { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 4px; }
.cal-day .dname { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.cal-day .dnum  { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.cal-day.today  { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(15, 42, 71, .08); }
.cal-day .btn   { padding: 4px 10px; font-size: 16px; line-height: 1; }
.cal-shift {
  display: block; background: var(--crema); padding: 8px 10px; border-radius: 8px;
  margin-bottom: 6px; font-size: 13px; border-left: 3px solid var(--azul);
  color: var(--texto); text-decoration: none; transition: transform .05s ease;
}
.cal-shift:hover { text-decoration: none; transform: translateY(-1px); background: #F1ECE2; }
.cal-shift.unassigned { background: #FFF7ED; border-left-color: var(--naranja); }
.cal-shift .who  { font-weight: 600; }
.cal-shift .when { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cal-empty { color: var(--muted); font-size: 13px; padding: 8px; text-align: center; }
@media (max-width: 900px) {
  .cal { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .cal { grid-template-columns: 1fr; }
  .cal-day { min-height: auto; }
}

.center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ===== Burger (oculto en desktop) ===== */
.burger {
  display: none; width: 44px; height: 44px; padding: 0; background: transparent;
  border: 1px solid var(--linea); border-radius: 10px; cursor: pointer; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
}
.burger span { display: block; width: 18px; height: 2px; background: var(--texto); border-radius: 2px; transition: transform .15s ease; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ===== Cal tabs (sólo mobile) ===== */
.cal-tabs { display: none; }

/* ===== MOBILE ===== */
@media (max-width: 760px) {
  /* Spacing global */
  .main { padding: 22px 14px 60px; }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  .lead { font-size: 16px; }

  /* Header */
  .topbar-inner { padding: 12px 16px; }
  .burger { display: inline-flex; }
  .topbar-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--linea);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 16px 14px;
    box-shadow: 0 12px 24px rgba(15, 42, 71, 0.08);
    display: none;
  }
  .topbar-nav.open { display: flex; }
  .topbar-nav a {
    padding: 12px 4px; border-bottom: 1px solid var(--linea); font-size: 16px;
  }
  .topbar-nav a:last-child { border-bottom: 0; }
  .tenant-pill {
    align-self: flex-start; margin: 8px 0; padding: 8px 14px !important;
  }

  /* Forms */
  .field-row { grid-template-columns: 1fr; gap: 0; }

  /* Buttons */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; padding: 9px 14px; font-size: 14px; }

  /* Hero */
  .hero { padding: 20px 0 10px; gap: 24px; }

  /* Dashboard */
  .dash-greet { font-size: 24px; }

  /* Cards más compactas */
  .card { padding: 18px; border-radius: 14px; }

  /* Lists / list-items: stack en items con muchas acciones */
  .list-item {
    padding: 12px 14px; flex-wrap: wrap; gap: 8px;
  }
  .list-item > div:first-child { min-width: 0; flex: 1 1 100%; }

  /* Swap rows */
  .swap-row { flex-direction: column; align-items: stretch; }
  .swap-row > div:last-child { display: flex; gap: 6px; flex-wrap: wrap; }

  /* Tabla de generador en mobile: que sea legible */
  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding: 8px 9px; }

  /* Configurar restaurante: plantillas en stack */
  .card form > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Calendario: tabs visibles, días ocultos salvo el activo */
  .cal-tabs {
    display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px;
    -webkit-overflow-scrolling: touch; margin-left: -2px; margin-right: -2px;
    scrollbar-width: none;
  }
  .cal-tabs::-webkit-scrollbar { display: none; }
  .cal-tab {
    flex: 0 0 auto; padding: 10px 14px; min-width: 64px;
    border: 1px solid var(--linea); border-radius: 12px; background: #fff;
    font-family: inherit; cursor: pointer; color: var(--texto);
    display: flex; flex-direction: column; align-items: center; line-height: 1.1;
  }
  .cal-tab .t-dname { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  .cal-tab .t-dnum  { font-size: 16px; font-weight: 700; margin-top: 2px; }
  .cal-tab.today { border-color: var(--azul); }
  .cal-tab.today .t-dnum { color: var(--azul); }
  .cal-tab.active {
    background: var(--azul); border-color: var(--azul);
  }
  .cal-tab.active .t-dname,
  .cal-tab.active .t-dnum  { color: #fff; }

  .cal { grid-template-columns: 1fr; gap: 12px; }
  .cal-day { min-height: auto; padding: 14px; }
  .cal-day.mobile-hide { display: none; }
  .cal-day .hd { margin-bottom: 12px; }
  .cal-day .dnum { font-size: 22px; }
  .cal-day .dname { font-size: 13px; }
  .cal-shift { padding: 10px 12px; font-size: 14px; }

  .cal-nav { width: 100%; }
  .cal-nav .btn { flex: 1 1 0; min-width: 0; }

  /* Checks: chips de día un poco más grandes para touch */
  .dia-chip span { width: 40px; height: 40px; font-size: 14px; }

  /* Hero CTA: stack */
  .hero .cta { width: 100%; }
  .hero .cta .btn { flex: 1 1 0; min-width: 0; }
}

@media (max-width: 420px) {
  h1 { font-size: 22px; }
  .dash-greet { font-size: 20px; }
  .stat .num { font-size: 26px; }
}
