/* ============================================================
   Inventario de Piezas · hoja de estilos principal
   Paleta: azul petróleo, turquesa, verde y neutros.
   ============================================================ */
:root {
    --navy-950: #061c24;
    --navy-900: #0b2b36;
    --navy-800: #0e3644;
    --navy-700: #124555;
    --teal-800: #0a5a5a;
    --teal-700: #0d6b6b;
    --teal-600: #0f8585;
    --teal-500: #17a2a2;
    --teal-soft: #e6f5f5;
    --green-700: #157a52;
    --green-600: #1c9b68;
    --green-soft: #e7f7f0;
    --amber-700: #a16207;
    --amber-600: #c4880a;
    --amber-soft: #fdf5e4;
    --red-700: #a93f38;
    --red-600: #c04a42;
    --red-soft: #fdeceb;
    --ink: #102b35;
    --ink-2: #1c4553;
    --muted: #5f7a84;
    --faint: #8ba0a8;
    --bg: #f2f6f7;
    --card: #ffffff;
    --line: #e0e9ec;
    --line-strong: #cbdadd;
    --shadow-xs: 0 1px 2px rgba(6, 28, 36, .05);
    --shadow-sm: 0 4px 14px rgba(6, 28, 36, .06);
    --shadow: 0 14px 38px rgba(6, 28, 36, .1);
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 20px;
    --sidebar: 264px;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::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.55;
    color: var(--ink);
    background: var(--bg);
}
h1, h2, h3, h4, p { margin: 0; }
h2 { font-size: 24px; line-height: 1.25; letter-spacing: -.01em; }
h3 { font-size: 16px; }
a { color: var(--teal-700); text-decoration: none; }
a:hover { color: var(--teal-800); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal-500); outline-offset: 2px; }
::selection { background: var(--teal-soft); }

