/* =====================================================================
   REPAIRCRUZ LABORATORIO · Panel de órdenes · v2
   Base blanca, azul corporativo, barra lateral azul noche.
   Motivo: esquinas cortadas a 45° tomadas de las letras del logo RC.
   ===================================================================== */
:root {
  --white: #ffffff;
  --canvas: #f3f5f9;
  --ink: #000000;
  --ink-2: #353b47;
  --ink-3: #6a7282;
  --blue: #1450d2;
  --blue-2: #2f6bff;
  --blue-press: #0d3ea6;
  --blue-soft: #ebf1ff;
  --blue-glow: rgba(47, 107, 255, .35);
  --night: #08132a;
  --night-2: #0f1f40;
  --night-ink: #b9c5dd;
  --line: #e4e8ef;
  --line-2: #cfd5df;
  --surface: #f6f8fb;
  --ok: #15803d;   --ok-soft: #e8f7ee;
  --bad: #c62828;  --bad-soft: #fdeeee;
  --warn: #b45309; --warn-soft: #fff5e6;
  --cut: 10px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --side: 264px;
  --shadow-1: 0 1px 2px rgba(8, 19, 42, .06), 0 1px 1px rgba(8, 19, 42, .04);
  --shadow-2: 0 10px 30px -12px rgba(8, 19, 42, .22), 0 2px 6px rgba(8, 19, 42, .06);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --tabbar-h: 0px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 15px/1.5 var(--font); font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; }
