:root {
    --navy: #0c2340;
    --navy-2: #16395f;
    --ink: #18324f;
    --muted: #64748b;
    --teal: #079a9a;
    --purple: #5d2a7d;
    --amber: #f1a43c;
    --red: #d65454;
    --blue: #2f6fa1;
    --line: #dbe5ee;
    --surface: #ffffff;
    --background: #edf3f8;
    --radius: 20px;
    --shadow: 0 18px 45px rgba(12, 35, 64, .10);
}

* { box-sizing: border-box; }
html { font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--background); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
code { background: #e8eef4; padding: .15rem .35rem; border-radius: 5px; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 250px; padding: 25px 18px;
    color: white; background: linear-gradient(180deg, #071d35, #163f68);
    display: flex; flex-direction: column; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.16); }
.brand img { width: 145px; height: 58px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.brand span { font-weight: 700; font-size: 15px; }
.sidebar nav { display: grid; gap: 6px; margin-top: 24px; }
.sidebar nav a { padding: 12px 15px; border-radius: 11px; text-decoration: none; color: #c9d8e7; font-weight: 700; font-size: 14px; }
.sidebar nav a:hover, .sidebar nav a.active { color: white; background: rgba(7,154,154,.30); }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.16); padding: 20px 10px 0; display: grid; gap: 7px; }
.sidebar-user a { color: #a9c3da; font-size: 13px; }

.main { margin-left: 250px; padding: 28px 35px 55px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; gap: 25px; align-items: center; margin-bottom: 25px; }
.topbar h1 { margin: 0; font-size: clamp(25px, 2.4vw, 38px); }
.topbar p { margin: 7px 0 0; color: var(--muted); }
.institutional-logos { display: flex; align-items: center; gap: 22px; }
.institutional-logos img:first-child { width: 58px; height: 58px; object-fit: contain; }
.institutional-logos img:last-child { width: 170px; height: 55px; object-fit: contain; }

.card, .empty-state, .map-report { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { padding: 25px; }
.card h2 { margin: 0 0 10px; font-size: 21px; }
.card > p { color: var(--muted); line-height: 1.55; }
.content-grid { display: grid; gap: 18px; margin-top: 20px; }
.two-columns { grid-template-columns: repeat(2, minmax(0,1fr)); }
.three-columns { grid-template-columns: repeat(3, minmax(0,1fr)); }
.section-title { margin: 18px 0; }
.section-title h2 { margin: 0; font-size: 26px; }.section-title p { margin: 4px 0; color: var(--muted); }

.kpi-grid { display: grid; gap: 16px; margin: 18px 0; }
.kpi-grid.five { grid-template-columns: repeat(5, minmax(0,1fr)); }
.kpi-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.kpi { position: relative; overflow: hidden; min-height: 150px; padding: 23px; background: white; border-radius: 18px; box-shadow: var(--shadow); border-top: 7px solid var(--teal); }
.kpi span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; }
.kpi strong { display: block; margin: 10px 0 7px; font-size: 39px; line-height: 1; }
.kpi small { font-weight: 700; color: var(--ink); }
.kpi.red { border-color: var(--red); }.kpi.purple { border-color: var(--purple); }.kpi.amber { border-color: var(--amber); }.kpi.blue { border-color: var(--blue); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 0 0 22px; padding: 15px; background: white; border-radius: 15px; box-shadow: 0 8px 25px rgba(12,35,64,.07); }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
input, select { min-height: 42px; padding: 9px 11px; color: var(--ink); background: white; border: 1px solid #cbd8e4; border-radius: 9px; font: inherit; }
select[multiple] { min-width: 330px; min-height: 125px; }
label small { font-weight: 400; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 17px; border: 0; border-radius: 9px; background: #e5edf4; color: var(--ink); font-weight: 800; text-decoration: none; cursor: pointer; }
.button:hover { filter: brightness(.97); }.button:disabled { opacity: .55; cursor: wait; }
.button-primary { background: var(--teal); color: white; }.button-success { background: var(--navy-2); color: white; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.bar-list { display: grid; gap: 15px; margin-top: 20px; }
.bar-list div span { display: flex; justify-content: space-between; gap: 15px; font-size: 13px; font-weight: 700; }
.bar-list i { display: block; position: relative; height: 9px; margin-top: 6px; border-radius: 10px; background: #e4ecf3; overflow: hidden; }
.bar-list i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit; background: var(--teal); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px; color: var(--muted); text-align: left; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #e9eff4; vertical-align: top; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.ranking-table tbody tr:nth-child(odd) { background: #f7f9fb; }
.quality { display: inline-block; min-width: 58px; padding: 5px 8px; border-radius: 8px; text-align: center; font-weight: 800; }
.quality.good { background: #def3ef; color: #067d78; }.quality.warn { background: #fff0df; color: #9a6017; }

.feedback-card ul { padding: 0; margin: 18px 0; list-style: none; display: grid; gap: 12px; }
.feedback-card li { display: flex; justify-content: space-between; padding: 10px 12px; background: #f3f6f9; border-radius: 9px; }
.responsible-note { padding: 11px 13px; background: #edf4f8; color: var(--muted); border-radius: 10px; font-size: 13px; line-height: 1.45; }

.comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 15px; margin: 20px 0; }
.comparison-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fafcfd; }
.comparison-grid h3 { min-height: 42px; margin: 0 0 12px; font-size: 16px; }
.comparison-grid dl { margin: 0; display: grid; gap: 8px; }.comparison-grid dl div { display: flex; justify-content: space-between; gap: 10px; }.comparison-grid dt { color: var(--muted); }.comparison-grid dd { margin: 0; font-weight: 800; }

.map-report { min-height: 690px; padding: 15px; display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(280px,.8fr); gap: 15px; }
#map { min-height: 660px; border-radius: 15px; overflow: hidden; }
.map-report aside { padding: 20px; }.map-report aside h2 { font-size: 26px; margin: 0 0 8px; }.map-report aside > p { color: var(--muted); }
.map-report ol { margin: 23px 0; padding: 0; list-style: none; display: grid; gap: 9px; }.map-report li { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 8px; border-bottom: 1px solid #e7edf3; }
.map-bubble { display: grid; place-items: center; width: 38px; height: 38px; border: 4px solid white; border-radius: 50%; color: white; background: var(--teal); font-weight: 900; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.map-status { margin: 16px 0 11px; padding: 12px 14px; border-radius: 11px; background: #e7f6f5; color: #087c78; font-size: 13px; line-height: 1.45; }
.map-legend { display: flex; flex-wrap: wrap; gap: 9px 16px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-legend i { width: 12px; height: 12px; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #bac8d5; }
.map-legend i.exact { background: var(--teal); }.map-legend i.approx { background: var(--amber); }

.upload-zone { display: grid; gap: 13px; place-items: center; min-height: 300px; margin-top: 20px; padding: 35px; border: 2px dashed #9fb4c8; border-radius: 17px; background: #f7fafc; text-align: center; }
.upload-zone input { width: min(100%, 420px); }
.badge { display: inline-block; padding: 4px 8px; border-radius: 7px; background: #e8eef4; }.badge-success { background: #dff3ef; color: #087c78; }
.empty-state { padding: 70px; text-align: center; }.empty-state.compact { padding: 45px; }.empty-state h2 { margin-top: 0; }.empty-state p { color: var(--muted); }
.insight-card { margin-top: 20px; }

.alert { margin: 0 0 18px; padding: 13px 16px; border-radius: 10px; background: #e8eef4; }
.alert-success { background: #dff3ef; color: #075f5b; }.alert-error { background: #fde8e8; color: #8e2727; }

.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 30px; background: linear-gradient(145deg, #071d35, #164569); }
.login-card, .setup-card { width: min(100%, 760px); padding: 35px; background: white; border-radius: 24px; box-shadow: 0 25px 70px rgba(0,0,0,.28); }
.login-card { width: min(100%, 560px); }.login-card h1, .setup-card h1 { margin-bottom: 6px; }.login-card > p, .setup-card > p { margin-top: 0; color: var(--muted); }
.login-logos { display: flex; justify-content: space-between; align-items: center; gap: 20px; }.login-logos img { width: 105px; height: 72px; object-fit: contain; }.login-logos img:nth-child(2) { width: 230px; }
.setup-logo { width: 290px; max-width: 100%; }.stack-form { display: grid; gap: 15px; margin-top: 25px; }.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin-top: 25px; }.span-2 { grid-column: 1/-1; }.form-grid hr { width: 100%; border: 0; border-top: 1px solid var(--line); }

@media (max-width: 1150px) {
    .kpi-grid.five { grid-template-columns: repeat(3,1fr); }
    .three-columns { grid-template-columns: 1fr 1fr; }
    .map-report { grid-template-columns: 1fr; }.map-report aside { order: -1; }
}
@media (max-width: 800px) {
    .sidebar { position: static; width: auto; }.sidebar nav { grid-template-columns: repeat(2,1fr); }.sidebar-user { margin-top: 22px; }
    .main { margin-left: 0; padding: 22px 16px 45px; }.topbar { align-items: flex-start; }.institutional-logos { display: none; }
    .kpi-grid.five, .kpi-grid.four, .two-columns, .three-columns { grid-template-columns: 1fr; }
    .filters { align-items: stretch; }.filters label, .filters input, .filters select, .filters .button { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }.span-2 { grid-column: auto; }
}
