/* ═══════════════════════════════════════════════
   TICKETPRO — main.css
   Design tokens + layout + components
═══════════════════════════════════════════════ */

:root {
  /* Colors */
  --bg: #f2f1ec;
  --surface: #ffffff;
  --surface2: #eeede6;
  --border: #e0dfd6;
  --ink: #17170f;
  --ink2: #4e4e44;
  --ink3: #96968a;

  --brand: #1a3a7c;   /* dynamic — updated by applyBranding() */

  --nav-text:       rgba(255,255,255,1);    /* dynamic — nav item text (active)  */
  --nav-text-dim:   rgba(255,255,255,.52);  /* dynamic — nav item text (inactive) */
  --nav-text-hover: rgba(255,255,255,.88);  /* dynamic — nav item text (hover)   */
  --nav-text-lbl:   rgba(255,255,255,.28);  /* dynamic — nav section label       */

  --blue: #1a3a7c;
  --blue-mid: #2d55b8;
  --blue-lt: #dde8ff;
  --blue-xs: #f0f4ff;

  --green: #145c38;
  --green-lt: #d6f5e3;
  --green-xs: #f0faf4;

  --amber: #7a3d00;
  --amber-lt: #fdefd4;
  --amber-xs: #fffbf0;

  --red: #7a1a1a;
  --red-lt: #fde8e8;
  --red-xs: #fff5f5;

  --violet: #3d1a96;
  --violet-lt: #ede9fe;

  --teal: #0a5c52;
  --teal-lt: #d4f5ef;

  --sky: #05577a;
  --sky-lt: #daf3ff;

  /* Typography */
  --fh: 'Epilogue', sans-serif;
  --fb: 'Instrument Sans', sans-serif;

  /* Misc */
  --r: 10px;
  --sh: 0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.06);
  --sh2: 0 4px 6px rgba(0,0,0,.04), 0 16px 40px rgba(0,0,0,.11);
}

/* ── DARK MODE ── */
html.dark {
  --bg: #111110;
  --surface: #1c1c1a;
  --surface2: #242420;
  --border: #2e2e2a;
  --ink: #e8e8e2;
  --ink2: #a0a098;
  --ink3: #585850;
}
html.dark .topbar    { box-shadow: 0 1px 0 var(--border); }
html.dark .tbl-wrap  { box-shadow: none; }
html.dark .stat-card { box-shadow: none; }
html.dark .modal     { box-shadow: 0 8px 40px rgba(0,0,0,.6); }

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--fb); background: var(--bg); color: var(--ink); min-height: 100vh; }
input, select, textarea, button { font-family: var(--fb); }

/* ══════════════════════════════════════
   DEV SWITCHER
══════════════════════════════════════ */
/* ══════════════════════════════════════
   LAYOUT — SHELL
══════════════════════════════════════ */
.shell { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: 224px; background: var(--brand); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0; overflow: hidden;
}
.sb-logo { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sb-brand { font-family: var(--fh); font-size: 19px; font-weight: 900; color: #fff; letter-spacing: -.5px; }
.sb-brand span { color: #60a5fa; }
.sb-tag { font-size: 9px; color: rgba(255,255,255,.45); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }

.role-badge { margin: 10px 14px; padding: 8px 11px; border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.role-badge.admin   { background: rgba(96,165,250,.12); }
.role-badge.manager { background: rgba(190,24,93,.10);  }
.role-badge.tech    { background: rgba(52,211,153,.10); }
.rb-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.admin   .rb-dot { background: #60a5fa; }
.manager .rb-dot { background: #be185d; }
.tech    .rb-dot { background: #34d399; }
.rb-name { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.88); }
.rb-role { font-size: 10px; color: rgba(255,255,255,.42); text-transform: uppercase; letter-spacing: .8px; }

.nav-sec { padding: 6px 10px; }
/* El primer nav-sec (módulos) crece y scrollea; el de Sistema y el sb-bottom quedan siempre visibles */
.sidebar > .nav-sec:first-of-type { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.sidebar > .nav-sec:first-of-type::-webkit-scrollbar { width: 3px; }
.sidebar > .nav-sec:first-of-type::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.nav-lbl { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--nav-text-lbl); padding: 8px 8px 3px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 7px;
  cursor: pointer; font-size: 13px; color: var(--nav-text-dim); font-weight: 500; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: var(--nav-text-hover); }
.nav-item.active { background: rgba(255,255,255,.14); color: var(--nav-text); font-weight: 600; }
.nav-item.locked { opacity: .28; cursor: not-allowed; }
.nav-item.locked::after { content: '🔒'; font-size: 10px; margin-left: auto; }
.nav-ico { font-size: 14px; width: 17px; text-align: center; }
.nav-badge { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 700; }
.nb-blue { background: rgba(255,255,255,.18); color: rgba(255,255,255,.8); }
.nb-amber { background: rgba(255,255,255,.15); color: rgba(255,255,255,.7); }
.nb-red { background: rgba(255,255,255,.15); color: rgba(255,255,255,.7); }

.sb-bottom { margin-top: auto; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.sb-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sb-uname { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.82); }
.sb-urole { font-size: 10px; color: rgba(255,255,255,.38); }
.sb-logout { margin-left: auto; font-size: 11px; color: rgba(255,255,255,.35); cursor: pointer; transition: color .15s; }
.sb-logout:hover { color: rgba(255,255,255,.75); }
.sb-darkmode { display:flex; align-items:center; gap:8px; margin-top:8px; padding:7px 10px; border-radius:7px; font-size:12px; color:rgba(255,255,255,.42); cursor:pointer; transition:all .15s; }
.sb-darkmode:hover { background:rgba(255,255,255,.07); color:rgba(255,255,255,.75); }

/* ── MAIN AREA ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 13px 26px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; position: sticky; top: 0; z-index: 20;
}
.page-title { font-family: var(--fh); font-size: 16px; font-weight: 800; }
.topbar-right { display: flex; gap: 8px; align-items: center; }

.content { padding: 22px 26px; overflow-y: auto; flex: 1; }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  padding: 8px 15px; border-radius: 7px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--ink2); }
.btn-outline:hover { border-color: var(--ink3); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink3); border: none; }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { background: var(--red-lt); color: var(--red); border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fca5a5; }
.btn-success { background: var(--green-lt); color: var(--green); border: 1px solid #86efac; }
.btn-success:hover { background: #86efac; }
.btn-sm { padding: 5px 11px; font-size: 11px; }
.btn-xs { padding: 3px 8px; font-size: 10px; font-weight: 700; }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════════════════
   BADGES
══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px; font-size: 10px; font-weight: 700;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.b-new { background: var(--blue-lt); color: var(--blue); }
.b-review { background: var(--amber-lt); color: var(--amber); }
.b-approved { background: var(--green-lt); color: var(--green); }
.b-repair { background: var(--sky-lt); color: var(--sky); }
.b-warranty { background: var(--violet-lt); color: var(--violet); }
.b-shipped { background: var(--teal-lt); color: var(--teal); }
.b-rejected { background: var(--red-lt); color: var(--red); }
.b-closed { background: var(--surface2); color: var(--ink3); }
.b-rma { background: var(--blue-lt); color: var(--blue); }
.b-arr { background: var(--violet-lt); color: var(--violet); }
.b-dev { background: var(--teal-lt); color: var(--teal); }
.b-active { background: var(--green-lt); color: var(--green); }
.b-draft { background: var(--surface2); color: var(--ink3); }
.b-admin   { background: var(--blue-lt);  color: var(--blue);  }
.b-manager { background: #fce7f3;        color: #be185d;      }
.b-tech    { background: var(--green-lt); color: var(--green); }

/* ══════════════════════════════════════
   FORMS / INPUTS
══════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 10px; font-weight: 700; color: var(--ink3);
  letter-spacing: .7px; text-transform: uppercase; margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea, .form-control {
  width: 100%; padding: 9px 11px; border-radius: 7px;
  border: 1px solid var(--border); font-size: 13px; color: var(--ink);
  background: var(--surface2); outline: none; transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus, .form-control:focus {
  border-color: var(--blue-mid); background: var(--surface);
}
.form-textarea, textarea.form-control { min-height: 80px; resize: vertical; }
select.form-select, select.form-control {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-hint { font-size: 11px; color: var(--ink3); margin-top: 3px; }

/* ══════════════════════════════════════
   TABLE
══════════════════════════════════════ */
.tbl-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: visible; margin-bottom: 22px; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface2); }
/* Clip thead bg to rounded top corners (tbl-wrap uses overflow:visible for dropdowns) */
.tbl-wrap thead { clip-path: inset(0 0 0 0 round calc(var(--r) - 1px) calc(var(--r) - 1px) 0 0); }
th { padding: 10px 13px; text-align: left; font-size: 10px; font-weight: 700; color: var(--ink3); letter-spacing: .7px; text-transform: uppercase; }
td { padding: 12px 13px; font-size: 13px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(0,0,0,.01); }
.tid { font-family: var(--fh); font-weight: 800; font-size: 12px; color: var(--blue); }
.cname { font-weight: 600; font-size: 13px; }
.cemail { font-size: 11px; color: var(--ink3); }
.row-acts { display: flex; gap: 5px; }
/* ── Action dropdown menu ── */
.act-menu { position: relative; display: inline-block; }
.act-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.10);
  z-index: 200; min-width: 160px; padding: 4px;
  display: none; white-space: nowrap;
}
.act-menu-list.open { display: block; }
.act-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 11px; border-radius: 5px; border: none;
  background: transparent; font-size: 12px; font-weight: 500;
  color: var(--ink); cursor: pointer; text-align: left;
  transition: background .1s;
}
.act-menu-item:hover { background: var(--surface2); }
.act-menu-item.danger { color: var(--red); }
.act-menu-sep { height: 1px; background: var(--border); margin: 3px 0; }
.act-btn { padding: 4px 9px; border-radius: 5px; font-size: 10px; font-weight: 700; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--ink2); transition: all .15s; }
.act-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.act-btn.locked-btn { opacity: .35; cursor: not-allowed; }
.field-locked select,
.field-locked input { opacity: .45; cursor: not-allowed; background: var(--surface2); }
.field-locked .form-label::after { content: ' 🔒'; font-size: 10px; opacity: .6; }

