/* ============================================================
   Berbaz Udalak (udalak.berbaz.com): panel de ayuntamientos y su backoffice.
   Réplica del vídeo de Egoitz (28-nov-2026), medido a 1280×720: cada px de
   aquí es un px del vídeo × 1,51. Paleta de marca (la de berbaz.css).
   Este fichero: fuente, tokens, marco (menú lateral) y componentes comunes.
   Lo propio de cada pantalla va en css/udalak/<pantalla>.css.
   ============================================================ */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --indigo: #3510A8;        /* botones, acentos */
  --indigo-hover: #4A20D4;
  --indigo-deep: #24107F;   /* menú lateral */
  --indigo-ink: #2A1592;    /* cifras y etiquetas en morado */
  --indigo-soft: #EFEDFB;   /* chips activos suaves, fondos de icono */
  --violet: #5B2EDF;        /* color del 1.er departamento */
  --teal: #00A79C;
  --teal-soft: #D9F4F1;
  --teal-ink: #007A70;
  --amber: #E5A400;
  --amber-soft: #FFF3C9;
  --amber-ink: #8A6100;
  --yellow: #FFC72C;
  --rose: #FF4D6A;
  --rose-soft: #FFE4E9;
  --ink: #171F29;           /* texto principal */
  --body: #4B5563;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --bg: #F7F8FD;            /* fondo del panel */
  --card: #FFFFFF;
  --line: #E7E9F0;
  --line-strong: #D7DAE3;
  --track: #E9EAF2;         /* raíl de barras de progreso y deslizadores */
  --rest: #CFD3DB;          /* «Banatu gabe» en las barras */
  --radius: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(36, 16, 127, 0.04), 0 6px 20px -10px rgba(36, 16, 127, 0.14);
  --shadow-pop: 0 18px 40px -12px rgba(23, 31, 41, 0.28);
  --sidebar-w: 220px;
  --pad-x: 36px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--indigo); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.brand-mark { width: 27px; height: 14px; flex: none; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.brand-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--yellow); color: var(--indigo-deep);
}

