:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --border: #e2e5ea;
    --text: #1f2733;
    --muted: #6b7280;
    --primary: #f97316;
    --primary-600: #ea580c;
    --primary-soft: #fff3e9;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --radius: 12px;
    --shadow: 0 6px 24px rgba(17, 24, 39, .08);
}

* { box-sizing: border-box; }

/* El atributo hidden debe ganar a cualquier display declarado por una clase. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- Auth (login) ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: linear-gradient(135deg, #fb923c 0%, #f97316 45%, #ea580c 100%);
    position: relative; overflow: hidden;
}
.auth-wrap::before,
.auth-wrap::after {
    content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.12);
}
.auth-wrap::before { width: 420px; height: 420px; top: -140px; right: -120px; }
.auth-wrap::after { width: 320px; height: 320px; bottom: -120px; left: -100px; background: rgba(255,255,255,.08); }
.auth-card {
    width: 100%; max-width: 410px; position: relative; z-index: 1;
    padding: 34px 30px; border: none; box-shadow: 0 24px 60px rgba(124,45,18,.35);
}
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; font-weight: 700; }
.auth-brand .brand-name { font-size: 17px; }
.auth-card h2 { text-align: center; }
.auth-card p.muted { text-align: center; }
.auth-card .field { margin-bottom: 16px; }

/* Input con icono */
.input-icon { position: relative; }
.input-icon > i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 14px; pointer-events: none;
}
.auth-card .input-icon input {
    width: 100%; padding: 12px 14px 12px 42px; border-radius: 10px;
    background: #f8fafc; border: 1.5px solid var(--border); transition: border-color .15s, box-shadow .15s;
}
.auth-card .input-icon input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(249,115,22,.15); background: #fff;
}
.auth-card .btn-primary { padding: 12px; font-size: 15px; border-radius: 10px; margin-top: 4px; }

