/* =========================================================================
   KynovaPOS — hoja de estilos base

   Dirección de diseño: herramienta de operación para dueños/admins de
   restaurante — claridad y confianza sobre "wow". Identidad "KynovaPOS":
   verde pino profundo como color de marca (frescura, confianza) + acento
   azafrán cálido (hospitalidad) sobre papel neutro tibio, tinta plum para
   texto. Deliberadamente NO el crema+terracota ni el oscuro+neón típicos.

   Nota de implementación: los nombres de las variables (--navy, --amber…)
   se conservan por compatibilidad — las vistas y sus <style> inline los
   referencian, así que remapear aquí los valores recolorea toda la app de
   una sola vez, sin tocar el markup.
   ========================================================================= */

@font-face{font-family:"Inter";font-weight:400;font-style:normal;font-display:swap;src:url("../fonts/inter-400.woff2") format("woff2");}
@font-face{font-family:"Inter";font-weight:500;font-style:normal;font-display:swap;src:url("../fonts/inter-500.woff2") format("woff2");}
@font-face{font-family:"Inter";font-weight:600;font-style:normal;font-display:swap;src:url("../fonts/inter-600.woff2") format("woff2");}
@font-face{font-family:"Inter";font-weight:700;font-style:normal;font-display:swap;src:url("../fonts/inter-700.woff2") format("woff2");}
@font-face{font-family:"Bricolage Grotesque";font-weight:600;font-style:normal;font-display:swap;src:url("../fonts/bricolage-600.woff2") format("woff2");}
@font-face{font-family:"Bricolage Grotesque";font-weight:700;font-style:normal;font-display:swap;src:url("../fonts/bricolage-700.woff2") format("woff2");}
@font-face{font-family:"Bricolage Grotesque";font-weight:800;font-style:normal;font-display:swap;src:url("../fonts/bricolage-800.woff2") format("woff2");}

:root {
    --ink:        #221D26;
    --navy:       #2B54D4;   /* color de marca / primario (antes azul-marino) */
    --navy-light: #4666E6;   /* hover/focus del primario */
    --amber:      #4A8FF0;   /* acento azafrán */
    --amber-dark: #2E6FD6;
    --bg:         #FFFFFF;
    --bg-soft:    #F6F4F0;    /* papel tibio */
    --border:     #E9E4DC;
    --text:       #33303A;
    --text-muted: #8A8580;
    --success:    #2E7D5B;
    --success-bg: #E6F1EB;
    --danger:     #C4443B;
    --danger-bg:  #FBEBE9;
    --radius:     12px;
    --shadow:     0 1px 2px rgba(24,20,28,.05), 0 1px 3px rgba(24,20,28,.03);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Bricolage Grotesque", "Inter", sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg-soft);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum" 1;   /* cifras tabulares: columnas de S/ alineadas */
}

.contenedor {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Topbar --- */
.topbar {
    background: var(--navy);
    border-bottom: 3px solid var(--amber);
}
.topbar__inner {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 18px 24px;
}
.marca {
    font-family: var(--font-display);
    color: #fff;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.marca span { color: var(--amber); }
.topbar__fase {
    color: #A9C0BB;
    font-size: 12.5px;
    font-weight: 500;
}

main.contenedor { padding-top: 40px; padding-bottom: 60px; min-height: 60vh; }

/* --- Tipografía --- */
h1 {
    font-family: var(--font-display);
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 6px 0;
}
h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 14px 0;
    letter-spacing: -0.01em;
}
p.subtitulo {
    color: var(--text-muted);
    margin: 0 0 32px 0;
    font-size: 15px;
}

/* --- Tarjeta / formulario --- */
.tarjeta {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

fieldset {
    border: none;
    padding: 0;
    margin: 0 0 26px 0;
}
fieldset legend {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--amber-dark);
    padding: 0 0 12px 0;
    margin: 0 0 4px 0;
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.campo { margin-bottom: 16px; }
.campo label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 5px;
}
.campo .ayuda {
    display: block;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 4px;
}
.campo input[type=text],
.campo input[type=email],
.campo input[type=tel],
.campo input[type=password],
.campo input[type=number],
.campo input[type=date],
.campo select,
.campo textarea {
    width: 100%;
    padding: 11px 13px;
    font-size: 14.5px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    outline: none;
    border-color: var(--navy-light);
    box-shadow: 0 0 0 3px rgba(43, 84, 212, 0.14);
}
.campo input.campo--error { border-color: var(--danger); }
.campo .error {
    color: var(--danger);
    font-size: 12.5px;
    margin-top: 5px;
    font-weight: 600;
}
.fila-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 560px) {
    .fila-2 { grid-template-columns: 1fr; }
}

