:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #667085;
    --border: #e1e4ea;
    --accent: #1f6feb;
    --accent-soft: #e8f0fe;
    --good: #12805c;
    --bad: #c4321c;
    --radius: 10px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; }
a { color: var(--accent); }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 1rem;
}
.brand { display: flex; flex-direction: column; margin-bottom: 1.5rem; }
.brand span { color: var(--muted); font-size: .85rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar nav a { padding: .5rem .75rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-group { margin: .75rem .75rem .15rem; font-size: .75rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
@media (max-width: 760px) { .nav-group { display: none; } }
.user { border-top: 1px solid var(--border); padding-top: .75rem; display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }
.content { flex: 1; padding: 1.5rem; max-width: 1100px; min-width: 0; }
.content.public { margin: 0 auto; }

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
    .brand { margin-bottom: .5rem; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .content { padding: 1rem; }
}

/* Building blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.35rem; font-weight: 600; margin-top: .25rem; }
.stat .sub { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.toolbar { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; }
.in { color: var(--good); }
.out { color: var(--bad); }

/* Forms */
.form { display: grid; gap: .9rem; max-width: 520px; }
.form.inline { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); max-width: none; align-items: end; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
input, select, textarea {
    font: inherit; color: var(--text); padding: .55rem .65rem; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.hint { color: var(--muted); font-size: .85rem; }

button, .btn {
    font: inherit; cursor: pointer; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--accent);
    background: var(--accent); color: #fff; text-decoration: none; display: inline-block;
}
button.secondary, .btn.secondary { background: var(--surface); color: var(--accent); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; }
button:disabled { opacity: .6; cursor: default; }

.alert { padding: .75rem 1rem; border-radius: 8px; background: #fdecea; color: var(--bad); margin-bottom: 1rem; }
.success { padding: .75rem 1rem; border-radius: 8px; background: #e7f6ef; color: var(--good); margin-bottom: 1rem; }

.login { max-width: 380px; margin: 10vh auto 0; }
.login h1 { text-align: center; }

.tabs { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }
tr.muted td { color: var(--muted); }
.lines td input, .lines td select { width: 100%; min-width: 90px; }
.lines td.actions { width: 1%; }
.totals { display: flex; gap: 2rem; justify-content: flex-end; margin-top: .75rem; flex-wrap: wrap; }
.totals .stat .value { text-align: right; }
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .8rem; background: var(--accent-soft); color: var(--accent); }
.badge.Confirmed { background: #e7f6ef; color: var(--good); }
.badge.Cancelled { background: #fdecea; color: var(--bad); }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

.report-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
table.statement td { border-bottom: 0; padding: .35rem .25rem; }
table.statement td.indent { padding-left: 1.25rem; color: var(--muted); }
table.statement tr.total td { font-weight: 600; border-top: 1px solid var(--border); }
table.statement tr.grand td { font-size: 1.1rem; }
.bar { height: 8px; border-radius: 4px; margin: 2px 0; min-width: 2px; }
.in-bar { background: var(--good); }
.out-bar { background: var(--bad); }

.validation-message { color: var(--bad); font-size: .85rem; }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Ocurrió un error."; }
