/* ===== Kite School — tokens ===== */
:root {
  --ink: #0a3540;
  --ink-2: #14505e;
  --lagoon: #0fa3b1;
  --lagoon-dark: #0b7e8a;
  --lagoon-soft: #d9f0f2;
  --coral: #ff7a48;
  --coral-dark: #e85d2a;
  --bg: #f2f7f6;
  --surface: #ffffff;
  --line: #dce9e7;
  --text: #173b42;
  --muted: #5e7c82;
  --ok: #248a3d;
  --warn: #b45309;
  --bad: #d32f2f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(10, 53, 64, 0.08), 0 6px 20px rgba(10, 53, 64, 0.06);
  --font-display: "Sora", sans-serif;
  --font-body: "Karla", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0; }
a { color: var(--lagoon-dark); }
button { font-family: var(--font-body); }

/* ===== Layout ===== */
#app { min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink) 0%, #0c4250 100%);
  color: #cfe6e6;
  display: flex; flex-direction: column;
  padding: 20px 12px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  color: #fff; display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 18px; letter-spacing: 0.2px;
}
.brand svg { flex-shrink: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  color: #a8cdd0; font-weight: 500; text-decoration: none;
  margin-bottom: 2px; border: 0; background: none; width: 100%;
  font-size: 15px; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active { background: var(--lagoon); color: #fff; }
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.sidebar .spacer { flex: 1; }
.sidebar .who { padding: 10px 12px; font-size: 13px; color: #8fb7ba; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar .who b { color: #fff; display: block; font-size: 14px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 90px; max-width: 1180px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Barra superior (móvil) y barra inferior */
.topbar { display: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 14px 14px 84px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--ink); color: #fff; padding: 12px 16px;
    position: sticky; top: 0; z-index: 40;
  }
  .topbar .brand { padding: 0; font-size: 17px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar .nav-item {
    flex: 1; flex-direction: column; gap: 3px; padding: 6px 2px;
    font-size: 11px; color: var(--muted); align-items: center; margin: 0;
  }
  .tabbar .nav-item.active { background: none; color: var(--lagoon-dark); }
  .tabbar .nav-item svg { width: 21px; height: 21px; }
}

/* ===== Componentes ===== */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h3 { font-size: 16px; margin-bottom: 12px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1020px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; } .grid.one-mobile { grid-template-columns: 1fr; } }

.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  font-weight: 700; font-size: 14.5px; background: var(--lagoon); color: #fff;
  transition: background 0.15s;
}
.btn:hover { background: var(--lagoon-dark); }
.btn.coral { background: var(--coral); }
.btn.coral:hover { background: var(--coral-dark); }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--lagoon-soft); border-color: var(--lagoon); }
.btn.danger { background: transparent; color: var(--bad); border: 1.5px solid #f3c1c1; }
.btn.danger:hover { background: #fdf0f0; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 5px; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 15px; font-family: var(--font-body);
  background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--lagoon); outline-offset: 0; border-color: var(--lagoon);
}
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
}
.chip.confirmed { background: var(--lagoon-soft); color: var(--lagoon-dark); }
.chip.completed { background: #e3f2e6; color: var(--ok); }
.chip.cancelled { background: #f5e8e8; color: var(--bad); }
.chip.noshow { background: #f7ecdd; color: var(--warn); }
.chip.active { background: #e3f2e6; color: var(--ok); }
.chip.exhausted { background: #eef1f1; color: var(--muted); }
.chip.expired { background: #f5e8e8; color: var(--bad); }
.chip.cat { background: #eef2ff; color: #4353b8; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line);
}
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--lagoon-soft); }

/* Slots de horario */
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot {
  border: 1.5px solid var(--line); background: #fff; border-radius: 9px;
  padding: 8px 13px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink-2);
}
.slot:hover { border-color: var(--lagoon); }
.slot.sel { background: var(--ink); border-color: var(--ink); color: #fff; }

.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.day-pill {
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 8px 4px; min-width: 62px; text-align: center; cursor: pointer; flex-shrink: 0;
}
.day-pill .dw { font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.day-pill .dn { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); }
.day-pill.sel { background: var(--ink); border-color: var(--ink); }
.day-pill.sel .dw, .day-pill.sel .dn { color: #fff; }

/* Tarjetas de instructor */
.inst-card {
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px;
  cursor: pointer; background: #fff; display: flex; gap: 12px; align-items: flex-start;
}
.inst-card:hover { border-color: var(--lagoon); }
.inst-card.sel { border-color: var(--ink); background: var(--lagoon-soft); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--lagoon); color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
}
.stars { color: #e8a013; font-size: 14px; letter-spacing: 1px; }
.stars .off { color: #d5dedd; }
.stars.input { font-size: 30px; cursor: pointer; user-select: none; }

/* Medidor de horas (firma visual) */
.gauge-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.gauge { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.gauge svg { transform: rotate(-90deg); }
.gauge .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.gauge .num b { font-family: var(--font-display); font-size: 34px; color: var(--ink); line-height: 1; }
.gauge .num span { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }

.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--lagoon); border-radius: 99px; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(8, 40, 48, 0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; padding: 22px;
}
.modal h2 { font-size: 19px; margin-bottom: 16px; }
.modal .close-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal .close-row h2 { margin-bottom: 0; }
.x-btn { border: 0; background: var(--bg); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 16px; color: var(--muted); }

/* Toasts */
.toasts { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 861px) { .toasts { bottom: 24px; } }
.toast {
  background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px;
  font-weight: 500; font-size: 14.5px; box-shadow: var(--shadow); text-align: center;
}
.toast.err { background: var(--bad); }

/* Notificaciones */
.bell { position: relative; background: none; border: 0; cursor: pointer; color: inherit; padding: 6px; }
.bell .dot {
  position: absolute; top: 2px; right: 0; background: var(--coral); color: #fff;
  font-size: 10.5px; font-weight: 700; border-radius: 99px; min-width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notif-panel {
  position: absolute; right: 0; top: 42px; width: min(92vw, 380px); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border-radius: 14px; box-shadow: 0 8px 40px rgba(10,53,64,0.25); z-index: 90;
}
.notif { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.notif:last-child { border-bottom: 0; }
.notif .when { font-size: 12px; color: var(--muted); margin-top: 2px; }
.notif.unread { background: var(--lagoon-soft); }

/* ===== Pantalla de acceso ===== */
.auth {
  min-height: 100vh; display: flex; align-items: stretch;
  background: linear-gradient(160deg, var(--ink) 0%, #0d5666 55%, var(--lagoon) 100%);
}
.auth-brand {
  flex: 1; color: #fff; display: flex; flex-direction: column; justify-content: center;
  padding: 8vh 7vw; position: relative; overflow: hidden;
}
.auth-brand h1 { color: #fff; font-size: clamp(30px, 4.2vw, 52px); line-height: 1.12; letter-spacing: -0.5px; }
.auth-brand p { color: #c8e7ea; font-size: 17px; max-width: 420px; }
.auth-brand .waves { position: absolute; bottom: -2px; left: 0; right: 0; opacity: 0.5; pointer-events: none; }
.auth-panel {
  width: min(460px, 100%); background: var(--bg); display: flex; align-items: center;
  padding: 28px;
}
.auth-panel .inner { width: 100%; }
.auth-panel .card { padding: 26px; }
.auth-panel h2 { font-size: 22px; margin-bottom: 4px; }
.auth-panel .sub { color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }
@media (max-width: 760px) {
  .auth { flex-direction: column; }
  .auth-brand { padding: 42px 26px 60px; }
  .auth-panel { width: 100%; flex: 1; border-radius: 22px 22px 0 0; margin-top: -22px; }
}
.lang-switch { display: flex; gap: 4px; }
.lang-switch button {
  border: 0; background: rgba(255,255,255,0.15); color: #fff; font-weight: 700;
  padding: 5px 11px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.lang-switch button.on { background: #fff; color: var(--ink); }
.lang-switch.dark button { background: var(--lagoon-soft); color: var(--ink-2); }
.lang-switch.dark button.on { background: var(--ink); color: #fff; }

/* Calendario admin (franja semanal) */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
@media (max-width: 900px) { .week-grid { grid-template-columns: 1fr; } }
.week-col { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 10px; min-height: 80px; }
.week-col .wd { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.week-col .wd.today { color: var(--coral-dark); }
.bk {
  border-left: 4px solid var(--lagoon); background: var(--lagoon-soft);
  border-radius: 8px; padding: 7px 9px; margin-top: 8px; font-size: 13px; cursor: pointer;
}
.bk.completed { border-left-color: var(--ok); background: #e9f5eb; }
.bk.cancelled { border-left-color: var(--bad); background: #f7ecec; opacity: 0.7; }
.bk.noshow { border-left-color: var(--warn); background: #f7f0e2; }
.bk b { display: block; }
.bk .sub2 { color: var(--muted); font-size: 12px; }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 14px; }
.muted { color: var(--muted); font-size: 13.5px; }
.right { text-align: right; }
.big-num { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