/* ---------- Marco: menú lateral + contenido ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--indigo-deep); color: #fff;
  padding: 22px 12px 15px;
}
.sidebar .brand { padding: 0 6px; margin-bottom: 18px; }
.sidebar .brand-name { color: #fff; }
.org-card {
  display: flex; align-items: center; gap: 9px;
  padding: 10px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.10);
  margin-bottom: 20px;
}
.org-icon {
  width: 30px; height: 30px; flex: none; border-radius: 8px; background: #fff; color: var(--indigo-deep);
  display: grid; place-items: center;
}
.org-icon svg { width: 17px; height: 17px; }
.org-name { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.org-role { font-size: 10.5px; color: rgba(255, 255, 255, 0.7); line-height: 1.25; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  height: 37px; padding: 0 12px; border-radius: 9px;
  color: rgba(255, 255, 255, 0.92); text-decoration: none; font-size: 12.5px; font-weight: 600;
}
.nav a svg { width: 16px; height: 16px; flex: none; opacity: 0.9; }
.nav a:hover { background: rgba(255, 255, 255, 0.07); }
.nav a[aria-current="page"] { background: #fff; color: var(--indigo-deep); font-weight: 700; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.4); }
.nav a[aria-current="page"] svg { opacity: 1; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 17px; padding-top: 16px; }
.hours-card {
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.10);
}
.hours-card .label { font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.85); }
.hours-card .value { margin-top: 6px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.hours-card .value b { font-size: 21px; font-weight: 800; color: #fff; letter-spacing: -0.01em; }
.hours-card .bar { margin: 8px 0 7px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.hours-card .bar i { display: block; height: 100%; border-radius: inherit; background: var(--yellow); }
.hours-card .until { font-size: 10.5px; color: rgba(255, 255, 255, 0.75); }
.me-row { display: flex; align-items: center; gap: 9px; padding: 0 6px; }
.me-row .me-name { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.me-row .me-sub { font-size: 10px; color: rgba(255, 255, 255, 0.7); }
.me-row button { margin-left: auto; background: none; border: 0; color: rgba(255, 255, 255, 0.7); padding: 4px; border-radius: 6px; }
.me-row button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.main { min-width: 0; padding: 26px var(--pad-x) 40px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.page-head .titles { flex: 1; min-width: 0; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--indigo-ink); }
.page-title { margin: 2px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.page-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.page-actions { display: flex; gap: 10px; align-items: center; }
.counter-pill {
  font-size: 11px; font-weight: 700; color: var(--indigo-ink);
  background: var(--indigo-soft); padding: 6px 12px; border-radius: 999px;
}

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(23, 31, 41, 0.04); }
.card-pad { padding: 18px 22px; }
.card-title { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.card-sub { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi { padding: 14px 16px 13px; border-radius: 14px; }
.kpi .k-label { font-size: 10.5px; font-weight: 700; color: var(--body); }
.kpi .k-value { margin-top: 3px; font-size: 25px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi .k-sub { margin-top: 4px; font-size: 10.5px; color: var(--muted); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 18px; border-radius: 999px; border: 0;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; text-decoration: none;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 6px 16px -8px rgba(53, 16, 168, 0.7); }
.btn-primary:hover { background: var(--indigo-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.btn-light { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-light:hover { border-color: var(--indigo); color: var(--indigo); }
.btn-ghost { background: transparent; color: var(--indigo); padding: 0 10px; }
.btn-danger { background: #fff; color: #B42318; border: 1px solid #F3C5C0; }
.btn-block { width: 100%; }
.btn-lg { height: 42px; font-size: 13px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--indigo-soft); color: var(--indigo); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field + .field { margin-top: 11px; }
.field-label { font-size: 11px; font-weight: 700; color: var(--ink); }
.field-hint { font-size: 10.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff;
  font-size: 12.5px; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea { height: auto; min-height: 80px; padding: 10px 13px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus, .input.is-active { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(53, 16, 168, 0.12); }
.input[aria-invalid="true"] { border-color: #D92D20; box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.1); }
.select { appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23171F29' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E") no-repeat right 14px center; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { min-height: 16px; margin-top: 8px; font-size: 11.5px; color: #B42318; }

/* Paso a paso − valor + */
.stepper { display: flex; align-items: center; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.stepper button { width: 34px; height: 100%; border: 0; background: none; font-size: 16px; font-weight: 600; color: var(--ink); }
.stepper button:hover { color: var(--indigo); }
.stepper input { flex: 1; min-width: 0; border: 0; text-align: center; font-weight: 800; font-size: 13px; outline: none; background: none; }

/* Chips (plantillas, idiomas) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 26px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #fff;
  font-size: 11px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.chip:hover { border-color: var(--indigo); }
.chip[aria-pressed="true"] { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 10.5px; font-weight: 600; color: var(--body); }

/* Casillas y opciones */
.check-row {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
}
.check-row:has(input:checked) { border-color: var(--indigo); background: #F7F5FF; }
.check-row input { appearance: none; width: 16px; height: 16px; margin: 0; border: 1.5px solid #A1A6B4; border-radius: 4px; display: grid; place-items: center; flex: none; }
.check-row input:checked { background: var(--indigo); border-color: var(--indigo); }
.check-row input:checked::after { content: ""; width: 8px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.radio-card {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; cursor: pointer;
}
.radio-card + .radio-card { margin-top: 8px; }
.radio-card:has(input:checked) { border-color: #8E89A6; background: #F1F2FB; }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--indigo); outline-offset: 2px; }
.radio-card input { appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid #A1A6B4; border-radius: 50%; flex: none; display: grid; place-items: center; }
.radio-card input:checked { border-color: var(--indigo); border-width: 2.5px; }
.radio-card input:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--indigo); }
.radio-card .rc-title { font-size: 12px; font-weight: 700; }
.radio-card .rc-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.switch { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: #D5D8E1; position: relative; margin: 0; cursor: pointer; transition: background 0.15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.switch:checked { background: var(--indigo); }
.switch:checked::after { transform: translateX(14px); }

/* ---------- Insignias de estado ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--teal-soft); color: var(--teal-ink); }
.badge-pending { background: var(--amber-soft); color: var(--amber-ink); }
.badge-off { background: #F0F1F4; color: var(--muted); }
.badge-over { background: var(--rose-soft); color: #B4233B; }
.badge-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.role-pill { display: inline-flex; align-items: center; height: 20px; padding: 0 10px; border-radius: 6px; font-size: 10.5px; font-weight: 700; background: #F0F1F6; color: var(--ink); }
.role-pill.is-admin { background: var(--indigo); color: #fff; }

/* ---------- Barras ---------- */
.progress { height: 5px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--indigo); }
.stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--rest); gap: 2px; }
.stack i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 11px; color: var(--body); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--rest)); }
.legend b { color: var(--ink); font-weight: 800; }