/* --- Botones --- */
.btn {
    display: inline-block;
    padding: 11px 22px;
    font-size: 14.5px;
    font-weight: 700;
    border-radius: 9px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font);
    transition: background .15s ease, border-color .15s ease;
}
.btn-primario {
    background: var(--navy);
    color: #fff;
}
.btn-primario:hover { background: var(--navy-light); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-secundario {
    background: var(--bg);
    color: var(--navy);
    border: 1.5px solid var(--border);
}
.btn-secundario:hover { border-color: var(--navy); }
/* Botón de acción cálida (cobrar / confirmar pago) */
.btn-acento { background: var(--amber); color: #fff; }
.btn-acento:hover { background: var(--amber-dark); }

/* --- Alertas --- */
.alerta {
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 22px;
    font-size: 14px;
    font-weight: 600;
}
.alerta-exito { background: var(--success-bg); color: var(--success); }
.alerta-error { background: var(--danger-bg); color: var(--danger); }

/* --- Insignias de estado --- */
.insignia {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 100px;
}
.insignia-activo { background: var(--success-bg); color: var(--success); }
.insignia-ambar  { background: #FBEEDB; color: var(--amber-dark); }

/* --- Lista de datos (detalle) --- */
.datos dt {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 14px;
}
.datos dd {
    margin: 3px 0 0 0;
    font-size: 15px;
    color: var(--ink);
}

.sucursal-item {
    padding: 14px 0;
    border-top: 1px solid var(--border);
}
.sucursal-item:first-child { border-top: none; }
.sucursal-item strong { color: var(--ink); }
.sucursal-item .meta { color: var(--text-muted); font-size: 13px; }

/* --- Tablas (estilo base; las vistas con tabla propia lo sobrescriben) --- */
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
}
tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
tbody tr:last-child td { border-bottom: none; }

/* --- Utilidades genéricas --- */
.num    { font-variant-numeric: tabular-nums; }
.centro { text-align: center; }

/* --- Footer --- */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 12.5px;
}

/* --- Home / bienvenida --- */
.hero-fase {
    background: linear-gradient(160deg, #4666E6 0%, var(--navy) 55%, #16276B 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 34px;
    margin-bottom: 28px;
}
.hero-fase h1 { color: #fff; }
.hero-fase p { color: #C9D6F5; margin: 8px 0 0 0; }
.checklist { list-style: none; padding: 0; margin: 20px 0 0 0; }
.checklist li {
    padding: 8px 0 8px 28px;
    position: relative;
    font-size: 14px;
    color: #E4EFEC;
}
.checklist li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--amber);
    font-weight: 700;
}

/* =========================================================================
   Shell de aplicación (sidebar + topbar) — se activa en layouts/app.php.
   El contenido de cada vista se renderiza dentro de .vista.
   ========================================================================= */
.app { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.side {
    width: 248px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-tx);
    display: flex; flex-direction: column; padding: 18px 14px;
}
.side .brand { display: flex; align-items: center; gap: 11px; padding: 8px 8px 18px; text-decoration: none; }
.side .brand .mk {
    width: 38px; height: 38px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.side .brand .mk img { width: 100%; height: 100%; object-fit: contain; }
.side .brand .wm { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: #fff; letter-spacing: -.02em; }
.side .brand .wm span { color: #4A8FF0; }
.side .brand .sub { font-size: 11px; color: #6f7d78; margin-top: -2px; }
.navlbl { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #5f6d69; padding: 15px 10px 7px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
    display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
    color: var(--sidebar-tx); text-decoration: none; font-size: 13.5px; font-weight: 500; position: relative;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.05); color: #cfd8d5; }
.nav a.on { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on svg { opacity: 1; color: #4A8FF0; }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #4A8FF0; }
.side .foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 10px; }
.side .foot .av { width: 34px; height: 34px; border-radius: 9px; background: #2b3a36; color: #dfe8e5; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.side .foot .nm { font-size: 12.5px; color: #dfe8e5; font-weight: 600; line-height: 1.25; }
.side .foot .rl { font-size: 11px; color: #6f7d78; }

/* --- Área principal + topbar de app --- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.appbar {
    height: 66px; background: var(--bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px; padding: 0 26px;
}
.appbar .branch { display: flex; align-items: center; gap: 9px; padding: 7px 13px; border: 1px solid var(--line-2, var(--border)); border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--bg-soft); }
.appbar .branch .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.appbar .sp { flex: 1; }
.appbar .chip { display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 20px; font-size: 12.5px; font-weight: 600; background: var(--success-bg); color: var(--success); text-decoration: none; }
.appbar .chip .d { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.appbar .uav { display: flex; align-items: center; gap: 10px; }
.appbar .uav .a { width: 37px; height: 37px; border-radius: 10px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.appbar .uav .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.appbar .uav .rl { font-size: 11.5px; color: var(--text-muted); }

.vista { padding: 26px 30px; flex: 1; }

/* En escritorio: barra lateral y topbar FIJOS; solo el contenido hace scroll.
   (En <=900px no aplica, para no romper el menú deslizable del celular.) */
@media (min-width: 901px) {
    .app { height: 100vh; overflow: hidden; }
    .side { height: 100vh; overflow-y: auto; }
    .main { height: 100vh; overflow: hidden; }
    .vista { overflow-y: auto; }
}

/* --- Aviso de suscripción / prueba --- */
.appbar .chip-trial { background: #EAF1FE; color: var(--amber-dark); }
.appbar .chip-trial.chip-urg { background: var(--danger-bg); color: var(--danger); }
.trialbar { display: flex; align-items: center; gap: 12px; padding: 11px 30px; background: #EAF1FE; color: var(--amber-dark); border-bottom: 1px solid #CFE0FB; font-size: 13.5px; }
.trialbar .tb-ico { flex: none; }
.trialbar .tb-tx { flex: 1; }
.trialbar .tb-btn { padding: 7px 15px; border-radius: 8px; background: var(--amber); color: #fff; font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap; }
.trialbar .tb-btn:hover { background: var(--amber-dark); }
.trialbar.trialbar-urg { background: var(--danger-bg); color: var(--danger); border-bottom-color: #F3D2CE; }
.trialbar.trialbar-urg .tb-btn { background: var(--danger); }
@media (max-width: 640px) { .trialbar { flex-wrap: wrap; padding: 10px 16px; } }

/* --- Encabezado de página --- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.ph .ey { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--amber-dark); margin-bottom: 5px; }
.ph h1 { margin: 0; }
.ph p { color: var(--text-muted); font-size: 13.5px; margin: 5px 0 0; }
.ph .acts { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Rejillas y KPIs --- */
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .g-3, .g-4, .g-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .g-2, .g-3, .g-4, .g-5 { grid-template-columns: 1fr; } }

.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.card-h h2 { margin: 0; font-size: 15.5px; }
.card-b { padding: 20px; }

.kpi { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 17px 20px; box-shadow: var(--shadow); }
.kpi .ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 13px; background: var(--brand-l, var(--success-bg)); color: var(--navy); }
.kpi .ic svg { width: 19px; height: 19px; }
.kpi .lb { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted); }
.kpi .vl { font-family: var(--font-display); font-size: 27px; font-weight: 700; margin-top: 3px; letter-spacing: -.02em; color: var(--ink); }

/* --- Filas de lista enriquecidas (reemplazan .sucursal-item en las vistas nuevas) --- */
.lrow { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.lrow:last-child { border-bottom: none; }
.lrow .th { width: 38px; height: 38px; border-radius: 9px; background: var(--brand-l, var(--success-bg)); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.lrow .grow { flex: 1; min-width: 0; }
.lrow .tt { font-weight: 600; font-size: 14px; color: var(--ink); }
.lrow .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.lrow .end { text-align: right; }

.money-lg { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 46px 20px; color: var(--text-muted); font-size: 14px; }

/* Variantes de insignia adicionales (además de -activo / -ambar) */
.insignia-roja  { background: var(--danger-bg); color: var(--danger); }
.insignia-teal  { background: var(--brand-l, #E7EDFC); color: var(--navy); }
.insignia-gris  { background: #EFECE6; color: var(--text-muted); }
.insignia-info  { background: #E5EFF5; color: #2A6F97; }

/* Tokens auxiliares que usan las clases del shell */
:root { --sidebar: #0F1729; --sidebar-tx: #94A0B8; --line-2: #DDD6CC; --brand-l: #E7EDFC; }

/* Barra de nivel de stock */
.bar { height: 6px; background: var(--bg-soft); border-radius: 20px; overflow: hidden; margin-top: 6px; max-width: 160px; }
.bar > span { display: block; height: 100%; border-radius: 20px; background: var(--success); }

/* Tarjetas de mesa (salón) */
.mesa { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 12px; padding: 15px 16px; box-shadow: var(--shadow); }
.mesa.m-libre { border-left-color: var(--success); }
.mesa.m-ocupada { border-left-color: var(--amber); }
.mesa.m-reservada { border-left-color: var(--text-muted); }
.mesa .n { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--ink); }
.mesa .c { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Tarjetas de módulo (dashboard) */
.modgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .modgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .modgrid { grid-template-columns: 1fr; } }
.modcard { display: flex; gap: 14px; align-items: flex-start; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
.modcard:hover { border-color: var(--navy-light); transform: translateY(-1px); }
.modcard .ic { width: 40px; height: 40px; border-radius: 11px; background: var(--brand-l); color: var(--navy); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modcard .ic svg { width: 20px; height: 20px; }
.modcard .t { font-weight: 700; font-size: 15px; color: var(--ink); }
.modcard .d { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.modcard .lk { display: block; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--navy); }
.hero-app { background: linear-gradient(160deg, #4666E6 0%, var(--navy) 55%, #16276B 100%); color: #fff; border-radius: var(--radius); padding: 26px 30px; margin-bottom: 22px; box-shadow: var(--shadow); }
.hero-app h1 { color: #fff; margin: 0; }
.hero-app p { color: #C9D6F5; margin: 7px 0 0; font-size: 14px; }

/* --- SaaS: inputs/selects usados en el panel de plataforma --- */
.input{width:100%;padding:9px 11px;border:1.5px solid var(--border);border-radius:10px;
  font-family:var(--font);font-size:14px;color:var(--text);background:var(--surface);box-sizing:border-box}
.input:focus{outline:none;border-color:var(--navy);box-shadow:0 0 0 3px rgba(43, 84, 212,.12)}

/* ===================== RESPONSIVE / MÓVIL ===================== */
.nav-toggle { display: none; }
.nav-ov { display: none; }

@media (max-width: 900px) {
    /* Sidebar como panel deslizable */
    .side {
        position: fixed; top: 0; bottom: 0; left: -280px;
        z-index: 60; transition: left .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.28);
    }
    body.nav-open .side { left: 0; }

    /* Fondo oscuro al abrir el menú */
    .nav-ov {
        display: block; position: fixed; inset: 0; background: rgba(15,15,15,.45);
        z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s ease;
    }
    body.nav-open .nav-ov { opacity: 1; pointer-events: auto; }

    /* Botón hamburguesa */
    .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px; flex-shrink: 0; border: 1px solid var(--border);
        border-radius: 10px; background: var(--bg-soft); color: var(--ink); cursor: pointer;
    }
    .nav-toggle svg { width: 20px; height: 20px; }

    /* Topbar compacto */
    .appbar { padding: 0 14px; gap: 10px; }
    .appbar .branch { max-width: 42vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .appbar .uav .nm, .appbar .uav .rl { display: none; }

    /* Contenido y encabezados */
    .vista { padding: 18px 15px; }
    .ph { flex-wrap: wrap; gap: 12px; }
    .ph .acts { flex-wrap: wrap; }

    /* Tablas con scroll horizontal para no romper el layout */
    .card table, .vista table {
        display: block; width: 100%; overflow-x: auto;
        -webkit-overflow-scrolling: touch; white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .appbar .chip-trial { display: none; } /* el aviso completo ya aparece debajo */
    .hero-app h1 { font-size: 22px; }
}