/* ---------- App shell + Sidebar ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 4px 6px; }
.brand-mark {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: #fff; font-weight: 800; font-size: 16px;
}
.brand-name { font-size: 15px; letter-spacing: .3px; }
.mainnav { display: flex; flex-direction: column; gap: 4px; }
.mainnav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px; color: var(--muted); font-weight: 600;
}
.mainnav a:hover { background: var(--surface-2); color: var(--text); }
.mainnav a.active { background: var(--primary); color: #fff; }
.nav-ico { font-size: 14px; width: 18px; text-align: center; opacity: .9; }

/* Submenu / grupos */
.nav-group-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 14px; border: none; background: transparent; cursor: pointer;
    color: var(--muted); font-weight: 600; font-size: 14px; font-family: inherit;
    border-radius: 8px; text-align: left;
}
.nav-group-toggle:hover { background: var(--surface-2); color: var(--text); }
.nav-chevron { margin-left: auto; font-size: 11px; transition: transform .2s; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; gap: 2px; margin: 2px 0 2px 14px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-group.open .nav-sub { display: flex; }
.nav-sub a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.nav-sub a:hover { background: var(--surface-2); color: var(--text); }
.nav-sub a.active { background: var(--primary); color: #fff; }
.sidebar-foot { margin-top: auto; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.user-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mail { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.year-pill {
    display: inline-block; padding: 6px 14px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-weight: 700; color: var(--muted);
}

/* ---------- Layout ---------- */
.content { flex: 1; min-width: 0; padding: 24px; max-width: 1500px; }

/* Barra superior movil (oculta en escritorio) */
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
    /* Barra superior con hamburguesa */
    .mobile-bar {
        display: flex; align-items: center; gap: 12px;
        padding: 10px 16px; background: var(--surface);
        border-bottom: 1px solid var(--border);
        position: sticky; top: 0; z-index: 120;
    }
    .mobile-bar .menu-btn {
        display: inline-grid; place-items: center; width: 40px; height: 40px;
        border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
        color: var(--text); font-size: 18px; cursor: pointer;
    }
    .mobile-bar .brand-name { font-size: 15px; font-weight: 700; }

    /* Sidebar como drawer deslizante */
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; width: 260px; z-index: 200;
        transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.open {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150;
    }
    .content { padding: 16px; }
}

@media (max-width: 640px) {
    /* Barras de herramientas y busquedas a ancho completo */
    .toolbar { align-items: stretch; }
    .toolbar > form, .toolbar > div { width: 100%; }
    .toolbar input[type=search],
    .toolbar input[type=text] { min-width: 0 !important; width: 100%; flex: 1; }
    /* Filtros del dashboard */
    .filters { gap: 10px; }
    .filters .field,
    .filters .field.small { min-width: 0; flex: 1 1 45%; }
    .filters .btn { flex: 1 1 100%; justify-content: center; }
    /* Formularios a una columna */
    .form-grid { grid-template-columns: 1fr; }
    /* KPIs en 2 columnas */
    .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .page-head { align-items: flex-start; }
    .page-head .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .content { padding: 12px; }
    .page-head h1 { font-size: 19px; }
    .card { padding: 14px; }
    .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .chart-box { height: 260px; }
}
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) { .grid-4, .grid-5 { grid-template-columns: 1fr; } }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.kpi .kpi-value { font-size: 30px; font-weight: 800; }
.kpi .kpi-sub { color: var(--muted); font-size: 12px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=search], input[type=number], input[type=email], input[type=password], select, textarea {
    width: 100%; padding: 9px 11px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
textarea { min-height: 72px; resize: vertical; }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: transparent; }
.btn-edit { padding: 5px 9px; font-size: 15px; line-height: 1; color: var(--primary); }
.btn-edit:hover { background: var(--primary-soft); border-color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
thead th { background: var(--surface-2); color: var(--muted); position: sticky; top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: var(--primary-soft); }

/* ---------- Chips / badges ---------- */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); }
.chip-fe { color: #2563eb; } .chip-be { color: #b45309; } .chip-re { color: #15803d; }

/* ---------- Filters bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; }
.filters .field { margin: 0; min-width: 160px; }
.filters .field.small { min-width: 110px; }

.dash-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 16px;
    align-items: end;
}
.dash-filters .field { margin: 0; min-width: 0; }
.dash-filters .field > label {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.dash-filters .helper {
    margin: 0; font-weight: 400; font-size: 11px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-filters-actions {
    grid-column: span 3;
    display: flex; gap: 8px; justify-content: flex-end; align-items: center;
    padding-bottom: 1px;
}
@media (max-width: 1100px) {
    .dash-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-filters-actions { grid-column: span 1; justify-content: flex-start; }
}
@media (max-width: 640px) {
    .dash-filters { grid-template-columns: 1fr 1fr; }
    .dash-filters-actions { grid-column: 1 / -1; }
    .dash-filters-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ---------- Assignment grid ---------- */
.assign-grid td.week-cell { min-width: 120px; height: 46px; cursor: pointer; padding: 0; position: relative; }
.assign-grid td.week-cell:hover { background: var(--primary-soft); }
.assign-grid .brand-tag {
    display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 4px 6px; border-radius: 6px; font-size: 11px; font-weight: 600; color: #fff;
    background: var(--primary);
}
.assign-grid .brand-tag-mixto { background: #94a3b8; font-style: italic; }
.assign-grid .brand-tag-parcial { opacity: 0.75; border: 1px dashed rgba(255,255,255,.6); }
.assign-grid td.week-cell-mixto { background: #f8fafc; }
.assign-grid td.week-cell-parcial { background: #fffbeb; }
.multi-select { min-height: 110px; }

/* ---------- Multiselect con buscador ---------- */
.ms-field { position: relative; }
.ms { position: relative; }
.ms-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; padding: 9px 11px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font-size: 14px; font-family: inherit; cursor: pointer; text-align: left;
}
.ms-trigger:hover, .ms.open .ms-trigger { border-color: var(--primary); }
.ms-trigger .ms-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-chevron { font-size: 11px; color: var(--muted); transition: transform .2s; }
.ms.open .ms-chevron { transform: rotate(180deg); }
.ms-panel {
    position: absolute; z-index: 120; left: 0; right: 0; top: calc(100% + 4px);
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: var(--shadow); overflow: hidden;
}
.ms-search {
    width: 100%; border: none; border-bottom: 1px solid var(--border);
    border-radius: 0; background: var(--surface);
}
.ms-search:focus { outline: none; box-shadow: inset 0 -2px 0 var(--primary); }
.ms-all {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; margin: 0; font-weight: 600; cursor: pointer;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.ms-all:hover { background: var(--primary-soft); }
.ms-options { max-height: 220px; overflow-y: auto; }
.ms-option {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin: 0; cursor: pointer; font-weight: 500;
}
.ms-option:hover { background: var(--primary-soft); }
.ms-option input { flex-shrink: 0; accent-color: var(--primary); }
.ms-option.hidden { display: none; }
.ms-empty { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }

.autocomplete-hint { padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.assign-grid td.sticky-col, .assign-grid th.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.assign-grid th.sticky-col { z-index: 3; }
.month-head th { text-align: center; background: var(--surface); color: var(--primary); border-bottom: 1px solid var(--border); }

/* ---------- Asistente de asignacion masiva ---------- */
.stepper { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 0 0 16px; padding: 0; }
.stepper .step {
    display: flex; align-items: center; gap: 8px; flex: 1 1 150px;
    padding: 10px 14px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--muted); font-weight: 600;
}
.stepper .step-num {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 800;
}
.stepper .step.is-done { color: var(--text); border-color: var(--primary); }
.stepper .step.is-done .step-num { background: var(--primary-soft); color: var(--primary); }
.stepper .step.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .step.is-active .step-num { background: rgba(255, 255, 255, .25); color: #fff; }

.wizard-step .step-title { margin: 0 0 4px; font-size: 17px; }
.wizard-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.wizard-hint { color: var(--warning); font-size: 13px; }
kbd {
    padding: 1px 6px; border-radius: 5px; font-size: 11px; font-family: inherit; font-weight: 700;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}

/* Listas de seleccion en linea (tiendas / espacios) */
.picker { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.picker .ms-options { max-height: 320px; }
.picker .ms-option { align-items: flex-start; }
.picker .ms-option input { margin-top: 3px; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0; cursor: pointer; }
.check-inline input { accent-color: var(--primary); }
.chip-parcial { color: var(--warning); border-color: var(--warning); }

/* Calendario de semanas */
.year-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.year-tab {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 700;
}
.year-tab:hover { border-color: var(--primary); color: var(--text); }
.year-tab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.year-tab-count {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--primary-soft); color: var(--primary);
    font-size: 11px; font-weight: 800;
}
.year-tab.is-active .year-tab-count { background: rgba(255, 255, 255, .25); color: #fff; }
.weekcal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.weekcal-month { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.weekcal-month-head {
    display: block; width: 100%; padding: 8px 12px; border: none; cursor: pointer;
    background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 700;
    font-size: 12px; text-transform: uppercase; letter-spacing: .4px; text-align: left;
}
.weekcal-month-head:hover { background: var(--primary-soft); color: var(--primary); }
.weekcal-weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; padding: 10px; }
.wk {
    display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
    padding: 6px 4px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); font: inherit;
}
.wk:hover { border-color: var(--primary); }
.wk .wk-num { font-weight: 700; font-size: 13px; }
.wk .wk-range { font-size: 10px; color: var(--muted); }
.wk.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.wk.selected .wk-range { color: rgba(255, 255, 255, .85); }

/* Gantt del dashboard */
.gantt-wrap {
    overflow: auto;
    max-height: 520px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
.gantt { min-width: 100%; }
.gantt-row, .gantt-head {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    min-height: 38px;
    border-bottom: 1px solid var(--border);
}
.gantt-head {
    position: sticky; top: 0; z-index: 3;
    background: var(--surface-2); min-height: 0;
}
.gantt-label {
    position: sticky; left: 0; z-index: 2;
    display: flex; align-items: center;
    padding: 6px 12px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    font-size: 12px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-head .gantt-label { background: var(--surface-2); z-index: 4; }
.gantt-track {
    position: relative;
    display: grid;
    min-height: 38px;
}
.gantt-head .gantt-track { min-height: 0; }
.gantt-wk { border-left: 1px solid var(--border); min-width: 32px; min-height: 38px; }
.gantt-wk-label {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; padding: 6px 2px;
    font-size: 10px; font-weight: 700; color: var(--muted);
    border-left: 1px solid var(--border);
    min-width: 32px;
}
.gantt-wk-label span { font-weight: 500; font-size: 9px; }
.gantt-row.is-empty .gantt-label { color: var(--muted); font-weight: 500; }
.gantt-bar {
    position: absolute; top: 7px; bottom: 7px; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 0 8px; border-radius: 6px;
    color: #fff; font-size: 11px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .12);
}
.gantt-bar-text { flex: 0 0 auto; white-space: nowrap; }
.gantt-bar.is-compact { padding: 0 2px; font-size: 10px; }
.gantt-bar.is-mixto { background-image: repeating-linear-gradient(135deg, transparent, transparent 4px, rgba(255,255,255,.25) 4px, rgba(255,255,255,.25) 8px); }
.gantt-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* Resumen final */
.resumen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.resumen-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.resumen-item .kpi-label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.resumen-item .kpi-value { font-size: 22px; font-weight: 800; }
@media (max-width: 640px) { .resumen { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Autocomplete ---------- */
.autocomplete { position: relative; }
.autocomplete-list {
    position: absolute; z-index: 100; left: 0; right: 0; top: 100%;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    max-height: 240px; overflow: auto; box-shadow: var(--shadow); margin-top: 2px;
}
.autocomplete-list div { padding: 8px 11px; cursor: pointer; }
.autocomplete-list div:hover, .autocomplete-list div.active { background: var(--primary); color: #fff; }
.autocomplete-empty { color: var(--muted); padding: 8px 11px; }
.autocomplete-list .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none;
    align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    max-width: 520px; width: 100%; padding: 22px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 12px; }
.modal-wide { max-width: 720px; }
.modal .modal-body { color: var(--muted); max-height: 300px; overflow: auto; }
.modal-wide .modal-body { max-height: 60vh; }
.modal .modal-body .table-wrap { max-height: 300px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal ul { margin: 10px 0; padding-left: 18px; }
.modal li { margin: 4px 0; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 300;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--success);
    padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow); opacity: 0;
    transform: translateY(10px); transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--danger); }

/* ---------- Brand tag preview (tabla de marcas) ---------- */
.brand-tag.preview {
    position: static; display: inline-flex; inset: auto;
    padding: 4px 12px; border-radius: 6px; color: #fff; font-weight: 600;
    font-size: 12px; max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
input[type=color] {
    -webkit-appearance: none; appearance: none;
    width: 42px; height: 34px; padding: 2px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface-2); cursor: pointer;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 5px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pagination-info { color: var(--muted); font-size: 13px; }
.pagination-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pagination-controls .btn[disabled] { opacity: .4; cursor: not-allowed; }

.muted { color: var(--muted); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 400px; }
.inline-add { display: none; margin-top: 8px; gap: 8px; }
.inline-add.open { display: flex; }
.helper { font-size: 12px; color: var(--muted); margin-top: 4px; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert-error { color: var(--danger); border-color: var(--danger); background: rgba(220,38,38,.07); }
.alert-success { color: var(--success); border-color: var(--success); background: rgba(22,163,74,.09); }