/* Colores de departamento (data-color) */
[data-color="violet"] { --c: var(--violet); --c-soft: #EEE9FD; }
[data-color="teal"] { --c: var(--teal); --c-soft: var(--teal-soft); }
[data-color="amber"] { --c: var(--amber); --c-soft: var(--amber-soft); }
[data-color="rose"] { --c: var(--rose); --c-soft: var(--rose-soft); }
[data-color="sky"] { --c: #1E88E5; --c-soft: #E3F0FD; }
[data-color="lime"] { --c: #5BA51E; --c-soft: #EAF6DD; }
[data-color="orange"] { --c: #F2711C; --c-soft: #FDEBDD; }
[data-color="slate"] { --c: #64748B; --c-soft: #EEF1F5; }
.dept-icon { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); }
.dept-icon svg { width: 16px; height: 16px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--rest)); flex: none; display: inline-block; }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .strong { font-weight: 700; }
.table .sub { font-size: 10.5px; color: var(--muted); }

/* ---------- Avatar ---------- */
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff; background: var(--c, var(--teal)); }
.avatar-sm { width: 26px; height: 26px; font-size: 9.5px; }

/* ---------- Avisos flotantes ---------- */
/* Altura del vídeo: encima de la franja de abajo */
.toasts { position: fixed; right: 28px; bottom: 82px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px;
  background: #1B2230; color: #fff; font-size: 12px; font-weight: 600; box-shadow: var(--shadow-pop);
  animation: toast-in 0.22s ease-out;
}
.toast svg { width: 20px; height: 20px; flex: none; }
/* Como en el vídeo: círculo verde relleno con la marca en blanco */
.toast:not(.is-error) svg circle { fill: var(--teal); stroke: var(--teal); }
.toast:not(.is-error) svg path { stroke: #fff; stroke-width: 2.2; }
.toast.is-error svg { color: #FCA5A5; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Panel lateral (cajón) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(23, 31, 41, 0.38); z-index: 40; animation: fade-in 0.18s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 392px; max-width: 100vw; z-index: 41;
  background: #fff; box-shadow: var(--shadow-pop); overflow-y: auto; padding: 22px 26px 26px;
  animation: drawer-in 0.22s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Estados ---------- */
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--muted); font-size: 12.5px; }
.empty-dashed {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px;
  border: 1.5px dashed #C9CDD8; border-radius: 16px; background: transparent; color: var(--indigo-ink);
  min-height: 132px; padding: 18px; cursor: pointer; width: 100%;
}
.empty-dashed:hover { border-color: var(--indigo); background: #FBFAFF; }
.empty-dashed .plus { width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; font-size: 17px; font-weight: 600; color: var(--indigo); margin-bottom: 6px; }
.empty-dashed .e-title { font-size: 12.5px; font-weight: 700; }
.empty-dashed .e-sub { font-size: 10.5px; color: var(--muted); font-weight: 500; }

/* ---------- Pantallas sin menú (entrar, invitación) ---------- */
.solo { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(1200px 600px at 85% -10%, #3A1FB0 0%, var(--indigo-deep) 55%, #1A0B62 100%); }
.solo-card { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 30px 30px 26px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.55); }
.solo-card .brand { margin-bottom: 22px; }
.solo-card h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.solo-card p.lead { margin: 6px 0 18px; color: var(--muted); font-size: 12.5px; }
.solo-foot { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); }
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: #F1F2F6; }
.lang-switch button { border: 0; background: none; font-size: 10.5px; font-weight: 800; padding: 4px 9px; border-radius: 999px; color: var(--muted); }
.lang-switch button[aria-pressed="true"] { background: #fff; color: var(--indigo); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.staging-badge { position: fixed; right: 10px; top: 8px; z-index: 60; font: 700 10px var(--font); letter-spacing: 0.05em; background: #FFC72C; color: #24107F; padding: 4px 8px; border-radius: 6px; pointer-events: none; }

/* ---------- Pantallas estrechas: el menú pasa arriba ---------- */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 45; transform: translateX(-100%); transition: transform 0.2s; }
  .shell.menu-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .menu-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; margin-bottom: 12px; }
  .main { padding: 18px 16px 32px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .drawer { width: 100vw; }
}
