:root {
  --navy: #071e33;
  --navy-2: #0a3455;
  --brand: #005bbb;
  --brand-2: #008fd5;
  --red: #e21b2d;
  --gold: #f5b40b;
  --ink: #102033;
  --muted: #6c7d91;
  --line: #dfe8f0;
  --soft-line: #edf2f6;
  --surface: #ffffff;
  --bg: #f3f6f9;
  --success: #0b9b69;
  --danger: #d92d43;
  --shadow: 0 18px 52px rgba(7, 30, 51, .09);
  --small-shadow: 0 10px 28px rgba(7, 30, 51, .06);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: Figtree, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--brand); font-size: 10px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.eyebrow.light { color: #8dd9ff; }
.button { min-height: 44px; padding: 0 17px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; text-decoration: none; transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--brand), #00448d); box-shadow: 0 11px 24px rgba(0, 91, 187, .22); }
.button-light { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.button-dark { color: #fff; background: var(--navy); }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; display: grid; place-items: center; background: #fff; color: var(--ink); font-size: 20px; }
.install-hidden { display: none !important; }

.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.field label { color: #32465d; font-size: 12px; font-weight: 800; }
.field input, .field select, .field textarea, .report-filter select, .grid-search input {
  width: 100%; border: 1px solid #d5e0e9; border-radius: 12px; outline: none; background: #fff; color: var(--ink); padding: 11px 13px; transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus, .report-filter select:focus, .grid-search input:focus { border-color: #45aee7; box-shadow: 0 0 0 4px rgba(0, 143, 213, .11); }
.field small, .form-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid .full { grid-column: 1 / -1; }
.divider { display: flex; align-items: center; gap: 12px; color: #738399; font-size: 10px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.alert { margin: 15px 0; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.alert-danger { border: 1px solid #ffc6cf; background: #fff0f2; color: #9d1830; }
.alert-success { border: 1px solid #a9ead3; background: #edfff8; color: #087750; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 8% 10%, #d9efff, transparent 30%), radial-gradient(circle at 92% 90%, #ffe9ec, transparent 28%), #edf3f7; }
.login-shell { width: min(1120px, 100%); min-height: 700px; overflow: hidden; display: grid; grid-template-columns: 1.08fr .92fr; border-radius: 30px; background: #fff; box-shadow: 0 38px 100px rgba(7, 30, 51, .2); }
.login-visual { position: relative; overflow: hidden; padding: 48px 54px; display: flex; flex-direction: column; color: #fff; background: linear-gradient(145deg, #061d31 0%, #063e69 55%, #005bbb 100%); }
.login-grid-art { position: absolute; inset: 0; opacity: .17; background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(135deg, #000, transparent 78%); }
.login-visual::after { content: ""; position: absolute; width: 470px; height: 470px; right: -180px; bottom: -190px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; box-shadow: 0 0 0 62px rgba(255,255,255,.035), 0 0 0 126px rgba(255,255,255,.025); }
.login-brand, .login-copy, .login-pills { position: relative; z-index: 1; }
.login-brand img { width: 178px; height: 178px; object-fit: contain; object-position: left center; filter: drop-shadow(0 12px 16px rgba(0,0,0,.2)); }
.login-copy { margin: auto 0; }
.login-copy .eyebrow { color: #82d7ff; }
.login-copy h1 { margin: 10px 0 22px; max-width: 620px; font-size: clamp(42px, 5vw, 68px); line-height: .98; letter-spacing: -.055em; }
.login-copy > p:not(.eyebrow) { max-width: 500px; margin: 0; color: #d5ebf7; font-size: 16px; line-height: 1.7; }
.login-pills { display: flex; flex-wrap: wrap; gap: 9px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.17); }
.login-pills span { padding: 8px 11px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.08); color: #dff4ff; font-size: 11px; font-weight: 800; }
.login-panel { padding: 58px; display: grid; place-items: center; }
.login-card { width: min(390px, 100%); }
.login-card h2 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.04em; }
.login-card > .muted { margin: 0 0 28px; }
.login-card .field { margin-bottom: 17px; }
.password-field { position: relative; }
.password-field input { padding-right: 68px; }
.password-toggle { position: absolute; right: 11px; bottom: 10px; border: 0; background: transparent; color: var(--brand); font-size: 11px; font-weight: 900; }
.login-button { width: 100%; margin-top: 8px; }
.login-button span { font-size: 19px; }
.login-footnote { margin: 20px 0 0; text-align: center; color: #91a1b3; font-size: 11px; }

/* Installer */
.install-body { min-height: 100vh; padding: 35px; background: radial-gradient(circle at 0 0, #d7f0ff, transparent 28%), radial-gradient(circle at 100% 100%, #ffe8eb, transparent 28%), #f4f7fa; }
.installer-shell { width: min(1180px, 100%); margin: auto; overflow: hidden; display: grid; grid-template-columns: .82fr 1.18fr; border-radius: 29px; background: #fff; box-shadow: var(--shadow); }
.install-hero { position: relative; overflow: hidden; padding: 48px 50px; color: #fff; background: linear-gradient(155deg, #071e33, #064978 58%, #005bbb); }
.install-hero::after { content: ""; position: absolute; width: 400px; height: 400px; right: -195px; bottom: -165px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 58px rgba(255,255,255,.035), 0 0 0 116px rgba(255,255,255,.022); }
.install-logo { position: relative; z-index: 1; width: 150px; height: 150px; object-fit: contain; filter: drop-shadow(0 12px 16px rgba(0,0,0,.2)); }
.install-hero .eyebrow { position: relative; z-index: 1; margin-top: 28px; color: #8cddff; }
.install-hero h1 { position: relative; z-index: 1; margin: 10px 0 20px; font-size: 44px; line-height: 1.04; letter-spacing: -.05em; }
.install-hero > p:not(.eyebrow) { position: relative; z-index: 1; color: #d4eaf6; line-height: 1.7; }
.install-feature { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; margin-top: 25px; }
.install-feature > span { flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; color: #8cddff; font-size: 10px; font-weight: 900; }
.install-feature div { display: flex; flex-direction: column; gap: 3px; }
.install-feature small { color: #bad8e8; line-height: 1.35; }
.install-card { padding: 48px; }
.install-card h2 { margin: 0 0 5px; font-size: 30px; letter-spacing: -.04em; }
.install-card > .muted { margin: 0 0 28px; }
.install-submit { margin-top: 5px; }

/* Shell */
.app-body { background: var(--bg); }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 258px; padding: 22px 16px; display: flex; flex-direction: column; color: #fff; background: linear-gradient(180deg, #071e33, #0a3455 58%, #082a43); box-shadow: 13px 0 36px rgba(7, 30, 51, .08); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 7px 21px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand img { flex: 0 0 58px; width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 6px 9px rgba(0,0,0,.18)); }
.sidebar-brand div { min-width: 0; display: flex; flex-direction: column; }
.sidebar-brand strong { font-size: 17px; }
.sidebar-brand small { margin-top: 2px; color: #a7c7d9; font-size: 10px; }
.sidebar-nav { margin-top: 17px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: thin; }
.nav-label { margin: 14px 12px 5px; color: #7299ae; font-size: 9px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.nav-item { position: relative; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; display: flex; align-items: center; gap: 12px; color: #b7d0dc; background: transparent; text-decoration: none; text-align: left; font-size: 12px; font-weight: 750; transition: color .2s ease, background .2s ease; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.105); }
.nav-item.active { box-shadow: inset 3px 0 #48c7ff; }
.nav-icon { flex: 0 0 22px; width: 22px; text-align: center; font-size: 16px; font-weight: 900; }
.nav-status { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: #536f80; }
.nav-status.ready { background: #28d89a; box-shadow: 0 0 0 4px rgba(40,216,154,.1); }
.sidebar-bottom { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.user-mini { margin-top: 13px; padding: 15px 8px 3px; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 10px; }
.user-mini > span { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand-2), var(--brand)); font-weight: 900; }
.user-mini div { min-width: 0; display: flex; flex-direction: column; }
.user-mini strong { overflow: hidden; color: #fff; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.user-mini small { color: #88aebe; font-size: 10px; text-transform: capitalize; }
.sidebar-overlay { display: none; }

.main-content { min-height: 100vh; margin-left: 258px; padding: 28px 32px 48px; }
.topbar { margin-bottom: 25px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.topbar-actions { display: flex; gap: 10px; }
.mobile-menu { display: none; }
.content-section { display: none; }
.content-section.active { display: block; animation: sectionIn .25s ease; }
@keyframes sectionIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Overview */
.overview-hero { position: relative; overflow: hidden; min-height: 245px; padding: 32px 35px; border-radius: 24px; display: grid; grid-template-columns: 1.25fr .75fr; gap: 35px; align-items: center; color: #fff; background: linear-gradient(125deg, #071e33, #064b7c 56%, #006bcf); box-shadow: 0 22px 54px rgba(7,30,51,.17); }
.overview-hero::before { content: ""; position: absolute; inset: 0; opacity: .13; background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px); background-size: 38px 38px; mask-image: linear-gradient(90deg, #000, transparent 85%); }
.overview-hero::after { content: ""; position: absolute; width: 410px; height: 410px; right: -185px; top: -210px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 54px rgba(255,255,255,.03), 0 0 0 108px rgba(255,255,255,.02); }
.overview-hero > div { position: relative; z-index: 1; }
.overview-hero h2 { margin: 8px 0 12px; font-size: clamp(30px, 3.2vw, 47px); line-height: 1.02; letter-spacing: -.055em; }
.overview-hero p:not(.eyebrow) { max-width: 650px; margin: 0; color: #d2e9f5; line-height: 1.6; }
.hero-status { width: fit-content; max-width: 100%; margin-top: 22px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; display: flex; align-items: center; gap: 8px; color: #dff3fd; background: rgba(255,255,255,.08); font-size: 11px; }
.hero-status span { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(245,180,11,.12); }
.hero-status.success span { background: #28d89a; box-shadow: 0 0 0 4px rgba(40,216,154,.12); }
.hero-status.failed span { background: #ff7180; box-shadow: 0 0 0 4px rgba(255,113,128,.12); }
.hero-total { min-height: 150px; padding: 22px; border: 1px solid rgba(255,255,255,.15); border-radius: 20px; display: flex; flex-direction: column; justify-content: center; background: rgba(255,255,255,.09); backdrop-filter: blur(8px); }
.hero-total small, .hero-total span { color: #beddea; }
.hero-total strong { display: block; margin: 9px 0 5px; font-size: clamp(30px, 3vw, 44px); letter-spacing: -.045em; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.overview-kpis, .report-kpis { margin-top: 16px; }
.kpi-card { min-width: 0; padding: 19px; border: 1px solid #e3ebf2; border-radius: 18px; background: #fff; box-shadow: var(--small-shadow); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 800; }
.kpi-icon { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--brand); background: #e8f4ff; font-weight: 900; }
.kpi-card > strong { display: block; overflow: hidden; margin: 14px 0 4px; font-size: 26px; letter-spacing: -.045em; white-space: nowrap; text-overflow: ellipsis; }
.kpi-card > strong.small-kpi { font-size: 17px; letter-spacing: -.02em; }
.kpi-card > small { color: #8a99aa; font-size: 10px; line-height: 1.4; }

.chart-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }
.overview-charts, .report-charts { margin-top: 16px; }
.panel { border: 1px solid #e3ebf2; border-radius: 20px; background: #fff; box-shadow: var(--small-shadow); }
.chart-panel { min-width: 0; padding: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.035em; }
.panel-badge { padding: 7px 10px; border-radius: 999px; color: #537086; background: #edf4f8; font-size: 9px; font-weight: 800; }
.chart-wrap { position: relative; min-height: 285px; margin-top: 12px; }
.chart-wrap.large { height: 320px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 25px; text-align: center; color: #8a9bad; font-size: 12px; }

.section-heading { margin: 30px 0 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; }
.section-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.section-heading > p { max-width: 480px; margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.report-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.report-card { position: relative; overflow: hidden; min-width: 0; padding: 20px; border: 1px solid #e2eaf1; border-radius: 18px; background: #fff; box-shadow: var(--small-shadow); transition: transform .2s ease, box-shadow .2s ease; }
.report-card:hover { transform: translateY(-3px); box-shadow: 0 17px 38px rgba(7,30,51,.1); }
.report-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -38px; bottom: -45px; border-radius: 50%; background: rgba(0,91,187,.06); }
.report-card-top { display: flex; align-items: center; justify-content: space-between; }
.report-number { color: #b7c4d0; font-size: 11px; font-weight: 900; }
.report-state { display: flex; align-items: center; gap: 6px; color: #7b8b9d; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.report-state i { width: 7px; height: 7px; border-radius: 50%; background: #9eacba; }
.report-card.ready .report-state i { background: var(--success); }
.report-card h3 { margin: 20px 0 7px; font-size: 17px; letter-spacing: -.025em; }
.report-card p { min-height: 34px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.report-card > strong { display: block; margin-top: 18px; color: var(--brand); font-size: 24px; letter-spacing: -.04em; }
.report-card-foot { position: relative; z-index: 1; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--soft-line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-card-foot small { overflow: hidden; color: #91a0b0; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.report-card-foot button { padding: 0; border: 0; background: transparent; color: var(--red); font-size: 10px; font-weight: 900; white-space: nowrap; }

/* Individual reports */
.report-section { position: relative; }
.report-section.is-loading::after { content: "Loading saved report…"; position: absolute; inset: 0; z-index: 10; min-height: 400px; display: grid; place-items: center; border-radius: 20px; color: var(--brand); background: rgba(243,246,249,.86); font-size: 12px; font-weight: 900; backdrop-filter: blur(3px); }
.report-toolbar { margin-bottom: 13px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.report-filter { min-width: 185px; display: flex; flex-direction: column; gap: 6px; }
.report-filter label { color: #52687e; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.report-filter select { padding: 10px 12px; }
.toolbar-actions { display: flex; gap: 9px; }
.report-banner { position: relative; overflow: hidden; min-height: 175px; padding: 28px 32px; border-radius: 22px; display: flex; align-items: center; justify-content: space-between; gap: 28px; color: #fff; background: linear-gradient(125deg, #071e33, #084b78 67%, #005bbb); box-shadow: 0 18px 44px rgba(7,30,51,.14); }
.report-banner::after { content: ""; position: absolute; width: 260px; height: 260px; right: -115px; top: -135px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 42px rgba(255,255,255,.028), 0 0 0 84px rgba(255,255,255,.018); }
.report-banner > div { position: relative; z-index: 1; }
.report-banner h2 { margin: 7px 0 9px; font-size: clamp(28px, 3vw, 42px); line-height: 1.03; letter-spacing: -.05em; }
.report-banner p:not(.eyebrow) { margin: 0; color: #c8e1ed; font-size: 11px; line-height: 1.55; }
.report-banner-total { min-width: 255px; padding: 20px 22px; border: 1px solid rgba(255,255,255,.15); border-radius: 17px; background: rgba(255,255,255,.09); }
.report-banner-total small { color: #bedbe8; }
.report-banner-total strong { display: block; margin-top: 8px; font-size: clamp(28px, 3vw, 39px); letter-spacing: -.04em; }

.sheet-panel { margin-top: 16px; overflow: hidden; }
.sheet-heading { padding: 20px; border-bottom: 1px solid var(--soft-line); }
.grid-search { display: flex; align-items: center; gap: 10px; }
.grid-search input { width: 230px; padding: 9px 11px; font-size: 11px; }
.grid-search span { color: #8291a1; font-size: 10px; white-space: nowrap; }
.sheet-scroll { max-width: 100%; max-height: 650px; overflow: auto; background: #fff; scrollbar-color: #b8c6d2 #edf2f6; }
.sheet-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; color: #18283a; font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.sheet-table td { min-width: 135px; max-width: 330px; height: 31px; padding: 6px 9px; border-right: 1px solid #b9c2ca; border-bottom: 1px solid #b9c2ca; overflow: hidden; background: #fff; white-space: nowrap; text-overflow: ellipsis; }
.sheet-table tr:first-child td { border-top: 0; }
.sheet-table td:first-child { min-width: 170px; border-left: 0; }
.sheet-table .sheet-first-cell { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 2px 0 0 rgba(7,30,51,.08); text-align: right; }
.sheet-table .sheet-number-cell { color: #e11127; font-weight: 800; text-align: center; }
.sheet-table .sheet-date-cell { color: #111; font-weight: 700; }
.sheet-table .sheet-total-cell { font-weight: 900; }
.sheet-table .sheet-title-row td { height: 39px; color: #fff; background: #8f0009; font-weight: 900; font-size: 14px; }
.sheet-table .sheet-title-row .sheet-first-cell { background: #8f0009; }
.sheet-table .sheet-header-row td { position: sticky; top: 0; z-index: 4; color: #0d1825; background: #f5d90d; font-weight: 900; font-size: 14px; }
.sheet-table .sheet-header-row .sheet-first-cell { z-index: 5; background: #f5d90d; }
.empty-cell { padding: 35px !important; color: #8998a8 !important; text-align: center !important; font-style: italic; }

/* History */
.history-panel { overflow: hidden; }
.history-panel > .panel-heading { padding: 20px; border-bottom: 1px solid var(--soft-line); }
.table-scroll { width: 100%; overflow: auto; }
.history-table { width: 100%; min-width: 1050px; border-collapse: collapse; font-size: 11px; }
.history-table th { padding: 12px 14px; color: #66768a; background: #f7f9fb; text-align: left; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.history-table td { padding: 13px 14px; border-top: 1px solid var(--soft-line); color: #405167; vertical-align: top; }
.history-message { min-width: 310px; line-height: 1.45; }
.status-pill { padding: 6px 9px; border-radius: 999px; display: inline-block; color: #5c6c7d; background: #eaf0f4; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.status-pill.success { color: #087750; background: #e6faf2; }
.status-pill.failed { color: #a5162d; background: #ffedf0; }
.status-pill.running { color: #785704; background: #fff7d9; }

/* Modal, dialog, toast */
.modal-backdrop, .dialog-backdrop { position: fixed; inset: 0; z-index: 100; padding: 24px; display: none; place-items: center; background: rgba(4, 17, 30, .58); backdrop-filter: blur(7px); }
.modal-backdrop.open, .dialog-backdrop.open { display: grid; }
.modal-card, .dialog-card { width: min(680px, 100%); max-height: calc(100vh - 48px); overflow: auto; border-radius: 22px; background: #fff; box-shadow: 0 28px 90px rgba(0,0,0,.26); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.settings-card { padding: 24px; }
.modal-heading { margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.modal-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.modal-actions { padding-top: 4px; display: flex; justify-content: flex-end; gap: 9px; }
.dialog-card { width: min(420px, 100%); padding: 32px; text-align: center; }
.dialog-icon { width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; color: #fff; background: var(--success); font-size: 27px; font-weight: 900; }
.dialog-icon.error { background: var(--danger); }
.dialog-card h3 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.035em; }
.dialog-card p { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 150; width: min(360px, calc(100% - 44px)); display: flex; flex-direction: column; gap: 9px; }
.toast { opacity: 0; transform: translateY(8px); padding: 13px 14px; border: 1px solid #d9e6ee; border-radius: 14px; display: flex; align-items: center; gap: 11px; background: #fff; box-shadow: 0 15px 42px rgba(7,30,51,.17); transition: .25s ease; }
.toast.show { opacity: 1; transform: none; }
.toast > span { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--success); font-weight: 900; }
.toast.error > span { background: var(--danger); }
.toast p { margin: 0; color: #405167; font-size: 12px; line-height: 1.4; }

.spinning .sync-icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-data .overview-hero, .loading-data .kpi-card, .loading-data .panel { cursor: progress; }

/* Responsive */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-hero { grid-template-columns: 1fr; }
  .hero-total { min-height: auto; }
}

@media (max-width: 920px) {
  .login-shell, .installer-shell { grid-template-columns: 1fr; }
  .login-visual { min-height: 500px; }
  .login-panel { padding: 45px 28px; }
  .install-card { padding: 38px 28px; }
  .sidebar { transform: translateX(-105%); transition: transform .25s ease; }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 35; display: block; visibility: hidden; opacity: 0; background: rgba(5,17,29,.52); transition: .25s ease; }
  .sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
  .main-content { margin-left: 0; padding: 24px 22px 42px; }
  .mobile-menu { display: grid; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-wide { grid-column: auto; }
}

@media (max-width: 660px) {
  .login-body, .install-body { padding: 0; background: #fff; }
  .login-shell, .installer-shell { min-height: 100vh; border-radius: 0; }
  .login-visual { min-height: 460px; padding: 34px 26px; }
  .login-brand img { width: 135px; height: 135px; }
  .login-copy h1 { font-size: 42px; }
  .login-panel { padding: 38px 24px; }
  .install-hero { padding: 36px 26px; }
  .install-logo { width: 125px; height: 125px; }
  .install-hero h1 { font-size: 36px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .main-content { padding: 18px 14px 34px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column; align-items: stretch; }
  .topbar-actions .button { min-height: 40px; padding: 0 12px; font-size: 11px; }
  .topbar h1 { font-size: 22px; }
  .overview-hero { min-height: auto; padding: 27px 23px; }
  .overview-hero h2 { font-size: 34px; }
  .hero-total strong { font-size: 30px; }
  .kpi-grid, .report-card-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading > p { text-align: left; }
  .report-toolbar { align-items: stretch; flex-direction: column; }
  .report-filter { min-width: 0; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .report-banner { align-items: stretch; flex-direction: column; padding: 26px 23px; }
  .report-banner h2 { font-size: 31px; }
  .report-banner-total { min-width: 0; }
  .sheet-heading { align-items: flex-start; flex-direction: column; }
  .grid-search { width: 100%; }
  .grid-search input { flex: 1; width: auto; }
  .chart-wrap.large { height: 290px; }
  .modal-backdrop, .dialog-backdrop { padding: 12px; }
  .settings-card { padding: 20px; }
}

/* Print only the selected report */
@media print {
  @page { size: landscape; margin: 10mm; }
  body { background: #fff !important; }
  .sidebar, .sidebar-overlay, .topbar, .report-toolbar, .overview-hero, .toast-stack, .modal-backdrop, .dialog-backdrop { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .content-section { display: none !important; }
  body[data-print-report="main"] #section-report-main,
  body[data-print-report="cash"] #section-report-cash,
  body[data-print-report="home_skyro"] #section-report-home_skyro,
  body[data-print-report="bank"] #section-report-bank,
  body[data-print-report="credit"] #section-report-credit { display: block !important; }
  .report-banner { min-height: auto; padding: 18px; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .report-kpis, .report-charts { break-inside: avoid; }
  .panel, .kpi-card { box-shadow: none; }
  .sheet-panel { overflow: visible; }
  .sheet-heading { display: none; }
  .sheet-scroll { max-height: none; overflow: visible; }
  .sheet-table { width: 100%; font-size: 7px; }
  .sheet-table td { min-width: 0; max-width: none; height: 19px; padding: 3px 4px; white-space: normal; }
  .sheet-table .sheet-first-cell, .sheet-table .sheet-header-row td { position: static; }
  canvas { max-height: 250px; }
}
.status-pill.partial { color: #785704; background: #fff7d9; }