/* ══════════════════════════════════════
   STATS
══════════════════════════════════════ */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 17px; transition: all .2s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh); border-color: var(--ink3); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.stat-ico { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.stat-ico.blue { background: var(--blue-lt); }
.stat-ico.amber { background: var(--amber-lt); }
.stat-ico.green { background: var(--green-lt); }
.stat-ico.red { background: var(--red-lt); }
.stat-val { font-family: var(--fh); font-size: 28px; font-weight: 900; line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--ink3); margin-top: 3px; }
.stat-trend { font-size: 10px; font-weight: 700; }
.stat-trend.up { color: #16a34a; }
.stat-trend.dn { color: #dc2626; }

/* ══════════════════════════════════════
   MODAL
   Transitions for overlay and modal
══════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--surface); border-radius: 14px; width: 520px;
  max-width: 95vw; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--sh2);
  transform: translateY(16px);
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
}
.overlay.open .modal { transform: translateY(0); }

.modal-wide { width: 680px; }

/* ── Inline modal overlay (toggled via style="display:none / ''") ── */
@keyframes overlayFadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalSlideIn   { from { opacity: 0; transform: translateY(18px) scale(.97) } to { opacity: 1; transform: translateY(0) scale(1) } }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.48);
  display: flex; align-items: center; justify-content: center;
  z-index: 600; backdrop-filter: blur(4px); padding: 16px; box-sizing: border-box;
  animation: overlayFadeIn .18s ease;
}
.modal-box {
  background: var(--surface); border-radius: 16px;
  max-width: 95vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.10);
  width: 100%;
  animation: modalSlideIn .22s cubic-bezier(0.16,1,0.3,1);
}
.modal-box.modal-shake { animation: modalShake 0.35s cubic-bezier(0.36,0.07,0.19,0.97); }
.modal-box .modal-body { overflow-y: auto; }

/* ── Content Fade In ── */
@keyframes contentFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content-animate {
  /* No forwards — keeps transform:none after animation ends so
     position:fixed overlays inside .content are not broken */
  animation: contentFade 0.25s ease;
}

/* ── Modal shake (clicking outside) ── */
@keyframes modalShake {
  0%,100% { transform: translateX(0) translateY(0); }
  20%     { transform: translateX(-7px) translateY(0); }
  40%     { transform: translateX(6px)  translateY(0); }
  60%     { transform: translateX(-4px) translateY(0); }
  80%     { transform: translateX(3px)  translateY(0); }
}
.modal.modal-shake {
  animation: modalShake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.mh, .modal-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; }
.mh-title, .modal-title { font-family: var(--fh); font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.mh-sub { font-size: 11px; color: var(--ink3); margin-top: 1px; }
.m-close, .modal-close { width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--border); background: transparent; cursor: pointer; font-size: 12px; color: var(--ink3); display: flex; align-items: center; justify-content: center; }
.mb, .modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.mf, .modal-footer { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; gap: 7px; justify-content: flex-end; }

/* ══════════════════════════════════════
   SETTINGS
══════════════════════════════════════ */
.settings-grid { display: grid; grid-template-columns: 210px 1fr; min-height: 500px; }
.settings-nav { border-right: 1px solid var(--border); padding: 4px 0; }
.sn-item {
  display: flex; align-items: center; gap: 9px; padding: 10px 16px;
  font-size: 13px; color: var(--ink2); cursor: pointer; transition: all .15s;
  border-right: 2px solid transparent;
}
.sn-item:hover { background: var(--surface2); color: var(--ink); }
.sn-item.active { color: var(--blue); border-right-color: var(--blue); background: var(--blue-xs); }
.sn-ico { font-size: 14px; }
.settings-panel { padding: 22px 26px; }
.sp-title { font-family: var(--fh); font-size: 15px; font-weight: 800; margin-bottom: 3px; }
.sp-sub { font-size: 12px; color: var(--ink3); margin-bottom: 22px; }

