/* =========================================================
   Report Portal — theme tokens
   Palette (coolors.co/palette/0d1b2a-1b263b-415a77-778da9-e0e1dd):
     #0d1b2a ink navy · #1b263b oxford blue · #415a77 steel blue
     #778da9 shadow blue · #e0e1dd platinum
   Light is the default; dark applies via system preference or
   [data-theme="dark"].
   ========================================================= */
:root {
  color-scheme: light;
  --bg: #e0e1dd;
  --surface: #ffffff;
  --surface-2: #f4f5f2;
  --surface-3: #e9ebe7;
  --border: #d3d6d0;
  --border-strong: #b6bec8;
  --text: #0d1b2a;
  --text-2: #1b263b;
  --muted: #56677d;           /* darker than #778da9 so small text keeps 4.5:1 */
  --icon: #778da9;
  --primary: #415a77;
  --primary-hover: #1b263b;
  --primary-soft: #e4e9f0;
  --primary-ring: rgba(65, 90, 119, .3);
  --on-primary: #ffffff;
  --brand-gradient: linear-gradient(135deg, #415a77 0%, #1b263b 100%);
  --hero-gradient: linear-gradient(120deg, #0d1b2a 0%, #1b263b 50%, #415a77 100%);
  --chart-bar: #415a77;
  --chart-bar-hover: #1b263b;
  --danger: #b42318;
  --danger-hover: #912018;
  --danger-soft: #fdeceb;
  --success: #1d7a46;
  --success-soft: #e9f6ef;
  --success-border: #b9e2cb;
  --pdf-bg: #f6e9e8;
  --pdf-fg: #b42318;
  --toast-bg: #0d1b2a;
  --shimmer-a: #eef0ec;
  --shimmer-b: #e0e3de;
  --shadow-sm: 0 1px 2px rgba(13, 27, 42, .06);
  --shadow: 0 1px 3px rgba(13, 27, 42, .07), 0 8px 24px -12px rgba(13, 27, 42, .18);
  --shadow-lg: 0 28px 56px -16px rgba(13, 27, 42, .35);
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 20px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1b2a;
    --surface: #1b263b;
    --surface-2: #213049;
    --surface-3: #283a56;
    --border: #2b3c58;
    --border-strong: #415a77;
    --text: #e0e1dd;
    --text-2: #c9ced6;
    --muted: #97a8bf;
    --icon: #778da9;
    --primary: #9db1cc;
    --primary-hover: #bccbdf;
    --primary-soft: rgba(119, 141, 169, .18);
    --primary-ring: rgba(119, 141, 169, .45);
    --on-primary: #0d1b2a;
    --brand-gradient: linear-gradient(135deg, #778da9 0%, #415a77 100%);
    --hero-gradient: linear-gradient(120deg, #0a1622 0%, #1b263b 55%, #344b68 100%);
    --chart-bar: #778da9;
    --chart-bar-hover: #bccbdf;
    --danger: #f2877d;
    --danger-hover: #f6a69e;
    --danger-soft: rgba(242, 135, 125, .13);
    --success: #6fd29b;
    --success-soft: rgba(111, 210, 155, .1);
    --success-border: rgba(111, 210, 155, .28);
    --pdf-bg: rgba(242, 135, 125, .14);
    --pdf-fg: #f6a69e;
    --toast-bg: #283a56;
    --shimmer-a: #213049;
    --shimmer-b: #2b3c58;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -12px rgba(0, 0, 0, .55);
    --shadow-lg: 0 28px 60px -14px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1b2a;
  --surface: #1b263b;
  --surface-2: #213049;
  --surface-3: #283a56;
  --border: #2b3c58;
  --border-strong: #415a77;
  --text: #e0e1dd;
  --text-2: #c9ced6;
  --muted: #97a8bf;
  --icon: #778da9;
  --primary: #9db1cc;
  --primary-hover: #bccbdf;
  --primary-soft: rgba(119, 141, 169, .18);
  --primary-ring: rgba(119, 141, 169, .45);
  --on-primary: #0d1b2a;
  --brand-gradient: linear-gradient(135deg, #778da9 0%, #415a77 100%);
  --hero-gradient: linear-gradient(120deg, #0a1622 0%, #1b263b 55%, #344b68 100%);
  --chart-bar: #778da9;
  --chart-bar-hover: #bccbdf;
  --danger: #f2877d;
  --danger-hover: #f6a69e;
  --danger-soft: rgba(242, 135, 125, .13);
  --success: #6fd29b;
  --success-soft: rgba(111, 210, 155, .1);
  --success-border: rgba(111, 210, 155, .28);
  --pdf-bg: rgba(242, 135, 125, .14);
  --pdf-fg: #f6a69e;
  --toast-bg: #283a56;
  --shimmer-a: #213049;
  --shimmer-b: #2b3c58;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 28px 60px -14px rgba(0, 0, 0, .7);
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.015em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--primary-soft); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.m0 { margin: 0; }
.form-h { margin: 0 0 12px; font-size: 15px; }

/* =========================================================
   Buttons & inputs
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--primary); color: var(--on-primary); font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s var(--ease), filter .15s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn:focus-visible, .icon-btn:focus-visible, .menu button:focus-visible, .pw-toggle:focus-visible,
.dropzone:focus-within, a:focus-visible {
  outline: 3px solid var(--primary-ring); outline-offset: 2px;
}
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-light { background: rgba(224, 225, 221, .12); border-color: rgba(224, 225, 221, .3); color: #fff; box-shadow: none; }
.btn-light:hover { background: rgba(224, 225, 221, .22); }
.btn-white { background: #e0e1dd; color: #0d1b2a; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .45); }
.btn-white:hover { background: #ffffff; }
.btn-block { width: 100%; padding: 12px 16px; }
.btn-sm { padding: 6px 12px; font-size: 13.5px; border-radius: 8px; }
.btn-gradient { background: var(--brand-gradient); color: #fff; border: 0; box-shadow: 0 10px 22px -10px rgba(13, 27, 42, .6); }
.btn-gradient:hover { background: var(--brand-gradient); filter: brightness(1.12); }
:root[data-theme="dark"] .btn-gradient { color: #0d1b2a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-gradient { color: #0d1b2a; } }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: transparent; text-decoration: none;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); text-decoration: none; }
.icon-btn svg { width: 19px; height: 19px; }

/* theme toggle — moon in light, sun in dark */
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.input {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--muted); opacity: .85; }
.input:hover { border-color: var(--icon); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.form-error {
  background: var(--danger-soft); color: var(--danger); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; margin-bottom: 16px;
}

/* =========================================================
   Brand mark
   ========================================================= */
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; color: #e0e1dd; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #415a77 0%, #0d1b2a 100%);
  box-shadow: 0 6px 14px -6px rgba(13, 27, 42, .6), inset 0 1px 0 rgba(224, 225, 221, .2);
}
.brand-mark svg { width: 19px; height: 19px; }

/* =========================================================
   Auth pages (split layout)
   ========================================================= */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }
.auth-aside {
  position: relative; overflow: hidden; color: #e0e1dd; padding: 44px 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background: var(--hero-gradient);
}
.auth-aside::before, .auth-aside::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
}
.auth-aside::before { width: 560px; height: 560px; right: -220px; top: -180px; background: radial-gradient(circle, rgba(119, 141, 169, .35), transparent 70%); }
.auth-aside::after { width: 420px; height: 420px; left: -160px; bottom: -180px; background: radial-gradient(circle, rgba(65, 90, 119, .55), transparent 70%); }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .brand-mark { background: rgba(224, 225, 221, .12); box-shadow: inset 0 0 0 1px rgba(224, 225, 221, .28); }
.auth-logo { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.auth-pitch h2 { font-size: 34px; line-height: 1.15; margin: 0 0 14px; max-width: 440px; color: #fff; }
.auth-pitch p { margin: 0 0 30px; color: #c3ccd8; font-size: 16px; max-width: 420px; }
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.feature-list li { display: flex; gap: 14px; align-items: flex-start; }
.feature-list .f-icon {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: rgba(224, 225, 221, .1); border: 1px solid rgba(224, 225, 221, .22);
}
.feature-list .f-icon svg { width: 19px; height: 19px; }
.feature-list strong { display: block; font-size: 15px; color: #fff; }
.feature-list span { font-size: 13.5px; color: #b4bfcd; }
.auth-copy { font-size: 13px; color: #8fa1b8; }

.auth-main { position: relative; display: grid; place-items: center; padding: 48px 24px; background: var(--surface); }
.auth-corner { position: absolute; top: 18px; right: 18px; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-bottom: 26px; }
.login-card { width: 100%; max-width: 400px; animation: rise .4s var(--ease); }
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; margin-bottom: 20px;
}
.login-logo svg { width: 26px; height: 26px; }
.login-card h1 { font-size: 28px; margin: 0 0 6px; }
.login-card p.sub { margin: 0 0 28px; color: var(--muted); font-size: 14.5px; }
.login-card .btn-block { margin-top: 6px; }
.auth-foot { color: var(--muted); font-size: 13px; text-align: center; margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.auth-foot svg { width: 14px; height: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 72px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  color: var(--primary); font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px 10px; border-radius: 6px;
}
.pw-toggle:hover { background: var(--primary-soft); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* =========================================================
   App shell
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 17px; margin-right: auto; letter-spacing: -.015em; }
.user-chip {
  display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; color: var(--text-2);
  padding: 3px 14px 3px 3px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; color: #e0e1dd; background: linear-gradient(135deg, #778da9, #1b263b);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}

.container { max-width: 1240px; margin: 0 auto; padding: 24px 24px 72px; }

/* hero banner */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); color: #e0e1dd;
  background: var(--hero-gradient); padding: 30px 32px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  box-shadow: 0 18px 40px -22px rgba(13, 27, 42, .8);
}
:root[data-theme="dark"] .hero { box-shadow: inset 0 0 0 1px #2b3c58; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { box-shadow: inset 0 0 0 1px #2b3c58; } }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 460px; height: 460px; right: -140px; top: -260px; background: radial-gradient(circle, rgba(119, 141, 169, .45), transparent 70%); }
.hero::after { width: 320px; height: 320px; left: 35%; bottom: -240px; background: radial-gradient(circle, rgba(224, 225, 221, .12), transparent 70%); }
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow { font-size: 12.5px; font-weight: 600; color: #a9b8cb; text-transform: uppercase; letter-spacing: .1em; }
.hero h1 { margin: 4px 0 6px; font-size: 28px; line-height: 1.2; color: #fff; }
.hero p { margin: 0; color: #c3ccd8; font-size: 15px; max-width: 520px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px 16px; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, #415a77, #778da9); opacity: .8;
}
.kpi-icon {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
}
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 30px; font-weight: 750; line-height: 1.15; margin: 6px 0 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub.up { color: var(--success); font-weight: 600; }
.kpi-sub.down { color: var(--muted); font-weight: 600; }

/* two-column layout */
.layout { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
.side-col, .main-col { display: grid; gap: 24px; align-content: start; min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.card-head h2 .count {
  font-weight: 700; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary);
}
.card-head h2 .count:empty { display: none; }
.card-note { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 20px; }
.section { margin-bottom: 0; }

/* =========================================================
   Upload
   ========================================================= */
.dropzone {
  display: block; position: relative;
  border: 2px dashed var(--border-strong); border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 28px 16px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.drag { border-color: var(--primary); border-style: solid; background: var(--primary-soft); transform: scale(1.015); }
.dropzone > svg {
  width: 56px; height: 56px; padding: 15px; border-radius: 16px; color: #e0e1dd;
  background: linear-gradient(135deg, #415a77, #1b263b); box-shadow: 0 10px 22px -10px rgba(13, 27, 42, .7);
  transition: transform .25s var(--ease);
}
.dropzone:hover > svg, .dropzone.drag > svg { transform: translateY(-4px); }
.dropzone .dz-title { font-weight: 700; margin: 14px 0 4px; font-size: 15.5px; }
.dropzone .dz-sub { color: var(--muted); font-size: 13.5px; }
.dropzone .dz-browse { color: var(--primary); font-weight: 600; }
.tips { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.tips li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.tips svg { width: 18px; height: 18px; flex: none; color: var(--success); margin-top: 1px; }
.progress { margin-top: 16px; }
.progress-label { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.progress-bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress-bar > div { height: 100%; width: 0; border-radius: 99px; transition: width .2s; background: linear-gradient(90deg, #415a77, #778da9); }

.new-links { margin-top: 16px; display: grid; gap: 10px; }
.new-links:empty { display: none; }
.new-link {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--success-soft); border: 1px solid var(--success-border); animation: rise .3s var(--ease);
}
.new-link .nl-text { min-width: 0; flex: 1 1 100%; }
.new-link .nl-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-link a { font-size: 13px; word-break: break-all; }

/* =========================================================
   Side widgets: top uploaders & activity feed
   ========================================================= */
.mini-list, .feed { list-style: none; margin: 0; padding: 10px 20px 16px; }
.mini-empty { color: var(--muted); font-size: 13.5px; padding: 10px 0; }
.top-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.mini-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700;
}
.top-main { flex: 1; min-width: 0; }
.top-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.top-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-n { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > div { height: 100%; border-radius: 99px; background: var(--chart-bar); transition: width .4s var(--ease); }

.feed-item { position: relative; display: flex; gap: 12px; padding: 8px 0; }
.feed-item::before {
  content: ""; position: absolute; left: 5px; top: 26px; bottom: -6px; width: 2px; border-radius: 2px; background: var(--border);
}
.feed-item:last-child::before { display: none; }
.feed-dot {
  width: 12px; height: 12px; border-radius: 50%; flex: none; margin-top: 5px;
  background: var(--surface); border: 3px solid var(--icon);
}
.feed-item:first-child .feed-dot { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.feed-main { min-width: 0; flex: 1; }
.feed-title { display: block; font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-meta { font-size: 12.5px; color: var(--muted); }

/* =========================================================
   Reports list
   ========================================================= */
.search { position: relative; width: 100%; max-width: 300px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search .input { padding: 9px 12px 9px 38px; background: var(--surface-2); border-color: var(--border); }
.search .input:focus { background: var(--surface); border-color: var(--primary); }
.report-list { list-style: none; margin: 0; padding: 0; }
.report {
  position: relative; display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  border-top: 1px solid var(--border); transition: background .15s;
}
.report:first-child { border-top: 0; }
.report::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--primary); opacity: 0; transition: opacity .15s;
}
.report:hover { background: var(--surface-2); }
.report:hover::before { opacity: 1; }
.report.flash { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: var(--success-soft); } to { background: transparent; } }
.pdf-icon {
  width: 44px; height: 50px; border-radius: 10px; background: var(--pdf-bg); color: var(--pdf-fg);
  display: grid; place-items: center; align-content: center; gap: 1px; flex: none;
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
}
.pdf-icon svg { width: 20px; height: 20px; }
.report-main { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.report-title { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.report-meta { font-size: 13px; color: var(--muted); }
.report-link {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start; max-width: 100%;
  font-size: 12.5px; font-weight: 500; padding: 3px 10px 3px 8px; border-radius: 99px;
  background: var(--primary-soft); color: var(--primary); margin-top: 3px;
}
.report-link:hover { text-decoration: none; filter: brightness(.96); }
.report-link svg { width: 13px; height: 13px; flex: none; }
.report-link .rl-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-actions { display: flex; align-items: center; gap: 2px; position: relative; }
.report .quick { opacity: 0; transition: opacity .15s; }
.report:hover .quick, .report:focus-within .quick { opacity: 1; }
@media (hover: none) { .report .quick { display: none; } }

.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; display: grid; animation: pop .14s var(--ease); transform-origin: top right;
}
.menu.up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.menu button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; text-align: left; color: var(--text); font-size: 14px;
}
.menu button:hover { background: var(--surface-2); }
.menu button svg { width: 17px; height: 17px; color: var(--icon); }
.menu button.danger, .menu button.danger svg { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }
.empty::before {
  content: ""; display: block; width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px;
  background: var(--primary-soft) center / 28px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23778da9' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3C/svg%3E");
}
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); gap: 8px; font-variant-numeric: tabular-nums; }

.skeleton { padding: 18px 20px; display: grid; gap: 8px; border-top: 1px solid var(--border); }
.skeleton:first-child { border-top: 0; }
.skeleton div { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--shimmer-a), var(--shimmer-b), var(--shimmer-a)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton div + div { width: 55%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* =========================================================
   Modal
   ========================================================= */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13, 27, 42, .6); z-index: 50;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 450px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: rise .22s var(--ease);
}
.modal-wide { max-width: 580px; }
.modal-head { display: flex; align-items: center; padding: 16px 16px 16px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; margin-right: auto; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; flex-wrap: wrap; }
.link-row { display: flex; gap: 8px; margin: 14px 0; }
.link-row .input { font-size: 13px; background: var(--surface-2); }
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.user-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 20px; }
.user-table th, .user-table td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.user-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.role-pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 16px; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* =========================================================
   Toast
   ========================================================= */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: var(--toast-bg); color: #e0e1dd; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500; animation: toast-in .22s var(--ease);
}
.toast.error { background: #b42318; color: #fff; }
.toast.success { background: #1d7a46; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* =========================================================
   Public viewer
   ========================================================= */
/* Report only, always on white — no header, no theme. */
html:has(.viewer-body) { background: #fff; color-scheme: light; }
.viewer-body { background: #fff; color: #56677d; min-height: 100vh; margin: 0; }
.viewer-pages { padding: 0; display: grid; justify-items: center; gap: 0; }
.viewer-pages canvas { display: block; max-width: 100%; height: auto; background: #fff; }
.viewer-pages canvas + canvas { border-top: 1px solid #e3e5e1; }
.viewer-loading { color: #56677d; padding: 48px; display: flex; align-items: center; gap: 12px; }
.viewer-loading::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #c9ced6; border-top-color: #415a77; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-fallback { width: 100%; max-width: 1000px; height: 100vh; border: 0; background: #fff; }

.nf-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.nf-card { max-width: 440px; }
.nf-icon {
  width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.nf-icon svg { width: 32px; height: 32px; }
.nf-wrap h1 { margin: 0 0 8px; font-size: 24px; }
.nf-wrap p { color: var(--muted); margin: 0; }

/* =========================================================
   Responsive & motion
   ========================================================= */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  /* Phone/tablet order: upload, reports, then the side widgets. */
  .side-col { display: contents; }
  .side-col > .card { order: 2; }
  .side-col > .upload-card { order: 0; }
  .main-col { order: 1; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-mobile-brand { display: flex; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 10px 16px; }
  .container { padding: 16px 16px 64px; }
  .hero { padding: 22px 20px; gap: 18px; margin-bottom: 16px; }
  .hero h1 { font-size: 22px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
  .kpis { gap: 12px; margin-bottom: 16px; }
  .kpi { padding: 14px 14px 12px; }
  .kpi-icon { width: 32px; height: 32px; top: 12px; right: 12px; border-radius: 10px; }
  .kpi-icon svg { width: 16px; height: 16px; }
  .kpi-value { font-size: 24px; }
  .kpi-sub { white-space: normal; }
  .layout, .side-col, .main-col { gap: 16px; }
  .report { padding: 14px 14px; gap: 12px; align-items: flex-start; }
  .pdf-icon { width: 38px; height: 44px; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .mini-list, .feed { padding: 8px 16px 14px; }
  .search { max-width: none; }
  .user-chip { padding: 3px; }
  .user-chip .name { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .user-table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
