/* === TrackLine styles (migrados desde <style> inline) === */
/* Paleta TrackLineX */
:root {
	/* NAV + look general (modo principal oscuro según branding) */
	--nav-bg: #001128;           /* Fondo */
	--nav-active: #1E88E5;       /* Azul marca */
	--brand: #E7F0F8;            /* Texto/brand */
	--bg1: #000D1E;              /* Fondo base */
	--bg2: #0E131A;              /* Fondo sutil */
	--card: #0F172A;             /* Panel/ tarjeta oscura */
	--muted: #94A3B8;            /* Texto secundario */
	--ink: #E7F0F8;              /* Texto principal */
	--blue: #1E88E5;             /* Primario */
	--bar-track: #243040;        /* Pista de barras */
	--chip: #1f2937;             /* Chip oscuro */
	--shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
	--radius: 16px;

	/* Login / inputs */
	--line: #243040;             /* Bordes */
	--brand-2: #53B6FF;          /* Azul claro marca */
	--orange: #FF6A00;           /* Naranja marca */
}

/* GlassFlow brand overrides (separate login/app) */
[data-brand="glassflow"] {
  --nav-bg: #05161a;
  --nav-active: #0ea5a8;
  --bg1: #020c0f;
  --bg2: #0b1619;
  --card: #0d1a1d;
  --line: #1f2e31;
  --brand: #e6f6f6;
  --ink: #e6f6f6;
  --muted: #8aa1a6;
  --blue: #0ea5a8;
  --brand-2: #22d3ee;
  --orange: #0f766e;
  --shadow: 0 12px 30px rgba(1, 8, 10, 0.6);
}
[data-brand="glassflow"] body {
  font-family: 'Space Grotesk', Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial;
}
[data-brand="glassflow"] .auth-card {
  background: radial-gradient(circle at top right, rgba(34,211,238,.08), transparent 60%), var(--card);
  border: 1px solid rgba(34,211,238,.2);
}
[data-brand="glassflow"] .gf-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
[data-brand="glassflow"] .gf-logo-word {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
[data-brand="glassflow"] .gf-logo-tag {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

/* === TEMA CLARO ===
   Sustituye el bloque anterior [data-theme="dark"] por este.
   Aplica cuando <html data-theme="light"> */
[data-theme="light"] {
	/* Navbar + look general */
	--nav-bg: #f0f3f8;           /* Barra clara gris-azulada */
	--nav-active: #1E88E5;       /* Azul marca */
	--brand: #0B0F14;            /* Texto/brand oscuro */
	--bg1: #f7f9fb;              /* Fondo base gris claro */
	--bg2: #e9eef4;              /* Fondo sutil secciones/cards */
	--card: #ffffff;             /* Tarjetas claras pero no blancazo */
	--muted: #5c6c80;            /* Texto secundario */
	--ink: #111827;              /* Texto principal gris oscuro */
	--blue: #1E88E5;             /* Primario */
	--bar-track: #dce3ec;        /* Pista de barras */
	--chip: #e2e8f0;             /* Chips claros */
	--shadow: 0 8px 24px rgba(3, 10, 27, 0.08);
	--radius: 16px;

	/* Login / inputs */
	--line: #c9d4e0;             /* Bordes claros */
	--brand-2: #53B6FF;          /* Azul claro marca (acento) */
	--orange: #FF6A00;           /* Naranja marca */
}
/* Light theme overrides */
[data-theme="light"] .tabs {
  background: rgba(104, 96, 96, 0.23);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    color: var(--ink);
    font: 15px/1.5 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial;
    background: var(--bg1);
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }

/* ===== NAV SUPERIOR (post-login) ===== */
.nav {
	position: sticky; top: 0; z-index: 10;
	background: var(--nav-bg); color: var(--brand);
	padding: 14px 22px;
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
	display: none; align-items: center; gap: 18px;
}
input:focus,
select:focus,
textarea:focus {
outline: none !important;
box-shadow: none !important;
}
input, select, textarea {
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.hidden { display: none !important; }
.nav.show { display: flex; }
.logo { font-weight: 700; letter-spacing: 0.2px; font-size: 20px;}
.tabs {
	display: flex; gap: 8px;
	background: rgba(255,255,255,0.06);
	padding: 4px; border-radius: 25px;
}
.tab {
	color: var(--brand); padding: 8px 14px; border-radius: 18px;
	font-weight: 600; font-size: 14px;
}
.tab.active { background: var(--orange); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.12); }
.spacer { flex: 1; }
.user { font-size: 14px; opacity: .95; }
.nav .user button { color: var(--brand); }
.logout {
    margin-left: 10px; padding: 8px 12px; border-radius: 999px;
    background: transparent; color: var(--brand);
    border: 1px solid var(--line);
    font-weight: 600; cursor: pointer;
}
.logout:hover { filter: brightness(1.05); }

/* ===== WRAP + CARDS ===== */
.wrap { max-width: 1200px; margin: 26px auto; padding: 0 22px 40px; display: none; }
.wrap.show { display: block; }
.page-title { font-size: 34px; font-weight: 700; letter-spacing: -0.4px; margin: 10px 0 18px; }
.page.page-active .page-title {
  animation: title-fade .45s ease both;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-title-row .page-title {
  margin: 10px 0 18px;
}

.dashboard-filter {
  position: relative;
  flex: 0 0 auto;
}

.dashboard-range-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink) !important;
  border: none !important;
}

.dashboard-range-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.dashboard-range-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 280px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.dashboard-range-popover.hidden {
  display: none;
}

.dashboard-range-options {
  display: grid;
  gap: 8px;
}

.dashboard-range-option {
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--fg);
  cursor: pointer;
  transition: transform .15s, box-shadow .2s ease;
  font-weight: 700;
}

.dashboard-range-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0,0,0,.16);
}

.dashboard-range-option.is-selected {
  border-color: rgba(255, 106, 0, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 106, 0, 0.15);
}

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

.dashboard-range-custom {
  display: grid;
  gap: 10px;
}

.dashboard-range-custom-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
}

.dashboard-range-custom-row label {
  font-size: 12px;
  color: var(--muted);
}

.dashboard-range-date {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--fg);
  font-weight: 700;
}
.page.page-active .card {
  animation: card-rise .5s ease both;
}
.page.page-active .card:nth-child(2) { animation-delay: .05s; }
.page.page-active .card:nth-child(3) { animation-delay: .1s; }
.page.page-active .card:nth-child(4) { animation-delay: .15s; }
.page.page-active .card:nth-child(5) { animation-delay: .2s; }

@keyframes card-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes title-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 980px) {
	.grid-4 { grid-template-columns: repeat(2,1fr); }
	.grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
	.tabs { display: none; }
	.page-title { font-size: 28px; }
}
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card {
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0,0,0,.18);
}

/* ===== STATS ===== */
.stat .label { color: var(--muted); font-weight: 600; font-size: 14px; }
.stat .value { margin-top: 8px; font-size: 44px; font-weight: 700; letter-spacing: -1px; }

/* ===== BARRAS POR ETAPA ===== */
.section-title { font-weight: 700; font-size: 18px; margin: 4px 0 18px; }
.stages { display: grid; gap: 12px; }
.stage { display: grid; grid-template-columns: 1fr; gap: 12px; }

.bar {
	height: 36px;
	background: var(--bar-track);
	border-radius: 999px;
	position: relative; /* para posicionar fill/labels */
	overflow: hidden;
}
/* Relleno animado */
.bar .fill {
	position: absolute; inset: 0 auto 0 0;
	width: 0;
	background: var(--orange);
	border-radius: 999px;
	transition: width .8s cubic-bezier(.2,.8,.2,1);
}
/* Textos fijos a los extremos del track */
.bar .label, .bar .val {
	position: absolute; top: 50%; transform: translateY(-50%);
	z-index: 2;
	font-weight: 700; font-size: 13px; letter-spacing: .2px;
	color: var(--card);
	pointer-events: none;
}
.bar .label { left: 10px; }
.bar .val { right: 10px; }

.rowline {
	display: grid; grid-template-columns: 1fr auto;
	align-items: center; padding: 8px 0;
  transition: background .2s ease, border-color .2s ease;
}
.rowline + .rowline { border-top: 1px solid var(--line); }
.name { font-weight: 600; }
.qty { font-weight: 700; }

