/* Supérior by SnowmaticONE */
:root {
    --brand: #0b3d91;
    --brand-strong: #082c6b;
    --brand-soft: #e8eefb;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --text: #1d2433;
    --muted: #5b6475;
    --border: #dfe3ec;
    --ok: #137a4b;
    --ok-soft: #e3f5ec;
    --warn: #9a5b00;
    --warn-soft: #fdf1dc;
    --error: #b42318;
    --error-soft: #fdeceb;
    --info: #0b5cad;
    --info-soft: #e5f0fb;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --brand: #7aa5ff;
        --brand-strong: #a8c4ff;
        --brand-soft: #1b2a4a;
        --bg: #0f131a;
        --surface: #171c25;
        --surface-2: #1d2330;
        --text: #e6e9f0;
        --muted: #9aa3b5;
        --border: #2b3242;
        --ok: #5fd39a;
        --ok-soft: #16302a;
        --warn: #f0b75a;
        --warn-soft: #33281a;
        --error: #ff8a80;
        --error-soft: #3a1f1f;
        --info: #8cc1ff;
        --info-soft: #182a40;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
a { color: var(--brand); }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }

/* Brand: "Supérior" with the slogan smaller beside it. */
.brand { display: inline-flex; align-items: baseline; gap: .4rem; white-space: nowrap; }
.brand-name { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 1.45rem; color: var(--brand); letter-spacing: .01em; }
.brand-slogan { font-size: .72rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.brand-large .brand-name { font-size: 2.1rem; }
.brand-large .brand-slogan { font-size: .85rem; }
.brand-link, .auth-brand { text-decoration: none; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-head { padding: 1.1rem 1.1rem .75rem; display: flex; align-items: center; justify-content: space-between; }
.menu-toggle { display: none; }
.nav { display: flex; flex-direction: column; padding: 0 .6rem; flex: 1; }
.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem .6rem .3rem; font-weight: 600; }
.nav a { color: var(--text); text-decoration: none; padding: .42rem .6rem; border-radius: 7px; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar-user { border-top: 1px solid var(--border); padding: .9rem 1.1rem; font-size: .88rem; }
.user-name { font-weight: 600; }
.user-mail { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; min-width: 0; padding: 2rem 2.25rem 3rem; max-width: 1280px; }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
    .menu-toggle { display: inline-block; }
    .sidebar .nav, .sidebar .sidebar-user { display: none; }
    .sidebar.open .nav, .sidebar.open .sidebar-user { display: flex; flex-direction: column; }
    .content { padding: 1.25rem 1rem 2.5rem; }
}

/* Page parts */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.page-narrow { max-width: 640px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.tile-label { font-size: .8rem; color: var(--muted); }
.tile-value { font-size: 1.65rem; font-weight: 700; margin-top: .15rem; }
.tile-hint { font-size: .8rem; color: var(--muted); }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input[type=search] { min-width: 240px; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 1rem 0; }

/* Forms */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .9rem; margin-bottom: .85rem; }
label.check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 400; margin-bottom: .4rem; }
input, select, textarea {
    font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: .5rem .65rem; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
textarea { min-height: 8rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
fieldset { border: none; padding: 0; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.span-2 { grid-column: span 2; }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
details.address { margin: .25rem 0 1rem; }
details.address summary { cursor: pointer; font-weight: 500; margin-bottom: .75rem; }
.validation-message { color: var(--error); font-size: .82rem; font-weight: 400; }
.invalid { border-color: var(--error); }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; }
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-bottom: .85rem; }

button, .button {
    font: inherit; font-weight: 600; border-radius: 8px; padding: .5rem 1rem; cursor: pointer;
    border: 1px solid var(--brand); background: var(--brand); color: #fff; text-decoration: none; display: inline-block;
}
@media (prefers-color-scheme: dark) { button, .button { color: #0b1220; } }
button:hover, .button:hover { background: var(--brand-strong); }
button:disabled { opacity: .55; cursor: default; }
button.secondary, .button.secondary { background: var(--surface); color: var(--brand); border-color: var(--border); }
button.secondary:hover { background: var(--surface-2); }
button.danger { background: var(--error); border-color: var(--error); color: #fff; }
button.danger.secondary { background: var(--surface); color: var(--error); border-color: var(--border); }
button.link { background: none; border: none; color: var(--brand); padding: 0; font-weight: 500; }
button.link:hover { text-decoration: underline; background: none; }
button.small, .button.small { padding: .25rem .6rem; font-size: .82rem; }
button.icon { background: none; border: none; color: var(--muted); padding: .2rem .4rem; font-size: 1rem; }
button.wide { width: 100%; }

.alert { border-radius: 8px; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .92rem; }
.alert-error { background: var(--error-soft); color: var(--error); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--border); padding: .75rem; border-radius: 8px; word-break: break-all; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .3rem; font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: .75rem; border-radius: 8px; }
.qr { background: #fff; padding: .75rem; border-radius: 8px; display: inline-block; }
.qr svg { width: 190px; height: 190px; display: block; }
pre.config { background: var(--surface-2); border: 1px solid var(--border); padding: .75rem; border-radius: 8px; overflow-x: auto; font-size: .8rem; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 1rem; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal-wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1.25rem; }
.modal-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }

/* Pager, tabs, chart */
.pager { display: flex; align-items: center; gap: .75rem; justify-content: flex-end; margin-top: .75rem; color: var(--muted); font-size: .88rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs button { background: none; border: none; color: var(--muted); border-bottom: 2px solid transparent; border-radius: 0; padding: .5rem .8rem; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: .5rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.bar { background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.bar-col:hover .bar { opacity: 1; }
.bar-label { font-size: .65rem; color: var(--muted); text-align: center; margin-top: 3px; white-space: nowrap; overflow: hidden; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.dot-ok { background: var(--ok); }
.dot-error { background: var(--error); }
.dot-muted { background: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .1rem .4rem; cursor: pointer; }
.picker-selected { display: flex; gap: .75rem; align-items: center; padding: .45rem .65rem; border: 1px solid var(--border); border-radius: 8px; }
.picker-results { list-style: none; padding: .25rem 0; margin: .25rem 0 0; }
.picker-results li { padding: .2rem 0; }
iframe.mail-preview { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }

/* Sign-in pages */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 2rem; width: 100%; max-width: 480px; }
.auth-card.wide { max-width: 640px; }
.auth-brand { display: block; text-align: center; margin-bottom: 1.5rem; }
.auth-card h1 { text-align: center; font-size: 1.35rem; }
.auth-card .lead { text-align: center; color: var(--muted); margin: 0 0 1.25rem; }
.auth-links { display: flex; flex-direction: column; gap: .35rem; align-items: center; margin-top: 1.25rem; font-size: .9rem; }
.auth-foot { color: var(--muted); font-size: .85rem; margin-top: 1.25rem; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; margin: 1.1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

#blazor-error-ui { background: var(--warn-soft); color: var(--warn); bottom: 0; display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.auth-card:has(.register-form) { max-width: 640px; }
