/* ============================================================
   barberia — design system (dark minimalista + ámbar)
   Mobile-first, sin dependencias externas
   ============================================================ */

:root {
  --bg:        #0E1116;
  --bg-2:      #141922;
  --bg-3:      #1B2230;
  --panel:     rgba(255,255,255,0.03);
  --panel-2:   rgba(255,255,255,0.05);
  --line:      rgba(255,255,255,0.08);
  --line-2:    rgba(255,255,255,0.14);

  --text:      #E9EDF4;
  --text-dim:  #9AA4B5;
  --text-faint:#6B7686;

  --accent:    #F5A524;
  --accent-2:  #FFC65C;
  --accent-soft:rgba(245,165,36,0.14);
  --accent-ring:rgba(245,165,36,0.45);

  --ok:        #34C77B;
  --ok-soft:   rgba(52,199,123,0.14);
  --warn:      #F5A524;
  --err:       #F2696B;
  --err-soft:  rgba(242,105,107,0.14);
  --info:      #5AA9FF;
  --info-soft: rgba(90,169,255,0.14);

  --radius:    16px;
  --radius-sm: 12px;
  --radius-lg: 22px;
  --tabbar-h:  64px;
  --shadow:    0 12px 40px rgba(0,0,0,0.45);
  --shadow-sm: 0 6px 18px rgba(0,0,0,0.35);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(245,165,36,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(90,169,255,0.06), transparent 55%),
    var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  letter-spacing: 0.1px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.app-shell {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 8px;
}

/* ---------- Header de página ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.page-title { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -0.5px; }
.page-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); }
.page-sub strong { color: var(--accent-2); font-weight: 600; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(20,25,34,0.85), rgba(14,17,22,0.97));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 30px rgba(0,0,0,0.4);
}
.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  transition: color .18s ease, background .18s ease, transform .18s ease;
  position: relative;
}
.tab-icon svg { width: 22px; height: 22px; display: block; }
.tab-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.2px; }
.tab:active { transform: scale(0.94); }
.tab.is-active { color: var(--accent); }
.tab.is-active::before {
  content: "";
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-ring);
}

/* ---------- Tarjetas / paneles ---------- */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 12px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -0.2px; display:flex; align-items:center; gap:8px; }
.card-title svg { width: 18px; height: 18px; color: var(--accent); }
.muted { color: var(--text-dim); font-size: 13px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-faint); font-weight: 700; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: #1a1205;
  box-shadow: 0 8px 22px rgba(245,165,36,0.28);
}
.btn-primary:active { box-shadow: 0 4px 12px rgba(245,165,36,0.35); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--err-soft); border-color: rgba(242,105,107,0.4); color: #FF9B9D; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.input, select.input, textarea.input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background: rgba(255,255,255,0.06);
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239AA4B5' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; gap: 0; } .grid-2 .field { margin-bottom: 14px; } }

