/* ═══════════════════════════════════════════════════════════════════
   FERROKA — sistema de diseño
   Paleta: naranja industrial + grafito. Una sola familia de color.
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --orange:        #F97316;
  --orange-deep:   #C2410C;   /* AA: 5,18:1 con blanco */
  --orange-soft:   #FFF3E8;
  --orange-line:   #FDBA74;

  --graphite:      #16181D;
  --graphite-2:    #1E222A;
  --graphite-3:    #2A2F39;

  --bg:            #F4F5F7;
  --surface:       #FFFFFF;
  --surface-2:     #FAFBFC;
  --line:          #E3E6EA;
  --line-strong:   #CBD1D8;
  --ink:           #14171C;
  --ink-2:         #3D4550;
  --muted:         #6E7783;

  --green:         #15803D;
  --green-soft:    #E9F7EE;
  --red:           #B91C1C;
  --red-soft:      #FDECEC;
  --amber:         #B45309;
  --amber-soft:    #FEF4E6;
  --blue:          #1D4ED8;
  --blue-soft:     #EBF0FE;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow:    0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, .18);
  --sidebar-w: 246px;
  --header-h: 62px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.45;
}
.hidden { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.015em; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--orange-deep); }
.ico { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; }
.ico svg { width: 100%; height: 100%; stroke-width: 1.9; }

/* ── Botones ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background .14s, border-color .14s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #b9c0c9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--orange-deep); border-color: var(--orange-deep); color: #fff; }
.btn-primary:hover { background: #9A3412; border-color: #9A3412; }
.btn-dark { background: var(--graphite-2); border-color: var(--graphite-2); color: #fff; }
.btn-dark:hover { background: var(--graphite-3); border-color: var(--graphite-3); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(20, 23, 28, .06); border-color: transparent; }
.btn-danger { background: var(--red-soft); border-color: #f3c7c7; color: var(--red); }
.btn-danger:hover { background: #fbe0e0; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(20, 23, 28, .07); }

/* ── Inputs ──────────────────────────────────────────────────────────── */
label.fld { display: block; font-size: 12px; font-weight: 600; color: var(--muted);
            text-transform: uppercase; letter-spacing: .04em; margin: 0 0 5px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: #fff; color: var(--ink); outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249, 115, 22, .16);
}
.input::placeholder { color: #9aa2ad; }
.field { margin-bottom: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 13px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 13px; }
@media (max-width: 620px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ── Login ───────────────────────────────────────────────────────────── */
.login-screen { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-art {
  position: relative; overflow: hidden; background: var(--graphite); color: #fff;
  padding: 54px 52px; display: flex; flex-direction: column; justify-content: center; gap: 26px;
}
.login-mark { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: .22em; font-size: 15px; }
.mark-box {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 10px; background: var(--orange); color: #fff; font-weight: 800; letter-spacing: 0;
  font-size: 19px; box-shadow: 0 5px 16px rgba(249, 115, 22, .35);
}
.mark-box.sm { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; box-shadow: none; }
.login-art h1 { font-size: 33px; line-height: 1.18; max-width: 17ch; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 13px; max-width: 380px; }
.login-points li { display: flex; gap: 12px; color: #C7CCD4; font-size: 13.5px; align-items: flex-start; }
.login-points span { color: var(--orange); font-weight: 800; font-size: 11.5px; letter-spacing: .08em; padding-top: 2px; }
.login-stripes {
  position: absolute; inset: auto -60px -120px auto; width: 320px; height: 320px; border-radius: 50%;
  background: repeating-linear-gradient(45deg, rgba(249,115,22,.5) 0 8px, transparent 8px 20px);
  opacity: .16; pointer-events: none;
}
.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.login-card {
  width: 100%; max-width: 372px; background: var(--surface); padding: 30px 28px 26px;
  border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.login-card h2 { font-size: 22px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 0 5px; }
.login-card input {
  width: 100%; height: 42px; padding: 0 12px; margin-bottom: 14px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); outline: none; transition: border-color .14s, box-shadow .14s;
}
.login-card input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249, 115, 22, .16); }
.login-card .btn { margin-top: 6px; height: 44px; font-size: 14.5px; }
.login-error { color: var(--red); font-size: 12.5px; margin: 11px 0 0; min-height: 16px; }
@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; padding: 20px; }
}

