/* Reparlink · sistema de diseño
   Azul #2563EB · Turquesa #14B8A6 · tarjetas redondeadas · modo claro y oscuro */

:root {
  --primary: #2563EB;
  --primary-600: #1D4ED8;
  --primary-50: #EEF4FF;
  --primary-100: #DCE8FE;
  --teal: #14B8A6;
  --teal-600: #0D9488;
  --teal-50: #E8FAF6;
  --brand-grad: linear-gradient(135deg, #14B8A6 0%, #1D6FE8 55%, #2563EB 100%);

  --bg: #F5F8FC;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #F1F5FA;
  --border: #E6ECF4;
  --border-strong: #D5DEEA;
  --text: #0F1E3D;
  --text-2: #334155;
  --muted: #64748B;
  --faint: #94A3B8;

  --green: #10B981; --green-bg: #E7F8F1; --green-fg: #047857;
  --amber: #F59E0B; --amber-bg: #FFF4DB; --amber-fg: #B45309;
  --red: #EF4444; --red-bg: #FDECEC; --red-fg: #DC2626;
  --violet: #8B5CF6; --violet-bg: #F1ECFF; --violet-fg: #6D28D9;
  --blue-bg: #E8F0FE; --blue-fg: #1D4ED8;
  --teal-bg: #E3F8F5; --teal-fg: #0F766E;
  --orange: #F97316; --orange-bg: #FFEEDF; --orange-fg: #C2410C;
  --slate-bg: #EEF2F7; --slate-fg: #475569;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(15, 30, 61, .04), 0 4px 16px rgba(15, 30, 61, .04);
  --shadow-lg: 0 10px 40px rgba(15, 30, 61, .12);
  --sidebar-w: 256px;
  --topbar-h: 68px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --surface: #111A2B; --surface-2: #142036; --surface-3: #18253D;
    --border: #1F2C44; --border-strong: #2A3A57;
    --text: #E8EEF8; --text-2: #C6D2E3; --muted: #8FA0B8; --faint: #64748B;
    --primary-50: #13254A; --primary-100: #1A3363; --teal-50: #0E2C2C;
    --green-bg: #0F2E25; --green-fg: #34D399; --amber-bg: #33270E; --amber-fg: #FBBF24;
    --red-bg: #3A1618; --red-fg: #F87171; --violet-bg: #251B45; --violet-fg: #C4B5FD;
    --blue-bg: #13254A; --blue-fg: #93B4FB; --teal-bg: #0E2C2C; --teal-fg: #5EEAD4;
    --orange-bg: #36200F; --orange-fg: #FDBA74; --slate-bg: #1C2940; --slate-fg: #A8B6CA;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --surface: #111A2B; --surface-2: #142036; --surface-3: #18253D;
  --border: #1F2C44; --border-strong: #2A3A57;
  --text: #E8EEF8; --text-2: #C6D2E3; --muted: #8FA0B8; --faint: #64748B;
  --primary-50: #13254A; --primary-100: #1A3363; --teal-50: #0E2C2C;
  --green-bg: #0F2E25; --green-fg: #34D399; --amber-bg: #33270E; --amber-fg: #FBBF24;
  --red-bg: #3A1618; --red-fg: #F87171; --violet-bg: #251B45; --violet-fg: #C4B5FD;
  --blue-bg: #13254A; --blue-fg: #93B4FB; --teal-bg: #0E2C2C; --teal-fg: #5EEAD4;
  --orange-bg: #36200F; --orange-fg: #FDBA74; --slate-bg: #1C2940; --slate-fg: #A8B6CA;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.icon { display: inline-block; flex-shrink: 0; stroke-width: 1.8; vertical-align: middle; }
.tabular, .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.bold { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.text-green { color: var(--green-fg); } .text-red { color: var(--red-fg); } .text-amber { color: var(--amber-fg); }
.text-primary { color: var(--primary); } .text-teal { color: var(--teal-fg); }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px 18px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 22px; color: var(--text); }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
.brand-name { font-size: 23px; font-weight: 800; letter-spacing: -.03em; color: var(--text); line-height: 1; }
.brand-tag { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.brand-custom img { max-height: 40px; width: auto; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 10px; color: var(--text-2);
  font-weight: 500; font-size: 15px; transition: background .15s, color .15s;
}
.nav a .icon { width: 21px; height: 21px; color: var(--text-2); }
.nav a:hover { background: var(--surface-3); }
.nav a.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav a.active .icon { color: var(--primary); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 10px 14px 4px; font-weight: 600; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.sidebar-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.sidebar-foot small { display: block; color: var(--muted); font-size: 12px; }
.sidebar-store { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--text); }
.sidebar-store .icon { color: var(--primary); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.search {
  position: relative; flex: 0 1 600px; display: flex; align-items: center;
}
.search .icon { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; height: 42px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px;
  padding: 0 64px 0 42px; font: inherit; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.search kbd { position: absolute; right: 12px; font: 500 11.5px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; background: var(--surface-2); }
.search-results {
  position: absolute; top: 48px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 70vh; overflow: auto; z-index: 50;
}
.search-results .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 8px 10px 4px; font-weight: 600; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); }
.search-results a:hover, .search-results a.focus { background: var(--surface-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 0;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .ping { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.account { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; cursor: pointer; border: 0; background: transparent; color: var(--text); font: inherit; }
.account:hover { background: var(--surface-3); }
.account .name { font-weight: 600; font-size: 14px; text-align: left; line-height: 1.2; }
.account .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600;
  font-size: 13px; background: var(--primary); flex-shrink: 0; letter-spacing: .02em;
}
.avatar.sq { border-radius: 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.main { padding: 22px 28px 40px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 + p { color: var(--muted); margin-top: 6px; font-size: 15px; }
.page-head .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 500; font-size: 14px; }
.back-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--text); }
.back-btn:hover { background: var(--surface-3); }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.card-head h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.card-head h2 .icon { color: var(--primary); }
.card-body { padding: 14px 22px 22px; }
.card-link { font-size: 13.5px; font-weight: 500; color: var(--primary); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; } .gap-lg { gap: 20px; }
.mt { margin-top: 16px; } .mt-sm { margin-top: 8px; } .mt-lg { margin-top: 24px; } .mb { margin-bottom: 16px; }
.grow { flex: 1; min-width: 0; }

/* Indicadores */
.stat { display: flex; gap: 18px; align-items: flex-start; padding: 22px 22px; }
.stat-icon { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon .icon { width: 28px; height: 28px; }
.stat-label { color: var(--text-2); font-size: 15px; font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-delta { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.stat-delta b { font-weight: 500; }
.up { color: var(--green-fg); } .down { color: var(--red-fg); } .flat { color: var(--amber-fg); }
.tone-blue { background: var(--blue-bg); color: var(--primary); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-teal { background: var(--teal-bg); color: var(--teal); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-slate { background: var(--slate-bg); color: var(--slate-fg); }
.tone-orange { background: var(--orange-bg); color: var(--orange); }

/* ---------- Insignias ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; line-height: 1;
}
.badge.lg { height: 34px; padding: 0 16px; font-size: 15px; font-weight: 600; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-yellow { background: #FDF0C2; color: #9A6700; }
.badge-red { background: var(--red-bg); color: var(--red-fg); }
.badge-violet { background: var(--violet-bg); color: var(--violet-fg); }
.badge-blue { background: var(--blue-bg); color: var(--blue-fg); }
.badge-teal { background: var(--teal-bg); color: var(--teal-fg); }
.badge-orange { background: var(--orange-bg); color: var(--orange-fg); }
.badge-slate, .badge-gray { background: var(--slate-bg); color: var(--slate-fg); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--blue-bg); color: var(--blue-fg); font-size: 12px; font-weight: 500; }
.tag.nfc { background: var(--slate-bg); color: var(--slate-fg); }
.count { min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 600; background: rgba(15,30,61,.08); color: var(--text-2); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 11px; border: 1px solid transparent; font: 600 14.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; color: var(--text); background: var(--surface); text-decoration: none;
}
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--primary-600); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-600); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.btn-outline:hover { background: var(--surface-3); }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.btn-outline-primary:hover { background: var(--primary-50); }
.btn-soft { background: var(--primary-50); color: var(--primary); }
.btn-soft:hover { background: var(--primary-100); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: var(--red-bg); color: var(--red-fg); }
.btn-danger:hover { background: #FAD7D7; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-xl { height: 64px; font-size: 20px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }

/* Control segmentado (Kanban/Lista, Cliente existente/Nuevo/Anónimo, vistas) */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button, .seg a, .seg label {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border: 0; background: transparent; border-radius: 9px;
  font: 500 14px var(--font); color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.seg .active, .seg input:checked + span { background: var(--primary); color: #fff; }
.seg label input { display: none; }
.seg label span { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 9px; margin: 0 -16px; }
.choice-row { display: grid; gap: 12px; }
.choice {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 11px; background: var(--surface); cursor: pointer; font-weight: 500; color: var(--text); font-size: 14.5px; position: relative;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:hover { border-color: var(--primary); }
.choice.active, .choice:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; }
.choice.tall { height: 56px; }

/* Pestañas */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 12px 16px; color: var(--text-2); font-weight: 500; font-size: 15.5px; border: 0; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-family: inherit;
}
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); }
.pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font: 500 14.5px var(--font); cursor: pointer; white-space: nowrap;
}
.pill:hover { border-color: var(--border-strong); }
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill.soft { background: var(--surface-3); border-color: transparent; }
.pill.soft.active { background: var(--primary); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 500; color: var(--text); }
.field .req, .req { color: var(--red); }
.help { font-size: 13px; color: var(--muted); }
.error-text { font-size: 12.5px; color: var(--red-fg); }
.input, .select, .textarea {
  width: 100%; height: 44px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  padding: 0 14px; font: 400 14.5px var(--font); color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.input.sm, .select.sm { height: 36px; font-size: 13.5px; border-radius: 9px; }
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input, .input-icon .select { padding-left: 40px; }
.input-icon .suffix { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.counter { position: absolute; right: 12px; bottom: 10px; font-size: 12px; color: var(--faint); }
.check { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; cursor: pointer; }
.switch { position: relative; display: inline-flex; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.section-title { font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.section-sub { color: var(--muted); font-size: 13.5px; margin-top: -10px; margin-bottom: 14px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left; font-weight: 500; color: var(--text-2); font-size: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--surface);
}
.table th .sort { color: var(--faint); margin-left: 4px; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.selected { background: var(--primary-50) !important; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact td, .table.compact th { padding: 10px 12px; }
.table.plain th { background: transparent; color: var(--text-2); font-size: 13.5px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 16px; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; gap: 8px; }
.pager a, .pager span { min-width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); padding: 0 8px; }
.pager .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .disabled { color: var(--faint); }

/* Listas de filas */
.list > * + * { border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.kv { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); }

/* ---------- Dispositivo ---------- */
.dev-thumb { display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 8px; overflow: hidden; }
.dev-thumb img, img.dev-thumb { object-fit: contain; }
.dev-emoji { background: var(--surface-3); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kcol { border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 14px 14px 0 0; font-weight: 600; font-size: 16.5px; }
.kcol[data-color="slate"] .kcol-head { background: var(--surface-3); }
.kcol[data-color="amber"] .kcol-head { background: #FFF2DA; }
.kcol[data-color="amber"] .count { background: #FCD687; color: #7A4A00; }
.kcol[data-color="blue"] { border-color: #BBD3FB; }
.kcol[data-color="blue"] .kcol-head { background: #E5EEFD; }
.kcol[data-color="blue"] .count { background: #C9DAFB; color: var(--primary-600); }
.kcol[data-color="green"] .kcol-head { background: #DDF6EC; }
.kcol[data-color="green"] .count { background: #A9E9CF; color: #04684A; }
.kcol[data-color="violet"] .kcol-head { background: var(--violet-bg); }
:root[data-theme="dark"] .kcol .kcol-head { background: var(--surface-3) !important; }
.kcards { display: flex; flex-direction: column; gap: 0; padding: 0 0 4px; flex: 1; min-height: 80px; }
.kcard {
  display: flex; gap: 12px; padding: 14px 14px 12px; background: var(--surface); border-top: 1px solid var(--border);
  color: var(--text); cursor: grab; position: relative; transition: background .12s;
}
.kcard:hover { background: var(--surface-2); }
.kcard.dragging { opacity: .5; }
.kcol.drop { outline: 2px dashed var(--primary); outline-offset: -4px; }
.kcard .who { font-weight: 500; font-size: 14.5px; }
.kcard .dev { color: var(--text-2); font-size: 14px; }
.kcard .issue { color: var(--muted); font-size: 14px; }
.kcard .meta { white-space: nowrap; gap: 6px; display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.kcard .chev { position: absolute; right: 12px; top: 18px; color: var(--muted); }
.kcol-foot { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 14px 14px; }

/* ---------- Línea de tiempo horizontal (ficha) ---------- */
.htl { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative; padding: 8px 0 4px; }
.htl-step { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; gap: 4px; }
.htl-step::before { content: ''; position: absolute; top: 14px; left: -50%; right: 50%; height: 2px; background: var(--border-strong); z-index: 0; }
.htl-step:first-child::before { display: none; }
.htl-step.done::before, .htl-step.current::before { background: var(--teal); }
.htl-dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; z-index: 1; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--muted);
}
.htl-step.done .htl-dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.htl-step.current .htl-dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-50); }
.htl-name { font-size: 15px; font-weight: 500; margin-top: 6px; color: var(--text); }
.htl-step.current .htl-name { color: var(--primary); font-weight: 600; }
.htl-step.todo .htl-name { color: var(--text-2); }
.htl-date { font-size: 13px; color: var(--muted); }

/* Stepper (nueva reparación) */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); margin: 4px 0 24px; }
.stepper .htl-step::before { background: var(--border-strong) !important; }

/* Línea de tiempo vertical */
.vtl { position: relative; }
.vtl-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding-bottom: 18px; position: relative; }
.vtl-item::before { content: ''; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.vtl-item:last-child::before { display: none; }
.vtl-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); color: #fff; }
.vtl-dot.sm { width: 10px; height: 10px; margin: 6px 0 0 8px; }

/* Barras de progreso */
.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.bar.thin { height: 6px; }
.bar.green > span { background: var(--green); } .bar.red > span { background: var(--red); } .bar.amber > span { background: var(--amber); }
.bar.teal > span { background: var(--teal); }

/* Avisos dentro de tarjetas */
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--primary-50); color: var(--text-2); font-size: 13.5px; }
.note .icon { color: var(--primary); margin-top: 1px; }
.note b, .note strong { color: var(--primary); font-weight: 500; display: block; margin-bottom: 2px; }
.note.teal { background: var(--teal-50); } .note.teal .icon, .note.teal b { color: var(--teal-fg); }
.note.amber { background: var(--amber-bg); } .note.amber .icon, .note.amber b { color: var(--amber-fg); }
.note.red { background: var(--red-bg); } .note.red .icon, .note.red b { color: var(--red-fg); }

/* Mensajes flash y toasts */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--green-bg); color: var(--green-fg); }
.flash.error { background: var(--red-bg); color: var(--red-fg); }
.flash.info { background: var(--primary-50); color: var(--primary); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: #0F1E3D; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-weight: 500; animation: toast-in .2s ease-out; max-width: 380px; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* Menús desplegables */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none;
}
.menu.open { display: block; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu .sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu .head { padding: 8px 12px; font-size: 12px; color: var(--muted); }
.menu .danger { color: var(--red-fg); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 30, 61, .45); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal-back.open { display: flex; }
.modal { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: toast-in .18s ease-out; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 8px; }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 12px 24px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; }

/* Panel lateral (stock) */
.side-panel { position: sticky; top: calc(var(--topbar-h) + 10px); }

/* Vacío */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* Firma */
.sigpad { width: 100%; height: 180px; border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); touch-action: none; cursor: crosshair; display: block; }

/* QR */
.qr { width: 96px; height: 96px; }
.qr canvas, .qr img, .qr svg { width: 100%; height: 100%; }
.copy-field { display: flex; align-items: center; gap: 8px; height: 44px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; background: var(--surface-2); color: var(--primary); font-weight: 500; }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.photo { display: flex; flex-direction: column; gap: 6px; }
.photo-img { aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); }
.photo-img img { width: 100%; height: 100%; object-fit: cover; }
.photo-add { display: grid; place-items: center; aspect-ratio: 4 / 5; border-radius: 10px; border: 1.5px dashed var(--border-strong); color: var(--muted); cursor: pointer; text-align: center; font-size: 13px; gap: 4px; }
.photo-add:hover { border-color: var(--primary); color: var(--primary); }

/* Gráficos */
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: var(--brand-grad); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h2 { color: #fff; font-size: 34px; line-height: 1.15; max-width: 460px; font-weight: 700; letter-spacing: -.02em; }
.auth-side p { opacity: .9; font-size: 16px; max-width: 440px; margin-top: 14px; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }

/* Utilidades responsive */
.mobile-only { display: none; }
@media (max-width: 1360px) {
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 76px; }
  .sidebar { padding: 18px 10px; }
  .brand-name, .brand-tag, .nav a span, .sidebar-foot .txt, .nav-label { display: none; }
  .brand { justify-content: center; padding: 2px 0 18px; }
  .nav a { justify-content: center; padding: 12px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar .brand-name, .sidebar .nav a span, .sidebar .sidebar-foot .txt { display: initial; }
  .sidebar .nav a { justify-content: flex-start; }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 0 14px; gap: 8px; }
  .main { padding: 16px 14px 32px; }
  .g2, .g4, .kanban, .form-grid { grid-template-columns: 1fr; }
  .account .txt { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  h1 { font-size: 24px; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* ---------- Panel principal ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 22px; align-items: start; }
.dash-side { position: sticky; top: calc(var(--topbar-h) + 4px); }
.agenda-item { display: grid; grid-template-columns: 54px 14px 1fr; gap: 12px; padding: 10px 0 12px; position: relative; font-size: 14.5px; }
.agenda-item::before { content: ''; position: absolute; left: 72px; top: 26px; bottom: -12px; width: 1px; background: var(--border); }
.agenda-item:last-child::before { display: none; }
.agenda-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.agenda-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--surface); }
.agenda-title { font-weight: 500; font-size: 15px; margin-bottom: 2px; }
@media (max-width: 1700px) {
  .dash { grid-template-columns: minmax(0, 1fr) 340px; }
  .stat { padding: 18px; gap: 14px; }
  .stat-icon { width: 46px; height: 46px; border-radius: 13px; }
  .stat-icon .icon { width: 23px; height: 23px; }
  .stat-label { font-size: 14px; }
  .stat-value { font-size: 26px; }
  .kcard { padding: 12px 10px 10px; gap: 10px; }
  .kcard .dev-thumb { width: 36px !important; }
}
@media (max-width: 1250px) { .dash { grid-template-columns: 1fr; } .dash-side { position: static; } }
