/* WebPeñas — Verbena Eléctrica · design tokens + shell
 * Sistema de diseño basado en el deck de mockups del 26-04.
 * Convive con tokens.css y app.css legacy hasta que todas las páginas
 * migren. Páginas migradas enlazan SOLO este archivo.
 */
:root {
  --bg:        #150B0D;
  --s1:        #1C1014;
  --s2:        #241419;
  --s3:        #2D1A22;
  --s4:        #38222B;
  --tx:        #F4ECDB;
  --tx-dim:    rgba(244,236,219,0.62);
  --tx-faint:  rgba(244,236,219,0.38);
  --albero:       #E89B3C;
  --albero-light: #F2B864;
  --albero-deep:  #C8801F;
  --line:      rgba(244,236,219,0.10);
  --line-2:    rgba(244,236,219,0.18);
  --ok:    #6FBE85;
  --warn:  #E0B85A;
  --bad:   #E06A60;
  --info:  #7AA3D6;
  --r1: 6px; --r2: 10px; --r3: 14px; --r4: 20px; --r5: 28px;
  --f-display: "Fraunces", ui-serif, Georgia, serif;
  --f-body: "Inter Tight", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --ember: 0 8px 24px -8px rgba(232,155,60,0.22), 0 0 0 1px rgba(232,155,60,0.18) inset;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --expo:   cubic-bezier(0.16, 1, 0.3, 1);

  /* Legacy aliases for pages with inline styles using old variable names */
  --bg-deep:    var(--bg);
  --bg-soft:    var(--s1);
  --bg-lift:    var(--s2);
  --bg-raised:  var(--s3);
  --bg-overlay: var(--s4);
  --text:       var(--tx);
  --text-dim:   var(--tx-dim);
  --text-faint: var(--tx-faint);
  --accent:       var(--albero);
  --accent-light: var(--albero-light);
  --accent-deep:  var(--albero-deep);
  --accent-soft:  rgba(232,155,60,0.12);
  --accent-edge:  rgba(232,155,60,0.32);
  --accent-glow:  rgba(232,155,60,0.32);
  --line-strong:  var(--line-2);
  --line-soft:    rgba(244,236,219,0.06);
  --success:    var(--ok);
  --danger:     var(--bad);
  --success-bg: rgba(111,190,133,0.13);
  --warn-bg:    rgba(224,184,90,0.13);
  --danger-bg:  rgba(224,106,96,0.14);
  --info-bg:    rgba(122,163,214,0.13);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.30);
  --shadow-md: 0 4px 14px -4px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.32);
  --shadow-lg: 0 22px 44px -16px rgba(0,0,0,0.6);
  --shadow-ember: var(--ember);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --dur-fast: 180ms;
  --dur-mid:  280ms;
  --dur-slow: 460ms;
  --ease-out: var(--expo);
  --ease-spring: var(--spring);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--tx);
  font-family: var(--f-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }

/* ============== APP SHELL ============== */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #110709;
  border-right: 1px solid var(--line);
  padding: 28px 18px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.sb-brand {
  display: flex; justify-content: center;
  padding: 4px 16px 12px;
}
.sb-brand .sb-logo {
  width: 100%;
  max-width: 110px;
  height: auto;
  border-radius: 50%;
  filter: invert(1) sepia(0.35) saturate(2.2) hue-rotate(5deg);
  mix-blend-mode: screen;
  opacity: 0.88;
  transition: opacity 0.2s;
}
.sb-brand:hover .sb-logo { opacity: 1; }