/* ── Shell ───────────────────────────────────────────────────────────── */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--graphite);
  color: #E7EAEF; display: flex; flex-direction: column; z-index: 40; transition: transform .22s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 17px 18px; border-bottom: 1px solid #24282F; }
.brand-name { font-weight: 800; letter-spacing: .2em; font-size: 13.5px; color: #fff; }
.nav { padding: 12px 10px; display: grid; gap: 2px; flex: 1; align-content: start; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0;
  border-radius: var(--r-sm); background: transparent; color: #B9C0CA; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-align: left; position: relative;
}
.nav-item:hover { background: #21252D; color: #fff; }
.nav-item.active { background: #24282F; color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--orange);
}
.nav-item.active .ico { color: var(--orange); }
.sidebar-foot { padding: 12px; border-top: 1px solid #24282F; display: grid; gap: 10px; }
.rate-chip {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: var(--r-sm);
  background: #21252D; border: 1px solid #2C313A; cursor: pointer; font-size: 12px;
}
.rate-chip:hover { border-color: var(--orange-line); }
.rate-label { color: #8E97A3; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 700; }
.rate-chip strong { color: #fff; font-size: 12.5px; }
.rate-src { margin-left: auto; color: var(--orange); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.user-row { display: flex; align-items: center; gap: 9px; padding: 2px 4px; color: #B9C0CA; }
.user-meta { display: grid; line-height: 1.2; flex: 1; min-width: 0; }
.user-meta strong { color: #fff; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: #7F8894; font-size: 10.5px; letter-spacing: .02em; }
.user-row .icon-btn:hover { background: #2A2F39; color: #fff; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  margin-left: var(--sidebar-w); display: flex; align-items: center; gap: 12px;
  padding: 0 22px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.chip-rate {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--orange-line);
  background: var(--orange-soft); color: var(--orange-deep); font-weight: 700; font-size: 12.5px;
  cursor: pointer;
}
.chip-rate:hover { background: #ffe8d4; }
#sidebar-toggle { display: none; color: var(--ink); }

.view { margin-left: var(--sidebar-w); padding: 22px; max-width: 1420px; }
.scrim { position: fixed; inset: 0; background: rgba(14, 18, 24, .42); z-index: 35; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .topbar, .view { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .view { padding: 14px 14px 84px; }
  #sidebar-toggle { display: inline-flex; }
  .topbar h1 { font-size: 15.5px; }
}

/* ── Cards / KPI ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { font-size: 14px; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 16px; min-width: 0; }
.kpi-grid.three { grid-template-columns: repeat(3, 1fr); }
.kpi-grid > * { min-width: 0; }
@media (max-width: 1080px) {
  .kpi-grid, .kpi-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* En móvil las tarjetas NO se apilan: se deslizan de lado con el dedo y quedan alineadas (snap).
   La siguiente asoma a la derecha para que se entienda que hay más. */
@media (max-width: 700px) {
  .kpi-grid, .kpi-grid.three {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 67%;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .kpi-grid::-webkit-scrollbar { display: none; }
  .kpi-grid > * { scroll-snap-align: start; scroll-snap-stop: always; }

  /* tarjeta compacta: el ícono ocupa el lado derecho y el dato manda */
  .kpi-grid .kpi { padding: 11px 12px; display: grid; gap: 2px; }
  .kpi-grid .kpi-label {
    font-size: 9px; letter-spacing: .05em; display: flex; align-items: center;
    justify-content: space-between; gap: 6px; margin-bottom: 2px;
  }
  .kpi-grid .kpi-label .ico { width: 22px; height: 22px; color: var(--orange); order: 2; opacity: .9; }
  .kpi-grid .kpi-value { font-size: 23px; margin-top: 0; line-height: 1.05; }
  .kpi-grid .kpi-sub { font-size: 10px; line-height: 1.3; margin-top: 2px;
                       display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
       box-shadow: var(--shadow-sm); min-width: 0; overflow-wrap: anywhere; }
.kpi .kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.kpi .kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi.accent { border-color: var(--orange-line); background: linear-gradient(180deg, #FFF8F1, #fff 62%); }
.kpi.accent .kpi-value { color: var(--orange-deep); }

/* ── Tablas ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-weight: 700; white-space: nowrap;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #EEF1F4; vertical-align: middle; }
table.tbl tbody tr:hover { background: #FCFCFD; }
table.tbl tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.t-strong { font-weight: 700; }
.t-muted { color: var(--muted); }
.t-small { font-size: 11.5px; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

/* ── Badges / pills ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
}
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.low { background: var(--amber-soft); color: var(--amber); }
.badge.out { background: var(--red-soft); color: var(--red); }
.badge.void { background: #F1F3F5; color: #5A6270; }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.unit { background: #F1F3F5; color: var(--ink-2); font-weight: 600; }
.tag { display: inline-flex; padding: 1px 7px; border-radius: 5px; background: #F1F3F5; color: var(--ink-2); font-size: 11px; font-weight: 600; }

/* ── Toolbar / filtros ───────────────────────────────────────────────── */
.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search-box { position: relative; flex: 1; min-width: 190px; max-width: 460px; }
.search-box .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search-box input { width: 100%; height: 38px; padding: 0 11px 0 35px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); outline: none; background: #fff; }
.search-box input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249, 115, 22, .14); }
.spacer { flex: 1; }
.seg { display: inline-flex; background: #EDEFF2; border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── POS ─────────────────────────────────────────────────────────────── */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 16px; align-items: start; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); gap: 11px; min-width: 0; }
@media (max-width: 430px) {
  .pos-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .pos-card { padding: 10px; }
  .pos-card .pc-name { font-size: 12.5px; min-height: 32px; }
  .pos-card .pc-price { font-size: 14px; }
}
.pos-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
  cursor: pointer; transition: border-color .13s, box-shadow .13s; display: grid; gap: 6px; text-align: left;
}
.pos-card:hover { border-color: var(--orange-line); box-shadow: var(--shadow); }
.pos-card:active { transform: scale(.995); }
.pos-card .pc-name { font-weight: 700; font-size: 13px; line-height: 1.3; min-height: 34px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-card .pc-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.pos-card .pc-price { font-weight: 800; font-size: 15px; color: var(--ink); }
.pos-card .pc-bs { font-size: 11px; color: var(--muted); }
.pos-card.disabled { opacity: .5; cursor: not-allowed; }
.cat-chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; margin-bottom: 12px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 6px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.cat-chip.active { background: var(--graphite-2); border-color: var(--graphite-2); color: #fff; }

.cart { position: sticky; top: calc(var(--header-h) + 16px); background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); display: flex;
        flex-direction: column; max-height: calc(100vh - var(--header-h) - 40px); }
.cart-head { display: flex; align-items: center; gap: 8px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.cart-head h2 { font-size: 14px; }
.cart-count { background: var(--orange-soft); color: var(--orange-deep); font-weight: 800; font-size: 11.5px;
              padding: 2px 8px; border-radius: 999px; }
.cart-items { flex: 1; overflow-y: auto; padding: 6px 8px; min-height: 90px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 7px; border-bottom: 1px dashed #EDEFF2; }
.cart-line:last-child { border-bottom: 0; }
.cl-name { font-weight: 600; font-size: 12.5px; line-height: 1.25; }
.cl-sku { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.cl-right { text-align: right; display: grid; gap: 5px; }
.cl-total { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.qty-ctrl { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.qty-ctrl button { width: 26px; height: 26px; border: 0; background: #fff; cursor: pointer; font-weight: 800; color: var(--ink-2); font-size: 14px; }
.qty-ctrl button:hover { background: var(--orange-soft); color: var(--orange-deep); }
.qty-ctrl input { width: 46px; height: 26px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
                  text-align: center; font-size: 12.5px; font-weight: 700; outline: none; font-variant-numeric: tabular-nums; }
.cart-foot { border-top: 1px solid var(--line); padding: 12px 15px 14px; display: grid; gap: 8px; }
.cart-row { display: flex; justify-content: space-between; font-size: 13px; }
.cart-row.total { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.cart-row.total .bs { font-size: 12.5px; color: var(--muted); font-weight: 600; display: block; text-align: right; }
.cart-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 12.5px; }
.cart-fab { display: none; }
@media (max-width: 980px) {
  html, body { overflow-x: hidden; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-layout > * { min-width: 0; }
  .cart {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 45; border-radius: 16px 16px 0 0;
    max-height: 78vh; max-width: 100vw; width: 100%; transform: translateY(102%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .cart-items, .cart-line, .cart-line > div { min-width: 0; }
  .cl-name { overflow-wrap: anywhere; }
  .cart.open { transform: translateY(0); }
  .cart-fab {
    display: flex; position: fixed; right: 16px; bottom: 18px; z-index: 44; align-items: center; gap: 9px;
    padding: 12px 17px; border: 0; border-radius: 999px; background: var(--orange-deep); color: #fff;
    font-weight: 800; font-size: 13.5px; box-shadow: 0 10px 26px rgba(234, 88, 12, .38); cursor: pointer;
  }
  .cart-fab.off { display: none; }
}
.cart-backdrop { display: none; }
@media (max-width: 980px) { .cart-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(14,18,24,.4); z-index: 44; } }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-back {
  position: fixed; inset: 0; background: rgba(14, 18, 24, .48); z-index: 60; display: flex;
  align-items: center; justify-content: center; padding: 18px; animation: fade .14s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%;
  max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  animation: pop .16s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6 } to { transform: none; opacity: 1 } }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15.5px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; background: var(--surface-2); }
@media (max-width: 560px) {
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 94vh; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
}

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast-root { position: fixed; top: 16px; right: 16px; z-index: 80; display: grid; gap: 8px; max-width: 340px; }
.toast {
  background: var(--graphite-2); color: #fff; padding: 11px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); animation: slide .18s ease;
  border-left: 3px solid var(--orange);
}
.toast.ok { border-left-color: #22c55e; }
.toast.err { border-left-color: #ef4444; }
@keyframes slide { from { transform: translateX(14px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ── Detalles ────────────────────────────────────────────────────────── */
.list-rows { display: grid; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #EEF1F4; font-size: 13px; }
.list-row:last-child { border-bottom: 0; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 600; }
.list-row .lr-sub { font-size: 11.5px; color: var(--muted); }
.stat-line { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed #EDEFF2; }
.stat-line:last-child { border-bottom: 0; }
.stat-line strong { font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; border-radius: 999px; background: #EDEFF2; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--orange); }
.alert-inline {
  display: flex; gap: 9px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r-sm);
  background: var(--amber-soft); border: 1px solid #F5D9AE; color: #7C4A03; font-size: 12.5px; margin-bottom: 14px;
}
.alert-inline.red { background: var(--red-soft); border-color: #F3C7C7; color: #8F1D1D; }
.alert-inline.blue { background: var(--blue-soft); border-color: #C7D5FB; color: #1E3FA8; }
.ticket-frame { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.recap { display: grid; gap: 7px; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.recap .r-row { display: flex; justify-content: space-between; font-size: 13px; }
.recap .r-row.big { font-size: 19px; font-weight: 800; }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
@media (max-width: 520px) { .pay-grid { grid-template-columns: repeat(2, 1fr); } }
.pay-btn { border: 1px solid var(--line-strong); background: #fff; border-radius: var(--r-sm); padding: 9px 6px;
           font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.pay-btn.active { border-color: var(--orange); background: var(--orange-soft); color: var(--orange-deep); box-shadow: 0 0 0 2px rgba(249,115,22,.14); }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800;
                 margin: 20px 0 9px; }
.section-title:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 128px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--orange-deep); }