/* Toggle switch */
.prop-toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.toggle-sw { position: relative; width: 36px; height: 20px; cursor: pointer; flex-shrink: 0; }
.toggle-sw input { opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: #ccc; border-radius: 20px; transition: .2s; }
.toggle-track::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle-sw input:checked + .toggle-track { background: var(--blue); }
.toggle-sw input:checked + .toggle-track::after { left: 18px; }

/* SMTP */
.smtp-status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; margin-top: 10px; }
.smtp-ok { background: var(--green-lt); color: var(--green); }
.smtp-err { background: var(--red-lt); color: var(--red); }
.smtp-pending { background: var(--amber-lt); color: var(--amber); }

/* Perms grid */
.perms-grid { display: grid; grid-template-columns: 1fr 80px 80px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.pg-header { background: var(--surface2); padding: 10px 13px; font-size: 10px; font-weight: 700; color: var(--ink3); letter-spacing: .7px; text-transform: uppercase; }
.pg-cell { padding: 10px 13px; border-top: 1px solid var(--border); font-size: 12px; display: flex; align-items: center; }
.pg-cell.center { justify-content: center; }
.perm-yes { color: #16a34a; font-size: 14px; }
.perm-no { color: #dc2626; font-size: 14px; }

/* Users list */
.u-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.u-row:last-child { border-bottom: none; }
.u-ava { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0; }
.u-name { font-size: 13px; font-weight: 600; }
.u-email { font-size: 11px; color: var(--ink3); }
.u-perms { font-size: 11px; color: var(--ink3); margin-top: 1px; }
.u-actions { margin-left: auto; display: flex; gap: 6px; }

/* Brand preview */
.brand-preview { background: var(--brand); border-radius: 10px; padding: 16px 20px; margin-bottom: 18px; }
.bp-logo { font-family: var(--fh); font-size: 18px; font-weight: 900; color: #fff; }
.bp-logo span { color: #60a5fa; }
.bp-tag { font-size: 10px; color: #444; letter-spacing: 1.5px; text-transform: uppercase; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: all .15s; }
.swatch.active { border-color: var(--ink); transform: scale(1.1); }

/* ══════════════════════════════════════
   FORM BUILDER
══════════════════════════════════════ */
.builder-shell { display: grid; grid-template-columns: 240px 1fr 240px; height: calc(100vh - 100px); overflow: hidden; }
.palette { background: var(--surface); border-right: 1px solid var(--border); padding: 14px; overflow-y: auto; }
.palette-title { font-size: 9px; font-weight: 700; color: var(--ink3); letter-spacing: 1px; text-transform: uppercase; margin: 10px 0 6px; }
.field-type { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface2); margin-bottom: 5px; cursor: grab; transition: all .15s; font-size: 12px; font-weight: 600; }
.field-type:hover { background: var(--blue-lt); border-color: #93c5fd; color: var(--blue); }
.ft-ico { font-size: 13px; width: 16px; text-align: center; }

.canvas { background: var(--bg); padding: 18px; overflow-y: auto; }
.form-name-inp { font-family: var(--fh); font-size: 17px; font-weight: 800; background: transparent; border: none; outline: none; color: var(--ink); border-bottom: 2px solid transparent; padding-bottom: 2px; transition: border-color .15s; width: 100%; }
.form-name-inp:focus { border-bottom-color: var(--blue-mid); }
.field-wrapper { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px 11px 26px; margin-bottom: 7px; cursor: pointer; transition: all .15s; position: relative; }
.field-wrapper:hover { border-color: var(--blue-mid); }
.field-wrapper.selected { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-lt); }
.fw-drag { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--ink3); cursor: grab; }
.fw-label { font-size: 10px; font-weight: 700; color: var(--ink3); letter-spacing: .7px; text-transform: uppercase; margin-bottom: 5px; display: flex; align-items: center; gap: 5px; }
.fw-required { color: var(--red); }
.fw-input-preview { width: 100%; padding: 7px 9px; border-radius: 5px; border: 1px solid var(--border); font-size: 12px; color: var(--ink3); background: var(--surface2); pointer-events: none; }
.fw-select-preview { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.fw-option { padding: 3px 9px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--surface2); border: 1px solid var(--border); color: var(--ink2); }
.fw-delete { position: absolute; top: 7px; right: 7px; width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--border); background: transparent; cursor: pointer; font-size: 10px; color: var(--ink3); display: none; align-items: center; justify-content: center; }
.field-wrapper:hover .fw-delete { display: flex; }
.fw-delete:hover { background: var(--red-lt); color: var(--red); border-color: #fca5a5; }
.drop-zone { border: 2px dashed var(--border); border-radius: 8px; padding: 18px; text-align: center; font-size: 12px; color: var(--ink3); margin-bottom: 7px; transition: all .15s; }
.drop-zone.drag-over { border-color: var(--blue-mid); background: var(--blue-xs); }

.properties { background: var(--surface); border-left: 1px solid var(--border); padding: 14px; overflow-y: auto; }
.prop-title { font-size: 9px; font-weight: 700; color: var(--ink3); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 12px; }
.prop-group { margin-bottom: 14px; }
.prop-group label { display: block; font-size: 10px; font-weight: 700; color: var(--ink3); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 4px; }
.prop-input { width: 100%; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--border); font-size: 12px; color: var(--ink); background: var(--surface2); outline: none; }
.prop-input:focus { border-color: var(--blue-mid); }
.flow-rules { background: var(--amber-xs); border: 1px solid var(--amber-lt); border-radius: 7px; padding: 11px; }
.fr-title { font-size: 11px; font-weight: 700; color: var(--amber); margin-bottom: 6px; }

/* ══════════════════════════════════════
   FLOW DIAGRAM
══════════════════════════════════════ */
.flow-wrap { max-width: 840px; margin: 0 auto; padding-bottom: 32px; }
.flow-entry { background: var(--blue); color: #fff; border-radius: 10px; padding: 12px 20px; font-family: var(--fh); font-size: 13px; font-weight: 800; text-align: center; max-width: 360px; margin: 0 auto; box-shadow: 0 4px 14px rgba(26,58,124,.25); display: block; }
.flow-arr { width: 2px; background: var(--border); margin: 0 auto; display: block; }
.flow-node { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); max-width: 360px; margin: 0 auto; }
.fn-auto { border-left: 3px solid #3b82f6; }
.fn-manual { border-left: 3px solid #f59e0b; }
.fn-email { border-left: 3px solid #10b981; }
.fn-check { border-left: 3px solid #8b5cf6; }
.fn-title { font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.fn-desc { font-size: 11px; color: var(--ink2); line-height: 1.5; }
.fn-end { border-radius: 20px; padding: 6px 16px; font-size: 11px; font-weight: 800; font-family: var(--fh); text-align: center; display: inline-block; }
.fn-end.ok { background: var(--green-lt); color: var(--green); }
.fn-end.rej { background: var(--red-lt); color: var(--red); }
.fn-end.man { background: var(--amber-lt); color: var(--amber); }
.decision-node { background: var(--surface); border: 2px solid var(--border); border-radius: 11px; padding: 11px 16px; text-align: center; max-width: 300px; margin: 0 auto; font-size: 12px; font-weight: 700; box-shadow: var(--sh); }
.branches { display: grid; gap: 11px; }
.b3 { grid-template-columns: repeat(3, 1fr); }
.b2 { grid-template-columns: repeat(2, 1fr); }
.branch-col { display: flex; flex-direction: column; gap: 5px; }
.branch-top-line { height: 16px; border-left: 2px solid var(--border); margin-left: 50%; }
.cond-tag { padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; text-align: center; letter-spacing: .2px; text-transform: uppercase; }
.ct-green { background: var(--green-lt); color: var(--green); }
.ct-amber { background: var(--amber-lt); color: var(--amber); }
.ct-red { background: var(--red-lt); color: var(--red); }
.ct-blue { background: var(--blue-lt); color: var(--blue); }

/* ══════════════════════════════════════
   LOGIN
══════════════════════════════════════ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--surface); border-radius: 16px; box-shadow: var(--sh2); width: 370px; overflow: hidden; }
.lc-header { background: var(--brand); padding: 26px 26px 20px; color: #fff; }
.lc-brand { font-family: var(--fh); font-size: 21px; font-weight: 900; }
.lc-brand span { color: #60a5fa; }
.lc-sub { font-size: 12px; color: #555; margin-top: 3px; }
.lc-body { padding: 22px 26px; }
.lc-tabs { display: inline-flex; gap: 4px; background: var(--surface2); border-radius: 7px; padding: 3px; margin-bottom: 18px; }
.lc-tab { padding: 7px 18px; border-radius: 5px; font-size: 12px; font-weight: 600; text-align: center; cursor: pointer; border: none; background: transparent; color: var(--ink3); transition: all .15s; white-space: nowrap; }
.lc-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh); }
.login-btn { width: 100%; padding: 11px; border-radius: 7px; background: var(--brand); color: #fff; font-family: var(--fh); font-size: 14px; font-weight: 800; border: none; cursor: pointer; transition: all .15s; margin-top: 4px; }
.login-btn:hover { filter: brightness(1.15); }

/* ══════════════════════════════════════
   CLIENT PORTAL
══════════════════════════════════════ */
.cp-wrap { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.cp-nav { background: var(--brand); padding: 13px 26px; display: flex; align-items: center; justify-content: space-between; }
.cp-logo { font-family: var(--fh); font-size: 17px; font-weight: 900; color: #fff; }
.cp-logo span { color: #60a5fa; }
.cp-hero { padding: 40px 26px; text-align: center; color: #fff; }
.cp-hero h1 { font-family: var(--fh); font-size: 24px; font-weight: 900; margin-bottom: 6px; }
.cp-hero p { font-size: 13px; opacity: .75; margin-bottom: 20px; }
.track-box { display: flex; gap: 7px; max-width: 420px; margin: 0 auto; }
.track-inp { flex: 1; padding: 11px 14px; border-radius: 7px; border: none; font-size: 13px; outline: none; }
.track-btn { padding: 11px 16px; border-radius: 7px; border: none; color: #fff; font-weight: 700; cursor: pointer; font-size: 12px; transition: all .15s; }

/* Progress steps */
.prog-steps { display: flex; margin-bottom: 24px; position: relative; }
.prog-steps::before { content: ''; position: absolute; top: 13px; left: 26px; right: 26px; height: 2px; background: var(--border); z-index: 0; }
.ps-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 1; }
.ps-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; transition: all .25s; }
.ps-step.done .ps-dot { background: var(--green); border-color: var(--green); color: #fff; }
.ps-step.cur .ps-dot { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 3px var(--blue-lt); }
.ps-lbl { font-size: 9px; font-weight: 600; color: var(--ink3); text-align: center; max-width: 60px; line-height: 1.3; }
.ps-step.done .ps-lbl { color: var(--green); }
.ps-step.cur .ps-lbl { color: var(--blue); }

/* Update feed */
.upd-feed { display: flex; flex-direction: column; }
.upd-item { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.upd-item:last-child { border-bottom: none; }
.upd-ico { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.ui-blue { background: var(--blue-lt); }
.ui-green { background: var(--green-lt); }
.ui-amber { background: var(--amber-lt); }
.ui-gray { background: var(--surface2); }
.ut-title { font-size: 13px; font-weight: 600; }
.ut-desc { font-size: 12px; color: var(--ink2); margin-top: 1px; line-height: 1.5; }
.ut-time { font-size: 11px; color: var(--ink3); margin-top: 2px; }

/* ══════════════════════════════════════
   TIMELINE
══════════════════════════════════════ */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 11px; position: relative; }
.tl-line { position: absolute; left: 12px; top: 25px; bottom: -4px; width: 1px; background: var(--border); }
.tl-ico { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; z-index: 1; border: 2px solid var(--border); background: var(--surface); }
.tl-ico.done { background: var(--green-lt); border-color: #86efac; }
.tl-ico.cur { background: var(--blue-lt); border-color: #93c5fd; }
.tl-content { padding-bottom: 14px; flex: 1; }
.tl-label { font-size: 13px; font-weight: 600; }
.tl-date { font-size: 11px; color: var(--ink3); }
.tl-desc { font-size: 12px; color: var(--ink2); margin-top: 2px; line-height: 1.5; }

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  box-shadow: var(--sh2); z-index: 9998; transform: translateY(14px); opacity: 0;
  transition: all .3s; max-width: 300px; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ══════════════════════════════════════
   UTILS
══════════════════════════════════════ */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.if-field label { font-size: 10px; font-weight: 700; color: var(--ink3); letter-spacing: .7px; text-transform: uppercase; display: block; margin-bottom: 3px; }
.if-field p { font-size: 13px; font-weight: 500; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-family: var(--fh); font-size: 14px; font-weight: 800; }
.filter-row { display: flex; gap: 7px; margin-bottom: 12px; flex-wrap: wrap; }
.search-inp { flex: 1; min-width: 160px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 8px 11px; font-size: 12px; color: var(--ink); outline: none; }
.search-inp:focus { border-color: var(--blue-mid); }
.search-inp::placeholder { color: var(--ink3); }
.chip { padding: 6px 11px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--ink3); transition: all .15s; white-space: nowrap; }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--blue-lt); color: var(--blue); border-color: #93c5fd; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.alert { border-radius: 8px; padding: 12px 14px; font-size: 12px; margin-bottom: 14px; }
.alert-info { background: var(--blue-xs); border: 1px solid var(--blue-lt); color: var(--blue); }
.alert-warning { background: var(--amber-xs); border: 1px solid var(--amber-lt); color: var(--amber); }
.alert-success { background: var(--green-xs); border: 1px solid var(--green-lt); color: var(--green); }

/* ══════════════════════════════════════
   PAGE TRANSITIONS
══════════════════════════════════════ */

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Panel principal al navegar */
.shell  { animation: pageEnter .22s cubic-bezier(0.4, 0, 0.2, 1); }
.cp-wrap { animation: pageEnter .22s cubic-bezier(0.4, 0, 0.2, 1); }

/* Contenido de los paneles de configuración */
.settings-panel { animation: pageEnter .18s cubic-bezier(0.4, 0, 0.2, 1); }

/* Login / pantallas sin sidebar */
#app-root > .cp-wrap,
#app-root > form { animation: pageEnter .22s cubic-bezier(0.4, 0, 0.2, 1); }

/* Suaviza el hover en nav items */
.nav-item   { transition: background .12s, color .12s; }
.sn-item    { transition: background .12s, color .12s; }

/* Suaviza las stat-cards al aparecer */
.stat-card:nth-child(1) { animation: pageEnter .22s .03s both cubic-bezier(0.4,0,0.2,1); }
.stat-card:nth-child(2) { animation: pageEnter .22s .07s both cubic-bezier(0.4,0,0.2,1); }
.stat-card:nth-child(3) { animation: pageEnter .22s .11s both cubic-bezier(0.4,0,0.2,1); }
.stat-card:nth-child(4) { animation: pageEnter .22s .15s both cubic-bezier(0.4,0,0.2,1); }

/* ══════════════════════════════════════
   PLATFORM SHELL (super-admin)
══════════════════════════════════════ */
.platform-shell { min-height: 100vh; background: var(--bg); animation: pageEnter .22s cubic-bezier(0.4,0,0.2,1); }

.platform-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 13px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.ph-logo { font-family: var(--fh); font-size: 18px; font-weight: 900; letter-spacing: -.5px; }
.ph-logo span { color: #7c3aed; }
.ph-right { display: flex; align-items: center; gap: 10px; }

.platform-body { padding: 28px; max-width: 1200px; margin: 0 auto; }
.platform-section { margin-bottom: 28px; }
.ps-titlebar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ps-title { font-family: var(--fh); font-size: 15px; font-weight: 800; }

/* ── PLAN BADGES ── */
.plan-badge {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
}
.pl-starter    { background: #f1f5f9; color: #475569; }
.pl-pro        { background: var(--blue-lt); color: var(--blue); }
.pl-enterprise { background: var(--violet-lt); color: var(--violet); }

/* ── STAT ICO VIOLET ── */
.stat-ico.violet { background: var(--violet-lt); color: var(--violet); }

/* ══════════════════════════════════════
   UPGRADE BANNER
══════════════════════════════════════ */
.upgrade-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border-radius: var(--r);
  border: 1px dashed var(--border); background: var(--surface); margin: 16px 0;
}
.ub-icon { font-size: 22px; flex-shrink: 0; }
.ub-body { flex: 1; }
.ub-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.ub-sub   { font-size: 12px; color: var(--ink3); margin-top: 3px; }

/* ══════════════════════════════════════
   IMPERSONATION BAR
══════════════════════════════════════ */
.impersonation-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #f59e0b; color: #000; height: 40px;
  padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.impersonation-bar button {
  background: rgba(0,0,0,.12); border: none; border-radius: 5px;
  padding: 4px 12px; font-size: 11px; font-weight: 700; cursor: pointer; font-family: var(--fb);
}
.impersonation-bar button:hover { background: rgba(0,0,0,.22); }

/* ══════════════════════════════════════
   RESPONSIVE — ALTURA (720p / 768p)
══════════════════════════════════════ */
@media (max-height: 768px) {
  .sb-logo    { padding: 11px 18px 9px; }
  .sb-brand   { font-size: 17px; }
  .nav-item   { padding: 6px 10px; font-size: 12px; }
  .nav-lbl    { padding: 5px 8px 2px; }
  .sb-bottom  { padding: 8px 14px; }
  .sb-darkmode { margin-top: 5px; padding: 5px 10px; font-size: 11px; }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 900px) {
  .builder-shell { grid-template-columns: 1fr; }
  .palette, .properties { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .branches.b3 { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════
   CALENDAR
══════════════════════════════════════ */
.cal-header { display:flex; align-items:center; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.cal-grid   { display:grid; grid-template-columns:repeat(7, 1fr); gap:3px; }
.cal-head   { text-align:center; font-size:10px; font-weight:700; color:var(--ink3); padding:5px 0; text-transform:uppercase; letter-spacing:.5px; }

.cal-cell         { min-height:88px; border:1px solid var(--border); border-radius:6px; padding:5px 6px; background:var(--surface); cursor:pointer; transition:background .1s; }
.cal-cell:hover   { background:var(--surface2); }
.cal-day-num      { font-size:12px; font-weight:700; margin-bottom:3px; width:22px; height:22px; display:flex; align-items:center; justify-content:center; border-radius:50%; }
.cal-unavail      { background:var(--surface2); opacity:.55; cursor:not-allowed; }
.cal-unavail:hover{ background:var(--surface2); }
.cal-today .cal-day-num { background:var(--brand); color:#fff; }

.cal-events    { display:flex; flex-direction:column; gap:2px; }
.cal-ev        { font-size:10px; padding:2px 4px; border-radius:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer; font-weight:600; line-height:1.4; }
.cal-ev:hover  { filter:brightness(.92); }
.cal-ev-more   { font-size:9px; color:var(--ink3); padding:1px 4px; }
.cal-ev-ticket  { background:var(--blue-lt);  color:var(--blue);  }
.cal-ev-personal{ background:var(--surface2); color:var(--ink2);  border:1px solid var(--border); }
.cal-ev-booking { background:var(--green-lt); color:var(--green); }
.cal-ev-allday  { background:#fef3c7; color:#92400e; border-left:3px solid #f59e0b; border-radius:0 3px 3px 0; font-style:italic; }

.cal-legend          { font-size:11px; padding:3px 8px; border-radius:4px; font-weight:600; }
.cal-legend-ticket   { background:var(--blue-lt);  color:var(--blue);  }
.cal-legend-personal { background:var(--surface2); color:var(--ink2);  border:1px solid var(--border); }
.cal-legend-booking  { background:var(--green-lt); color:var(--green); }
.cal-legend-allday   { background:#fef3c7; color:#92400e; border:1px solid #f59e0b; }

/* ── PORTAL BOOKING PICKER ───────────────────── */
.bkp-wrap       { margin-top:20px; border:1px solid var(--border); border-radius:12px; overflow:hidden; background:var(--surface); }
.bkp-head       { padding:14px 18px; border-bottom:1px solid var(--border); background:var(--surface2); }
.bkp-title      { font-size:14px; font-weight:800; font-family:var(--fh); margin-bottom:2px; }
.bkp-sub        { font-size:12px; color:var(--ink3); }
.bkp-body       { display:grid; grid-template-columns:1fr 1fr; }
.bkp-cal        { padding:16px; border-right:1px solid var(--border); }
.bkp-times      { padding:16px; }
.bkp-cal-head   { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.bkp-cal-title  { font-size:13px; font-weight:700; }
.bkp-cal-nav    { background:none; border:1px solid var(--border); border-radius:6px; width:26px; height:26px; cursor:pointer; font-size:13px; color:var(--ink2); display:flex; align-items:center; justify-content:center; transition:all .12s; }
.bkp-cal-nav:hover { background:var(--surface2); }
.bkp-grid       { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; }
.bkp-dow        { text-align:center; font-size:9px; font-weight:700; color:var(--ink3); padding:3px 0; text-transform:uppercase; letter-spacing:.4px; }
.bkp-day        { aspect-ratio:1; display:flex; align-items:center; justify-content:center; border-radius:50%; font-size:12px; font-weight:600; cursor:pointer; transition:all .12s; color:var(--ink); }
.bkp-day:hover  { background:var(--blue-lt); color:var(--blue); }
.bkp-day.today  { border:2px solid var(--brand); color:var(--brand); }
.bkp-day.avail  { color:var(--blue); font-weight:700; }
.bkp-day.selected { background:var(--brand); color:#fff !important; border-color:transparent; }
.bkp-day.unavail{ color:var(--border); cursor:not-allowed; font-weight:400; }
.bkp-day.unavail:hover { background:none; color:var(--border); }
.bkp-day.pad    { visibility:hidden; }
.bkp-times-title{ font-size:12px; font-weight:700; margin-bottom:10px; color:var(--ink2); }
.bkp-time-btn   { display:block; width:100%; padding:9px; border:1px solid var(--border); border-radius:8px; background:var(--surface); font-size:13px; font-weight:600; color:var(--ink); cursor:pointer; margin-bottom:6px; transition:all .12s; text-align:center; }
.bkp-time-btn:hover   { border-color:var(--brand); color:var(--brand); background:var(--blue-lt); }
.bkp-time-btn.confirm { background:var(--brand); color:#fff; border-color:var(--brand); }
.bkp-existing   { padding:16px 18px; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.bkp-conf-badge { background:var(--green-lt); color:var(--green); border-radius:8px; padding:10px 14px; font-size:13px; font-weight:700; flex:1; }
.bkp-conf-date  { font-size:15px; margin-bottom:2px; }
.bkp-conf-time  { font-size:12px; opacity:.8; }
@media(max-width:520px) { .bkp-body { grid-template-columns:1fr; } .bkp-cal { border-right:none; border-bottom:1px solid var(--border); } }

/* ═══════════════════════════════════════════
   INVENTORY MODULE — design tokens + components
   ═══════════════════════════════════════════ */

/* State badges */
.inv-state                  { display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:8px;font-size:11px;font-weight:700; }
.inv-state-available        { background:var(--green-lt,#dcfce7); color:var(--green,#16a34a); }
.inv-state-reserved         { background:var(--blue-lt);           color:var(--blue); }
.inv-state-in_repair        { background:#fef9c3;                   color:#92400e; }
.inv-state-repaired         { background:#d1fae5;                   color:#065f46; }
.inv-state-assigned         { background:#ede9fe;                   color:#5b21b6; }
.inv-state-in_distribution  { background:#dbeafe;                   color:#1e40af; }
.inv-state-decommissioned   { background:#fee2e2;                   color:#991b1b; }
.inv-state-retired          { background:var(--surface2);           color:var(--ink3); }
.inv-state-enviado          { background:#dbeafe;                   color:#1e40af; }
.inv-state-devuelto         { background:#d1fae5;                   color:#065f46; }

/* Low stock alert badge */
.inv-low-stock           { background:#fef2f2; color:var(--red,#dc2626); border:1px solid #fca5a5;
                           display:inline-flex;align-items:center;gap:3px;padding:1px 6px;border-radius:6px;font-size:10px;font-weight:700; }

/* Stat cards row */
.inv-stats               { display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin-bottom:20px; }
.inv-stat                { background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:14px 16px; }
.inv-stat-val            { font-family:var(--fh);font-size:22px;font-weight:800;line-height:1; }
.inv-stat-lbl            { font-size:11px;color:var(--ink3);margin-top:3px; }
.inv-stat-ico            { font-size:18px;margin-bottom:6px; }

/* Movement type badges */
.inv-mov                      { display:inline-flex;align-items:center;gap:3px;padding:2px 7px;border-radius:6px;font-size:10px;font-weight:700; }
.inv-mov-in                   { background:#dcfce7; color:#15803d; }
.inv-mov-out                  { background:#fee2e2; color:#dc2626; }
.inv-mov-reserve              { background:var(--blue-lt); color:var(--blue); }
.inv-mov-release              { background:var(--surface2); color:var(--ink3); }
.inv-mov-repair_in            { background:#fef9c3; color:#92400e; }
.inv-mov-repair_out           { background:#dcfce7; color:#15803d; }
.inv-mov-transfer             { background:#ede9fe; color:#7c3aed; }
.inv-mov-adjust               { background:#ffedd5; color:#c2410c; }
.inv-mov-assign               { background:#ede9fe; color:#5b21b6; }
.inv-mov-distribute           { background:#dbeafe; color:#1e40af; }
.inv-mov-return_distribution  { background:#d1fae5; color:#065f46; }
.inv-mov-decommission         { background:#fee2e2; color:#991b1b; }
.inv-mov-reactivation         { background:#dcfce7; color:#15803d; }

/* Item card in list */
.inv-item-row            { display:flex;align-items:center;gap:12px;padding:11px 14px;border-bottom:1px solid var(--border);transition:background .1s; }
.inv-item-row:hover      { background:var(--surface2); }
.inv-item-name           { font-weight:700;font-size:13px;line-height:1.3; }
.inv-item-meta           { font-size:11px;color:var(--ink3);margin-top:2px; }
.inv-qty-pill            { display:inline-flex;align-items:center;justify-content:center;min-width:26px;height:22px;border-radius:11px;font-size:11px;font-weight:700;padding:0 6px; }
.inv-qty-avail           { background:var(--green-lt,#dcfce7); color:var(--green,#16a34a); }
.inv-qty-reserved        { background:var(--blue-lt); color:var(--blue); }
.inv-qty-repair          { background:#fef9c3; color:#92400e; }
.inv-qty-zero            { background:var(--surface2); color:var(--ink3); }

/* Location badge */
.inv-loc                 { font-size:10px;padding:2px 6px;background:var(--surface2);border:1px solid var(--border);border-radius:5px;font-family:monospace;color:var(--ink2);white-space:nowrap; }

/* Filters bar */
.inv-filters             { display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:14px; }
.inv-filter-btn          { padding:4px 12px;border-radius:20px;font-size:11px;font-weight:600;border:1px solid var(--border);background:var(--surface2);cursor:pointer;transition:all .12s; }
.inv-filter-btn:hover    { border-color:var(--blue);color:var(--blue); }
.inv-filter-btn.active   { background:var(--blue);color:#fff;border-color:var(--blue); }

/* ══════════════════════════════════════
   THEME — OLD SYSTEM
   Activar con: html.theme-old
══════════════════════════════════════ */
html.theme-old {
  /* ── Design tokens reemplazados ── */
  --bg:        #ECF0F5;
  --surface:   #FFFFFF;
  --surface2:  #E0E8F0;
  --border:    #8EA4BE;
  --ink:       #000000;
  --ink2:      #333333;
  --ink3:      #666666;

  --brand:     #003399;

  --nav-text:       #FFFFFF;
  --nav-text-dim:   rgba(255,255,255,.70);
  --nav-text-hover: #FFFFFF;
  --nav-text-lbl:   rgba(255,255,255,.50);

  --blue:      #003399;
  --blue-mid:  #0055CC;
  --blue-lt:   #C0D0E8;
  --blue-xs:   #E8EEF8;

  --green:     #007700;
  --green-lt:  #C8E8C8;
  --green-xs:  #E8F5E8;

  --amber:     #996600;
  --amber-lt:  #F5DCA0;
  --amber-xs:  #FDF5DC;

  --red:       #CC0000;
  --red-lt:    #F5C8C8;
  --red-xs:    #FDE8E8;

  --violet:    #660099;
  --violet-lt: #E0C8F0;

  --teal:      #006666;
  --teal-lt:   #C0E8E8;

  --sky:       #005577;
  --sky-lt:    #C8E4F0;

  --r:  0px;
  --sh:  inset -1px -1px 0 #8EA4BE, inset 1px 1px 0 #FFFFFF;
  --sh2: 2px 2px 6px rgba(0,0,0,.35);

  /* ── Tipografía compacta ── */
  --fh: Arial, 'Helvetica Neue', sans-serif;
  --fb: Arial, 'Helvetica Neue', sans-serif;

  font-size: 12px;
}

/* ── Reset de redondeos global ── */
html.theme-old *,
html.theme-old *::before,
html.theme-old *::after {
  border-radius: 0 !important;
}

/* ── Body ── */
html.theme-old body {
  font-size: 12px;
  font-family: Arial, sans-serif;
  background: var(--bg);
}

/* ── Sidebar ── */
html.theme-old .sidebar {
  width: 200px;
  background: #003399;
  border-right: 2px solid #001F6B;
}
html.theme-old .sb-logo {
  background: #001F6B;
  padding: 8px 10px;
  border-bottom: 1px solid #0044CC;
}
html.theme-old .sb-brand {
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0;
}
html.theme-old .sb-tag { display: none; }

html.theme-old .nav-lbl {
  font-size: 9px;
  padding: 6px 8px 2px;
  color: rgba(255,255,255,.45);
  letter-spacing: 1px;
}
html.theme-old .nav-item {
  padding: 5px 8px;
  font-size: 12px;
  gap: 6px;
}
html.theme-old .nav-item.active {
  background: #C0D0E8;
  color: #000000;
  font-weight: bold;
}
html.theme-old .nav-item:hover:not(.active) {
  background: rgba(255,255,255,.12);
}

/* ── Topbar ── */
html.theme-old .topbar {
  background: #D0DCF0;
  border-bottom: 2px solid #8EA4BE;
  padding: 5px 12px;
  min-height: 36px;
}
html.theme-old .page-title {
  font-size: 13px;
  font-weight: bold;
  font-family: Arial, sans-serif;
  color: #000;
}

/* ── Content ── */
html.theme-old .content {
  padding: 10px 14px;
  background: #ECF0F5;
}

/* ── Botones: efecto 3D Windows ── */
html.theme-old .btn {
  padding: 3px 12px;
  font-size: 12px;
  font-weight: normal;
  background: linear-gradient(to bottom, #F5F5F5, #D8D8D8);
  color: #000000;
  border: 1px solid #888;
  box-shadow: inset 1px 1px 0 #FFF, inset -1px -1px 0 #AAA;
  transition: none;
}
html.theme-old .btn:hover {
  background: linear-gradient(to bottom, #E8EEF8, #C0D0E8);
  border-color: #003399;
  filter: none;
}
html.theme-old .btn:active {
  box-shadow: inset 1px 1px 0 #AAA, inset -1px -1px 0 #FFF;
  transform: none;
}
html.theme-old .btn-primary {
  background: linear-gradient(to bottom, #4477CC, #003399);
  color: #FFF;
  border-color: #001F6B;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.3), inset -1px -1px 0 rgba(0,0,0,.3);
}
html.theme-old .btn-primary:hover {
  background: linear-gradient(to bottom, #5588DD, #0044AA);
  filter: none;
}
html.theme-old .btn-danger {
  background: linear-gradient(to bottom, #F5F5F5, #D8D8D8);
  color: #CC0000;
  border-color: #CC0000;
}
html.theme-old .btn-sm,
html.theme-old .btn-xs {
  padding: 2px 8px;
  font-size: 11px;
}

/* ── Formularios ── */
html.theme-old .form-group label {
  font-size: 11px;
  font-weight: bold;
  color: #000;
  text-transform: none;
  letter-spacing: 0;
}
html.theme-old .form-input,
html.theme-old .form-select,
html.theme-old .form-textarea,
html.theme-old .form-control {
  padding: 3px 5px;
  font-size: 12px;
  background: #FFFFFF;
  border: 1px solid #8EA4BE;
  color: #000;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.10);
}
html.theme-old .form-input:focus,
html.theme-old .form-select:focus,
html.theme-old .form-textarea:focus,
html.theme-old .form-control:focus {
  border-color: #003399;
  background: #FFFFFF;
  outline: 1px solid #003399;
}

/* ── Tablas: filas compactas ── */
html.theme-old .tbl-wrap {
  border: 1px solid #8EA4BE;
  box-shadow: none;
}
html.theme-old thead {
  background: #C0D0E8;
}
html.theme-old th {
  padding: 5px 8px;
  font-size: 11px;
  font-weight: bold;
  color: #000;
  text-transform: none;
  letter-spacing: 0;
  border-right: 1px solid #8EA4BE;
  background: linear-gradient(to bottom, #D8E4F8, #B0C4E0);
}
html.theme-old td {
  padding: 3px 8px;
  font-size: 12px;
  border-top: 1px solid #C8D4E4;
  border-right: 1px solid #C8D4E4;
}
html.theme-old tr:nth-child(even) td {
  background: #EEF2F8;
}
html.theme-old tr:hover td {
  background: #C8D8F0 !important;
}
html.theme-old .tid {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: bold;
  color: #003399;
}

/* Botones de acción en tabla */
html.theme-old .act-btn {
  padding: 2px 7px;
  font-size: 11px;
  background: linear-gradient(to bottom, #F5F5F5, #D8D8D8);
  border: 1px solid #888;
  color: #000;
  box-shadow: inset 1px 1px 0 #FFF, inset -1px -1px 0 #AAA;
}
html.theme-old .act-btn:hover {
  background: linear-gradient(to bottom, #E8EEF8, #C0D0E8);
  border-color: #003399;
  color: #000;
}

/* ── Stat cards ── */
html.theme-old .stat-card {
  border: 1px solid #8EA4BE;
  background: #FFFFFF;
  box-shadow: inset -1px -1px 0 #8EA4BE, inset 1px 1px 0 #FFF;
  padding: 10px 14px;
}
html.theme-old .stat-card:hover {
  transform: none;
  box-shadow: inset -1px -1px 0 #8EA4BE, inset 1px 1px 0 #FFF;
  border-color: #003399;
}
html.theme-old .stat-val {
  font-size: 22px;
  font-family: Arial, sans-serif;
}
html.theme-old .stat-lbl {
  font-size: 11px;
}

/* ── Modal ── */
html.theme-old .overlay {
  background: rgba(0,0,50,.40);
  backdrop-filter: none;
}
html.theme-old .modal {
  box-shadow: 4px 4px 10px rgba(0,0,0,.5);
  border: 2px solid #003399;
}
html.theme-old .mh,
html.theme-old .modal-header {
  background: linear-gradient(to right, #003399, #0044CC);
  color: #FFFFFF;
  padding: 7px 12px;
  border-bottom: 1px solid #001F6B;
}
html.theme-old .mh-title,
html.theme-old .modal-title {
  font-size: 13px;
  font-weight: bold;
  color: #FFFFFF;
}
html.theme-old .m-close,
html.theme-old .modal-close {
  background: #CC0000;
  border: 1px solid #880000;
  color: #FFF;
  font-weight: bold;
}
html.theme-old .mf,
html.theme-old .modal-footer {
  background: #E0E8F0;
  border-top: 1px solid #8EA4BE;
}

/* ── Badges: más cuadrados, menos coloridos ── */
html.theme-old .badge {
  padding: 1px 6px;
  font-size: 10px;
  font-weight: bold;
  border: 1px solid currentColor;
}

/* ── Search / filter ── */
html.theme-old .search-inp {
  padding: 3px 7px;
  font-size: 12px;
  border: 1px solid #8EA4BE;
  background: #FFF;
}
html.theme-old .chip {
  padding: 3px 9px;
  font-size: 11px;
  background: linear-gradient(to bottom, #F5F5F5, #D8D8D8);
  border: 1px solid #888;
  box-shadow: inset 1px 1px 0 #FFF;
}
html.theme-old .chip.on {
  background: linear-gradient(to bottom, #4477CC, #003399);
  color: #FFF;
  border-color: #001F6B;
}

/* ── Settings nav ── */
html.theme-old .settings-nav {
  background: #E0E8F0;
  border-right: 1px solid #8EA4BE;
}
html.theme-old .sn-item {
  font-size: 12px;
  padding: 5px 12px;
  border-right: none;
  border-bottom: 1px solid #C8D4E4;
}
html.theme-old .sn-item.active {
  background: #C0D0E8;
  color: #000;
  font-weight: bold;
  border-right: 3px solid #003399;
}

/* ── Toast ── */
html.theme-old .toast {
  border: 2px solid #003399;
  background: #E8EEF8;
  color: #000;
  font-size: 12px;
  box-shadow: 3px 3px 6px rgba(0,0,0,.4);
}

/* ── Animaciones: desactivadas ── */
html.theme-old *,
html.theme-old .shell,
html.theme-old .cp-wrap,
html.theme-old .settings-panel,
html.theme-old .stat-card,
html.theme-old .stat-card:nth-child(1),
html.theme-old .stat-card:nth-child(2),
html.theme-old .stat-card:nth-child(3),
html.theme-old .stat-card:nth-child(4) {
  animation: none !important;
  transition: none !important;
}

/* Excepciones: overlay y modal siguen apareciendo */
html.theme-old .overlay { transition: opacity .1s !important; }

/* ── Barra de estado (status bar) ── */
html.theme-old .main::after {
  content: '● System ready';
  display: block;
  background: #C0D0E8;
  border-top: 1px solid #8EA4BE;
  padding: 2px 10px;
  font-size: 11px;
  color: #007700;
  font-family: Arial, sans-serif;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* ── Role badge ── */
html.theme-old .role-badge {
  background: rgba(255,255,255,.10) !important;
  border: 1px solid rgba(255,255,255,.25);
  padding: 4px 8px;
  margin: 6px 10px;
}

/* ── Dark mode desactivado en Old System ── */
html.theme-old.dark {
  --bg:      #ECF0F5;
  --surface: #FFFFFF;
  --surface2:#E0E8F0;
  --border:  #8EA4BE;
  --ink:     #000000;
  --ink2:    #333333;
  --ink3:    #666666;
}

/* ══════════════════════════════════════
   PLATFORM — STATS 5 columnas (desktop)
══════════════════════════════════════ */
.platform-stats { grid-template-columns: repeat(5, 1fr) !important; margin-bottom: 24px; }


/* ══════════════════════════════════════
   PLATFORM — MENÚ HAMBURGUESA
══════════════════════════════════════ */

/* Botón ☰ — solo visible en móvil */
.ph-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
  transition: background .15s;
}
.ph-hamburger:hover  { background: var(--surface2); }
.ph-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

/* Overlay */
.platform-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 199;
}
.platform-drawer-overlay.open { display: block; }

/* Drawer */
.platform-drawer {
  position: fixed;
  top: 0;
  left: -290px;
  width: 270px;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0,0,0,.1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: left .26s cubic-bezier(.4, 0, .2, 1);
}
.platform-drawer.open { left: 0; }

/* Drawer — encabezado */
.pd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.pd-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  font-size: 17px;
  color: var(--ink3);
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
  transition: background .15s, color .15s;
}
.pd-close:hover { background: var(--surface2); color: var(--ink); }

/* Drawer — navegación */
.pd-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
  flex: 1;
}
.pd-tab {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: none;
  background: transparent;
  color: var(--ink2);
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .15s, color .15s;
}
.pd-tab .pd-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 15px;
  background: var(--surface2);
  flex-shrink: 0;
}
.pd-tab:hover              { background: var(--surface2); color: var(--ink); }
.pd-tab.active             { background: var(--blue-lt, #eff6ff); color: var(--blue, #2563eb); }
.pd-tab.active .pd-icon    { background: var(--blue, #2563eb); filter: grayscale(0); }


/* ── Responsive ─────────────────────── */
@media (max-width: 768px) {
  /* Mostrar hamburguesa */
  .ph-hamburger { display: flex; }

  /* Ocultar tabs horizontales */
  .platform-body .lc-tabs-bar { display: none; }

  /* Reducir padding lateral */
  .platform-body { padding: 14px; }

  /* Stats: 2 columnas en móvil */
  .platform-stats { grid-template-columns: repeat(2, 1fr) !important; }

  /* Header: ocultar nombre de usuario (queda en el drawer) */
  #ph-user-name { display: none; }

  /* Header: ocultar botón de tema */
  .platform-header [data-theme-btn] { display: none; }

  /* Tabla clientes: scroll horizontal contenido, permitir overflow */
  .platform-clients-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Ocultar columnas secundarias */
  .pc-col-hide { display: none; }

  /* Ajustar padding de celdas restantes */
  .platform-clients-tbl th,
  .platform-clients-tbl td { padding: 10px 10px; }

  /* Botones de acción: apilar verticalmente */
  .platform-clients-tbl .row-acts {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
  .platform-clients-tbl .act-btn {
    font-size: 11px;
    padding: 4px 8px;
    white-space: nowrap;
  }
}

/* ── TICKET CHAT / MESSAGES ──────────────────────────────────────────────── */
.ticket-chat-container { scroll-behavior: smooth; }
.chat-msg { padding: 8px 0; border-bottom: 1px solid var(--border); }
.chat-msg:last-child { border-bottom: none; }
.chat-msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.chat-msg-sender { font-size: 11px; font-weight: 700; }
.chat-msg-time { font-size: 10px; color: var(--ink3); }
.chat-msg-body { font-size: 13px; color: var(--ink); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.chat-msg-tech .chat-msg-sender { color: var(--brand); }
.chat-msg-tech .chat-msg-body { background: color-mix(in srgb, var(--brand) 6%, transparent); border-left: 2px solid var(--brand); padding: 6px 10px; border-radius: 6px; }
.chat-msg-client .chat-msg-sender { color: #059669; }
.chat-msg-client .chat-msg-body { background: color-mix(in srgb, #059669 6%, transparent); border-left: 2px solid #059669; padding: 6px 10px; border-radius: 6px; }