.sb-section {
  font: 700 10px var(--f-mono);
  color: var(--tx-faint);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 18px 12px 8px;
}
.sb-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font: 500 14px var(--f-body);
  color: var(--tx-dim);
  position: relative;
  transition: background 0.15s var(--expo), color 0.15s var(--expo);
}
.sb-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sb-link:hover { color: var(--tx); background: rgba(244,236,219,0.04); }
.sb-link.active {
  background: linear-gradient(90deg, rgba(232,155,60,0.14), transparent);
  color: var(--tx);
}
.sb-link.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--albero); border-radius: 0 3px 3px 0;
}
.sb-link .badge-num {
  margin-left: auto;
  font: 600 10px var(--f-mono);
  background: var(--s4); color: var(--tx-dim);
  padding: 2px 7px; border-radius: 999px;
}
.sb-link.active .badge-num { background: var(--albero); color: #150B0D; }

.sb-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.sb-foot .av {
  width: 36px; height: 36px; border-radius: 999px;
  background: linear-gradient(135deg, var(--albero), var(--albero-deep));
  color: #150B0D;
  display: flex; align-items: center; justify-content: center;
  font: 700 13px var(--f-body);
  flex-shrink: 0;
}
.sb-foot .info { flex: 1; min-width: 0; }
.sb-foot .info .n { font: 600 13px var(--f-body); color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot .info .r { font: 500 11px var(--f-mono); color: var(--tx-faint); letter-spacing: 0.1em; text-transform: uppercase; }
.sb-foot__logout {
  background: transparent; border: 0; cursor: pointer;
  color: var(--tx-faint); padding: 4px;
  transition: color 0.15s;
}
.sb-foot__logout:hover { color: var(--bad); }
.sb-foot__logout svg { width: 18px; height: 18px; }

.main {
  padding: 0;
  min-width: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(21,11,13,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  height: 64px;
  display: flex; align-items: center;
  padding: 0 36px;
  gap: 16px;
}
.topbar .crumbs {
  font: 500 13px var(--f-mono);
  color: var(--tx-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar .crumbs b { color: var(--tx); font-weight: 600; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .search {
  display: flex; align-items: center; gap: 10px;
  background: var(--s2); border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  width: 280px;
  color: var(--tx-faint);
  font: 500 13px var(--f-body);
}
.topbar .kbd {
  margin-left: auto;
  font: 600 10px var(--f-mono); color: var(--tx-faint);
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 4px;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--s2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--tx-dim);
  position: relative;
  cursor: pointer;
}
.icon-btn:hover { color: var(--tx); }
.icon-btn .pip { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 999px; background: var(--albero); border: 2px solid var(--bg); }

.page {
  padding: 32px 40px 56px;
  max-width: 1400px;
}
.page-h {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-h .eb {
  font: 700 11px var(--f-mono); color: var(--albero); letter-spacing: 0.22em; text-transform: uppercase;
}
.page-h .h1 {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 1;
  font-weight: 400;
  font-size: clamp(32px, 4vw, 48px); line-height: 1;
  letter-spacing: -0.02em;
  margin: 6px 0 0;
}
.page-h .h1 em { font-style: italic; color: var(--albero); }
.page-h .sub {
  font: 400 15px var(--f-body); color: var(--tx-dim);
  margin-top: 8px;
}

/* Buttons */
.btn-pena {
  height: 38px; padding: 0 16px;
  border-radius: 999px;
  background: var(--albero); color: #150B0D;
  font: 600 13px var(--f-body);
  display: inline-flex; align-items: center; gap: 8px;
  border: 0;
  box-shadow: var(--ember);
  cursor: pointer;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: filter 0.15s var(--expo), transform 0.15s var(--expo);
}
.btn-pena:hover { filter: brightness(1.08); }
.btn-pena:active { transform: scale(0.97); }
.btn-pena.ghost { background: var(--s2); color: var(--tx); border: 1px solid var(--line); box-shadow: none; }
.btn-pena.ghost:hover { background: var(--s3); }
.btn-pena.danger { background: var(--bad); color: #150B0D; box-shadow: 0 8px 24px -8px rgba(224,106,96,0.3); }
.btn-pena svg { width: 16px; height: 16px; }
.btn-pena:disabled { opacity: 0.4; cursor: not-allowed; }

.panel {
  background: var(--s1);
  border: 1px solid var(--line);
  border-radius: var(--r4);
  padding: 22px;
}
.panel-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-h .t {
  font-family: var(--f-display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-weight: 500; font-size: 20px;
}
.panel-h .l { font: 500 12px var(--f-body); color: var(--tx-dim); cursor: pointer; }
.panel-h .l:hover { color: var(--albero); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  background: var(--s3); color: var(--tx-dim);
}
.chip.ok    { background: rgba(111,190,133,0.14); color: var(--ok); }
.chip.warn  { background: rgba(224,184,90,0.14); color: var(--warn); }
.chip.bad   { background: rgba(224,106,96,0.14); color: var(--bad); }
.chip.info  { background: rgba(122,163,214,0.14); color: var(--info); }
.chip.albero { background: rgba(232,155,60,0.14); color: var(--albero); }
.chip .dotpulse { width: 6px; height: 6px; border-radius: 999px; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.av-pena {
  width: 32px; height: 32px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 12px var(--f-body);
  color: #150B0D;
  flex-shrink: 0;
}
.av-pena.a { background: linear-gradient(135deg, #E89B3C, #C8801F); }
.av-pena.b { background: linear-gradient(135deg, #6FBE85, #3D8050); color: var(--tx); }
.av-pena.c { background: linear-gradient(135deg, #C84F4F, #5C2A22); color: var(--tx); }
.av-pena.d { background: linear-gradient(135deg, #7AA3D6, #2D5783); color: var(--tx); }
.av-pena.e { background: linear-gradient(135deg, #E0B85A, #8C6A1F); }
.av-pena.f { background: linear-gradient(135deg, #B07ECC, #5A3470); color: var(--tx); }
.av-pena.g { background: linear-gradient(135deg, #5BA8A0, #2D5A55); color: var(--tx); }

.tnum { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

table.t {
  width: 100%; border-collapse: collapse;
}
table.t th {
  text-align: left;
  font: 700 10px var(--f-mono); color: var(--tx-faint);
  letter-spacing: 0.18em; text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
table.t td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font: 500 14px var(--f-body); color: var(--tx);
  vertical-align: middle;
}
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: rgba(244,236,219,0.02); }
table.t .num { font-family: var(--f-mono); font-feature-settings: "tnum"; }
table.t .right { text-align: right; }

input.field-pena, select.field-pena, textarea.field-pena {
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--tx);
  font: 500 14px var(--f-body);
  width: 100%;
  outline: none;
  transition: border-color 0.15s var(--expo), box-shadow 0.15s var(--expo);
  font-family: var(--f-body);
}
input.field-pena::placeholder, textarea.field-pena::placeholder { color: var(--tx-faint); }
input.field-pena:focus, select.field-pena:focus, textarea.field-pena:focus {
  border-color: var(--albero);
  box-shadow: 0 0 0 3px rgba(232,155,60,0.18);
}
.field-lbl {
  display: block;
  font: 700 10px var(--f-mono); color: var(--tx-faint);
  letter-spacing: 0.2em; text-transform: uppercase;
  margin-bottom: 8px;
}

.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* ============== ALERTS / BADGES (compat) ============== */
.alert {
  padding: 12px 16px; border-radius: var(--r2);
  margin-bottom: 16px;
  font: 500 13px var(--f-body);
  border: 1px solid;
  animation: alert-in 0.28s var(--expo) both;
}
@keyframes alert-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.alert-error    { background: rgba(224,106,96,0.14); border-color: rgba(224,106,96,0.4); color: var(--bad); }
.alert-success  { background: rgba(111,190,133,0.14); border-color: rgba(111,190,133,0.4); color: var(--ok); }
.alert-warn     { background: rgba(224,184,90,0.14); border-color: rgba(224,184,90,0.4); color: var(--warn); }
.alert-info     { background: rgba(122,163,214,0.14); border-color: rgba(122,163,214,0.4); color: var(--info); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font: 600 11px var(--f-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--s3); color: var(--tx-dim);
}
.badge-yes { background: rgba(111,190,133,0.14); color: var(--ok); }
.badge-no  { background: rgba(224,106,96,0.14); color: var(--bad); }

/* ============== MODAL (compat) ============== */
.modal-backdrop, .modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal-backdrop[style*="flex"], .modal-bg.is-open { display: flex !important; }
.modal-backdrop > .modal, .modal-bg > .modal {
  background: var(--s3);
  border: 1px solid var(--line-2);
  border-radius: var(--r4);
  padding: 28px;
  width: min(440px, 100%);
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
  animation: modal-in 0.28s var(--spring) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal h2 { font-family: var(--f-display); font-weight: 500; font-size: 24px; margin: 0 0 16px; font-variation-settings: "opsz" 144, "SOFT" 30; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Field wrapper compat (legacy uses .field as wrapper, new uses input.field-pena directly) */
.field { margin-bottom: 14px; }
.field label { display: block; font: 700 10px var(--f-mono); color: var(--tx-faint); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 8px; }
.field input, .field select, .field textarea {
  background: var(--s2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; color: var(--tx); font: 500 14px var(--f-body);
  width: 100%; outline: none;
  transition: border-color 0.15s var(--expo), box-shadow 0.15s var(--expo);
  font-family: var(--f-body);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--albero);
  box-shadow: 0 0 0 3px rgba(232,155,60,0.18);
}
.field input[type="checkbox"], .field input[type="radio"] { width: auto; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; }
.checkbox-row input[type="checkbox"] { accent-color: var(--albero); width: 18px; height: 18px; }
.checkbox-row label { margin: 0; font: 500 14px var(--f-body); text-transform: none; letter-spacing: 0; cursor: pointer; }
.radio-group { border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 14px; margin-bottom: 14px; }
.radio-group legend { font: 700 10px var(--f-mono); color: var(--tx-faint); letter-spacing: 0.2em; text-transform: uppercase; padding: 0 6px; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.radio-row input[type="radio"] { accent-color: var(--albero); width: 16px; height: 16px; }
.radio-row label { margin: 0; font: 500 13px var(--f-body); text-transform: none; letter-spacing: 0; }

/* Toolbar (legacy) */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

/* Container (legacy) — no-op when used inside .page */
.container { max-width: 100%; margin: 0; padding: 0; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.page-header h1 { font-family: var(--f-display); font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 1; font-weight: 400; font-size: 36px; margin: 0; letter-spacing: -0.02em; }

/* Table-wrap legacy */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--r2);
  background: var(--s1);
}
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th, .table-wrap td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.table-wrap th { font: 700 10px var(--f-mono); color: var(--tx-faint); letter-spacing: 0.18em; text-transform: uppercase; background: rgba(244,236,219,0.02); }
.table-wrap tr:last-child td { border-bottom: 0; }

/* ============== LEGACY BUTTONS (compat) ==============
   Used by drinks.html (inline) and users.js (external). These match the
   original outlined / pill style of the old shell so existing buttons
   render coherently inside the new design.
   New code should use .btn-pena instead. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 999px;
  background: var(--s2); color: var(--tx);
  border: 1px solid var(--line);
  font: 600 13px var(--f-body);
  cursor: pointer; letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.15s var(--expo), border-color 0.15s var(--expo), color 0.15s var(--expo);
}
.btn:hover { background: var(--s3); border-color: var(--line-2); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn.btn-danger { background: rgba(224,106,96,0.14); border-color: rgba(224,106,96,0.4); color: var(--bad); }
.btn.btn-danger:hover { background: rgba(224,106,96,0.22); border-color: var(--bad); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(232,155,60,0.18); }

/* ============== TOASTS ==============
   Used by toast.js. Bottom-right stack with slide-in animation. */
.toast-stack {
  position: fixed;
  right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 3000;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r3);
  background: var(--s3);
  color: var(--tx);
  font: 500 13px var(--f-body);
  line-height: 1.4;
  box-shadow: 0 22px 44px -16px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px) scale(0.96);
  transition: opacity 0.28s var(--expo), transform 0.28s var(--spring);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.toast::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 3px;
  background: var(--albero);
}
.toast.is-in  { opacity: 1; transform: translateX(0) scale(1); }
.toast.is-out { opacity: 0; transform: translateX(22px) scale(0.96); }
.toast--success::before { background: var(--ok); }
.toast--error::before   { background: var(--bad); }
.toast--warn::before    { background: var(--warn); }
.toast--info::before    { background: var(--info); }
.toast__icon {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; line-height: 1;
  margin-top: 1px;
  background: rgba(232, 155, 60, 0.14);
  color: var(--albero);
}
.toast--success .toast__icon { color: var(--ok);   background: rgba(111,190,133,0.14); }
.toast--error   .toast__icon { color: var(--bad);  background: rgba(224,106,96,0.14); }
.toast--warn    .toast__icon { color: var(--warn); background: rgba(224,184,90,0.14); }
.toast--info    .toast__icon { color: var(--info); background: rgba(122,163,214,0.14); }
.toast__text { flex: 1; min-width: 0; word-wrap: break-word; }
.toast__close {
  flex-shrink: 0;
  background: transparent; border: 0;
  color: var(--tx-faint);
  font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0 4px;
  transition: color 0.15s;
}
.toast__close:hover { color: var(--tx); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; transform: none; }
  .toast.is-out { opacity: 0; }
}

/* Custom scrollbar (webkit) — subtle albero accent */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(232, 155, 60, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(232, 155, 60, 0.45); background-clip: padding-box; border: 2px solid transparent; }

/* Selection color */
::selection { background: var(--albero); color: #150B0D; }

/* ============== EMPTY STATE ============== */
.pena-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--tx-dim);
}
.pena-empty__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 35%, rgba(232,155,60,0.14), transparent 70%);
  color: var(--albero);
  font-size: 1.6rem;
  font-family: var(--f-display);
}
.pena-empty__title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 18px;
  color: var(--tx);
  margin-bottom: 4px;
  font-variation-settings: "opsz" 36, "SOFT" 30;
}
.pena-empty__msg {
  font-size: 14px;
  max-width: 36ch;
  margin: 0 auto;
  line-height: 1.5;
}

/* ============== BACKDROP (always present in DOM, hidden by default) ============== */
.sb-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
}
.sb-backdrop.is-open { display: block; }

.topbar .menu-btn {
  display: none;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--s2); border: 1px solid var(--line);
  align-items: center; justify-content: center;
  color: var(--tx-dim); cursor: pointer;
}

/* ============== MOBILE ============== */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  body.sidebar-open { overflow: hidden; touch-action: none; }
  .sidebar {
    position: fixed; left: -100%; top: 0;
    height: 100vh;
    height: 100dvh;
    width: 280px; z-index: 100;
    transition: left 0.3s var(--expo);
  }
  .sidebar.is-open { touch-action: pan-y; }
  .sidebar.is-open { left: 0; box-shadow: 0 0 60px rgba(0,0,0,0.6); }
  .topbar { padding: 0 18px; }
  .topbar .search { display: none; }
  .topbar .menu-btn { display: flex; }
  .page { padding: 20px 18px 40px; }

  /* Prevent iOS Safari from zooming on input focus */
  input.field-pena, select.field-pena, textarea.field-pena { font-size: 16px; }

  /* page-h: stack title block and action button */
  .page-h { align-items: flex-start; }
  .page-h .h1 { font-size: clamp(28px, 7vw, 40px); }
}

/* ============ SMALL PHONES (≤ 640px) ============ */
@media (max-width: 640px) {

  /* ---- Buttons: minimum 44px touch target ---- */
  .btn-pena { height: 44px; padding: 0 18px; font-size: 14px; }

  /* ---- Modals: extra padding safety ---- */
  .modal-backdrop { padding: 12px; }

  /* ---- Tables → stacked cards ---- */
  table.t thead { display: none; }
  table.t, table.t tbody, table.t tfoot { display: block; }
  table.t tbody tr {
    display: block;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
  }
  table.t tbody tr:last-child { border-bottom: 0; }
  table.t tfoot tr { display: block; padding: 12px 18px; }

  table.t td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 0;
    font-size: 14px;
    min-height: 28px;
  }
  /* label from data-label attribute */
  table.t td[data-label]::before {
    content: attr(data-label);
    font: 700 10px var(--f-mono);
    color: var(--tx-faint);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 80px;
  }
  /* action cells: no label, full width */
  table.t td[data-label=""] {
    justify-content: flex-end;
    padding-top: 8px;
  }
  table.t td[data-label=""]::before { display: none; }

  /* ---- .row-actions wraps nicely on card ---- */
  .row-actions { width: 100%; justify-content: flex-end; }

  /* ---- table-wrap: still needed for drinks matrix ---- */
  .table-wrap { border-radius: var(--r2); }
}

/* ============================================================
 * RANGOS — badges, icon picker, color picker
 * ============================================================ */
.rango-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.rango-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.rango-badge svg { width: 14px; height: 14px; flex-shrink: 0; }

.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}
.icon-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--bg-lift);
  color: var(--tx-dim);
  cursor: pointer;
  transition: border-color .15s;
}
.icon-opt:hover    { border-color: var(--albero); color: var(--tx); }
.icon-opt.selected { border-color: var(--albero); background: color-mix(in srgb, var(--albero) 15%, transparent); color: var(--tx); }
.icon-opt svg      { width: 20px; height: 20px; }

.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-opt {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.color-opt:hover    { transform: scale(1.15); }
.color-opt.selected { border-color: var(--tx); }

/* ── Search overlay ───────────────────────────────────────────────── */
#search-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.55);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 80px;
  backdrop-filter: blur(4px);
}
.search-box {
  width: 560px; max-width: calc(100vw - 32px);
  background: var(--s2); border: 1px solid var(--line-2);
  border-radius: var(--r4);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  overflow: hidden;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.search-input-wrap svg { flex-shrink: 0; color: var(--tx-faint); }
.search-input-wrap input {
  flex: 1; background: none; border: none; outline: none;
  font: 500 16px var(--f-body); color: var(--tx);
}
.search-input-wrap input::placeholder { color: var(--tx-faint); }
.search-input-wrap kbd {
  font: 600 10px var(--f-mono); color: var(--tx-faint);
  background: var(--s3); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 7px; flex-shrink: 0;
}
#sp-results { max-height: 420px; overflow-y: auto; padding: 4px 0; }
.sp-section {
  padding: 10px 16px 4px;
  font: 700 10px var(--f-mono); color: var(--tx-faint);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.sp-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; cursor: pointer;
  text-decoration: none; color: inherit;
  transition: background 0.1s;
}
.sp-item:hover, .sp-item.active { background: var(--s3); }
.sp-av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--s3); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font: 700 13px var(--f-body); color: var(--albero); flex-shrink: 0;
}
.sp-av--ev { background: transparent; border-color: transparent; color: var(--tx-faint); }
.sp-label { font: 500 14px var(--f-body); color: var(--tx); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-meta { margin-left: auto; font: 400 12px var(--f-mono); color: var(--tx-faint); flex-shrink: 0; }
.sp-empty { padding: 28px 16px; text-align: center; color: var(--tx-faint); font: 400 14px var(--f-body); }

/* ── Notification panel ───────────────────────────────────────────── */
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px;
  background: var(--s2); border: 1px solid var(--line-2);
  border-radius: var(--r4);
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
  z-index: 200; overflow: hidden;
}
.np-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px 10px;
  font: 700 11px var(--f-mono); color: var(--tx);
  text-transform: uppercase; letter-spacing: 0.1em;
  border-bottom: 1px solid var(--line);
}
.np-badge {
  background: var(--albero); color: #150B0D;
  font: 700 10px var(--f-mono); border-radius: 999px;
  padding: 1px 6px; line-height: 16px;
}
.np-list { margin: 0; padding: 0; list-style: none; max-height: 360px; overflow-y: auto; }
.np-item { border-bottom: 1px solid var(--line); }
.np-item:last-child { border-bottom: none; }
.np-item.unread { background: rgba(232,155,60,0.06); }
.np-item__inner {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: baseline; gap: 4px 10px;
  padding: 12px 16px;
  text-decoration: none; color: inherit;
  cursor: default;
}
a.np-item__inner { cursor: pointer; }
a.np-item__inner:hover { background: var(--s3); }
.np-kind {
  grid-column: 1; grid-row: 1;
  font: 700 9px var(--f-mono); color: var(--albero);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.np-title {
  grid-column: 1 / 3; grid-row: 2;
  font: 500 13px var(--f-body); color: var(--tx);
}
.np-time {
  grid-column: 3; grid-row: 1 / 3;
  font: 400 11px var(--f-mono); color: var(--tx-faint);
  align-self: center; white-space: nowrap;
}
.np-empty { padding: 32px 16px; text-align: center; color: var(--tx-faint); font: 400 13px var(--f-body); }