.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.strong { font-weight: 650; }
.muted { color: var(--muted); }
.subtle { display: block; color: var(--faint); font-size: 12px; margin-top: 1px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-in { color: var(--green-700); }
.text-out { color: var(--red-600); }
.link { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.req { color: var(--red-600); }
.small { font-size: 12px; }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--navy-950), var(--navy-800) 60%, var(--navy-700));
    color: #d5e4e8;
    z-index: 60;
    transition: transform .22s ease;
}
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 18px 18px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; min-width: 0; }
.brand:hover { color: #fff; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
    color: #fff;
    box-shadow: 0 6px 18px rgba(23, 162, 162, .35);
    flex: none;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.lg { width: 48px; height: 48px; border-radius: 14px; }
.brand-mark.lg svg { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 14px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; color: #8fb0b8; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-close { display: none; color: #a9c2c8; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 18px; }
.nav-section {
    padding: 16px 10px 6px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: #7fa0a8;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 10px;
    color: #c9dde1;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active {
    background: linear-gradient(90deg, rgba(23, 162, 162, .28), rgba(23, 162, 162, .08));
    color: #fff;
    box-shadow: inset 2px 0 0 var(--teal-500);
}
.nav-icon { display: inline-flex; width: 19px; height: 19px; flex: none; color: #8fb6bd; }
.nav-icon svg { width: 19px; height: 19px; }
.nav-link.active .nav-icon { color: #6fe0e0; }
.nav-badge {
    margin-left: auto;
    min-width: 21px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--red-600);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: #d7e6e9; }
.sidebar-user:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-info strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small { font-size: 11px; color: #8fb0b8; }
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(23, 162, 162, .18);
    color: #7de3e3;
    font-size: 12px;
    font-weight: 700;
    flex: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.app-main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 12px 28px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-eyebrow { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.topbar-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.global-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(340px, 32vw);
    padding: 0 12px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #f7fafb;
    color: var(--faint);
}
.global-search:focus-within { border-color: var(--teal-500); background: #fff; box-shadow: 0 0 0 3px rgba(23, 162, 162, .12); }
.global-search svg { width: 17px; height: 17px; flex: none; }
.global-search input { border: 0; background: transparent; outline: none; width: 100%; font-size: 13px; }
.bell-btn { position: relative; }
.bell-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--red-600);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border: 2px solid #fff;
}
.user-menu { position: relative; }
.user-menu summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    list-style: none;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: #f1f6f7; }
.user-menu-name { font-size: 12.5px; font-weight: 600; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-caret { display: inline-flex; color: var(--faint); transform: rotate(90deg); }
.user-menu-caret svg { width: 15px; height: 15px; }
.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 220px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: var(--shadow);
    z-index: 70;
}
.user-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu-head strong { display: block; font-size: 13px; }
.user-menu-head small { color: var(--muted); font-size: 11.5px; }
.user-menu-panel a, .user-menu-panel button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-2);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.user-menu-panel a:hover, .user-menu-panel button:hover { background: #f1f6f7; }
.user-menu-panel svg { width: 16px; height: 16px; color: var(--muted); }
.user-menu-panel form { margin: 4px 0 0; border-top: 1px solid var(--line); padding-top: 4px; }
.content { padding: 26px 28px 48px; width: 100%; max-width: 1560px; margin: 0 auto; flex: 1; }
.sidebar-backdrop { display: none; }

/* ---------- Icons ---------- */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    flex: none;
}
.icon-btn:hover { border-color: var(--line-strong); background: #f7fafb; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--teal-700); color: #fff; box-shadow: 0 6px 16px rgba(13, 107, 107, .18); }
.btn-primary:hover { background: var(--teal-800); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #f6fafb; border-color: var(--line-strong); color: var(--ink); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 48px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost.btn-sm svg { width: 15px; height: 15px; }

/* ---------- Page head ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-head h2 { margin-bottom: 3px; }
.subtitle { color: var(--muted); font-size: 13px; max-width: 760px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions.end { justify-content: flex-end; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--faint); margin-bottom: 4px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { color: var(--faint); }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    padding: 20px;
    margin-bottom: 20px;
}
.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-foot.left { justify-content: flex-start; }
.card-body { padding: 0; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
    position: relative;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.kpi::after { content: ''; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--teal-500); opacity: .65; }
.kpi.tone-blue::after { background: #3d7ea6; }
.kpi.tone-amber::after { background: var(--amber-600); }
.kpi.tone-slate::after { background: #5d7680; }
.kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--teal-soft);
    color: var(--teal-700);
    flex: none;
}
.kpi.tone-blue .kpi-icon { background: #e8f1f7; color: #2f6b92; }
.kpi.tone-amber .kpi-icon { background: var(--amber-soft); color: var(--amber-700); }
.kpi.tone-slate .kpi-icon { background: #eef2f4; color: #45606a; }
.kpi-icon svg { width: 21px; height: 21px; }
.kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 27px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; margin: 2px 0 1px; }
.kpi-meta { font-size: 11.5px; color: var(--faint); }

/* ---------- Alerts strip ---------- */
.alert-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid #f0dcb4;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--amber-soft), #fffdf8);
    color: var(--ink-2);
    font-size: 13px;
}
.alert-strip:hover { border-color: #e6c98f; color: var(--ink); }
.alert-strip-icon { display: inline-flex; color: var(--amber-700); }
.alert-strip-icon svg { width: 20px; height: 20px; }
.alert-strip-link { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--amber-700); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.alert-strip-link svg { width: 15px; height: 15px; }
.notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #f7fafb;
    font-size: 13px;
    margin-bottom: 16px;
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice-info { background: #eef6f8; border-color: #cfe4e8; color: #24505c; }
.notice-warning { background: var(--amber-soft); border-color: #f0dcb4; color: #6f4a05; }
.notice-error { background: var(--red-soft); border-color: #f3cdca; color: #7d2a25; }
.notice-success { background: var(--green-soft); border-color: #c5e9d8; color: #145c3f; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
.dash-grid .card { margin-bottom: 20px; }
.dash-grid-tables { grid-template-columns: 1.45fr 1fr; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend-dot.ok { background: var(--teal-500); }
.legend-dot.warn { background: #e8a23a; }
.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    height: 210px;
    padding: 8px 4px 0;
    border-bottom: 1px solid var(--line);
}
.chart-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; flex: 1; }
.chart-bar-group { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 100%; width: 100%; }
.chart-bar { position: relative; width: 14px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s ease; }
.chart-bar.in { background: linear-gradient(180deg, var(--teal-500), var(--teal-700)); }
.chart-bar.out { background: linear-gradient(180deg, #f0b45a, #d68a1c); }
.chart-bar em { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; color: var(--muted); }
.chart-label { font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar-list-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-list-head strong { font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; border-radius: 999px; background: #eef3f4; overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal-500), var(--teal-700)); }
.stock-list { list-style: none; margin: 0; padding: 0; }
.stock-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stock-list li:last-child { border-bottom: 0; }
.stock-list-main { min-width: 0; }
.stock-list-main .table-link { display: block; font-size: 13px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.8px; min-width: 620px; }
.data-table th {
    padding: 10px 10px;
    text-align: left;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    font-weight: 650;
    background: #f5f9fa;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.data-table th.num { text-align: right; }
.data-table th.actions { text-align: right; }
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:hover td { background: #fafcfd; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table.compact td { padding: 8px 9px; }
.data-table.compact th { padding: 8px 9px; }
.data-table .table-link { font-weight: 600; color: var(--ink); }
.data-table .table-link:hover { color: var(--teal-700); }
.data-table .subtle { max-width: 320px; }
.data-table td.actions { text-align: right; }
.row-inactive td { background: #fbfbfb; color: var(--muted); }
.row-error td { background: #fff8f7; }
.table-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 2px 12px; font-size: 12px; color: var(--muted); }
.action-group { display: inline-flex; align-items: center; gap: 5px; justify-content: flex-end; }
.action-group form { display: inline-flex; margin: 0; }
.table-link { font-weight: 600; }
.empty-row { color: var(--faint); font-size: 12.5px; padding: 14px 4px; list-style: none; }
.columns-table td { font-size: 12px; }

/* ---------- Badges & chips ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.6;
    white-space: nowrap;
}
.badge svg { width: 11px; height: 11px; }
.badge-ok { background: var(--green-soft); color: var(--green-700); }
.badge-low { background: var(--amber-soft); color: var(--amber-700); }
.badge-out { background: var(--red-soft); color: var(--red-700); }
.badge-neutral { background: #eef2f4; color: #4d6570; }
.badge-teal { background: var(--teal-soft); color: var(--teal-800); }
.chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 7px;
    background: #f1f5f6;
    border: 1px solid #e5edef;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.stock-value { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.stock-value small { color: var(--faint); font-weight: 500; font-size: 10.5px; }
.wh-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-chip {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 6px;
    background: #f2f6f7;
    border: 1px solid #e2ebed;
    color: var(--muted);
    font-size: 10.5px;
    font-family: var(--mono);
    white-space: nowrap;
}
.mini-chip.empty { background: #fdf3f2; border-color: #f3d9d6; color: var(--red-700); }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty-state.small { padding: 26px 14px; }
.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--teal-soft);
    color: var(--teal-700);
    margin-bottom: 12px;
}
.empty-icon.ok { background: var(--green-soft); color: var(--green-700); }
.empty-icon svg { width: 26px; height: 26px; }
.empty-state h3 { font-size: 16px; color: var(--ink); margin-bottom: 4px; }
.empty-state p { font-size: 13px; max-width: 420px; margin: 0 auto 14px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Filters ---------- */
.filters { padding: 14px 16px; margin-bottom: 18px; }
.filters-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.filter-field { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.filter-field.grow { flex: 1 1 240px; min-width: 220px; }
.filter-field.narrow { min-width: 86px; }
.filter-field label { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- Forms ---------- */
.form-card { padding: 0; overflow: hidden; }
.form-section { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section-head { margin-bottom: 16px; }
.form-section-head h3 { font-size: 14px; font-weight: 650; }
.form-section-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input {
    width: 100%;
    height: 41px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    font-size: 13.5px;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 64px; }
select.input { padding-right: 34px; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f7a84' 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 11px center; }
.input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(23, 162, 162, .14); }
.input:disabled { background: #f4f7f8; color: var(--muted); }
.input-error { border-color: var(--red-600); background: #fffafa; }
.error-text { font-size: 11.5px; color: var(--red-700); }
.hint { font-size: 11.5px; color: var(--faint); }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg { position: absolute; left: 12px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.input-action { position: absolute; right: 6px; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.input-action:hover { background: #f0f5f6; }
.input-action svg { width: 17px; height: 17px; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 24px;
    background: #f8fbfb;
    border-top: 1px solid var(--line);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.warehouse-stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.check-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.check-card:hover { border-color: var(--line-strong); background: #fbfdfd; }
.check-card:has(input:checked) { border-color: var(--teal-500); background: var(--teal-soft); }
.check-card input { width: 16px; height: 16px; accent-color: var(--teal-700); }
.check-card span { display: flex; flex-direction: column; }
.check-card strong { font-size: 12.5px; }
.check-card small { color: var(--muted); font-size: 11px; }
.check-line { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; cursor: pointer; }
.check-line input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--teal-700); }
.check-line span { display: flex; flex-direction: column; }
.check-line strong { font-size: 13px; }
.check-line small { color: var(--muted); font-size: 12px; }

/* ---------- Detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
.detail-list { margin: 0; display: grid; gap: 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 12.5px; }
.detail-list dd { margin: 0; text-align: right; font-size: 13px; font-weight: 500; }
.detail-list.horizontal { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.detail-list.horizontal > div { flex-direction: column; align-items: flex-start; gap: 4px; padding: 0; border: 0; }
.detail-list.horizontal dd { text-align: left; }
.note-block { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #f7fafb; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.note-block strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.price-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.price-grid > div { padding: 10px 12px; border-radius: 10px; background: #f7fafb; border: 1px solid var(--line); }
.price-grid span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.price-grid strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; border-color: #f0cfcb; background: #fffdfd; }
.danger-zone .page-actions { margin: 0; }
.danger-zone form { display: inline-flex; margin: 0; }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-xs);
    border-left: 3px solid #c3d2d6;
}
.stat.tone-ok { border-left-color: var(--green-600); }
.stat.tone-out { border-left-color: var(--red-600); }
.stat.tone-warn { border-left-color: var(--amber-600); }
.stat-label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.stat-value { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.stat-note { display: block; font-size: 11px; color: var(--faint); }

/* ---------- Movement form ---------- */
.movement-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0; }
.movement-main { border-right: 1px solid var(--line); }
.movement-aside { padding: 22px; background: #f8fbfb; }
.summary-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 12px; }
.summary-card dl { margin: 0 0 14px; display: grid; gap: 9px; }
.summary-card dl > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.summary-card dt { color: var(--muted); }
.summary-card dd { margin: 0; text-align: right; font-weight: 600; max-width: 160px; }
.summary-note { display: flex; gap: 6px; font-size: 11.5px; color: var(--faint); margin-bottom: 14px; }
.summary-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.summary-card .btn { margin-top: 8px; }
.part-picker { position: relative; }
.selected-part {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--teal-500);
    border-radius: 12px;
    background: var(--teal-soft);
}
.selected-part-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #fff;
    color: var(--teal-700);
    flex: none;
}
.selected-part-icon svg { width: 19px; height: 19px; }
.selected-part-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.selected-part-info strong { font-size: 13.5px; }
.selected-part-info span { font-size: 11.5px; color: var(--muted); }
.part-search-box { position: relative; }
.part-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 5px;
}
.part-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.part-result:hover, .part-result:focus { background: #f1f7f8; outline: none; }
.part-result-main { display: flex; flex-direction: column; min-width: 0; }
.part-result-main strong { font-size: 12.5px; }
.part-result-main span { font-size: 11px; color: var(--muted); }
.part-result-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.part-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.segment { position: relative; cursor: pointer; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 46px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    transition: border-color .15s, background .15s, color .15s;
}
.segment span svg { width: 17px; height: 17px; }
.segment input:checked + span { border-color: var(--teal-500); background: var(--teal-soft); color: var(--teal-800); box-shadow: 0 0 0 2px rgba(23, 162, 162, .12); }
.segment-salida input:checked + span { border-color: #e2a59f; background: var(--red-soft); color: var(--red-700); box-shadow: 0 0 0 2px rgba(192, 74, 66, .1); }
.segment-ajuste input:checked + span { border-color: #b9cdd2; background: #eef4f5; color: var(--ink-2); box-shadow: 0 0 0 2px rgba(95, 122, 132, .1); }
.stock-hint {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 9px;
    background: #f4f8f9;
    border: 1px dashed var(--line-strong);
    font-size: 12.5px;
    color: var(--muted);
}
.stock-hint strong { color: var(--ink); }

/* ---------- Catalogs ---------- */
.catalog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.inline-add { display: flex; gap: 8px; margin-bottom: 14px; }
.catalog-list { list-style: none; margin: 0; padding: 0; }
.catalog-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}
.catalog-list li:last-child { border-bottom: 0; }
.catalog-list li.is-inactive { opacity: .6; }
.catalog-edit { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.input-flat { height: 34px; border-color: transparent; background: transparent; padding: 0 6px; font-weight: 600; font-size: 13px; }
.input-flat:hover { background: #f5f9fa; }
.input-flat:focus { background: #fff; }
.catalog-count { color: var(--faint); font-size: 11px; white-space: nowrap; }
.catalog-list form { margin: 0; }

/* ---------- Users ---------- */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .avatar { background: #eaf4f5; color: var(--teal-700); }
.user-cell strong { display: block; font-size: 13px; }
.popover { position: relative; }
.popover > summary { list-style: none; cursor: pointer; }
.popover > summary::-webkit-details-marker { display: none; }
.popover-body {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 250px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 50;
}
.popover-body strong { font-size: 12.5px; }
.popover-body .hint { margin-bottom: 4px; }

/* ---------- Two col & file ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 26px 18px;
    border: 2px dashed var(--line-strong);
    border-radius: 12px;
    background: #fafcfd;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.file-drop:hover, .file-drop.has-file { border-color: var(--teal-500); background: var(--teal-soft); }
.file-drop svg { width: 26px; height: 26px; color: var(--teal-700); }
.file-drop-title { font-size: 13px; font-weight: 600; }
.file-drop-hint { font-size: 11.5px; color: var(--muted); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-name { font-size: 12px; color: var(--teal-800); font-weight: 600; margin-top: 6px; }
.error-list { margin: 0; padding-left: 16px; font-size: 11.5px; color: var(--red-700); }
.error-list.padded { padding: 4px 24px 18px 40px; font-size: 12.5px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding-top: 16px; flex-wrap: wrap; }
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 600;
}
.page-link:hover { border-color: var(--line-strong); background: #f7fafb; color: var(--ink); }
.page-link.active { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.page-link.disabled { opacity: .45; pointer-events: none; }
.page-link svg { width: 15px; height: 15px; }
.page-dots { color: var(--faint); padding: 0 4px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 84px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    font-size: 13px;
    color: var(--ink);
    animation: toast-in .18s ease;
}
.toast-icon { display: inline-flex; color: var(--teal-700); margin-top: 1px; }
.toast-icon svg { width: 17px; height: 17px; }
.toast-success { border-left: 3px solid var(--green-600); }
.toast-success .toast-icon { color: var(--green-700); }
.toast-error { border-left: 3px solid var(--red-600); }
.toast-error .toast-icon { color: var(--red-700); }
.toast-warning { border-left: 3px solid var(--amber-600); }
.toast-warning .toast-icon { color: var(--amber-700); }
.toast-info { border-left: 3px solid var(--teal-600); }
.toast-close { margin-left: auto; border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 0 2px; font-size: 18px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Auth ---------- */
.auth-body { background: var(--navy-950); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr); min-height: 100vh; }
.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 42px 52px;
    color: #e6f1f3;
    background:
        radial-gradient(1100px 520px at 82% 8%, rgba(23, 162, 162, .26), transparent 60%),
        radial-gradient(700px 420px at 8% 92%, rgba(28, 155, 104, .16), transparent 60%),
        linear-gradient(155deg, var(--navy-950), var(--navy-800) 65%, #0d3d49);
    overflow: hidden;
}
.auth-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
    background-size: 42px 42px;
    pointer-events: none;
}
.auth-hero-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand { font-size: 15px; font-weight: 650; letter-spacing: -.01em; color: #fff; }
.auth-hero-copy { position: relative; z-index: 1; max-width: 620px; padding: 40px 0; }
.eyebrow { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-700); }
.eyebrow.light { color: #6fe0e0; }
.auth-hero-copy h1 { font-size: clamp(28px, 3.2vw, 44px); line-height: 1.12; letter-spacing: -.02em; margin: 14px 0 16px; color: #fff; }
.auth-hero-copy > p { font-size: 15px; line-height: 1.65; color: #b7cdd3; max-width: 560px; }
.auth-features { display: grid; gap: 14px; margin-top: 30px; max-width: 540px; }
.auth-features > div { display: flex; gap: 12px; align-items: flex-start; }
.auth-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .07);
    color: #6fe0e0;
    flex: none;
}
.auth-feature-icon svg { width: 19px; height: 19px; }
.auth-features strong { display: block; font-size: 13.5px; color: #fff; }
.auth-features small { font-size: 12px; color: #9db8bf; }
.auth-quote { position: relative; z-index: 1; font-size: 12.5px; font-style: italic; color: #8fb0b8; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #f4f8f9; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: 0 24px 70px rgba(6, 28, 36, .12); }
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { font-size: 23px; margin: 6px 0 6px; }
.auth-card-head p { font-size: 13px; color: var(--muted); }
.auth-help { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); text-align: center; }
.auth-demo-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--teal-700); }
.auth-demo-link:hover { color: var(--teal-800); }
.auth-demo-link svg { width: 15px; height: 15px; }
.auth-panel .toast-stack { top: 18px; right: 18px; }

/* ---------- Error page ---------- */
.error-card { max-width: 520px; margin: 8vh auto; padding: 34px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.error-code { display: inline-block; font-size: 54px; font-weight: 800; letter-spacing: -.04em; color: var(--teal-700); line-height: 1; }
.error-card h1 { font-size: 20px; margin: 10px 0 8px; }
.error-card p { color: var(--muted); font-size: 13.5px; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
    .dash-grid, .dash-grid-tables { grid-template-columns: 1fr; }
    .movement-grid { grid-template-columns: 1fr; }
    .movement-main { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 1080px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(6, 28, 36, .45); z-index: 55; }
    .app-main { margin-left: 0; }
    .menu-btn, .sidebar-close { display: inline-flex; }
    .topbar { padding: 10px 18px; }
    .content { padding: 20px 18px 40px; }
    .global-search { width: min(300px, 36vw); }
    .catalog-grid, .two-col, .detail-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid .span-2 { grid-column: span 2; }
    .form-grid .span-3 { grid-column: 1 / -1; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { min-height: 100vh; }
}
@media (max-width: 720px) {
    h2 { font-size: 20px; }
    .topbar-eyebrow, .user-menu-name { display: none; }
    .global-search { width: 100%; }
    .topbar-right { flex: 1; justify-content: flex-end; }
    .global-search { display: none; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi { padding: 13px; gap: 10px; }
    .kpi-icon { width: 36px; height: 36px; }
    .kpi-value { font-size: 21px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
    .form-section { padding: 18px 16px; }
    .form-actions { padding: 14px 16px; }
    .stat-row { grid-template-columns: 1fr 1fr; }
    .filter-actions { margin-left: 0; width: 100%; }
    .filter-actions .btn { flex: 1; }
    .filters-row { gap: 9px; }
    .filter-field, .filter-field.grow { min-width: 100%; }
    .page-head { align-items: flex-start; }
    .page-actions { width: 100%; }
    .detail-list > div { flex-direction: column; gap: 2px; }
    .detail-list dd { text-align: left; }
    .price-grid { grid-template-columns: 1fr 1fr; }
    .segmented { grid-template-columns: 1fr; }
    .toast-stack { top: 70px; right: 12px; left: 12px; width: auto; }
    .table-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
    .empty-state { padding: 36px 12px; }
}
@media (max-width: 420px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: 1fr; }
    .content { padding: 16px 12px 34px; }
}

@media print {
    .sidebar, .topbar, .toast-stack, .page-actions, .filters, .pagination, .btn, .sidebar-backdrop { display: none !important; }
    .app-main { margin: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
    body { background: #fff; }
}
