/* ===================================================================
   Manport Consultas — sistema visual
   Paleta tomada del logo: azul/teal #0079A6 y grises corporativos.
   =================================================================== */
:root {
    --brand: #0079A6;
    --brand-dark: #025E82;
    --brand-deep: #063a52;
    --brand-cyan: #17A9D6;
    --navy-1: #062f42;
    --navy-2: #0a4763;

    --ink: #1b2a35;
    --muted: #5b6b78;
    --line: #e3e8ec;
    --bg: #eef2f5;
    --card: #ffffff;

    --ok: #1a9d6b;
    --ok-bg: #e6f6ef;
    --info: #0f7bb5;
    --info-bg: #e5f2fa;
    --warn: #c9820a;
    --warn-bg: #fcf3e2;
    --danger: #d0453b;
    --danger-bg: #fbeae8;

    --radius: 14px;
    --shadow: 0 1px 2px rgba(16,42,63,.05), 0 8px 24px rgba(16,42,63,.06);
    --shadow-sm: 0 1px 2px rgba(16,42,63,.06);
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--ink);
}

/* ---------- Layout ---------- */
.page {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: linear-gradient(185deg, var(--navy-2) 0%, var(--navy-1) 100%);
    color: #eaf2f7;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand {
    padding: 1.4rem 1.1rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar .brand img {
    width: 100%;
    max-width: 168px;
    display: block;
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

.sidebar .brand small {
    display: block;
    margin-top: .55rem;
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
}

.sidebar .nav {
    padding: 1rem .7rem;
    gap: .18rem;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: rgba(255,255,255,.78);
    border-radius: 9px;
    padding: .62rem .8rem;
    font-size: .95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .12s ease, color .12s ease;
}

.sidebar .nav-link .ico {
    width: 18px;
    text-align: center;
    opacity: .85;
    font-size: 1rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(23,169,214,.16);
    color: #fff;
    border-left-color: var(--brand-cyan);
}

.sidebar .sidebar-foot {
    margin-top: auto;
    padding: 1rem 1.1rem;
    font-size: .72rem;
    color: rgba(255,255,255,.4);
    border-top: 1px solid rgba(255,255,255,.07);
}

main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    min-height: 62px;
    background-color: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem 1.4rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--ink);
}

.user-box {
    display: flex;
    align-items: center;
    gap: .7rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-box .who {
    font-size: .9rem;
    color: var(--muted);
}

.content {
    padding: 1.6rem 1.4rem 2.5rem;
    flex: 1;
}

/* ---------- Page heading ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.3rem;
    flex-wrap: wrap;
}

.page-head h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -.01em;
}

.page-head .sub {
    color: var(--muted);
    font-size: .92rem;
    margin-top: .15rem;
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--card);
}

.card .card-body { padding: 1.15rem 1.25rem; }

/* ---------- KPI / stat cards ---------- */
.stat {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    height: 100%;
}

.stat::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--brand);
}

.stat .stat-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    font-weight: 600;
}

.stat .stat-value {
    font-size: 2.15rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: .35rem;
    color: var(--ink);
}

.stat .stat-hint {
    font-size: .82rem;
    color: var(--muted);
    margin-top: .3rem;
}

.stat.brand { background: linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; }
.stat.brand::before { background: var(--brand-cyan); }
.stat.brand .stat-label { color: rgba(255,255,255,.82); }
.stat.brand .stat-value { color: #fff; }
.stat.brand .stat-hint { color: rgba(255,255,255,.85); }

.stat.tone-ok::before { background: var(--ok); }
.stat.tone-info::before { background: var(--info); }
.stat.tone-warn::before { background: var(--warn); }
.stat.tone-danger::before { background: var(--danger); }

/* ---------- Aging / status chips ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 600;
    padding: .22rem .6rem;
    border-radius: 999px;
    line-height: 1.2;
    white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-ok { color: var(--ok); background: var(--ok-bg); }
.chip-info { color: var(--info); background: var(--info-bg); }
.chip-warn { color: var(--warn); background: var(--warn-bg); }
.chip-danger { color: var(--danger); background: var(--danger-bg); }
.chip-neutral { color: var(--muted); background: #eef1f4; }

/* segmented aging bar */
.aging-bar {
    display: flex;
    height: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #eef1f4;
}
.aging-bar > span { display: block; }
.aging-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.4rem;
    margin-top: .9rem;
}
.aging-legend .item { display: flex; align-items: center; gap: .5rem; font-size: .86rem; color: var(--muted); }
.aging-legend .swatch { width: 12px; height: 12px; border-radius: 4px; }
.aging-legend b { color: var(--ink); }

.seg-ok { background: var(--ok); }
.seg-info { background: var(--info); }
.seg-warn { background: var(--warn); }
.seg-danger { background: var(--danger); }

/* ---------- Tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.table {
    margin: 0;
    --bs-table-hover-bg: #f4f8fb;
}
.table thead th {
    background: #f6f8fa;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    padding: .7rem 1rem;
}
.table tbody td {
    padding: .72rem 1rem;
    border-bottom: 1px solid #eef1f4;
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.mono { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .01em; }

/* ---------- Buttons (brand) ---------- */
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-deep);
    --bs-btn-active-border-color: var(--brand-deep);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
}
.btn { border-radius: 9px; font-weight: 500; }
.btn-sm { border-radius: 7px; }

.form-control, .form-select { border-radius: 9px; border-color: var(--line); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(0,121,166,.15);
}
.form-label.small { color: var(--muted); font-weight: 600; }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(23,169,214,.35), transparent 60%),
        radial-gradient(1000px 600px at 100% 110%, rgba(0,121,166,.30), transparent 55%),
        linear-gradient(160deg, var(--navy-2), var(--navy-1));
}

.login-card {
    width: 100%;
    max-width: 410px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 2rem 1.9rem;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

.login-card .login-logo {
    display: block;
    margin: 0 auto 1.1rem;
    max-width: 200px;
}

.login-card h1 {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: .2rem;
}

.login-card .login-sub {
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: 1.4rem;
}

.login-foot {
    text-align: center;
    margin-top: 1.4rem;
    font-size: .74rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.6);
}

/* ---------- Misc ---------- */
.badge-soft {
    background: var(--info-bg);
    color: var(--info);
    font-weight: 600;
    border-radius: 7px;
    padding: .28rem .55rem;
    font-size: .78rem;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .page { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex: none;
        position: static;
        height: auto;
    }
    .sidebar .brand { display: flex; align-items: center; gap: 1rem; }
    .sidebar .brand img { max-width: 140px; }
    .sidebar .brand small { margin-top: 0; }
    .sidebar .nav { flex-direction: row; overflow-x: auto; padding: .5rem .6rem; }
    .sidebar .nav-link { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
    .sidebar .nav-link.active { border-left: 0; border-bottom-color: var(--brand-cyan); }
    .sidebar .sidebar-foot { display: none; }
    .topbar { position: static; }
}