/* ===== FORM CONTROLS ===== */
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.row.labels-toolbar {
	display: flex;
	justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
	gap: 8px;
	margin-bottom: 22px;
}
.row.labels-toolbar .btn {
	font-size: 12px;
	padding: 6px 12px;
	border-radius: 999px;
	box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
}
@media (max-width: 900px){ .row { grid-template-columns: 1fr; } }
/* Signup fields stacked one above the other */
#signupBox .row { grid-template-columns: 1fr; }
input, select {
	width: 100%; padding: 12px 14px; border-radius: 14px;
	border: 1px solid var(--line); outline: none; background: var(--card); color: var(--ink);
}
input:focus, select:focus {
	border-color: var(--blue);
	box-shadow: 0 0 0 3px rgba(30,136,229,.22);
}
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  min-height: 90px;
  resize: vertical;
}
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30,136,229,.22);
}
/* Evitar fondo blanco del autocompletado/sugerencias en inputs */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0px 1000px var(--card) inset !important;
  -webkit-text-fill-color: var(--ink) !important;
  caret-color: var(--ink) !important;
}
.btn { cursor: pointer; font-weight: 700; border: none; border-radius: 12px; padding: 12px 14px; }
.btn {
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary { color: #ffffff; background: linear-gradient(135deg, #FF6A00, #FF8E3A); }
.btn-ghost {
	background: transparent;
	color: var(--brand-2);
	border: 1px solid rgba(83,182,255,.45);
}
[data-theme="dark"] .btn-ghost { background: var(--card); color: var(--brand); border-color: var(--line); }

/* Link-style text action */
.link { 
  background: transparent; border: none; padding: 0; 
  color: var(--brand-2); text-decoration: underline; cursor: pointer;
}
.link:hover { opacity: .9; }
[data-theme="dark"] .btn-ghost { background: var(--card); color: var(--brand); border-color: var(--line); }

/* Peligro */
.btn-danger { background: none; color: #ff6b6b; border: 1px solid #ff6b6b; }
.list { display: grid; gap: 10px; }
.item {
	display: grid; grid-template-columns: 180px 1fr 140px; gap: 8px; align-items: center;
	border: 1px solid transparent; border-radius: 12px; padding: 12px; background: var(--card); box-shadow: var(--shadow);
	transition: border-color .18s ease, transform .12s ease;
}
@media (max-width: 900px){ .item { grid-template-columns: 140px 1fr 110px; } }

/* Chip por etapa */
.stage-chip {
	display: inline-flex; gap: 8px; align-items: center;
	padding: 6px 10px; border-radius: 999px;
	background: rgba(83,182,255,.12); color: #53B6FF; border: 1px solid rgba(83,182,255,.5);
	justify-content: center;
}

/* Variantes de color por etapa (mantengo diversidad; adapto azules a la marca) */
.stage-chip.is-1 { background: rgba(83,182,255,.14); color: #53B6FF; border-color: rgba(83,182,255,.55); }
.stage-chip.is-2 { background: rgba(46,204,113,.12); color: #2ecc71; border-color: rgba(46,204,113,.45); }
.stage-chip.is-3 { background: rgba(255,171,64,.12); color: #FFAB40; border-color: rgba(255,171,64,.45); }
.stage-chip.is-4 { background: rgba(255,106,0,.12); color: #FF6A00; border-color: rgba(255,106,0,.45); }
.stage-chip.is-5 { background: rgba(30,136,229,.12); color: #1E88E5; border-color: rgba(30,136,229,.45); }
.stage-chip.is-6 { background: rgba(91,33,182,.14); color: #A78BFA; border-color: rgba(167,139,250,.45); }
.stage-chip.is-7 { background: rgba(14,116,144,.12); color: #0E7490; border-color: rgba(14,116,144,.45); }
.stage-chip.is-8 { background: rgba(107,114,128,.12); color: #6B7280; border-color: rgba(107,114,128,.45); }
.stage-chip.is-9 { background: rgba(202,138,4,.14); color: #CA8A04; border-color: rgba(202,138,4,.45); }
.stage-chip.is-10 { background: rgba(8,145,178,.12); color: #0891B2; border-color: rgba(8,145,178,.45); }
.stage-chip.is-11 { background: rgba(125,29,82,.12); color: #7D1D52; border-color: rgba(125,29,82,.45); }
.stage-chip.is-12 { background: rgba(34,197,94,.12); color: #22C55E; border-color: rgba(34,197,94,.45); }
.stage-chip.broken, .stage-chip.is-broken { background: rgba(220,38,38,.12); color: #dc2626; border-color: rgba(220,38,38,.45); }

/* ===== SEARCH UI ===== */
.search-header {
  position: sticky;
  top: 72px;
  z-index: 9;
  background: var(--bg1);
  padding: 6px 0 12px;
  margin: -6px 0 0;
}
.search-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
  background: linear-gradient(to bottom, rgba(15,23,42,0.06), rgba(15,23,42,0));
  pointer-events: none;
  border-radius: 62px;
}
[data-theme="dark"] .search-header::after {
  background: linear-gradient(to bottom, rgba(0,0,0,0.25), rgba(0,0,0,0));
}
.search-controls-card {
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

/* Make only results scroll (desktop) */
@media (min-width: 900px) {
  #page-search {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
  }
  .search-results-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 24px;
  }
}
.search-hero { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.searchbar { display: flex; flex-wrap: wrap; gap: 16px; flex: 1; align-items: center; }
.searchbar-primary { position: relative; flex: 1; min-width: 280px; }
.searchbar-primary input {
	width: 100%; padding: 14px 56px 14px 16px;
	border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.searchbar-primary button { position: absolute; right: 6px; top: 6px; padding: 10px 14px; border-radius: 999px; }
.search-mode { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.search-mode-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.search-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg2); border: 1px solid rgba(255,255,255,0.08); position: relative; }
[data-theme="light"] .search-toggle { border-color: rgba(15,23,42,0.08); background: rgba(15,23,42,0.06); }
.search-toggle-option { position: relative; border: none; background: transparent; color: var(--muted); padding: 6px 18px; border-radius: 999px; font-weight: 600; letter-spacing: .01em; cursor: pointer; transition: color .2s ease, background .2s ease, transform .2s ease; }
.search-toggle-option:hover { color: var(--ink); }
.search-toggle-option.is-active { color: var(--ink); background: rgba(255,106,0,.08); transform: translateY(-1px); }
.search-toggle-option.is-active::after { content: ''; position: absolute; inset: 2px; border-radius: 999px; border: 2px solid var(--orange); pointer-events: none; }
.search-toggle-option:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

#page-search.page-active .search-toggle-option { animation: toggle-pop .35s ease both; }
#page-search.page-active .search-toggle-option:nth-child(2) { animation-delay: .06s; }
#page-search.page-active .search-toggle-option:nth-child(3) { animation-delay: .12s; }

@keyframes toggle-pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.search-mode--top { justify-content: flex-end; width: 100%; margin-bottom: 16px; }
.search-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.search-footer button { border: 1px solid var(--orange);
    background: transparent;
    color: var(--orange);
    font-size: larger;
    border-radius: 25px !important;
    margin-left: 15px !important;}
#s-load-more {
	border: none;
	background: none;
	padding: 0;
	font-weight: 700;
	color: var(--brand-2);
	cursor: pointer;
	text-decoration: underline;
}
#s-load-more:disabled {
	opacity: .4;
	cursor: default;
 	text-decoration: none;
}


.filters { display: flex; gap: 12px; align-items: flex-start; }
.filter-secondary { display: flex; align-items: center; margin-top: 8px; margin-left: 0; padding: 0 6px; }
.filter-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stage-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Pending orders (Add Order) ===== */
#pending-orders-card .list { gap: 14px; }
#pending-orders-list .pending-order-item {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px 18px;
  border-color: rgba(148,163,184,.22);
  background: linear-gradient(180deg, rgba(255,255,255,.8), rgba(255,255,255,.65));
}
[data-theme="dark"] #pending-orders-list .pending-order-item {
  background: linear-gradient(180deg, rgba(15,23,42,.52), rgba(15,23,42,.4));
  border-color: rgba(148,163,184,.24);
}
#pending-orders-list .pending-order-meta { min-width: 0; }
#pending-orders-list .pending-order-meta > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#pending-orders-list .pending-order-meta strong {
  font-size: 16px;
  letter-spacing: -0.2px;
}
#pending-orders-list .pending-order-meta .hint { margin-top: 4px; }
#pending-orders-list .pending-order-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
#pending-orders-list .pending-order-actions .btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(255,106,0,.10);
}

.tl-switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; position: relative; }
.tl-switch input { position: absolute; opacity: 0; pointer-events: none; }
.tl-switch-track { position: relative; width: 46px; height: 26px; border-radius: 999px; background: var(--line); transition: background .2s ease; display: inline-block; flex-shrink: 0; }
.tl-switch-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #ffffff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .2s ease; }
[data-theme="dark"] .tl-switch-thumb { background: #0f172a; }
.tl-switch input:checked + .tl-switch-track { background: var(--orange); }
.tl-switch input:checked + .tl-switch-track .tl-switch-thumb { transform: translateX(20px); }
.tl-switch input:disabled + .tl-switch-track { opacity: .45; }
.tl-switch input:disabled ~ .tl-switch-label { opacity: .45; }
.tl-switch-label { font-weight: 600; font-size: 14px; }

.tl-switch--sm { gap: 10px; }
.tl-switch--sm .tl-switch-track { width: 36px; height: 20px; }
.tl-switch--sm .tl-switch-thumb { width: 16px; height: 16px; top: 2px; left: 2px; }
.tl-switch--sm input:checked + .tl-switch-track .tl-switch-thumb { transform: translateX(16px); }
.tl-switch--sm .tl-switch-label { font-size: 13px; font-weight: 500; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-left: 8px; letter-spacing: .02em; }
.status-badge-icon { font-size: 14px; }
.status-badge--office { background: rgba(34,197,94,.14); color: #16a34a; border: 1px solid rgba(34,197,94,.35); }
[data-theme="dark"] .status-badge--office { background: rgba(74,222,128,.12); color: #4ade80; border-color: rgba(74,222,128,.4); }
.status-badge--pending { background: rgba(59,130,246,.14); color: #2563eb; border: 1px solid rgba(59,130,246,.32); }
[data-theme="dark"] .status-badge--pending { background: rgba(59,130,246,.12); color: #93c5fd; border-color: rgba(59,130,246,.4); }
.status-badge--broken { background: rgba(220,38,38,.14); color: #dc2626; border: 1px solid rgba(220,38,38,.32); }
[data-theme="dark"] .status-badge--broken { background: rgba(248,113,113,.12); color: #f87171; border-color: rgba(248,113,113,.38); }
.status-badge--reprint { background: rgba(251,191,36,.18); color: #b45309; border: 1px solid rgba(251,191,36,.45); }
[data-theme="dark"] .status-badge--reprint { background: rgba(251,191,36,.12); color: #facc15; border-color: rgba(250,204,21,.4); }
.status-badge--urgent { background: rgba(239,68,68,.15); color: #b91c1c; border: 1px solid rgba(239,68,68,.4); }
[data-theme="dark"] .status-badge--urgent { background: rgba(248,113,113,.16); color: #fecaca; border-color: rgba(248,113,113,.45); }
.status-badge--finished { background: rgba(34,197,94,.18); color: #047857; border: 1px solid rgba(34,197,94,.42); font-weight: 700; letter-spacing: .02em; }
[data-theme="dark"] .status-badge--finished { background: rgba(22,163,74,.28); color: #bbf7d0; border-color: rgba(74,222,128,.5); }

.item--office {
  border-left: 3px solid rgba(34,197,94,.45);
  padding-left: 12px;
}
[data-theme="dark"] .item--office {
  border-left-color: rgba(74,222,128,.45);
}

/* ===== ORDER DETAIL ===== */
.order-detail-card { padding: 24px; }
.order-header { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
.order-header-left { flex: 1; min-width: 240px; display: grid; gap: 14px; }
.order-header-left label { font-size: 13px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 4px; }
.order-header-left input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.order-header-left input:focus { border-color: var(--brand-2); }
.order-header-right { flex: 1.2; min-width: 300px; display: grid; gap: 18px; }
.order-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.order-stat { background: rgba(83,182,255,.08); border: 1px solid rgba(83,182,255,.2); border-radius: 12px; padding: 12px; }
[data-theme="light"] .order-stat { background: rgba(30,136,229,.08); border-color: rgba(30,136,229,.18); }
.order-stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.order-stat-value { font-size: 22px; font-weight: 700; }
.order-status-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 28px; }
.order-stage-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.order-stage-chip { display: inline-flex; gap: 6px; align-items: center; padding: 8px 14px; border-radius: 999px; background: var(--chip); border: 1px solid rgba(148,163,184,.3); color: var(--ink); font-size: 13px; font-weight: 600; }
[data-theme="light"] .order-stage-chip { background: rgba(148,163,184,.14); border-color: rgba(148,163,184,.28); }
.order-stage-chip span { font-weight: 700; color: var(--brand-2); }
.order-alerts-card { max-width: 520px; }
.order-alerts-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.order-alert-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 44px 10px 14px; border-radius: 12px; background: var(--chip); border: 1px solid rgba(148,163,184,.28); position: relative; }
[data-theme="light"] .order-alert-row { background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.26); }
.order-alert-email { font-weight: 600; min-width: 180px; color: var(--ink); }
.order-alert-row .tl-switch { margin-left: 0; }
.order-alert-remove { position: absolute; top: 8px; right: 8px; margin-left: 0; color: #0b0f14; }
.order-alert-remove svg { width: 16px; height: 16px; }
.order-alerts-form { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.order-alerts-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.order-alerts-fields input[type="email"] { min-width: 220px; flex: 1 1 240px; }
.order-alerts-form .btn { align-self: flex-start; }
.order-office-toggle { display: flex; flex-direction: column; gap: 6px; }
.order-office-toggle .hint { margin-left: 0; }
.order-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-start; }
.order-actions .btn { min-width: 132px; }
.order-actions .btn.btn-danger { background: rgba(220,38,38,0.12); color: #dc2626; border: 1px solid rgba(220,38,38,0.36); }
.stage-rename-card .tl-modal-body { display: flex; flex-direction: column; gap: 14px; }
.stage-rename-card input { padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(148,163,184,.35); font-size: 15px; }
[data-theme="dark"] .stage-rename-card input { background: rgba(15,23,42,.45); border-color: rgba(148,163,184,.45); color: #e2e8f0; }
.stage-rename-card .tl-modal-footer { display: flex; gap: 12px; justify-content: flex-end; }
[data-theme="dark"] .stage-rename-card .tl-modal-body label { color: #e2e8f0; }
.admin-password-card .tl-modal-body { display: flex; flex-direction: column; gap: 12px; }
.admin-password-card input { padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(148,163,184,.35); font-size: 16px; }
[data-theme="dark"] .admin-password-card input { background: rgba(15,23,42,.45); border-color: rgba(148,163,184,.45); color: #e2e8f0; }
.admin-password-card .tl-modal-footer { display: flex; justify-content: flex-end; gap: 12px; }
.confirm-modal-card .tl-modal-body { font-size: 15px; color: var(--ink); }
[data-theme="dark"] .confirm-modal-card .tl-modal-body { color: #e2e8f0; }
.confirm-modal-card .tl-modal-footer { display: flex; justify-content: flex-end; gap: 12px; }
[data-theme="light"] .order-actions .btn.btn-danger { background: rgba(248,113,113,0.15); color: #b91c1c; border-color: rgba(248,113,113,0.4); }
.order-actions .btn.btn-danger:hover { background: rgba(220,38,38,0.2); }
.order-actions .btn.btn-danger:active { transform: translateY(1px); }
.order-detail-card .hint { font-size: 13px; color: var(--muted); }
#order-detail-msg[data-tone="error"] { color: #f87171; }
#order-detail-msg[data-tone="info"], #order-detail-msg:not([data-tone]) { color: var(--muted); }
.order-pieces-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.order-pieces-list .item { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .18s ease, transform .12s ease; }
.order-pieces-list .item:hover { border-color: var(--orange); transform: translateY(-1px); }
.order-piece-main { flex: 1; display: grid; gap: 6px; }
.order-piece-main strong { font-size: 16px; }
.order-piece-main .muted { font-size: 13px; color: var(--muted); }
.order-piece-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.order-piece-meta .status-badge { margin-left: 0; }
.order-pieces-list .item.item--needs-reprint { border-left: 4px solid #f59e0b; padding-left: 12px; }
.order-pieces-list--select .item { cursor: default; border-color: rgba(83,182,255,0.5); }
.order-pieces-list--select .item:hover { transform: none; border-color: rgba(83,182,255,0.8); }
.order-pieces-list .item.is-selected { border-color: var(--orange); box-shadow: 0 0 0 1px rgba(255,106,0,0.35); background: rgba(255,106,0,0.06); }
[data-theme="light"] .order-pieces-list .item.is-selected { background: rgba(255,106,0,0.12); }
.order-piece-check { display: flex; align-items: center; justify-content: center; padding-right: 4px; }
.order-piece-select { width: 18px; height: 18px; cursor: pointer; accent-color: var(--orange); }
.order-piece-select:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.order-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.order-meta .muted { font-size: 13px; color: var(--muted); }
.order-piece-stage { flex-shrink: 0; }
.order-piece-dates { font-size: 12px; color: var(--muted); }
.order-pieces-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.order-pieces-header .tl-switch-label { font-size: 13px; font-weight: 600; }
.search-order { display: flex; gap: 18px; justify-content: space-between; align-items: flex-start; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: border-color .18s ease, transform .12s ease; }
.search-order:hover { border-color: var(--orange); transform: translateY(-1px); }
.search-order-main { display: grid; gap: 6px; }
.search-order-main strong { font-size: 18px; }
.search-order-right { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; min-width: 220px; }
.order-stat-small { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--muted); }
.order-stat-small strong { font-size: 22px; color: var(--ink); }

/* ===== MODAL ===== */
.tl-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 120; }
.tl-modal:not(.hidden) { display: flex; }
.tl-modal-overlay { position: absolute; inset: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(2px); }
.tl-modal-card { position: relative; z-index: 1; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); width: min(480px, 92vw); max-height: 90vh; display: flex; flex-direction: column; }
.tl-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.tl-modal-title { font-size: 18px; font-weight: 700; }
.tl-modal-close { border: none; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.tl-modal-body { padding: 0 20px 20px; display: grid; gap: 16px; }
.tl-modal-footer { padding: 1px 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }

.pending-order-card .form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pending-order-card label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

[data-theme="dark"] .pending-order-card label { color: #e2e8f0; }

.pending-order-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.pending-order-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30,136,229,.22);
  outline: none;
}
.order-preview-card { border: 1px dashed rgba(83,182,255,.4); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: rgba(83,182,255,.08); }
[data-theme="light"] .order-preview-card { background: rgba(83,182,255,.12); border-color: rgba(83,182,255,.4); }
.order-preview-card .label-card { background: #fff; box-shadow: 0 12px 40px rgba(8, 15, 36, 0.16); border-radius: 18px; padding: 12px; }
.order-preview-card .label-header-img { border-bottom: 1px solid rgba(148,163,184,.35); padding-bottom: 12px; margin-bottom: 12px; }
.order-preview-card .label-header-img img { width: 100%; height: auto; display: block; border-radius: 10px; }
.order-preview-card .label-header-placeholder { display: flex; align-items: center; justify-content: center; padding: 32px; font-weight: 700; font-size: 20px; color: var(--muted); background: rgba(226,232,240,.6); border-radius: 12px; }
.order-preview-card .label-body--reserved { display: flex; align-items: center; justify-content: center; border-radius: 12px; transition: box-shadow .2s ease, transform .2s ease; }
.order-preview-card .label-body--reserved img { border-radius: 12px; object-fit: cover; }
.order-preview-hint { font-size: 13px; color: var(--muted); text-align: center; max-width: 320px; }
.chip {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 25px;
    background: none;
    color: var(--brand-2);
    cursor: pointer;
    margin-right: 7px;
    font: inherit;
    line-height: 1;
    white-space: nowrap;
    transition: all .15s ease;
    border: 2px solid var(--brand-2);
}
.chip:hover {
	background: rgba(83,182,255,.12);
	border-color: rgba(83,182,255,.8);
}
.chip:focus-visible { outline: 2px solid rgba(37,99,235,0.45); outline-offset: 2px; }
.chip.active {
    background: var(--orange);
    color: var(--bg1);
    border-color: var(--orange);
}
.dot { display:inline-block; width:8px; height:8px; border-radius:999px; background:#dc2626; margin-left:6px; vertical-align:middle; }

/* ===== LOGIN (look oscuro) ===== */
.app-wrap { min-height: 100%; display: grid; place-items: center; padding: 32px; }
.auth-card {
  width: min(580px, 96vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,.4);
  backdrop-filter: blur(6px);
  display: grid;
  overflow: hidden;
  height: auto;
}
@media (max-width: 980px){ .auth-card { grid-template-columns: 1fr; } }
.auth-visual {
	position: relative; padding: 32px; color: #fff;
	background: var(--nav-bg);
	border-radius: 0 120px 120px 0; overflow: hidden; isolation: isolate;
}
.logo {
	justify-content: center;
	display: flex; align-items: center; gap: 12px;
	font-weight: 800; letter-spacing: .2px; font-size: 28px;
}
.logo-img { width: 224px; height: 224px; border-radius: 8px; object-fit: contain; display: block; }
.visual-title { font-size: 30px; font-weight: 800; margin: 24px 0 6px; }
.visual-sub { opacity: .92; max-width: 40ch; }
.visual-chip {
	display: inline-flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 999px;
	background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); font-size: 12px; backdrop-filter: blur(6px);
}
.blob, .blob2, .ring { position: absolute; pointer-events: none; filter: blur(30px); opacity: .55; z-index: -1; }
.blob {
	width: 360px; height: 360px; right: -90px; top: -60px;
	background: radial-gradient(closest-side, rgba(231,240,248,.85), rgba(231,240,248,0));
}
.blob2 {
	width: 420px; height: 420px; left: -120px; bottom: -120px;
	background: radial-gradient(closest-side, rgba(83,182,255,.9), rgba(83,182,255,0));
	filter: blur(40px); opacity: .35;
}
.ring {
	width: 520px; height: 520px; right: -160px; bottom: -180px; border-radius: 50%;
	background:
		radial-gradient(closest-side, rgba(231,240,248,.28), transparent 60%),
		radial-gradient(closest-side, rgba(83,182,255,.6), transparent 70%);
	mix-blend-mode: screen; opacity: .35; filter: blur(18px);
}
.auth-form {
	padding: 26px;
	background: var(--card);
}
.form-box { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-top: -20px; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.hint { font-size: 13px; color: var(--muted); margin-top: 5px;}
.hint[data-tone="error"] { color: #dc2626; }
.input-ico {
  position: relative;
  border: 1px solid #424242;
  border-radius: 15px;
  display: flex;
  padding: 3px;
}
.input-ico svg {
  position: relative;
  width: 18px;
  height: 18px;
  opacity: .7;
}
.input-ico input {
  padding-left: 20px;
  border: none;
  width: 300px;
  color: var(--orange);
}
.input-with-actions { position: relative; }

/* Email suggestions dropdown */
.email-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 10px);
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  max-height: 220px;
  display: none;
}

.email-suggestions__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.email-suggestions__item + .email-suggestions__item {
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.email-suggestions__item:hover,
.email-suggestions__item:focus {
  background: rgba(59, 130, 246, 0.14);
  color: var(--ink);
  outline: none;
}

.email-suggestions__icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--brand-2);
  background: rgba(37, 99, 235, 0.15);
}

.email-suggestions__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.email-suggestions__local {
  font-weight: 600;
  color: var(--ink);
}

.email-suggestions__domain {
  font-size: 12px;
  color: var(--muted);
}
.input-actions { position: relative; display: flex; gap: 6px; }
.btn-icon { padding: 6px; min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
#order-rename-btn { width: 28px; height: 28px; min-width: 28px; padding: 3px; color: #111; border: none; background: transparent; box-shadow: none; }
#order-rename-btn svg { width: 16px; height: 16px; }
#order-rename-btn:focus,
#order-rename-btn:focus-visible { outline: none; box-shadow: none; }
.opkey-box { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 15px; padding: 3px; }
.opkey-input { width: 300px; border: none; background: transparent; outline: none; color: inherit; }
.opkey-row { align-items: stretch; gap: 18px; flex-wrap: wrap; }
.opkey-field { flex: 1; min-width: 260px; }
.opkey-qr-wrap { min-width: 130px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; justify-content: center; }
.qr-box { width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(226,232,240,.9); border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px rgba(15,23,42,.04); }
.qr-box canvas { width: 100%; height: 100%; }
.qr-box.qr-box--empty::after { content: 'No key yet'; color: var(--muted); font-size: 12px; text-align: center; padding: 0 6px; }
.qr-hint { font-size: 12px; color: var(--muted); text-align: center; }
.fit-content { width: fit-content; }
.span-all { grid-column: 1 / -1; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

/* ===== ETIQUETAS: vista previa ===== */
.label-wrap { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }

/* --- Ajuste: layout de la etiqueta con QR a la derecha --- */

/* Por defecto 3x4; se parametriza con modificadores */
.label-card {
	width: 3in; height: 4in;
	background: #ffffff; border: 1px solid #d1d5db; border-radius: 8px;
	padding: 8px 10px;
	display: grid;
	grid-template-columns: 1fr; /* encabezado img ocupa todo el ancho */
	grid-template-rows: auto 1fr;
	gap: 6px;
	box-shadow: 0 2px 8px rgba(0,0,0,.16);
}
.label-card--3x4 { width: 3in; height: 4in; }
.label-card--4x6 { width: 4in; height: 6in; }
.label-header {
	grid-column: 1 / -1;
	display: flex; justify-content: space-between; align-items: center;
}
.label-title { font-weight: 800; font-size: 12px; letter-spacing: .5px; color: #0b1220; }
.label-chip {
	font-size: 10px; background: rgba(30,136,229,.12); color: #1E88E5; border: 1px solid rgba(30,136,229,.35);
	border-radius: 999px; padding: 2px 6px; font-weight: 700;
}
.label-body { grid-column: 1 / 2; margin-top: 0; }
.label-order { font-size: 21px; font-weight: 800; letter-spacing: .2px; color: #0b1220; }
.label-client { font-size: 12px; color: #334155; }

.label-bar {
	grid-column: 2 / 3;
	margin-top: 0;
	overflow: visible;
	display: flex; align-items: center; justify-content: flex-end; /* QR a la derecha */
}

/* Grid de etiquetas por pieza */
.labels-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.labels-grid.is-3x4 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.labels-grid.is-4x6 { grid-template-columns: repeat(auto-fill, minmax(370px, 1fr)); }
/* Alinear items al inicio y forzar ancho consistente de cada etiqueta + acciones */
.labels-grid { justify-items: start; }
.label-item { width: 3in; }
.label-item--3x4 { width: 3in; }
.label-item--4x6 { width: 4in; }
.label-actions .btn { width: 100%; }
.label-item--select { position: relative; }
.label-select-check { display: none; }
.label-item--select .label-card {
  cursor: pointer;
  border-color: rgba(83, 182, 255, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.label-item--select:hover .label-card {
  border-color: rgba(83, 182, 255, 0.8);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
}
.label-item.is-selected { transform: translateY(-2px); }
.label-item.is-selected .label-card {
  border: 2px solid var(--orange);
  box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.32), 0 12px 26px rgba(0, 0, 0, 0.55);
  background: transparent;
}
[data-theme="light"] .label-item--select .label-card {
  box-shadow: 0 6px 18px rgba(3, 10, 27, 0.08);
}
[data-theme="light"] .label-item.is-selected { transform: translateY(-2px); }
[data-theme="light"] .label-item.is-selected .label-card {
  background: transparent;
  box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.34), 0 14px 30px rgba(3, 10, 27, 0.16);
}

#order-add-piece-preview {
  max-height: 420px;
  overflow: auto;
  padding: 12px 4px;
}

.label-preview-compact {
  display: inline-block;
  transform: scale(0.65);
  transform-origin: center;
}

.label-preview-compact .label-card {
  transform: none;
}

/* ===== IMPRESIÓN selectiva ===== */
@media print {
	body * { visibility: hidden !important; }
	#labelCard, #labelCard * { visibility: visible !important; }
	#labelCard { position: absolute; left: 0; top: 0; box-shadow: none; border: 0; }
	@page { size: auto; margin: 6mm; }
}

/* En impresión: grilla a columnas del ancho real de la tarjeta + QR un pelín menor */
@media print {
	.labels-grid {
		display: grid;
		grid-template-columns: repeat(auto-fill, 53mm);
		gap: 6mm;
	}
	.qr-here, .qr-box { width: .75in; height: .75in; }
	.label-bar { padding: 2mm; }
	.label-card .label-header-img,
	.label-card .label-body { display: none !important; }
	.label-card--3x4 .full-label { display: block !important; width: 3in; height: 4in; }
	.label-card--4x6 .full-label { display: block !important; width: 4in; height: 6in; }
}

/* Gestor de etapas */
.mgr-note { color: var(--muted); }
.mgr-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.mgr-form input { max-width: 360px; }
.mgr-list { display: grid; gap: 8px; margin-top: 10px; }
.mgr-item {
	display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
	padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.mgr-name { font-weight: 700; }
.mgr-actions { display: flex; gap: 6px; }
.icon-btn {
	cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink);
	border-radius: 10px; padding: 6px 8px; font-weight: 700;
}
.icon-btn:hover { border-color: #2a394c; }
.pill {
	display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 999px;
	background: none; color: var(--orange); border: 1px solid var(--orange); font-weight: 700;
}

/* === Utilidades extra (sustituyen estilos inline) === */
.flow-root { display: flow-root; }
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-18 { margin-top: 18px; }
.align-end { display: flex; align-items: flex-end; }
.pass-toggle { position: absolute; right: 6px; top: 29px; width: auto; padding: 6px 10px; }

/* Botón ancho completo */
.btn-block { width: 100%; }

/* Ajuste QR preview: tamaño físico y adaptación canvas/img */
.qr-here { width: .75in; height: .75in; }
.qr-here canvas, .qr-here img { width: 100%; height: 100%; display: block; }

/* Espaciados adicionales usados en HTML */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }

/* Utilidades de layout para reemplazar inline styles */
.flex { display: flex; }
.items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }
.grid { display: grid; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-4 > * { min-width: 0; }
@media (max-width: 1200px){ .cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 780px){ .cols-4 { grid-template-columns: 1fr; } }
@media (max-width: 1100px){ .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 780px){ .cols-3 { grid-template-columns: 1fr; } }

/* Columna derecha en pieza: acciones al final */
.piece-side { display: flex; flex-direction: column; min-height: 100%; }
.piece-actions { margin-top: auto; align-self: stretch; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.vstack { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

/* Diseño en Detalle de pieza */
#piece-design img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.28); }

/* ===== PIECE DETAIL (revamp) ===== */
.piece-detail-card {
  padding: 22px;
}
.piece-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.22);
  background: none;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}
[data-theme="dark"] .piece-hero {
  border-color: rgba(148,163,184,.26);
  background:
    radial-gradient(900px 280px at 15% 15%, rgba(30,136,229,.22), transparent 55%),
    radial-gradient(700px 320px at 90% 30%, rgba(255,106,0,.18), transparent 55%),
    linear-gradient(135deg, rgba(30,136,229,.1), rgba(255,106,0,.08));
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.piece-hero-eyebrow {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.piece-hero-code {
  margin-top: 4px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.6px;
  color: var(--ink);
  line-height: 1.1;
}
.piece-hero-chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.piece-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(6px);
  min-width: 0;
}
[data-theme="dark"] .piece-chip {
  background: rgba(15, 23, 42, 0.35);
}
.piece-chip-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.piece-chip-value {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.piece-hero-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.piece-status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.piece-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.piece-status-chip--info {
  background: rgba(30,136,229,.14);
  color: #1E88E5;
  border-color: rgba(30,136,229,.28);
}
.piece-status-chip--success {
  background: rgba(34,197,94,.14);
  color: #16a34a;
  border-color: rgba(34,197,94,.28);
}
.piece-status-chip--warn {
  background: rgba(245,158,11,.16);
  color: #b45309;
  border-color: rgba(245,158,11,.32);
}
.piece-status-chip--neutral {
  background: rgba(148,163,184,.18);
  color: var(--ink);
  border-color: rgba(148,163,184,.26);
}
.piece-status-meta {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(255,255,255,.62);
  backdrop-filter: blur(8px);
}
[data-theme="dark"] .piece-status-meta { background: rgba(15, 23, 42, 0.35); }
.piece-status-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.piece-status-k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.piece-status-v { font-size: 13px; color: var(--ink); font-weight: 700; min-width: 0; line-height: 1.25; }

.piece-body {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.35fr) minmax(240px, 0.85fr);
  gap: 16px;
  align-items: start;
}
.piece-pane { min-width: 0; }
.piece-pane-card {
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.22);
  background: var(--card);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  padding: 16px;
  transition: transform .16s ease, box-shadow .22s ease, border-color .22s ease;
}
[data-theme="dark"] .piece-pane-card { box-shadow: 0 14px 30px rgba(0,0,0,.22); }
.piece-pane-card:hover {
  transform: translateY(-1px);
  border-color: rgba(30,136,229,.26);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}
[data-theme="dark"] .piece-pane-card:hover {
  border-color: rgba(30,136,229,.32);
  box-shadow: 0 18px 40px rgba(0,0,0,.3);
}
.piece-pane-title {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 12px;
}
.piece-pane--left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.piece-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: none;
}
#piece-qr canvas,
#piece-qr img {
  width: 140px !important;
  height: 140px !important;
}
.piece-design-card {
  padding-bottom: 18px;
}
.piece-design {
  min-height: 320px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.22);
  background:none;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 14px;
}
.piece-design img {
  width: auto;
  height: auto;
  max-height: 520px;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}
.piece-design .muted {
  text-align: center;
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(148,163,184,.35);
  background: rgba(255,255,255,.55);
}
[data-theme="dark"] .piece-design img { background: rgba(15,23,42,.85); }
.piece-actions-card {
  position: sticky;
  top: 90px;
  background:
    radial-gradient(520px 240px at 70% 10%, rgba(255,106,0,.08), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.7), rgba(255,255,255,.5));
  backdrop-filter: blur(10px);
}
.piece-actions-card .btn {
  border-radius: 14px;
}
.piece-actions-card .btn.btn-ghost {
  border-color: rgba(30,136,229,.28);
  background: rgba(30,136,229,.06);
}
[data-theme="dark"] .piece-actions-card {
  background:
    radial-gradient(520px 240px at 70% 10%, rgba(255,106,0,.10), transparent 60%),
    linear-gradient(180deg, rgba(15,23,42,.55), rgba(15,23,42,.4));
}
[data-theme="dark"] .piece-actions-card .btn.btn-ghost { background: rgba(30,136,229,.10); }
.piece-actions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.piece-actions-group--primary .btn {
  height: 44px;
  font-weight: 800;
}
.piece-actions-group--secondary { margin-top: 12px; }
.piece-actions-divider {
  height: 1px;
  background: rgba(148,163,184,.22);
  margin: 14px 0;
}
.piece-actions-group--danger .btn { height: 44px; }

@media (max-width: 1100px) {
  .piece-hero { grid-template-columns: 1fr; }
  .piece-body { grid-template-columns: 1fr 1fr; }
  .piece-pane--right { grid-column: 1 / -1; }
  .piece-actions-card { position: static; }
}
@media (max-width: 780px) {
  .piece-body { grid-template-columns: 1fr; }
  .piece-status-row { grid-template-columns: 1fr; }
  #piece-qr canvas, #piece-qr img { width: 120px !important; height: 120px !important; }
  .piece-design { min-height: 260px; }
}

/* Header de etiqueta como imagen (mismo layout que PNG) */
.label-card--3x4 .label-header-img { min-height: calc(4in - 2.5in - 16px - 6px); }
.label-card--4x6 .label-header-img { min-height: calc(6in - 4.5in - 16px - 6px); }
.label-header-img img { width: 100%; height: 100%; display: block; object-fit: contain; }
.label-card--3x4 .label-body--reserved { min-height: 2.5in; }
.label-card--4x6 .label-body--reserved { min-height: 4.5in; }
.label-card--3x4 .label-body--reserved img { width: 2.5in; height: 2.5in; }
.label-card--4x6 .label-body--reserved img { width: 3.5in; height: 4in; }
.label-body--reserved { position: relative; cursor: pointer; text-align: center;}
.label-body--reserved::after {
  content: 'Edit design'; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  background: rgba(11,15,20,.72); color: #fff; font-weight: 700; font-size: 12px;
  padding: 4px 8px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.label-body--reserved:hover::after { opacity: 1; }

/* Botón de impresión dentro de la tarjeta */
.label-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.label-footer { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.label-footer label { font-weight: 600; font-size: 13px; color: var(--ink); }
[data-theme="dark"] .label-footer label { color: #e2e8f0; }
.label-footer select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.label-footer select.label-final-stage--error { border-color: #f87171; box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.4); }
.label-final-stage { width: 100%; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
.label-final-stage:disabled { opacity: 0.65; cursor: not-allowed; }
.labels-grid > .btn { display: none; }

.order-number-row { display: flex; align-items: center; gap: 8px; }
.btn-sm { padding: 14px 12px; font-size: 13px; line-height: 1.1; }
.hint.error { color: #f87171; }
.order-rename-danger { color: #ef4444; font-weight: 700; text-transform: uppercase; font-size: 13px; }
.piece-reprint { margin-top: 12px; padding: 12px; border-radius: 10px; border: 1px solid #f59e0b; background: #fef3c7; color: #92400e; font-weight: 600; font-size: 14px; }
.piece-reprint-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.piece-reprint-buttons .btn { flex: 0 0 auto; }
.reprint-alert-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(1px); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 24px; }
[data-theme="dark"] .reprint-alert-overlay { background: rgba(15, 23, 42, 0.7); }
.reprint-alert { background: var(--card, #fff); border-radius: 16px; box-shadow: 0 12px 35px rgba(15, 23, 42, 0.25); max-width: min(420px, 92vw); width: 100%; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; font-size: 15px; color: var(--ink, #0f172a); }
[data-theme="dark"] .reprint-alert { background: #0f172a; color: #e2e8f0; box-shadow: 0 18px 45px rgba(2, 6, 23, 0.55); }
.reprint-alert h3 { margin: 0; font-size: 20px; font-weight: 700; }
.reprint-alert-body { margin: 0; }
.reprint-alert-hint { margin: 0; font-size: 13px; color: var(--muted, #64748b); }
[data-theme="dark"] .reprint-alert-hint { color: rgba(148, 163, 184, 0.9); }
.reprint-alert-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 0; padding: 0; }
.reprint-alert-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35); }
[data-theme="dark"] .reprint-alert-item { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); }
.reprint-alert-item code { font-weight: 600; font-size: 14px; color: #b45309; }
[data-theme="dark"] .reprint-alert-item code { color: #facc15; }
.reprint-alert-item .btn { flex: 0 0 auto; }
.team-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.team-table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid rgba(148,163,184,.24); border-radius: 16px; background: rgba(148,163,184,.06); }
[data-theme="dark"] .team-table-wrap { border-color: rgba(148,163,184,.32); background: rgba(15,23,42,.35); }
.team-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 520px; }
.team-table thead tr { background: rgba(148,163,184,.16); }
[data-theme="dark"] .team-table thead tr { background: rgba(148,163,184,.22); }
.team-table th, .team-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(148,163,184,.2); }
.team-table th { font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.team-table td { font-size: 14px; color: var(--ink); }
[data-theme="dark"] .team-table td { color: var(--ink); }
.team-table td .muted { color: var(--muted); font-size: 13px; }
.team-table tbody tr:hover { background: rgba(148,163,184,.12); transition: background .15s ease; }
[data-theme="dark"] .team-table tbody tr:hover { background: rgba(148,163,184,.18); }
.team-user { display: flex; flex-direction: column; gap: 4px; }
.team-user-name { font-weight: 700; font-size: 15px; color: var(--ink); }
[data-theme="dark"] .team-user-name { color: #e2e8f0; }
.team-user-username { font-size: 13px; color: var(--muted); }
.team-user-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: rgba(59,130,246,.15); color: #1d4ed8; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; width: fit-content; }
[data-theme="dark"] .team-user-pill { background: rgba(59,130,246,.22); color: #bfdbfe; }
.team-table .team-role { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(59,130,246,.12); color: #1d4ed8; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
[data-theme="dark"] .team-table .team-role { background: rgba(59,130,246,.18); color: #93c5fd; }
.team-table .team-role[data-role="admin"] { background: rgba(34,197,94,.18); color: #0f5132; }
[data-theme="dark"] .team-table .team-role[data-role="admin"] { background: rgba(34,197,94,.22); color: #86efac; }
.team-table .team-role[data-role="user"] { background: rgba(148,163,184,.16); color: #475569; }
[data-theme="dark"] .team-table .team-role[data-role="user"] { background: rgba(148,163,184,.22); color: #cbd5f5; }
.team-table .team-status { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.team-table .team-status--inactive { color: #dc2626; }
.team-table .team-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.team-table .team-actions .btn { padding: 0; font-size: 12px; border-radius: 8px; }
.team-table .team-actions .btn.btn-ghost { color: var(--muted); }
.team-action-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.team-action-btn svg { width: 16px; height: 16px; }
.team-dialog-card { min-width: min(420px, 92vw); }
.team-dialog-body { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.team-dialog-body .form-field { display: flex; flex-direction: column; gap: 6px; }
.team-dialog-body label { font-weight: 600; font-size: 14px; color: var(--ink); }
[data-theme="dark"] .team-dialog-body label { color: #e2e8f0; }
.team-active-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); cursor: pointer; }
.team-active-toggle input { width: 16px; height: 16px; }
[data-theme="dark"] .team-active-toggle { color: #e2e8f0; }
.team-table .self-row { opacity: .75; }
.team-row-inactive { opacity: .55; }
.team-table tr:last-child td { border-bottom: none; }
.team-ops-card { margin-top: 20px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 18px 45px rgba(0,0,0,.18); }
[data-theme="light"] .team-ops-card { background: #fff; box-shadow: 0 16px 30px rgba(15,23,42,.08); }
.team-ops-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.team-ops-total { padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.08); font-weight: 800; letter-spacing: .06em; font-size: 12px; text-transform: uppercase; color: var(--ink); }
.team-ops-list { display: flex; flex-direction: column; gap: 10px; }
.team-ops-row { display: grid; grid-template-columns: 1.3fr 2fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
[data-theme="light"] .team-ops-row { background: rgba(14,116,255,.06); border-color: rgba(14,116,255,.16); }
.team-ops-user { display: flex; align-items: center; gap: 10px; }
.team-ops-avatar { width: 42px; height: 42px; border-radius: 12px; background: rgba(83,182,255,.18); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; letter-spacing: .04em; color: var(--brand); }
.team-ops-name { font-weight: 700; }
.team-ops-ops { font-size: 12px; color: var(--muted); }
.team-ops-meter { position: relative; width: 100%; height: 10px; border-radius: 999px; background: var(--bar-track); overflow: hidden; }
.team-ops-meter-fill { position: absolute; inset: 0; background: linear-gradient(90deg, #FF6A00, #FF8E3A); border-radius: 999px; }
.team-ops-percent { font-weight: 700; font-size: 14px; color: var(--muted); text-align: right; }
.team-ops-empty { margin-top: 8px; color: var(--muted); }
@media (max-width: 720px) {
  .team-ops-row { grid-template-columns: 1fr; }
  .team-ops-percent { text-align: left; }
}

/* Dialog de confirmación (migrado desde <style> inline) */
.tl-dialog { border: none; padding: 0; background: transparent; }
.tl-dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.tl-card { min-width: 320px; max-width: 460px; padding: 16px 16px 12px; }
.tl-dialog .tl-card, .dialog-card { color: var(--ink); }

/* QR en vista (no impresión) */
.qr-here img { width: .75in; height: .75in; }

/* Botón de acción destructiva (reemplaza inline) */
.btn-danger { background: none; color: var(--orange); border: 1px solid var(--orange); }

/* Ajustes overflow dialog */
.dialog-card { max-width: min(96vw, 560px); overflow: hidden; }
.dialog-body { max-height: 60vh; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.dialog .list { overflow-x: hidden; }

/* ====== Dialog de Alertas (mejorado) ====== */
.dialog { border: none; padding: 0; background: transparent; }
.dialog { max-width: 100vw; width: min(96vw, 600px); margin: 0 auto; overflow-x: hidden; word-break: break-word; }
.dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.dialog-card {
	min-width: 0; width: 100%; max-width: 100%; background: var(--card); border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0,0,0,.45);
	padding: 18px 18px 14px; border: 1px solid var(--line); margin-top: 40%;
}
.dialog-title { font-size: 20px; font-weight: 800; letter-spacing: .2px; margin: 4px 2px 10px; color: var(--brand); }
.dialog-body { display: grid; gap: 12px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* lista de etapas dentro del dialog */
.dialog .list { display: grid; gap: 8px; }
.dialog .item {
	display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px;
	border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card);
	transition: border-color .2s, background .2s;
}
.dialog .item input[type="checkbox"] { width: 18px; height: 18px; }
.dialog .item span { font-weight: 600; color: var(--brand); }
.dialog .item:hover { border-color: #2a394c; }
.dialog .item.is-checked { border-color: rgba(30,136,229,.55); background: rgba(30,136,229,.10); }

/* resumen compacto de alertas en detalle de pieza */
.alerts-compact { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.alerts-compact { display: grid; gap: 6px; }
.alerts-compact .pill { padding: 4px 8px; font-size: 12px; margin-right: 5px;}
.alert-line { display: flow-root; grid-template-columns: 120px 1fr; gap: 8px; align-items: center; }

/* inputs del dialog */
.dialog .input { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--brand); background: var(--card); }
.dialog .input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,136,229,.22); outline: none; }

/* cabecera de método */
.dialog .hint { color: var(--muted); }

/* selector segmentado (popup/email) */
.seg { display: inline-flex; background: #1b2430; padding: 4px; border-radius: 999px; gap: 4px; border: 1px solid var(--line); width: fit-content; }
.seg-opt { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; color: #cbd5e1; user-select: none; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt.active { background: var(--blue); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }

/* toggles (multiselección) */
.tog { display: inline-flex; flex-wrap: wrap; background: #1b2430; padding: 4px; border-radius: 999px; gap: 4px; border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.tog-opt { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; color: #cbd5e1; user-select: none; }
.tog-opt input { position: absolute; opacity: 0; pointer-events: none; }
.tog-opt.active { background: var(--blue); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }

.session-expired {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(11, 16, 32, 0.78);
  backdrop-filter: blur(6px);
  z-index: 4000;
}
.session-expired.show {
  display: flex;
}
.session-card {
  background: #ffffff;
  color: #0b1020;
  width: min(420px, 100%);
  padding: 32px 28px;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.session-card h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.session-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}
.session-card .session-detail {
  color: #94a3b8;
  font-size: 13px;
}
.session-card .session-icon {
  font-size: 32px;
}
.session-card .btn {
  align-self: center;
  min-width: 180px;
}

.search-chip {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--chip);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--ink);
}
.search-chip button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.autocomplete-list {
  margin-top: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.autocomplete-list.hidden {
  display: none;
}
.autocomplete-list button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  cursor: pointer;
}
.autocomplete-list button:hover {
  background: rgba(255,255,255,0.05);
}

.client-page-actions { display: flex; align-items: center; gap: 10px; }
.client-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
  grid-template-areas:
    "top top"
    "summary access"
    "orders alerts";
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .client-detail-card {
  border-color: var(--line);
  background: var(--card);
}
.client-detail-top {
  grid-area: top;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(83,182,255,.35);
  position: relative;
  z-index: 1;
}
.client-detail-top { align-items: center; }
.client-detail-title { justify-content: center; }
.client-detail-actions { align-items: center; }
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
.client-chip {
  height: 32px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(83,182,255,.12);
  color: var(--brand);
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 10px;
  border: 1px solid rgba(83,182,255,.35);
}
.client-detail-title { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.client-detail-title input {
  height: 44px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 16px;
  background: var(--bg2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
[data-theme="light"] .client-detail-title input { background: var(--card); }
.client-detail-title input::placeholder { color: var(--muted); }
.client-detail-meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.client-detail-meta strong { color: var(--ink); font-size: 15px; }
.client-detail-actions { display: flex; gap: 8px; align-items: center; position: relative; z-index: 1; }
.client-detail-actions .btn {
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.client-summary {
  grid-area: summary;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  position: relative;
  z-index: 1;
}
.client-summary-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .client-summary-card {
  background: var(--card);
  box-shadow: var(--shadow);
}
.client-summary-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.client-summary-value { font-size: 32px; font-weight: 800; letter-spacing: -0.6px; margin-top: 4px; }
.client-summary-hint { font-size: 12px; color: var(--muted); }
.client-orders { grid-area: orders; display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; }
.client-orders-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.client-order-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--card);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .2s ease, box-shadow .2s ease;
  font: inherit;
}
[data-theme="light"] .client-order-card { background: var(--card); }
.client-order-card:hover { transform: translateY(-2px); border-color: rgba(30,136,229,.7); box-shadow: 0 12px 30px rgba(0,0,0,.22); }
.client-order-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.client-order-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.client-order-number { font-size: 18px; font-weight: 800; letter-spacing: -0.2px; }
.client-order-po { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.client-order-status {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(83,182,255,.15);
  color: var(--brand);
  border: 1px solid rgba(83,182,255,.5);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.client-order-status.is-finished { background: rgba(34,197,94,.14); color: #16a34a; border-color: rgba(34,197,94,.4); }
.client-order-status.is-office { background: rgba(14,165,233,.14); color: #0ea5e9; border-color: rgba(14,165,233,.45); }
.client-order-status.is-broken { background: rgba(248,113,113,.14); color: #ef4444; border-color: rgba(248,113,113,.4); }
.client-order-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; align-items: center; }
.client-order-stages { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.client-stage-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: rgba(15,23,42,.4); border: 1px solid var(--line); font-size: 12px; color: var(--ink); }
[data-theme="light"] .client-stage-chip { background: var(--chip); }
.client-alerts,
.client-access {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px dashed var(--line);
  position: relative;
  z-index: 1;
}
.client-access { grid-area: access; }
.client-alerts { grid-area: alerts; align-self: start; }
[data-theme="light"] .client-alerts,
[data-theme="light"] .client-access {
  background: rgba(30,136,229,.05);
}
.client-detail-card .section-title {
  font-size: 14px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.client-alerts-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.client-access-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.client-access-row input[type="email"] { flex: 1; min-width: 220px; }
.client-alerts-list { display: flex; flex-direction: column; gap: 10px; }
.client-alert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 44px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
  position: relative;
}
[data-theme="light"] .client-alert-row { background: #fff; }
.client-alert-email { font-weight: 600; flex: 1; }
.client-alert-row-toggles { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.client-alert-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #0b0f14;
}
.client-alert-remove svg { width: 19px; height: 19px; }
.client-alert-toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.client-alert-toggle input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  display: inline-grid;
  place-items: center;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.client-alert-toggle input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: transparent;
  transition: background .15s ease;
}
.client-alert-toggle input[type="checkbox"]:checked {
  border-color: var(--orange);
  background: rgba(255,106,0,.12);
  box-shadow: 0 0 0 3px rgba(255,106,0,.12);
}
.client-alert-toggle input[type="checkbox"]:checked::after {
  background: var(--orange);
}
.client-alert-toggle input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30,136,229,.25);
}
.client-alerts-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.client-alerts-form input[type="email"] { flex: 1; min-width: 220px; }

@media (max-width: 980px) {
  .client-detail-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "summary"
      "access"
      "orders"
      "alerts";
  }
  .client-detail-top { grid-template-columns: 1fr; }
  .client-detail-actions { width: 100%; justify-content: flex-start; }
}
.client-result { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 18px; padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .2s ease; background: var(--card); }
[data-theme="light"] .client-result { background: #fff; }
.client-result:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.16); }
.client-result-header h3 { margin: 0; }
.client-result-stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.client-result-notes { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ===== DASHBOARD VISUALS ===== */
.dashboard-visuals { margin-top: 18px; }
.dashboard-lower {
  grid-template-areas:
    "wip top"
    "rhythm top";
  grid-template-rows: auto auto;
}
.dashboard-wip { grid-area: wip; align-self: start; }
.dashboard-topclients {
  grid-area: top;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.dashboard-rhythm { grid-area: rhythm; align-self: start; }

.dashboard-topclients .top-clients-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

@media (max-width: 980px) {
  .dashboard-lower {
    grid-template-areas:
      "wip"
      "top"
      "rhythm";
  }
}
.stage-mix { display: flex; flex-direction: column; gap: 12px; }
.stage-mix-bar {
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg2);
}
.stage-mix-seg { height: 100%; }
.stage-mix-legend { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.stage-mix-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stage-mix-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.stage-mix-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.sparkline-card { display: flex; flex-direction: column; gap: 10px; }
.sparkline {
  height: 120px;
  padding: 10px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg2);
}
.sparkline svg { width: 100%; height: 100%; display: block; }
.sparkline-area { fill: url(#sparklineFill); }
.sparkline-line { fill: none; stroke: var(--blue); stroke-width: 2; }
.sparkline-point { fill: var(--orange); }
.sparkline-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: spark-draw .9s ease forwards;
}
.sparkline-area { animation: spark-fade .9s ease forwards; }
.sparkline-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

@keyframes spark-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes spark-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.top-clients-list {
  max-height: 170px;
  overflow-y: auto;
  padding-right: 4px;
}

/* ===== USER SETTINGS ===== */
.settings-card { display: flex; flex-direction: column; gap: 18px; }
.settings-section { position: relative; }
.settings-section .section-title {
  font-size: 16px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
#page-settings .card { background: var(--card); }
#page-settings .hint { color: var(--muted); }
#page-settings .h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-top: 6px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.settings-field { display: flex; flex-direction: column; gap: 8px; }
.settings-field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
}
.settings-field input,
.settings-field select {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink);
  padding: 0 14px;
}
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}
.settings-actions .hint { margin: 0; }
.settings-key-card .opkey-row {
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
}
.settings-key-card .opkey-field { width: 100%; }
.settings-key-card .opkey-box {
  background: none;
  border-style: dashed;
  padding: 6px;
  width: 100%;
}
.settings-key-card .opkey-input {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: .02em;
}
.settings-key-card .qr-hint { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.settings-support-btn { align-self: flex-start; }
.settings-keys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.settings-keys-grid .card { margin-top: 0; }
.settings-keys-grid .mt-18 { margin-top: 0 !important; }
.settings-support-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-support-row .hint { margin: 0; }
.billing-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.billing-stat {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
@media (max-width: 640px) {
  .settings-actions { flex-direction: column; align-items: stretch; }
  .settings-actions .btn { width: 100%; }
}
@media (max-width: 980px) {
  .settings-key-card .opkey-row { grid-template-columns: 1fr; }
  .billing-stats { grid-template-columns: 1fr; }
}

/* ===== Operario: optimización móvil ===== */
@media (max-width: 600px) {
  #page-operator .page-title { font-size: 24px; }
  #page-operator #scanInput { font-size: 20px; padding: 16px; height: 56px; }
  #page-operator #status { font-size: 15px; }
  #page-operator .row.mt-10 .btn { width: 100%; }
  #page-operator .row.mt-10 { grid-template-columns: 1fr; gap: 8px; }
}
#s-results .item:hover { border-color: var(--orange); transform: translateY(-1px); }
