:root {
  --green-950: #09091a;
  --green-900: #151329;
  --green-800: #2016ff;
  --green-700: #3228ff;
  --green-100: #e8e7ff;
  --green-50: #f2f1ff;
  --gold: #2016ff;
  --gold-soft: #e9e8ff;
  --blue: #1d74e8;
  --purple: #6d36d8;
  --ink: #151521;
  --muted: #6d6d7d;
  --line: #e2e3ec;
  --surface: #ffffff;
  --canvas: #f6f7fb;
  --shadow: 0 16px 38px rgba(28, 25, 88, .08);
}

* { box-sizing: border-box; }
html { font-family: Arial, Tahoma, sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 9% -12%, #e8e7ff 0, transparent 31rem), var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
.dashboard-locked { overflow: hidden; }
.dashboard-locked .app-shell { visibility: hidden; }
.access-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 15% 5%, #dfddff 0, transparent 32rem), #f5f6fb; }
.access-gate[hidden] { display: none; }
.access-card { width: min(460px, 100%); padding: 30px; border: 1px solid #ddddea; border-top: 5px solid var(--green-800); border-radius: 24px; background: #fff; box-shadow: 0 28px 80px rgba(20, 18, 70, .16); text-align: center; }
.access-logo { width: min(290px, 86%); height: 104px; object-fit: contain; margin-bottom: 12px; }
.access-card h1 { margin: 7px 0 9px; font-size: 1.65rem; }
.access-card > p:not(.section-kicker) { margin: 0 0 20px; color: var(--muted); }
.access-card label { display: block; margin-bottom: 7px; color: #4e4e60; font-weight: 700; font-size: .86rem; text-align: right; }
.access-card input { width: 100%; min-height: 52px; border: 1px solid #cdceda; border-radius: 12px; padding: 11px 14px; font-size: 1.18rem; direction: ltr; text-align: center; letter-spacing: .2em; outline: none; }
.access-card input:focus { border-color: var(--green-800); box-shadow: 0 0 0 4px #e3e2ff; }
.access-card button { width: 100%; min-height: 49px; margin-top: 12px; border: 0; border-radius: 12px; color: #fff; background: var(--green-800); font-weight: 800; }
#access-error { display: block; min-height: 22px; margin-top: 8px; color: #b42318; font-size: .84rem; }
.app-shell { width: min(1480px, 100%); margin: 0 auto; padding: 24px clamp(16px, 3vw, 42px) 48px; }

.topbar { background: rgba(255,255,255,.96); color: var(--ink); border: 1px solid var(--line); border-top: 5px solid var(--green-800); border-radius: 22px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 16px; }
.logo-lockup { width: 188px; height: 66px; display: grid; place-items: center; overflow: hidden; border: 0; border-inline-end: 1px solid var(--line); padding: 0 0 0 15px; background: transparent; cursor: default; }
.logo-lockup img { width: 100%; height: 100%; object-fit: contain; }
.brand h1 { margin: 3px 0 0; font-size: clamp(1.35rem, 2.2vw, 2rem); line-height: 1.2; }
.eyebrow, .section-kicker { margin: 0; color: var(--green-800); font-size: .78rem; font-weight: 700; letter-spacing: .04em; }
.dashboard-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 18px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.dashboard-nav a { display: grid; place-items: center; min-height: 44px; padding: 8px 10px; border-radius: 11px; color: var(--ink); text-decoration: none; font-weight: 700; text-align: center; }
.dashboard-nav a:hover { background: var(--green-50); }
.dashboard-nav a[aria-current="page"] { background: var(--green-800); color: #fff; }
.view-toolbar, .view-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-toolbar { justify-content: space-between; margin-top: 20px; }
.view-toolbar h2 { margin: 0; font-size: 1.5rem; }
.month-control { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.month-control select { appearance: none; min-height: 44px; padding: 8px 12px 8px 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235d5d6d' stroke-width='1.5' d='m1 1 5 5 5-5'/%3E%3C/svg%3E") left 12px center no-repeat; font: inherit; }
.period-empty { margin: 18px 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; line-height: 1.7; }
.table-empty { color: var(--muted); text-align: center; }
[hidden] { display: none !important; }
.period-switch { display: flex; padding: 4px; background: #f0f1f6; border: 1px solid #e2e3eb; border-radius: 12px; }
.period-btn { border: 0; color: #5d5d6d; background: transparent; padding: 9px 13px; border-radius: 9px; }
.period-btn.active { background: #fff; color: var(--green-800); font-weight: 800; box-shadow: 0 3px 9px rgba(26,22,110,.11); }
.upload-btn, .ghost-btn, .export-btn { min-height: 42px; border-radius: 11px; padding: 9px 13px; display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.upload-btn { color: #fff; background: var(--green-800); }
.upload-btn svg, .export-btn svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.export-btn { color: var(--green-800); background: #f1f0ff; border: 1px solid #d8d6ff; }
.ghost-btn { border: 1px solid #d8d9e3; background: #fff; color: var(--ink); }
.ghost-btn:hover, .upload-btn:hover, .export-btn:hover { filter: brightness(.97); transform: translateY(-1px); }

.report-strip { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 16px 4px 8px; color: var(--muted); font-size: .88rem; }
.report-strip > div { display: flex; align-items: center; gap: 8px; }
.report-strip strong { color: var(--ink); }
.source-state { margin-inline-start: auto; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-800); box-shadow: 0 0 0 4px #dedcff; }

.platform-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.platform-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; gap: 14px; min-height: 132px; align-items: center; box-shadow: 0 7px 22px rgba(31, 27, 93, .05); position: relative; overflow: hidden; }
.platform-card::after { content: ""; position: absolute; inset-inline-end: 0; top: 0; width: 4px; height: 100%; background: var(--green-800); }
.card-icon { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--green-100); color: var(--green-800); font-weight: 800; font-size: 1.1rem; }
.services .card-icon { background: #e8f1f8; color: var(--blue); }
.entities .card-icon { background: #f0eafa; color: var(--purple); }
.active .card-icon { background: var(--gold-soft); color: var(--green-800); }
.platform-card span { display: block; color: var(--muted); font-size: .88rem; margin-bottom: 6px; }
.platform-card strong { display: block; font-size: clamp(1.55rem, 2.5vw, 2.1rem); color: #11111d; font-variant-numeric: tabular-nums; }
.platform-card small { display: block; margin-top: 7px; color: #7b8a84; }

.section-block, .panel { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 28px rgba(31,27,93,.05); }
.section-block { padding: 22px; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h2, .panel-heading h2 { margin: 4px 0 0; font-size: 1.16rem; }
.section-kicker { color: var(--green-700); }
.definition-note { color: var(--muted); font-size: .85rem; background: var(--green-50); border-radius: 10px; padding: 8px 11px; }
.performance-layout { display: grid; grid-template-columns: 220px 1fr; gap: 14px; margin-top: 18px; align-items: stretch; }
.overall-gauge { border-radius: 18px; color: #fff; background: linear-gradient(145deg, #11111c, #27206e); padding: 18px; display: grid; place-items: center; text-align: center; min-height: 184px; }
.gauge-ring { width: 118px; height: 118px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green-800) var(--gauge), rgba(255,255,255,.13) 0); position: relative; }
.gauge-ring::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #171535; }
.gauge-ring strong { position: relative; z-index: 1; color: #fff; font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.gauge-caption { margin-top: 10px; color: #cfcef8; font-size: .8rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi-card { padding: 14px; border-radius: 14px; background: #f8faf9; border: 1px solid #e2eae6; }
.kpi-card span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.kpi-card strong { font-size: 1.6rem; color: #171725; font-variant-numeric: tabular-nums; }
.kpi-card.highlight { background: var(--green-800); border-color: var(--green-800); }
.kpi-card.highlight span { color: #dcdbff; }
.kpi-card.highlight strong { color: #fff; }

.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.category-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: linear-gradient(180deg, #fff, #fbfbfe); display: grid; grid-template-columns: 1fr 84px; gap: 12px; align-items: center; }
.category-content { min-width: 0; }
.category-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.category-head h3 { margin: 0; font-size: 1rem; }
.rate-badge { background: var(--green-50); color: var(--green-800); font-weight: 800; border-radius: 999px; padding: 6px 9px; font-size: .82rem; }
.category-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 15px 0 14px; gap: 8px; }
.category-metrics span { display: block; color: var(--muted); font-size: .75rem; }
.category-metrics strong { display: block; margin-top: 4px; font-size: 1.12rem; }
.progress { height: 8px; background: #e7eeeb; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--green-800), #675fff); transition: width .35s ease; }
.category-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: .77rem; margin-top: 8px; }
.mini-gauge { width: 82px; height: 82px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green-800) var(--gauge), #ececf3 0); position: relative; }
.mini-gauge::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.mini-gauge strong { position: relative; z-index: 1; font-size: .82rem; color: #20202d; font-variant-numeric: tabular-nums; }

.analytics-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, .8fr); gap: 18px; }
.panel { padding: 20px; min-width: 0; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .76rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; }
.legend-product { background: var(--green-800); }.legend-service { background: var(--blue); }.legend-entity { background: #101017; }
.chart-wrap { min-height: 285px; display: grid; place-items: center; margin-top: 12px; overflow: hidden; }
.chart-wrap svg { width: 100%; height: auto; max-height: 290px; overflow: visible; }
.empty-chart { color: var(--muted); text-align: center; padding: 70px 20px; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table { border-collapse: collapse; width: 100%; min-width: 520px; }
th { text-align: right; color: var(--muted); font-size: .78rem; font-weight: 700; border-bottom: 1px solid var(--line); padding: 10px 9px; white-space: nowrap; }
td { padding: 12px 9px; border-bottom: 1px solid #edf1ef; font-size: .88rem; white-space: nowrap; }
td.number { font-variant-numeric: tabular-nums; font-weight: 700; color: #264b3e; }
.share-cell { min-width: 120px; }
.share-bar { display: flex; align-items: center; gap: 8px; }
.share-bar .progress { flex: 1; height: 6px; }
.details-panel { margin-top: 18px; }
.details-table { min-width: 980px; }
.details-table tbody tr:last-child { background: var(--green-50); font-weight: 800; }

.update-help { margin-top: 18px; border: 1px dashed #a8a6d7; border-radius: 16px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); background: rgba(255,255,255,.7); }
.update-help strong { color: var(--green-900); }
.update-help p { margin: 5px 0 0; line-height: 1.7; font-size: .86rem; }
#import-message { color: var(--green-700); font-weight: 700; white-space: nowrap; }

.admin-dialog { width: min(560px, calc(100% - 28px)); border: 0; padding: 0; border-radius: 22px; color: var(--ink); background: transparent; box-shadow: 0 28px 80px rgba(12, 12, 38, .28); }
.admin-dialog::backdrop { background: rgba(9, 9, 26, .62); backdrop-filter: blur(5px); }
.admin-card { position: relative; background: #fff; border: 1px solid #dedeea; border-top: 5px solid var(--green-800); border-radius: 22px; padding: 28px; }
.admin-card h2 { margin: 6px 0 8px; font-size: 1.45rem; }
.admin-close { position: absolute; inset-inline-start: 16px; top: 13px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #f5f5fa; color: #5f5f70; font-size: 1.4rem; line-height: 1; }
.admin-note { color: var(--muted); line-height: 1.7; font-size: .88rem; }
.admin-code-label { display: block; margin: 20px 0 7px; color: #4e4e60; font-weight: 700; font-size: .86rem; }
.admin-code { width: 100%; min-height: 48px; border: 1px solid #cdceda; border-radius: 11px; padding: 10px 13px; font-size: 1.1rem; direction: ltr; text-align: center; letter-spacing: .18em; outline: none; }
.admin-code:focus { border-color: var(--green-800); box-shadow: 0 0 0 4px #e3e2ff; }
.admin-primary, .admin-secondary { width: 100%; min-height: 46px; border-radius: 11px; font-weight: 800; margin-top: 12px; }
.admin-primary { border: 0; color: #fff; background: var(--green-800); }
.admin-secondary { border: 1px solid #d7d7e2; color: #505061; background: #f7f7fa; }
.admin-error { display: block; min-height: 22px; margin-top: 8px; color: #b42318; font-size: .84rem; }
.admin-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 20px 0 14px; }
.admin-toolbar .upload-btn, .admin-toolbar .ghost-btn, .admin-toolbar .export-btn { justify-content: center; width: 100%; }
.admin-tools-open .logo-lockup { cursor: pointer; }

[hidden] { display: none !important; }

@media (max-width: 1100px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .platform-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .performance-layout { grid-template-columns: 1fr; }
  .overall-gauge { min-height: 160px; }
  .analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { padding: 10px 10px 30px; }
  .topbar { border-radius: 16px; padding: 18px 15px; }
  .logo-lockup { width: 145px; height: 52px; }
  .period-switch { width: 100%; }
  .period-btn { flex: 1; }
  .dashboard-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-controls { width: 100%; }
  .upload-btn, .ghost-btn, .export-btn { flex: 1; justify-content: center; }
  .admin-toolbar { grid-template-columns: 1fr; }
  .source-state { margin-inline-start: 0; }
  .platform-grid, .category-grid { grid-template-columns: 1fr; }
  .category-card { grid-template-columns: 1fr 76px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .section-block, .panel { padding: 16px; border-radius: 16px; }
  .section-heading, .panel-heading { align-items: flex-start; flex-direction: column; }
  .definition-note { width: 100%; }
  .update-help { align-items: flex-start; flex-direction: column; }
}

@media print {
  body { background: #fff; }
  .app-shell { max-width: none; padding: 0; }
  .topbar { box-shadow: none; }
  .dashboard-nav, .view-controls, .update-help { display: none; }
  .section-block, .panel, .platform-card { box-shadow: none; break-inside: avoid; }
}
