/* PanelFreeka — sistema visual del panel.
   Tokens en :root; modo oscuro según el sistema operativo. Sin dependencias externas. */

:root {
    --bg: #f5f4f1;
    --surface: #ffffff;
    --surface-2: #faf9f7;
    --surface-3: #f1efeb;
    --border: #e6e3dd;
    --border-strong: #d6d2ca;
    --text: #1d1c1a;
    --text-2: #57534c;
    --text-3: #8b867c;

    --accent: #b9532f;
    --accent-hover: #a2461f;
    --accent-soft: #f8ebe5;
    --accent-text: #ffffff;

    --success: #2c7a4b;
    --success-soft: #e4f3e9;
    --warning: #9a6200;
    --warning-soft: #fcf1d9;
    --danger: #b42318;
    --danger-soft: #fde9e7;
    --info: #2d5cad;
    --info-soft: #e7eefb;

    --sidebar-bg: #1d1c1a;
    --sidebar-text: #c9c5bd;
    --sidebar-text-strong: #f4efe6;
    --sidebar-muted: #7d786f;
    --sidebar-hover: rgba(255, 255, 255, .06);
    --sidebar-active: rgba(224, 118, 80, .16);
    --sidebar-accent: #e07650;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(29, 28, 26, .05);
    --shadow: 0 1px 3px rgba(29, 28, 26, .06), 0 4px 14px rgba(29, 28, 26, .05);
    --shadow-lg: 0 12px 40px rgba(29, 28, 26, .16);
    --focus: 0 0 0 3px rgba(185, 83, 47, .25);

    --sidebar-w: 248px;
    --topbar-h: 60px;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #131211;
        --surface: #1b1a18;
        --surface-2: #201f1c;
        --surface-3: #282623;
        --border: #2f2d29;
        --border-strong: #3d3a35;
        --text: #eceae5;
        --text-2: #b4afa5;
        --text-3: #847f76;
        --accent: #e07650;
        --accent-hover: #ea8964;
        --accent-soft: rgba(224, 118, 80, .14);
        --accent-text: #1d1c1a;
        --success: #5cc287;
        --success-soft: rgba(92, 194, 135, .13);
        --warning: #e5b04a;
        --warning-soft: rgba(229, 176, 74, .13);
        --danger: #f07a6c;
        --danger-soft: rgba(240, 122, 108, .13);
        --info: #7da7f0;
        --info-soft: rgba(125, 167, 240, .13);
        --sidebar-bg: #0f0e0d;
        --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .2);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
        --focus: 0 0 0 3px rgba(224, 118, 80, .35);
        color-scheme: dark;
    }
}

/* ── Base ─────────────────────────────────────────────── */
*, *::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.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-lg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.hidden { display: none !important; }
.mt-section { margin-top: 26px; }
form.inline { display: inline; }
.config-card { display: flex; align-items: center; gap: 14px; padding: 18px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.config-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.config-card__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }

/* ── Estructura ───────────────────────────────────────── */
.shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .22s ease;
}
.sidebar__brand { height: var(--topbar-h); display: flex; align-items: center; padding: 0 18px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text-strong); font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 30px; height: 30px; }
.brand__sub { display: block; font-size: 11px; font-weight: 500; color: var(--sidebar-muted); letter-spacing: .02em; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; scrollbar-width: thin; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group__title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 6px 10px; font-weight: 600; }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 11px;
    padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500;
    margin: 1px 0;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); text-decoration: none; }
.nav-item.is-active { background: var(--sidebar-active); color: var(--sidebar-text-strong); }
.nav-item.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sidebar-accent); }
.nav-item.is-active .icon { color: var(--sidebar-accent); }
.sidebar__footer { padding: 12px 18px; font-size: 11.5px; color: var(--sidebar-muted); border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
    display: flex; align-items: center; gap: 12px; padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--border);
}
.icon-btn.topbar__menu { display: none; }
.topbar__title { flex: 1; min-width: 0; }
.topbar__title h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }
.content { padding: 24px 28px 48px; width: 100%; max-width: 1360px; }

