/* Base */
:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #667085;
    --line: #d9e0e8;
    --sidebar: #111827;
    --sidebar-soft: #1f2937;
    --blue: #246bfe;
    --green: #16a34a;
    --orange: #f59e0b;
    --red: #dc2626;
    --gray: #64748b;
    --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

input,
select,
button {
    font: inherit;
}

/* Layout */
.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: #fff;
    padding: 24px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--blue);
    font-weight: 800;
}

.brand small,
.eyebrow,
td small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.sidebar .brand small {
    color: #a8b3c7;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    padding: 11px 12px;
    border-radius: 8px;
    color: #d6deec;
}

.nav a.active,
.nav a:hover {
    background: var(--sidebar-soft);
    color: #fff;
}

.main {
    padding: 28px;
}

.topbar,
.public-header,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.section-head {
    margin-top: 28px;
}

.section-head.flush {
    margin-top: 0;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 20px;
}

.eyebrow {
    margin-bottom: 4px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.user-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.user-switch label {
    color: var(--muted);
    font-size: 13px;
}

/* Public */
.public-body {
    background: #eef3f8;
}

.public-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.public-header {
    padding: 22px 0;
}

.public-summary {
    margin-bottom: 28px;
}

/* Cards */
.metric-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.metric-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card,
.stock-card,
.panel,
.logic-block {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 20px;
}

.metric-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.metric-card.compact strong {
    font-size: 26px;
}

.metric-card.large strong {
    font-size: 34px;
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}

.stock-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stock-card {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.stock-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stock-title strong {
    font-size: 22px;
}

.stock-title span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #edf2f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stock-card p {
    min-height: 44px;
    color: var(--muted);
}

.price {
    font-size: 24px;
    font-weight: 800;
}

.trend-row {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.btn.primary {
    background: var(--blue);
    color: #fff;
}

.btn.secondary {
    background: #eaf1ff;
    color: #174ea6;
}

.btn.ghost {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.btn.full {
    width: 100%;
}

/* Forms */
.panel {
    margin-bottom: 20px;
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 8px 10px;
}

.checkline {
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
}

.checkline input {
    width: auto;
    min-height: auto;
}

.estimate-box {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
}

.estimate-box strong {
    color: var(--ink);
}

.mini-input {
    min-height: 32px;
    padding: 6px 8px;
}

.inline-form,
.stack-actions {
    display: grid;
    gap: 6px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td strong {
    display: block;
}

.empty,
.muted {
    color: var(--muted);
}

/* Status */
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e2e8f0;
    color: var(--gray);
    font-size: 12px;
    font-weight: 800;
    text-transform: capitalize;
}

.badge.active,
.badge.activa {
    background: #dcfce7;
    color: #166534;
}

.badge.pending,
.badge.en_proceso {
    background: #fef3c7;
    color: #92400e;
}

.badge.cerrada {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.vencida,
.badge.cancelada {
    background: #e5e7eb;
    color: #4b5563;
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Bars */
.temperature,
.progress {
    display: grid;
    gap: 6px;
}

.temp-track,
.progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.temp-fill,
.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.temp-fill {
    background: linear-gradient(90deg, #2563eb, #f59e0b, #dc2626);
}

.progress-fill {
    background: var(--green);
}

.logic-block {
    padding: 18px;
    color: var(--muted);
}

.logic-block strong {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
}

/* Responsive */
@media (max-width: 1100px) {
    .stock-grid,
    .metric-grid.three,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .main {
        padding: 18px;
    }

    .topbar,
    .public-header,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .stock-grid,
    .metric-grid.three,
    .metric-grid.two,
    .form-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 24px;
    }
}
.fill-0 { width: 0%; }
.fill-1 { width: 1%; }
.fill-2 { width: 2%; }
.fill-3 { width: 3%; }
.fill-4 { width: 4%; }
.fill-5 { width: 5%; }
.fill-6 { width: 6%; }
.fill-7 { width: 7%; }
.fill-8 { width: 8%; }
.fill-9 { width: 9%; }
.fill-10 { width: 10%; }
.fill-11 { width: 11%; }
.fill-12 { width: 12%; }
.fill-13 { width: 13%; }
.fill-14 { width: 14%; }
.fill-15 { width: 15%; }
.fill-16 { width: 16%; }
.fill-17 { width: 17%; }
.fill-18 { width: 18%; }
.fill-19 { width: 19%; }
.fill-20 { width: 20%; }
.fill-21 { width: 21%; }
.fill-22 { width: 22%; }
.fill-23 { width: 23%; }
.fill-24 { width: 24%; }
.fill-25 { width: 25%; }
.fill-26 { width: 26%; }
.fill-27 { width: 27%; }
.fill-28 { width: 28%; }
.fill-29 { width: 29%; }
.fill-30 { width: 30%; }
.fill-31 { width: 31%; }
.fill-32 { width: 32%; }
.fill-33 { width: 33%; }
.fill-34 { width: 34%; }
.fill-35 { width: 35%; }
.fill-36 { width: 36%; }
.fill-37 { width: 37%; }
.fill-38 { width: 38%; }
.fill-39 { width: 39%; }
.fill-40 { width: 40%; }
.fill-41 { width: 41%; }
.fill-42 { width: 42%; }
.fill-43 { width: 43%; }
.fill-44 { width: 44%; }
.fill-45 { width: 45%; }
.fill-46 { width: 46%; }
.fill-47 { width: 47%; }
.fill-48 { width: 48%; }
.fill-49 { width: 49%; }
.fill-50 { width: 50%; }
.fill-51 { width: 51%; }
.fill-52 { width: 52%; }
.fill-53 { width: 53%; }
.fill-54 { width: 54%; }
.fill-55 { width: 55%; }
.fill-56 { width: 56%; }
.fill-57 { width: 57%; }
.fill-58 { width: 58%; }
.fill-59 { width: 59%; }
.fill-60 { width: 60%; }
.fill-61 { width: 61%; }
.fill-62 { width: 62%; }
.fill-63 { width: 63%; }
.fill-64 { width: 64%; }
.fill-65 { width: 65%; }
.fill-66 { width: 66%; }
.fill-67 { width: 67%; }
.fill-68 { width: 68%; }
.fill-69 { width: 69%; }
.fill-70 { width: 70%; }
.fill-71 { width: 71%; }
.fill-72 { width: 72%; }
.fill-73 { width: 73%; }
.fill-74 { width: 74%; }
.fill-75 { width: 75%; }
.fill-76 { width: 76%; }
.fill-77 { width: 77%; }
.fill-78 { width: 78%; }
.fill-79 { width: 79%; }
.fill-80 { width: 80%; }
.fill-81 { width: 81%; }
.fill-82 { width: 82%; }
.fill-83 { width: 83%; }
.fill-84 { width: 84%; }
.fill-85 { width: 85%; }
.fill-86 { width: 86%; }
.fill-87 { width: 87%; }
.fill-88 { width: 88%; }
.fill-89 { width: 89%; }
.fill-90 { width: 90%; }
.fill-91 { width: 91%; }
.fill-92 { width: 92%; }
.fill-93 { width: 93%; }
.fill-94 { width: 94%; }
.fill-95 { width: 95%; }
.fill-96 { width: 96%; }
.fill-97 { width: 97%; }
.fill-98 { width: 98%; }
.fill-99 { width: 99%; }
.fill-100 { width: 100%; }