h1 { font-size: 1.65rem; font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: 1.08rem; font-weight: 650; letter-spacing: -0.005em; }
h3 { font-size: .98rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code { background: var(--surface); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; }
::selection { background: var(--blue-soft); }

/* ---------------------------------------------------------------- botones */
.btn {
  --bg: var(--white); --fg: var(--ink); --bd: var(--line-2);
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 40px; padding: 0 1rem; border: 1px solid var(--bd); border-radius: var(--r-sm);
  background: var(--bg); color: var(--fg); font: 600 .92rem/1 var(--font); cursor: pointer;
  text-decoration: none !important; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, transform .15s var(--ease), box-shadow .2s;
}
.btn:hover { background: var(--surface); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary {
  --fg: #fff; --bd: transparent; border-radius: 0;
  background: linear-gradient(135deg, var(--blue-2), var(--blue));
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.btn-primary:hover { background: linear-gradient(135deg, #3d76ff, var(--blue-press)); box-shadow: 0 8px 22px -8px var(--blue-glow); }
.btn-danger { --fg: var(--bad); --bd: #f2c9c9; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { --bd: transparent; --bg: transparent; }
.btn-sm { min-height: 32px; padding: 0 .75rem; font-size: .84rem; }
.btn-lg { min-height: 48px; padding: 0 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }
.icon-btn { width: 38px; min-height: 38px; padding: 0; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .18; pointer-events: none; animation: ripple .55s var(--ease); z-index: -1; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: radial-gradient(120% 60% at 0% 0%, #13306b 0%, transparent 60%), linear-gradient(180deg, var(--night-2), var(--night));
  color: var(--night-ink); padding: 18px 14px; scrollbar-width: thin; scrollbar-color: #26406f transparent;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 20px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 12px; padding: 4px; box-shadow: 0 0 0 3px rgba(47,107,255,.25); }
.brand strong { display: block; color: #fff; font: 750 .93rem/1.15 var(--font-display); letter-spacing: .01em; }
.brand span { font-size: .76rem; color: #8ea0c4; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  color: var(--night-ink); border-radius: 10px; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { color: #fff; font-weight: 650; background: linear-gradient(135deg, rgba(47,107,255,.95), rgba(20,80,210,.95)); box-shadow: 0 10px 24px -10px rgba(47,107,255,.8); }
.nav a.active svg { opacity: 1; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 6px; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 4px; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.side-user .avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--blue-2), #0b2f86);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.side-user strong { display: block; color: #fff; }
.side-user span { color: #8ea0c4; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  min-height: 66px; padding: 10px 30px; background: rgba(243,245,249,.82); border-bottom: 1px solid rgba(207,213,223,.6);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar h1 { font-size: 1.2rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; min-width: 240px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink-3); font: 500 .9rem var(--font); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.search-trigger:hover { border-color: var(--blue-2); box-shadow: 0 0 0 4px var(--blue-soft); }
.search-trigger svg { width: 17px; height: 17px; }
.search-trigger kbd { margin-left: auto; font: 600 .72rem var(--font); padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 5px; color: var(--ink-3); }
.menu-toggle { display: none; }
.content { padding: 28px 30px 70px; width: 100%; max-width: 1360px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }

.view-enter { animation: view-in .38s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }
.stagger > * { animation: view-in .5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; } .stagger > *:nth-child(5) { animation-delay: .2s; }

/* barra inferior (móvil) */
.tabbar { display: none; }
@media (max-width: 960px) {
  :root { --tabbar-h: 70px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: min(296px, 86vw); transform: translateX(-104%); transition: transform .28s var(--ease); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(8,19,42,.45); }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 10px 14px; min-height: 58px; }
  .search-trigger { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .topbar .btn-new { display: none; }
  .content { padding: 18px 14px calc(var(--tabbar-h) + 30px); }
  .tabbar {
    position: fixed; z-index: 40; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; height: 62px; padding: 0 6px;
    background: rgba(8,19,42,.94); border-radius: 20px; box-shadow: 0 18px 40px -12px rgba(8,19,42,.55);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #8ea0c4; font-size: .66rem; font-weight: 600; text-decoration: none; padding: 6px 0; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { color: #fff; }
  .tabbar a.active svg { filter: drop-shadow(0 0 8px var(--blue-glow)); }
  .tabbar .fab { justify-self: center; width: 56px; height: 56px; margin-top: -26px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--blue-2), var(--blue)); box-shadow: 0 10px 24px -6px var(--blue-glow);
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
  .tabbar .fab svg { width: 26px; height: 26px; }
  .toasts { bottom: calc(var(--tabbar-h) + 20px) !important; }
  .form-actions { bottom: var(--tabbar-h) !important; }
}

/* ---------------------------------------------------------------- paneles */
.panel { border: 1px solid var(--line); border-radius: var(--r); background: var(--white); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }

/* ---------------------------------------------------------------- dashboard */
.hero {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px;
  padding: 26px 28px; margin-bottom: 20px; color: #fff; border-radius: var(--r-lg);
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 26px 26px,
    radial-gradient(80% 140% at 100% 0%, #3d7bff 0%, transparent 55%),
    linear-gradient(135deg, #0b2a6e, #08132a 75%);
  box-shadow: var(--shadow-2);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border: 2px solid rgba(255,255,255,.12); border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(255,255,255,.04), 0 0 0 60px rgba(255,255,255,.025); pointer-events: none; }
.hero h1 { font-size: 1.85rem; color: #fff; }
.hero p { margin: 6px 0 0; color: #b9c8ea; }
.hero .clock { font: 700 .85rem var(--font); color: #cfe0ff; letter-spacing: .02em; margin-bottom: 6px; }
.hero .btn-primary { background: #fff; --fg: var(--blue); box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); }
.hero .btn-primary:hover { background: #eef3ff; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.kpis .kpi.lead { grid-column: span 2; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, 1fr); } .kpis .kpi.lead { grid-column: auto; } }
@media (min-width: 1240px) { .kpis { grid-template-columns: 1.25fr repeat(4, 1fr); } .kpis .kpi.lead { grid-row: span 2; display: flex; flex-direction: column; justify-content: flex-end; } .kpis .kpi.lead b { font-size: 3.2rem; } }
.kpi {
  position: relative; display: block; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: inherit;
  text-decoration: none !important; box-shadow: var(--shadow-1); transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; overflow: hidden;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: #c9d6f3; }
.kpi .ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; margin-bottom: 12px; color: var(--c, var(--blue)); background: color-mix(in srgb, var(--c, var(--blue)) 12%, white); }
.kpi .ico svg { width: 18px; height: 18px; }
.kpi b { display: block; font: 800 2rem/1 var(--font-display); letter-spacing: -.03em; }
.kpi span { display: block; margin-top: 6px; font-size: .85rem; color: var(--ink-2); }
.kpi::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: var(--c, var(--blue)); transition: width .9s var(--ease); }
.kpi.lead { background: linear-gradient(135deg, var(--blue-2), var(--blue)); border-color: transparent; color: #fff; }
.kpi.lead span { color: #dbe6ff; }
.kpi.lead .ico { background: rgba(255,255,255,.18); color: #fff; }

.distribution { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface); }
.distribution i { display: block; height: 100%; width: 0; transition: width 1s var(--ease); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: .82rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-grid > * + * { margin-top: 0; }
.dash-side > .panel + .panel { margin-top: 18px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- tablas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: .78rem; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: #f7f9ff; }
.table tbody tr.clickable:hover .order-no { border-color: var(--blue-2); color: var(--blue); }
.table .clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .actions { white-space: nowrap; text-align: right; }
.order-no {
  display: inline-block; padding: 3px 9px 3px 8px; font-weight: 750; color: var(--ink); background: #fff; letter-spacing: .01em;
  border: 1px solid var(--line-2); transition: border-color .15s, color .15s;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty .btn { margin-top: 12px; }
.empty svg.big { width: 46px; height: 46px; color: var(--line-2); margin-bottom: 8px; }

@media (max-width: 720px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { padding: 2px 0; border: 0; }
  .table.responsive td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-size: .8rem; }
  .table.responsive .actions { text-align: left; padding-top: 10px; }
  .table .clip { max-width: none; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* skeleton */
.sk { position: relative; overflow: hidden; background: #eceff4; border-radius: 8px; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-page { display: grid; gap: 14px; }
.sk-row { height: 54px; }
.sk-title { height: 30px; width: 40%; }

/* ---------------------------------------------------------------- estados */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .77rem; font-weight: 650; white-space: nowrap; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-slate { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.st-amber { color: #a16207; background: #fef9e7; border-color: #f7e6b0; }
.st-violet { color: #6d28d9; background: #f4effe; border-color: #e1d6fb; }
.st-orange { color: #c2410c; background: #fff3eb; border-color: #fbd5bf; }
.st-blue { color: var(--blue); background: var(--blue-soft); border-color: #cddcfa; }
.st-blue::before { animation: pulse 1.6s infinite; }
.st-green { color: var(--ok); background: var(--ok-soft); border-color: #c4e7cf; }
.st-teal { color: #0f766e; background: #e6f7f5; border-color: #bfe7e2; }
.st-dark { color: #fff; background: #000; border-color: #000; }
.st-red { color: var(--bad); background: var(--bad-soft); border-color: #f4c7c7; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------------------------------------------------------------- formularios */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field > span .req { color: var(--bad); }
.field small { color: var(--ink-3); font-size: .78rem; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
@media (min-width: 961px) { input, select, textarea { font-size: .95rem; } }
textarea { min-height: 88px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b8c1cf; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 4px rgba(47,107,255,.14); }
input[readonly] { background: var(--surface); }
.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 4px rgba(198,40,40,.12) !important; animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 18px; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-3 { grid-column: 1 / -1; } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .span-2, .span-3 { grid-column: auto; } }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: .93rem; }
.check input { width: 19px; height: 19px; min-height: 0; margin: 0; accent-color: var(--blue); }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search] { flex: 1 1 260px; }
.toolbar select, .toolbar input[type=date] { width: auto; flex: 0 1 auto; }
@media (max-width: 560px) { .toolbar select, .toolbar input[type=date] { flex: 1 1 45%; } }

/* ---------------------------------------------------------------- nueva orden */
.order-form { display: grid; grid-template-columns: 214px minmax(0, 1fr); gap: 26px; align-items: start; }
.form-steps { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-1); counter-reset: st; }
.form-steps a { counter-increment: st; display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 550; font-size: .92rem; text-decoration: none; transition: background .15s; }
.form-steps a::before { content: counter(st); display: grid; place-items: center; width: 26px; height: 26px; flex: none; font-size: .78rem; font-weight: 750; border: 1px solid var(--line-2); color: var(--ink-3); background: #fff; transition: background .25s, color .25s, border-color .25s;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.form-steps a:hover { background: var(--surface); }
.form-steps a.done::before { content: "✓"; background: var(--blue); border-color: var(--blue); color: #fff; }
.form-progress { margin-top: 10px; padding: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--ink-2); }
.ring { --ring: 0; width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 750 .72rem var(--font);
  background: radial-gradient(closest-side, #fff 76%, transparent 78%), conic-gradient(var(--blue-2) calc(var(--ring) * 1%), var(--line) 0); transition: --ring .4s; }
.form-section { scroll-margin-top: 90px; }
.form-section + .form-section { margin-top: 18px; }
.form-section .panel-head h2 { display: flex; gap: 10px; align-items: center; }
.form-section .panel-head h2 em { font-style: normal; color: #fff; font-weight: 750; font-size: .8rem; width: 26px; height: 26px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue-2), var(--blue));
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.order-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: .9rem; color: var(--ink-2); }
.order-meta b { color: var(--ink); }
.client-results { border: 1px solid var(--line); border-radius: 10px; margin: -4px 0 14px; overflow: hidden; box-shadow: var(--shadow-2); animation: view-in .2s var(--ease); }
.client-results button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; font: inherit; cursor: pointer; }
.client-results button:last-child { border-bottom: 0; }
.client-results button:hover { background: var(--blue-soft); }
.chosen-client { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 16px; background: var(--blue-soft); border: 1px solid #cddcfa; border-radius: 10px; font-size: .92rem; animation: view-in .25s var(--ease); }
.capacity-pick { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font: 600 .88rem var(--font); cursor: pointer; transition: all .15s var(--ease); }
.pill:hover { border-color: var(--blue-2); }
.pill[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; transform: scale(1.04); }
.form-actions { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 16px 0; margin-top: 18px; background: linear-gradient(to top, var(--canvas) 70%, rgba(243,245,249,0)); }
@media (max-width: 960px) { .order-form { grid-template-columns: 1fr; } .form-steps { display: none; } .form-actions .btn-lg { flex: 1; } }

.pattern { display: grid; grid-template-columns: repeat(3, 48px); gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; width: max-content; user-select: none; touch-action: none; background: var(--surface); }
.pattern button { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; font: 750 .9rem var(--font); color: var(--ink-3); cursor: pointer; transition: transform .15s var(--ease), background .15s; }
.pattern button.on { background: var(--blue); border-color: var(--blue); color: #fff; transform: scale(1.1); box-shadow: 0 0 0 6px rgba(47,107,255,.15); }

.check-section + .check-section { margin-top: 24px; }
.check-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.check-row { display: grid; grid-template-columns: minmax(130px, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row > span { font-size: .93rem; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #fff; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { display: block; padding: 7px 11px; font-size: .8rem; font-weight: 650; color: var(--ink-3); border-left: 1px solid var(--line); white-space: nowrap; transition: background .15s, color .15s; }
.seg label:first-child span { border-left: 0; }
.seg label:hover span { background: var(--surface); }
.seg input:focus-visible + span { outline: 2px solid var(--blue-2); outline-offset: -2px; }
.seg input:checked + span { animation: pop .22s var(--ease); }
.seg input:checked + span.r-funciona { background: var(--ok); color: #fff; }
.seg input:checked + span.r-no_funciona { background: var(--bad); color: #fff; }
.seg input:checked + span.r-no_probado { background: #4b5563; color: #fff; }
.seg input:checked + span.r-no_aplica { background: var(--line-2); color: var(--ink); }
@keyframes pop { 50% { transform: scale(1.06); } }
.seg.readonly label { cursor: default; }
@media (max-width: 640px) {
  .check-row { grid-template-columns: 1fr; gap: 6px; }
  .seg { display: grid; grid-template-columns: repeat(4, 1fr); }
  .seg label span { text-align: center; padding: 9px 2px; font-size: .74rem; white-space: normal; line-height: 1.15; }
}
.check-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.res { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: .78rem; font-weight: 600; }
.res-funciona { background: var(--ok-soft); color: var(--ok); }
.res-no_funciona { background: var(--bad-soft); color: var(--bad); }
.res-no_probado { background: #f1f2f4; color: #4b5563; }
.res-no_aplica { background: #f6f7f9; color: var(--ink-3); }
.acc-grid { display: flex; flex-wrap: wrap; gap: 10px 22px; }

.photo-drop { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.photo { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; font-size: .8rem; animation: view-in .3s var(--ease); transition: box-shadow .2s, transform .2s var(--ease); }
.photo:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.photo .thumb { display: block; aspect-ratio: 4/3; width: 100%; object-fit: cover; background: var(--surface); cursor: zoom-in; }
.photo .meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.photo .meta select, .photo .meta input { min-height: 34px; padding: 4px 8px; font-size: .82rem; }
.photo.voided { opacity: .55; }
.photo.voided .thumb { filter: grayscale(1); }
.stage-title { margin: 20px 0 6px; font-size: .9rem; color: var(--ink-2); }

/* detalle */
.detail-head { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; justify-content: space-between; margin-bottom: 18px; padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); }
.detail-head .num { font: 850 2.1rem/1 var(--font-display); letter-spacing: -.03em; }
.detail-head .sub { color: var(--ink-3); margin-top: 6px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; overflow-x: auto; background: #e8ecf3; border-radius: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { padding: 9px 14px; border: 0; border-radius: 9px; background: none; font: 600 .9rem var(--font); color: var(--ink-3); cursor: pointer; white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--blue); background: #fff; box-shadow: var(--shadow-1); }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; margin: 0; font-size: .93rem; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 560px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 8px; } }
.money { font-weight: 700; }
.secret { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.secret code { font-size: 1rem; letter-spacing: .1em; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 20px 28px; animation: view-in .35s var(--ease) both; }
.timeline > li::before { content: ""; position: absolute; left: 5px; top: 5px; width: 11px; height: 11px; background: var(--blue-2); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.timeline > li::after { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: linear-gradient(var(--line), transparent); }
.timeline > li:last-child::after { display: none; }
.timeline .when { font-size: .8rem; color: var(--ink-3); margin-top: 2px; }
.timeline .changes { margin: 8px 0 0; padding: 9px 12px; background: var(--surface); border-radius: 10px; font-size: .84rem; list-style: none; }
.timeline .changes li { padding: 2px 0; }
.timeline del { color: var(--ink-3); }

/* ---------------------------------------------------------------- alertas, modal, toast */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .92rem; border: 1px solid; animation: view-in .25s var(--ease); }
.alert-ok { background: var(--ok-soft); border-color: #c4e7cf; color: #14532d; }
.alert-bad { background: var(--bad-soft); border-color: #f4c7c7; color: #7f1d1d; }
.alert-warn { background: var(--warn-soft); border-color: #f4dcb3; color: #78350f; }
.alert-info { background: var(--blue-soft); border-color: #cddcfa; color: #0f2f7a; }

.modal-back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(8,19,42,.45); backdrop-filter: blur(3px); animation: fade .2s; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(8,19,42,.5); animation: modal-in .28s var(--ease); }
.modal.wide { width: min(900px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.modal-body { padding: 20px; }
.modal-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@media (max-width: 560px) {
  .modal-back { place-items: end stretch; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: sheet-in .3s var(--ease); }
  @keyframes sheet-in { from { transform: translateY(100%); } }
}
.lightbox img { display: block; max-height: 76vh; margin: 0 auto; border-radius: 8px; }

.toasts { position: fixed; z-index: 200; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 36px); }
.toast { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--night); color: #fff; border-radius: 12px; font-size: .92rem; max-width: 420px;
  box-shadow: 0 14px 34px -10px rgba(8,19,42,.5); animation: toast-in .32s var(--ease); }
.toast svg { width: 18px; height: 18px; flex: none; color: #6ee7a0; }
.toast.bad { background: #8f1d1d; }
.toast.bad svg { color: #ffc4c4; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255,255,255,.35); transform-origin: left; animation: toast-time var(--t, 3.5s) linear forwards; }
.toast.out { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { transform: translateY(14px) scale(.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(30px); opacity: 0; } }
@keyframes toast-time { to { transform: scaleX(0); } }

/* paleta de búsqueda rápida */
.palette-back { position: fixed; inset: 0; z-index: 150; background: rgba(8,19,42,.4); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 14px 14px; animation: fade .15s; }
.palette { width: min(640px, 100%); background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 40px 90px -20px rgba(8,19,42,.55); animation: modal-in .22s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 20px; height: 20px; color: var(--ink-3); }
.palette-input input { border: 0; box-shadow: none !important; font-size: 1.05rem; min-height: 54px; padding: 0; }
.palette-list { max-height: 56vh; overflow: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; text-align: left; font: inherit; cursor: pointer; color: inherit; }
.palette-item[aria-selected=true], .palette-item:hover { background: var(--blue-soft); }
.palette-item .meta { flex: 1; min-width: 0; }
.palette-item .meta div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-group { padding: 8px 12px 4px; font-size: .74rem; font-weight: 650; color: var(--ink-3); }
.palette-foot { padding: 9px 16px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--ink-3); background: var(--surface); }

/* confirmación de orden guardada */
.saved { position: relative; text-align: center; padding: 44px 20px; overflow: hidden; }
.saved .check-mark { width: 76px; height: 76px; margin: 0 auto 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue-2), var(--blue)); color: #fff; animation: badge-pop .6s var(--ease) both;
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px); }
.saved .check-mark svg { width: 38px; height: 38px; stroke-width: 2.6; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .35s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes badge-pop { 0% { transform: scale(.3) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.08) rotate(3deg); } }
.saved h2 { font-size: 1rem; letter-spacing: .04em; color: var(--ok); }
.saved .big-no { font: 850 clamp(2.2rem, 9vw, 3.2rem)/1.1 var(--font-display); margin: 4px 0 24px; letter-spacing: -.03em; animation: view-in .5s .3s var(--ease) both; }
.saved .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; animation: view-in .5s .45s var(--ease) both; }
.confetti { position: absolute; inset: 0; pointer-events: none; }

/* ---------------------------------------------------------------- login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.login-art { position: relative; overflow: hidden; display: grid; place-items: center; padding: 40px; color: #fff;
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 30px 30px,
    radial-gradient(70% 60% at 30% 30%, #2f6bff 0%, transparent 60%),
    linear-gradient(160deg, #0b2a6e, #08132a 70%); }
.login-art .logo-tile { width: min(260px, 58%); aspect-ratio: 1; display: grid; place-items: center; background: #fff; border-radius: 32px; padding: 24px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.6), 0 0 0 10px rgba(255,255,255,.08); animation: float 6s ease-in-out infinite; }
.login-art .logo-tile img { width: 100%; }
.login-art p { position: absolute; left: 40px; bottom: 32px; margin: 0; color: #b9c8ea; font-size: .9rem; }
@keyframes float { 50% { transform: translateY(-10px); } }
.login-box { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 6vw, 90px); }
.login-box form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; animation: view-in .5s var(--ease); }
.login-box h1 { font-size: 2rem; }
@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 36px 20px 30px; }
  .login-art .logo-tile { width: 120px; border-radius: 22px; padding: 12px; }
  .login-art p { display: none; }
  .login-box { justify-content: flex-start; padding: 26px 22px 40px; align-items: center; }
}

/* ---------------------------------------------------------------- etiquetas */
.label-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.label-side > .panel + .panel { margin-top: 18px; }
@media (max-width: 1080px) { .label-layout { grid-template-columns: 1fr; } }
.label-stage { position: relative; display: grid; place-items: center; padding: 34px 16px 30px; overflow: hidden; border-bottom: 1px solid var(--line);
  background: radial-gradient(60% 70% at 50% 0%, #e7eeff, transparent 70%), repeating-linear-gradient(45deg, #f4f6fa 0 10px, #fff 10px 20px); }
.printer-slot { width: min(320px, 90%); height: 16px; margin-bottom: -6px; position: relative; z-index: 2; border-radius: 10px; background: linear-gradient(#20345e, #08132a); box-shadow: 0 8px 18px -6px rgba(8,19,42,.5); }
.printer-slot::after { content: ""; position: absolute; left: 12%; right: 12%; top: 6px; height: 3px; border-radius: 2px; background: #000; }
.label-paper { position: relative; background: #fff; box-shadow: 0 0 0 1px var(--line-2), 0 18px 40px -16px rgba(8,19,42,.35); transform-origin: top center; transition: transform .45s var(--ease); }
.label-paper.feeding { animation: feed 1.3s var(--ease); }
@keyframes feed { 0% { clip-path: inset(0 0 100% 0); } 100% { clip-path: inset(0 0 0 0); } }
.label-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px; }
.warn-list { margin: 0; padding-left: 18px; }
.mode-card { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.mode-card + .mode-card { margin-top: 8px; }
.mode-card input { width: 18px; height: 18px; min-height: 0; margin-top: 2px; accent-color: var(--blue); }
.mode-card:has(input:checked) { border-color: var(--blue-2); background: var(--blue-soft); }
.mode-card small { display: block; color: var(--ink-3); }
.seg-choice { display: inline-flex; padding: 3px; gap: 3px; background: #e8ecf3; border-radius: 10px; }
.seg-choice button { padding: 7px 12px; border: 0; border-radius: 8px; background: none; font: 600 .84rem var(--font); color: var(--ink-3); cursor: pointer; }
.seg-choice button[aria-pressed=true] { background: #fff; color: var(--blue); box-shadow: var(--shadow-1); }
.export-grid { display: grid; gap: 12px; }
.export-grid > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.howto { margin: 0; padding-left: 18px; line-height: 1.65; font-size: .88rem; }

/* ---------------------------------------------------------------- instalación */
.install-page { background: var(--canvas); padding: 30px 16px; }
.install-card { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-2); }
.install-head { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.install-logo { width: 64px; }
.install-sub { margin: 26px 0 12px; font-size: 1.05rem; }
.req-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .92rem; }
.req-list li span { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; font-size: .75rem; color: #fff; }
.req-list .ok span { background: var(--ok); } .req-list .bad span { background: var(--bad); } .req-list .warn span { background: var(--warn); }
.install-form .btn { margin-top: 24px; }
.install-steps { line-height: 1.8; }

.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--blue-2); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@property --ring { syntax: "<number>"; inherits: false; initial-value: 0; }
.palette-item > svg { width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.palette-item[aria-selected=true] > svg { color: var(--blue); }
.empty > svg { display: block; width: 44px; height: 44px; margin: 0 auto 10px; color: var(--line-2); }
.empty p { margin: 0 0 4px; }
svg { max-width: 100%; }