/* ── Botones ──────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer;
    white-space: nowrap; transition: background .15s, border-color .15s, color .15s; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn--block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .icon, .btn.is-loading .icon-sm { display: none; }
.icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .count {
    position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
    border: 2px solid var(--bg);
}
.spinner {
    width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Encabezado de página ─────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head__text p { margin: 0; color: var(--text-2); }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 0; }

/* ── Tarjetas ─────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card__head h2, .card__head h3 { font-size: 15px; }
.card__head p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--main-side { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 118px; position: relative; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi__label { font-size: 13px; color: var(--text-2); font-weight: 550; }
.kpi__icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.kpi__icon--accent { background: var(--accent-soft); color: var(--accent); }
.kpi__icon--success { background: var(--success-soft); color: var(--success); }
.kpi__icon--warning { background: var(--warning-soft); color: var(--warning); }
.kpi__icon--danger { background: var(--danger-soft); color: var(--danger); }
.kpi__icon--info { background: var(--info-soft); color: var(--info); }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi__value--money { font-size: 22px; }
.kpi__hint { font-size: 12.5px; color: var(--text-3); margin-top: auto; }
.kpi--pending .kpi__value { color: var(--text-3); font-size: 20px; font-weight: 600; }

/* ── Tablas ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em;
    padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12.5px; color: var(--text-3); }
.table--compact td { padding: 9px 16px; }

/* ── Badges y estados ─────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.status--ok { color: var(--success); }
.status--error { color: var(--danger); }
.status--none { color: var(--text-3); }
.status .dot { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }

/* ── Formularios ──────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-weight: 600; font-size: 13px; color: var(--text); }
.label .opt { font-weight: 400; color: var(--text-3); }
.hint { font-size: 12.5px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--danger); font-weight: 500; }
.input, .select, .textarea {
    width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.select {
    appearance: none; padding-right: 34px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
    background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input::placeholder { color: var(--text-3); }
.field.has-error .input, .field.has-error .select { border-color: var(--danger); }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 42px; }
.input-group__btn { position: absolute; right: 3px; top: 3px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--text-3); border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.input-group__btn:hover { color: var(--text); background: var(--surface-3); }
.input-icon { position: relative; }
.input-icon .icon-sm { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 22px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.secret-field { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); overflow-wrap: anywhere; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); }

/* ── Alertas ──────────────────────────────────────────── */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid transparent; margin-bottom: 18px; }
.alert__body { flex: 1; min-width: 0; }
.alert__body strong { display: block; margin-bottom: 2px; }
.alert--exito { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert--error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert--aviso { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert--info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert__close { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; opacity: .7; }
.alert__close:hover { opacity: 1; }
.alert .alert__body, .alert .alert__body p { color: var(--text); }
.alert--inline { margin: 0; }

/* ── Dropdowns ────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown__panel {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 50;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 6px; display: none;
}
.dropdown.is-open .dropdown__panel { display: block; }
.dropdown__item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; border: 0;
    background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.dropdown__item:hover { background: var(--surface-3); text-decoration: none; }
.dropdown__item--danger { color: var(--danger); }
.dropdown__sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown__header { padding: 8px 10px 10px; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.user-btn:hover { background: var(--surface-3); }
.user-btn__text { text-align: left; line-height: 1.2; }
.user-btn__name { font-weight: 600; font-size: 13px; display: block; }
.user-btn__role { font-size: 11.5px; color: var(--text-3); }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.avatar--lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }

.notif-panel { width: 370px; padding: 0; }
.notif-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-panel__head h3 { font-size: 14px; }
.notif-panel__list { max-height: 380px; overflow-y: auto; }
.notif-panel__foot { padding: 10px 14px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-2); }
.notif--info .notif__icon { background: var(--info-soft); color: var(--info); }
.notif--exito .notif__icon { background: var(--success-soft); color: var(--success); }
.notif--aviso .notif__icon { background: var(--warning-soft); color: var(--warning); }
.notif--error .notif__icon { background: var(--danger-soft); color: var(--danger); }
.notif__body { flex: 1; min-width: 0; }
.notif__title { font-weight: 600; font-size: 13.5px; }
.notif__msg { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.notif__time { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.notif.is-unread .notif__title::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 7px; vertical-align: middle; }
.notif-empty { padding: 30px 14px; text-align: center; color: var(--text-3); }
.notif-page { max-height: none; }

/* ── Pestañas ─────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Listas de datos ──────────────────────────────────── */
.dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 20px; margin: 0; }
.dl dt { color: var(--text-3); font-size: 13px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list__item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.list__item:last-child { border-bottom: 0; }
.list__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.list__body { flex: 1; min-width: 0; }
.list__title { font-weight: 550; font-size: 13.5px; }
.list__meta { font-size: 12.5px; color: var(--text-3); }

/* ── Estados vacíos ───────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty__icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--surface-3); color: var(--text-3); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0 auto; max-width: 380px; }

/* ── Filtros y paginación ─────────────────────────────── */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 150px; }
.filters .field--grow { flex: 1; min-width: 200px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.pagination__links { display: flex; gap: 6px; }

/* ── Matriz de permisos ───────────────────────────────── */
.perm-module { border-bottom: 1px solid var(--border); padding: 14px 20px; display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.perm-module:last-child { border-bottom: 0; }
.perm-module__name { font-weight: 650; display: flex; flex-direction: column; gap: 6px; }
.perm-module__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 20px; }
.perm-item small { display: block; color: var(--text-3); font-family: var(--mono); font-size: 11.5px; }

/* ── Modal ────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.is-open { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 14, 13, .5); }
.modal__dialog { position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal__head h3 { font-size: 16px; }
.modal__body { padding: 20px; }
.modal__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Resultado de prueba / sync ───────────────────────── */
.result { border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; display: none; }
.result.is-visible { display: block; }
.result--ok { background: var(--success-soft); color: var(--success); }
.result--error { background: var(--danger-soft); color: var(--danger); }
.result .dl { margin-top: 8px; }
.result .dl dd { color: var(--text); }
.stat-row { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-row__item span { display: block; font-size: 12px; color: var(--text-3); }
.stat-row__item strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.pre { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; max-height: 360px; }

/* ── Login ────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth__art {
    position: relative; overflow: hidden; color: #f4efe6; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
    background:
        radial-gradient(circle at 20% 20%, rgba(224, 118, 80, .45), transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(214, 170, 90, .28), transparent 50%),
        #1d1c1a;
}
.auth__art::after {
    content: ""; position: absolute; right: -60px; bottom: -60px; width: 360px; height: 360px;
    border: 18px solid rgba(244, 239, 230, .06); border-radius: 16px; transform: rotate(-8deg);
}
.auth__art .brand { color: #f4efe6; font-size: 18px; }
.auth__quote { max-width: 420px; position: relative; z-index: 1; }
.auth__quote h2 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin-bottom: 12px; }
.auth__quote p { color: rgba(244, 239, 230, .7); font-size: 15px; }
.auth__panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--surface); }
.auth__box { width: 100%; max-width: 380px; }
.auth__box h1 { font-size: 24px; margin-bottom: 6px; }
.auth__box > p { color: var(--text-2); margin-bottom: 24px; }
.auth__links { display: flex; justify-content: space-between; font-size: 13px; margin-top: 4px; }

/* ── Páginas de error ─────────────────────────────────── */
.minimal { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.error-page { text-align: center; max-width: 480px; }
.error-page__code { font-size: 64px; font-weight: 800; letter-spacing: -.04em; color: var(--accent); line-height: 1; }
.error-page h1 { font-size: 20px; margin: 12px 0 8px; }
.error-page p { color: var(--text-2); }
.error-page .pre { text-align: left; margin-top: 16px; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1100px) {
    .grid--main-side { grid-template-columns: 1fr; }
    .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .shell.is-nav-open .sidebar { transform: translateX(0); }
    .shell.is-nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 14, 13, .45); }
    .main { margin-left: 0; }
    .topbar { padding: 0 14px; }
    .icon-btn.topbar__menu { display: inline-flex; }
    .content { padding: 18px 16px 40px; }
    .user-btn__text { display: none; }
    .auth { grid-template-columns: 1fr; }
    .auth__art { display: none; }
    .perm-module { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 640px) {
    .grid--2, .grid--3, .form-grid { grid-template-columns: 1fr; }
    .grid--kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 14px; min-height: 108px; }
    .kpi__value { font-size: 22px; }
    .kpi__value--money { font-size: 17px; }
    .notif-panel { width: calc(100vw - 24px); right: -60px; }
    .dl { grid-template-columns: 1fr; gap: 2px; }
    .dl dd { margin-bottom: 8px; }
    .page-head { align-items: stretch; }
    .table-responsive thead { display: none; }
    .table-responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
    .table-responsive td { display: grid; grid-template-columns: minmax(84px, auto) minmax(0, 1fr); column-gap: 12px; justify-items: end; border: 0; padding: 6px 16px; text-align: right; overflow-wrap: anywhere; }
    .table-responsive td > * { grid-column: 2; }
    .table-responsive td::before { content: attr(data-label); color: var(--text-3); font-size: 12.5px; text-align: left; grid-column: 1; grid-row: 1 / span 4; justify-self: start; }
    .table-responsive td.actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
    .table-responsive td.actions::before { content: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Sistema: versión e historial de cambios ──────────── */
.version-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.version-hero__text { flex: 1; min-width: 160px; }
.version-hero__text h2 { font-size: 22px; }
.card__foot--start { justify-content: flex-start; }
.plain-list { margin: 6px 0 0; padding-left: 18px; }
.plain-list li { margin: 3px 0; }
.changelog { display: flex; flex-direction: column; gap: 22px; }
.changelog__version h3 { font-size: 15px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.changelog__group { margin-top: 10px; }

/* ── Cuadros ──────────────────────────────────────────── */
.cuadros-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 16px; }
.cuadro-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); color: var(--text); transition: box-shadow .15s, border-color .15s, transform .15s; }
.cuadro-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.cuadro-card__img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); overflow: hidden; }
.cuadro-card__img img { width: 100%; height: 100%; object-fit: cover; }
.cuadro-card__estado { position: absolute; top: 10px; left: 10px; }
.cuadro-card__estado .badge { box-shadow: var(--shadow-sm); }
.cuadro-card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.cuadro-card__codigo { font-size: 12px; color: var(--text-3); }
.cuadro-card__nombre { font-weight: 650; font-size: 14.5px; line-height: 1.3; }
.cuadro-card__meta { font-size: 12.5px; color: var(--text-2); }
.cuadro-card__pie { display: flex; align-items: baseline; gap: 6px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.cuadro-card__pie .badge { margin-left: auto; }
.cuadro-hero { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; overflow: hidden; }
.cuadro-hero__img { background: var(--surface-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 240px; color: var(--text-3); text-align: center; padding: 0; }
.cuadro-hero__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cuadro-hero__body { padding: 20px 24px; }
.cuadro-hero__body h2 { font-size: 22px; margin: 2px 0 4px; }
.cuadro-hero__badges { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; display: block; }
.thumb--vacio { display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.thumb-cell { width: 60px; }
.input--sm { height: 32px; font-size: 13px; padding: 0 10px; }
.catalogo-alta { flex-direction: row; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--border); }
.catalogo-alta .input { flex: 1; min-width: 140px; height: 32px; }
.catalogo-alta .select { width: auto; height: 32px; }
.catalogo-item { align-items: center; gap: 4px 8px; padding: 8px 14px; flex-wrap: wrap; }
.catalogo-item .list__meta { flex: 1; padding-left: 2px; }
.catalogo-item__form { display: flex; gap: 4px; flex: 1 1 100%; min-width: 0; }
.catalogo-item.is-inactivo .input { color: var(--text-3); text-decoration: line-through; }
@media (max-width: 640px) {
    .cuadros-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
    .cuadro-hero { grid-template-columns: 1fr; }
    .cuadro-hero__img { min-height: 200px; }
    .catalogo-item { flex-wrap: wrap; }
}

/* ── Alquileres ───────────────────────────────────────── */
.items-alquiler td:first-child { min-width: 190px; }
.items-alquiler th, .items-alquiler td { padding-left: 8px; padding-right: 8px; }
.items-alquiler input[type="date"] { min-width: 132px; padding: 0 8px; }
.items-alquiler .input, .items-alquiler .select { height: 34px; }
.items-alquiler td:nth-child(4) { width: 105px; }
.table tfoot td { padding: 12px 16px; background: var(--surface-2); border-top: 1px solid var(--border); }
.cliente-nuevo summary { cursor: pointer; color: var(--accent); font-weight: 550; font-size: 13px; }
select[size] { height: auto; padding: 4px; background-image: none; }
select[size] option { padding: 4px 6px; border-radius: 4px; }
.tab .badge { margin-left: 2px; line-height: 16px; padding: 1px 7px; font-size: 11px; }