/* ---------- Badges / estados ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.2px;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  background: var(--panel-2);
}
.badge-ok    { color: #7fe0ad; background: var(--ok-soft); border-color: rgba(52,199,123,0.35); }
.badge-warn  { color: var(--accent-2); background: var(--accent-soft); border-color: rgba(245,165,36,0.35); }
.badge-err   { color: #ff9b9d; background: var(--err-soft); border-color: rgba(242,105,107,0.35); }
.badge-info  { color: #9bc7ff; background: var(--info-soft); border-color: rgba(90,169,255,0.35); }
.badge svg { width: 13px; height: 13px; }

/* ---------- Flash ---------- */
.flash-stack {
  position: fixed;
  top: 12px; left: 12px; right: 12px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.flash {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 550;
  border: 1px solid var(--line-2);
  backdrop-filter: blur(10px);
  animation: flash-in .28s ease;
  pointer-events: auto;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.flash-ok   { background: var(--ok-soft); color: #7fe0ad; border-color: rgba(52,199,123,0.4); }
.flash-err  { background: var(--err-soft); color: #ff9b9d; border-color: rgba(242,105,107,0.4); }
.flash-info { background: var(--info-soft); color: #9bc7ff; border-color: rgba(90,169,255,0.4); }

/* ---------- Lista / tablas ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
}
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 600; letter-spacing: -0.1px; }
.row-sub { font-size: 12.5px; color: var(--text-dim); }
.row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.empty {
  text-align: center; padding: 36px 16px; color: var(--text-faint);
  font-size: 14px;
}
.empty svg { width: 40px; height: 40px; opacity: 0.4; margin-bottom: 10px; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); font-weight: 700; }
.stat .v { font-size: 24px; font-weight: 750; margin-top: 6px; letter-spacing: -0.5px; }
.stat.accent .v { color: var(--accent-2); }

/* ---------- Agenda (horas) ---------- */
.agenda { display: flex; flex-direction: column; gap: 6px; }
.slot {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
}
.slot-empty {
  border-style: dashed;
  background: transparent;
  opacity: 0.7;
}
.slot-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; color: var(--accent-2); }
.slot-empty .slot-time { color: var(--text-faint); font-weight: 600; }
.slot-body { min-width: 0; }
.slot-client { font-size: 15px; font-weight: 650; letter-spacing: -0.2px; }
.slot-meta { font-size: 12.5px; color: var(--text-dim); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.slot-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }

/* ---------- Chips de estado ---------- */
.state-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text-dim);
  transition: all .14s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.ok:hover  { color: var(--ok); border-color: rgba(52,199,123,0.4); }
.icon-btn.warn:hover{ color: var(--accent-2); border-color: rgba(245,165,36,0.4); }
.icon-btn.err:hover { color: var(--err); border-color: rgba(242,105,107,0.4); }

/* ---------- Modal / sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(5,7,10,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 520px;
  background: linear-gradient(180deg, #1B2230, #141922);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--line-2);
  border-bottom: none;
  padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow);
  animation: sheet-up .28s cubic-bezier(.2,.9,.3,1.1);
  max-height: 88dvh; overflow-y: auto;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 38px; height: 4px; border-radius: 999px; background: var(--line-2); margin: 8px auto 14px; }
.sheet-title { font-size: 18px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.3px; }

@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; border: 1px solid var(--line-2); margin-bottom: 0; }
}

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, rgba(27,34,48,0.9), rgba(20,25,34,0.9));
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
}
.auth-logo {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #1a1205;
  box-shadow: 0 10px 26px rgba(245,165,36,0.35);
}
.auth-logo svg { width: 26px; height: 26px; }
.auth-brand-text .a { font-size: 17px; font-weight: 750; letter-spacing: -0.3px; }
.auth-brand-text .b { font-size: 12.5px; color: var(--text-dim); }
.auth-title { font-size: 22px; font-weight: 750; margin: 0 0 6px; letter-spacing: -0.5px; }
.auth-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 20px; }
.auth-actions { margin-top: 8px; }
.auth-switch { margin-top: 16px; text-align: center; font-size: 13.5px; color: var(--text-dim); }
.auth-switch a { color: var(--accent-2); font-weight: 600; }

/* ---------- Plan tiers ---------- */
.plan-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .plan-grid { grid-template-columns: repeat(3, 1fr); } }
.plan-card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
}
.plan-card.featured {
  border-color: rgba(245,165,36,0.5);
  background: linear-gradient(180deg, rgba(245,165,36,0.10), var(--panel));
}
.plan-card .tag {
  position: absolute; top: -10px; right: 16px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #1a1205; font-size: 11px; font-weight: 750; letter-spacing: 0.5px;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}
.plan-name { font-size: 18px; font-weight: 750; letter-spacing: -0.3px; }
.plan-desc { color: var(--text-dim); font-size: 13px; margin: 6px 0 14px; }
.plan-feats { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.plan-feats li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--text); }
.plan-feats li svg { width: 16px; height: 16px; color: var(--ok); flex-shrink: 0; margin-top: 2px; }

/* ---------- Utility ---------- */
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.spacer { height: 8px; }
.hidden { display: none !important; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.w100 { width: 100%; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hide-sm { display: none; }
@media (min-width: 720px) { .hide-sm { display: initial; } }

/* ---------- Admin table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.table th, table.table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.table th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); font-weight: 700; background: var(--panel); }
table.table tr:last-child td { border-bottom: none; }
table.table td.actions { text-align: right; }

/* ---------- Search ---------- */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: rgba(255,255,255,0.04);
  margin-bottom: 14px;
}
.search-bar input { flex: 1; border: none; background: transparent; color: var(--text); font-size: 15px; outline: none; }
.search-bar svg { width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }

/* ---------- Toggle ---------- */
.toggle { display: inline-flex; align-items: center; gap: 10px; }
.toggle input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .18s ease; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(18px); }
