/* Dark teal glass theme: glowing orbs, light beams, champagne gold and teal accents. */
:root {
  color-scheme: dark;
  --page: #050b0b;
  --page-2: #0a1716;
  --surface: rgba(18, 38, 37, 0.62);
  --surface-2: rgba(28, 56, 54, 0.55);
  --solid: #0c1918;          /* opaque surface for sticky table cells */
  --solid-2: #122524;
  --ink: #e9f2f0;
  --ink-2: #a8bdb9;
  --muted: #6d8783;
  --grid: rgba(150, 220, 210, 0.08);
  --axis: rgba(150, 220, 210, 0.20);
  --border: rgba(150, 230, 220, 0.13);
  --edge: rgba(255, 255, 255, 0.07);
  --teal: #5fd4c4;
  --gold: #e3be7c;
  --violet: #a995f5;
  --accent: #5fd4c4;
  --pos: #1fa08f;            /* validated pair on --solid: lightness band, CVD, contrast */
  --neg: #ea5a72;
  --good: #4fd18b;
  --warning: #f2b84b;
  --critical: #f07386;
  --critical-bg: rgba(234, 90, 114, 0.12);
  --warning-bg: rgba(242, 184, 75, 0.10);
  --radius: 18px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --glow-teal: 0 0 0 1px rgba(95, 212, 196, .35), 0 0 24px rgba(95, 212, 196, .18);
  --glow-gold: 0 0 0 1px rgba(227, 190, 124, .55), 0 0 26px rgba(227, 190, 124, .22);
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 14px/1.45 var(--font);
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(64, 140, 130, .22), transparent 60%),
    radial-gradient(900px 600px at 95% 15%, rgba(120, 100, 200, .10), transparent 60%),
    radial-gradient(1000px 800px at 50% 110%, rgba(40, 110, 100, .16), transparent 60%),
    linear-gradient(180deg, var(--page-2), var(--page) 70%);
  background-attachment: fixed;
}
#fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#login, #app { position: relative; z-index: 1; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
::selection { background: rgba(95, 212, 196, .3); }

/* ---------- glass ---------- */
.card, .login-card, .tip {
  background: linear-gradient(160deg, rgba(34, 66, 63, .55), rgba(10, 22, 22, .62) 60%);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--edge), 0 20px 50px -20px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; border-radius: 24px; padding: 32px; animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.login-card h1 { font-size: 22px; margin: 0 0 6px; font-weight: 600; letter-spacing: -.01em; }
.login-card p { margin: 0 0 22px; color: var(--ink-2); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--ink-2); }
input[type=email], input[type=search], input:not([type]), .field input {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(5, 14, 14, .55); transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { outline: none; border-color: rgba(95, 212, 196, .6); box-shadow: 0 0 0 3px rgba(95, 212, 196, .15), 0 0 20px rgba(95, 212, 196, .12); }
.btn {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: rgba(20, 44, 42, .6);
  cursor: pointer; white-space: nowrap; transition: border-color .2s, box-shadow .2s, background .2s, transform .1s;
}
.btn:hover { border-color: rgba(95, 212, 196, .45); box-shadow: 0 0 18px rgba(95, 212, 196, .14); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: rgba(227, 190, 124, .7); color: #fff3dc;
  background: linear-gradient(180deg, rgba(227, 190, 124, .28), rgba(227, 190, 124, .10));
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, .25), 0 0 22px rgba(227, 190, 124, .15);
}
.btn.primary:hover { box-shadow: var(--glow-gold); }
.btn.fx::before { content: "✦"; margin-right: 7px; color: var(--gold); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.link { border: 0; background: none; padding: 4px 6px; color: var(--ink-2); box-shadow: none; }
.btn.link:hover { color: var(--ink); }
.msg { min-height: 20px; font-size: 13px; margin-top: 10px; color: var(--ink-2); }
.login-brand { margin-bottom: 26px; }
.login-brand .brand-logo { height: 46px; }
.login-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.login-links .btn.link:disabled { opacity: 1; color: var(--muted); }
.login-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.login-foot + .login-foot { margin-top: 6px; padding-top: 0; border-top: 0; }
.msg.err { color: var(--critical); }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--border);
  background: rgba(5, 12, 12, .62); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.top-inner { max-width: 1320px; margin: 0 auto; padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.brand { font-weight: 650; font-size: 16px; margin-right: auto; display: flex; gap: 12px; align-items: center; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.brand-logo { display: block; height: 40px; width: auto; }
@media (max-width: 560px) { .brand-logo { height: 32px; } }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: rgba(20, 44, 42, .7); }
select option { background: var(--solid); }
.user { font-size: 12px; color: var(--muted); }
.btn.small { padding: 5px 12px; font-size: 12px; }
.btn.danger { border-color: rgba(240, 115, 134, .6); color: var(--critical); }
.btn.danger:hover { box-shadow: 0 0 18px rgba(240, 115, 134, .2); }

/* ---------- admin: Users page ---------- */
.admin { display: grid; gap: 16px; }
.add-user { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.add-user input { flex: 1 1 240px; max-width: 360px; }
#adminMsg { margin: 4px 0 10px; }
#usersTbl th, #auditTbl th { cursor: default; }
tr.muted-row td { color: var(--muted); }
.view-edit { display: inline-flex; align-items: center; gap: 6px; }
.view-edit .btn.small { padding: 4px 12px; }
#usersTbl tr.dirty td { background: rgba(227, 190, 124, .07); }
#usersTbl tr.dirty td:first-child { box-shadow: inset 2px 0 0 var(--gold); }
.dash { display: grid; gap: 18px; }
main { max-width: 1320px; margin: 0 auto; padding: 20px 16px; display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }

.banner { border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); }
.banner.err { background: var(--critical-bg); border-color: rgba(240, 115, 134, .35); box-shadow: inset 0 -2px 0 rgba(240, 115, 134, .55); }
.banner.warn { background: var(--warning-bg); border-color: rgba(242, 184, 75, .3); }
.banner .icon { font-weight: 700; }
.banner ul { margin: 6px 0 0; padding-left: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(10, 26, 25, .7); white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge.ok { border-color: rgba(79, 209, 139, .35); }
.badge.ok .dot { background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 2.4s ease-in-out infinite; }
.badge.fail { border-color: rgba(240, 115, 134, .45); }
.badge.fail .dot { background: var(--critical); box-shadow: 0 0 10px var(--critical); animation: pulse 1.2s ease-in-out infinite; }
.badge.mtd .dot { background: var(--teal); box-shadow: 0 0 8px var(--teal); }

.card { border-radius: var(--radius); padding: 18px 20px; min-width: 0; position: relative; animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.card h2 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .01em; }
.card .sub { font-size: 12px; color: var(--muted); margin: 3px 0 14px; }
.dash > .card:nth-child(2) { animation-delay: .08s; }
.dash > .card:nth-child(3) { animation-delay: .14s; }
.dash > .card:nth-child(4) { animation-delay: .2s; }

/* ---------- hero: true GP | net revenue | intercompany ---------- */
.hero { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
.kpi { display: flex; flex-direction: column; min-height: 248px; padding: 22px 24px; overflow: hidden; }
.kpi::before {   /* a soft light in the corner, in the card's accent colour */
  content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -110px; border-radius: 50%;
  pointer-events: none; filter: blur(10px); opacity: .9;
}
.k-gp::before { background: radial-gradient(circle, rgba(227, 190, 124, .22), transparent 65%); }
.k-nr::before { background: radial-gradient(circle, rgba(95, 212, 196, .18), transparent 65%); }
.k-ic::before { background: radial-gradient(circle, rgba(169, 149, 245, .18), transparent 65%); }
.k-gp { border-color: rgba(227, 190, 124, .22); }
.kpi > * { position: relative; }
.hero .k-nr { animation-delay: .06s; }
.hero .k-ic { animation-delay: .12s; }
.tile .label { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tile .value { font-size: 34px; font-weight: 650; margin-top: 14px; letter-spacing: -.015em; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; line-height: 1.1; }
.tile .note, .kpi .pct { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.tile .ico {
  width: 30px; height: 30px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 13px; flex: none;
  background: rgba(95, 212, 196, .12); border: 1px solid rgba(95, 212, 196, .25); color: var(--teal);
}
.k-gp .ico { background: rgba(227, 190, 124, .12); border-color: rgba(227, 190, 124, .3); color: var(--gold); }
.k-ic .ico { background: rgba(169, 149, 245, .12); border-color: rgba(169, 149, 245, .3); color: var(--violet); }
.lead .value {
  font-size: 50px; line-height: 1.05;
  background: linear-gradient(180deg, #fffaf0 10%, var(--gold) 120%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead .value.neg-text { background: linear-gradient(180deg, #ffe6ea, var(--neg)); -webkit-background-clip: text; background-clip: text; }
.k-gp .pct { color: var(--ink-2); font-size: 13.5px; }
.neg-text { color: var(--critical); }

.foot-kpi { margin-top: auto; padding-top: 18px; display: grid; gap: 7px; }
.meter { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .05);
  margin-bottom: 5px; transform-origin: left; animation: grow 1s cubic-bezier(.2, .8, .2, 1) .2s both; }
.meter i { display: block; min-width: 3px; }
.meter i.p { background: linear-gradient(90deg, rgba(31, 160, 143, .55), var(--pos)); box-shadow: 0 0 10px rgba(31, 160, 143, .5); }
.meter i.n { background: var(--neg); box-shadow: 0 0 10px rgba(234, 90, 114, .5); }
.meter i.t { background: linear-gradient(90deg, rgba(95, 212, 196, .4), var(--teal)); box-shadow: 0 0 10px rgba(95, 212, 196, .45); }
.meter i.rest { background: rgba(255, 255, 255, .06); }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; color: var(--ink-2); }
.kv span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv.neg b { color: var(--critical); }
.kv.small { font-size: 12px; color: var(--muted); }
.kv.small b { color: var(--ink-2); font-weight: 500; }
.kv .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.kv .dot.p { background: var(--pos); box-shadow: 0 0 8px var(--pos); }
.kv .dot.n { background: var(--neg); box-shadow: 0 0 8px var(--neg); }
.kv .dot.t { background: var(--teal); box-shadow: 0 0 8px var(--teal); }

.ic-tbl { margin-top: auto; padding-top: 14px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ic-r { display: grid; grid-template-columns: minmax(0, 1fr) 6.2em 5.6em; gap: 10px; align-items: center; padding: 7px 11px; }
.ic-r > :not(:first-child) { text-align: right; white-space: nowrap; }
.ic-h { padding-top: 0; padding-bottom: 6px; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.ic-body { display: grid; gap: 6px; max-height: 132px; overflow-y: auto; }
.ic-body .ic-r { border-radius: 10px; background: rgba(169, 149, 245, .06); border: 1px solid rgba(169, 149, 245, .14); color: var(--ink-2); }
.ic-r .nm { min-width: 0; display: grid; line-height: 1.25; }
.ic-r .n1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-r small { color: var(--muted); font-size: 10.5px; }
.ic-r b { font-weight: 600; color: var(--ink); }
.ic-tot { margin-top: 6px; padding-top: 9px; border-top: 1px solid rgba(169, 149, 245, .22); font-weight: 600; }
.ic-tot > :first-child { color: var(--ink-2); }
.small { font-size: 12px; }

@media (max-width: 1100px) {
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero .k-gp { grid-column: 1 / -1; min-height: 0; }
}
@media (max-width: 640px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .kpi { min-height: 0; }
  .lead .value { font-size: 42px; }
}

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart text.val { fill: var(--ink-2); font-size: 11px; animation: fade .6s ease both; }
.chart text.lbl { fill: var(--ink-2); font-size: 12px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .band { fill: rgba(95, 212, 196, .06); opacity: 0; transition: opacity .15s; }
.chart g:hover .band, .chart g.hover .band { opacity: 1; }
.chart .mark { transform-box: view-box; animation: grow .9s cubic-bezier(.2, .8, .2, 1) both; transition: filter .15s; }
.chart .mark.hover { filter: brightness(1.25) drop-shadow(0 0 6px currentColor); }
.chart .tipdot { animation: fade .6s ease both; }
.tip {
  position: absolute; pointer-events: none; border-radius: 12px; padding: 10px 12px; font-size: 12px;
  min-width: 170px; z-index: 3; background: rgba(8, 20, 20, .9);
}
.tip .t { color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.tip .r { display: flex; align-items: center; gap: 10px; justify-content: space-between; color: var(--ink-2); line-height: 1.7; }
.tip .r b { font-variant-numeric: tabular-nums; color: var(--ink); }
.tip .k { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }

/* ---------- tables ---------- */
.table-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.table-tools input { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: rgba(4, 12, 12, .35); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--solid-2); font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; font-size: 12px; }
th.sorted { color: var(--teal); }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
td.l, th.l { text-align: left; }
td.name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(95, 212, 196, .06); }
tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--teal); }
tr.total td { font-weight: 600; background: rgba(227, 190, 124, .07); color: var(--ink); border-top: 1px solid rgba(227, 190, 124, .3); }
tr.sub td { color: var(--ink-2); }
tr.grp td { padding-top: 18px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 0; }
tr.ind td:first-child { padding-left: 22px; }
tr.total.bad td { color: var(--neg); }
td.code, span.code { color: var(--muted); font-size: 12px; }
.chip {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px;
  background: rgba(95, 212, 196, .1); border: 1px solid rgba(95, 212, 196, .25); color: var(--teal);
}

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 0 28px; }

#tbl td:first-child, #tbl th:first-child { position: sticky; left: 0; background: var(--solid); z-index: 1; }
#tbl th:first-child { background: var(--solid-2); z-index: 2; }
#tbl tbody tr:hover td:first-child { background: #11211f; }
#tbl tr.total td:first-child { background: #1a2420; }
.note-gap { margin-top: 10px; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- date range picker ---------- */
.btn.range { display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px; }
.btn.range .cal {
  width: 15px; height: 15px; border: 1.5px solid var(--teal); border-radius: 4px; position: relative; flex: none;
  box-shadow: 0 0 8px rgba(95, 212, 196, .35);
}
.btn.range .cal::before { content: ""; position: absolute; left: 2px; right: 2px; top: 3px; height: 1.5px; background: var(--teal); }
.btn.range .rtag { font-size: 11px; color: var(--teal); padding: 1px 8px; border-radius: 999px; background: rgba(95, 212, 196, .1); border: 1px solid rgba(95, 212, 196, .22); }
.btn.range[aria-expanded="true"] { border-color: rgba(95, 212, 196, .55); box-shadow: var(--glow-teal); }

.picker {
  position: fixed; z-index: 50; display: grid; grid-template-columns: 160px auto; gap: 0; padding: 0; overflow: hidden;
  border-radius: 20px; animation: pop .18s cubic-bezier(.2, .8, .2, 1) both; background: rgba(8, 20, 20, .94);
  box-shadow: inset 0 1px 0 var(--edge), 0 30px 80px -10px rgba(0, 0, 0, .8), 0 0 40px rgba(95, 212, 196, .08);
}
.pk-presets { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--border); background: rgba(95, 212, 196, .03); }
.pk-preset {
  text-align: left; border: 1px solid transparent; background: none; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  color: var(--ink-2); font-size: 13px; transition: background .15s, color .15s, border-color .15s;
}
.pk-preset:hover:not(:disabled) { background: rgba(95, 212, 196, .08); color: var(--ink); }
.pk-preset.on { color: #fff3dc; border-color: rgba(227, 190, 124, .5); background: linear-gradient(90deg, rgba(227, 190, 124, .18), rgba(227, 190, 124, .04)); }
.pk-preset:disabled { color: var(--muted); opacity: .45; cursor: not-allowed; }
.pk-main { padding: 14px 16px 14px; min-width: 0; }
.pk-head { display: flex; align-items: flex-start; gap: 6px; }
.pk-nav {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: rgba(20, 44, 42, .6);
  cursor: pointer; font-size: 18px; line-height: 1; margin-top: 2px; flex: none;
}
.pk-nav:hover:not(:disabled) { border-color: rgba(95, 212, 196, .5); }
.pk-nav:disabled { opacity: .3; cursor: default; }
.pk-months { display: flex; gap: 22px; flex: 1; justify-content: center; }
.pk-month { width: 252px; }
.pk-title { text-align: center; font-weight: 600; font-size: 13px; padding: 7px 0 10px; letter-spacing: .02em; }
.pk-grid { display: grid; grid-template-columns: repeat(7, 36px); row-gap: 3px; }
.pk-dow { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.pk-day {
  height: 34px; border: 0; background: none; cursor: pointer; font-size: 12.5px; color: var(--ink); position: relative;
  font-variant-numeric: tabular-nums; border-radius: 0; transition: background .1s;
}
.pk-day:not(.lo):not(.hi):not(:disabled):hover { background: rgba(95, 212, 196, .16); border-radius: 10px; }
.pk-day:disabled { color: rgba(168, 189, 185, .22); cursor: default; }
.pk-day.today::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--gold); }
.pk-day.in { background: rgba(95, 212, 196, .13); }
.pk-day.pre { background: rgba(95, 212, 196, .07); }
.pk-day.lo { border-radius: 10px 0 0 10px; }
.pk-day.hi { border-radius: 0 10px 10px 0; }
.pk-day.lo.hi { border-radius: 10px; }
.pk-day.lo, .pk-day.hi {
  color: #03201c; font-weight: 700;
  background: radial-gradient(circle at 35% 30%, #d9fff8, var(--teal) 70%);
  box-shadow: 0 0 14px rgba(95, 212, 196, .55);
}
.pk-day:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 10px; }
.pk-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pk-sum { font-weight: 600; font-size: 14px; }
.pk-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pk-btns { display: flex; gap: 8px; }
.picker.sheet {
  left: 0; right: 0; bottom: 0; top: auto; grid-template-columns: minmax(0, 1fr); border-radius: 22px 22px 0 0;
  max-height: 92vh; overflow-y: auto; animation-name: sheet;
}
.picker.sheet .pk-presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px; }
.picker.sheet .pk-preset { padding: 6px 10px; font-size: 12px; border-color: var(--border); }
.picker.sheet .pk-months { min-width: 0; }
.picker.sheet .pk-month { width: 100%; }
.picker.sheet .pk-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- loader and scene changes ---------- */
.loader {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; align-content: center; gap: 20px;
  background: radial-gradient(520px 380px at 50% 46%, rgba(64, 140, 130, .20), transparent 70%), rgba(5, 11, 11, .78);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transition: opacity .35s ease;
}
.loader.in { opacity: 1; }
.loader.out { opacity: 0; transition: opacity .45s ease; }
.loader.out .ld-orb { transform: scale(1.35); opacity: 0; transition: transform .45s cubic-bezier(.4, 0, .2, 1), opacity .45s ease; }
.ld-orb { position: relative; width: 92px; height: 92px; }
.ld-orb::before, .ld-orb::after { content: ""; position: absolute; border-radius: 50%; border: 2px solid transparent; }
.ld-orb::before {
  inset: 0; border-top-color: var(--teal); border-right-color: rgba(95, 212, 196, .35);
  filter: drop-shadow(0 0 8px rgba(95, 212, 196, .7)); animation: spin 1.1s linear infinite;
}
.ld-orb::after {
  inset: 12px; border-bottom-color: var(--gold); border-left-color: rgba(227, 190, 124, .3);
  filter: drop-shadow(0 0 8px rgba(227, 190, 124, .7)); animation: spin 1.7s linear infinite reverse;
}
.ld-core {
  position: absolute; inset: 31px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, var(--gold) 35%, rgba(227, 190, 124, .2) 100%);
  box-shadow: 0 0 24px rgba(227, 190, 124, .65); animation: breathe 1.6s ease-in-out infinite;
}
.ld-logo { height: 30px; width: auto; opacity: .92; }
.ld-text { font-size: 13px; color: var(--ink-2); letter-spacing: .02em; min-height: 18px; }
.ld-bar { width: 160px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.ld-bar i { display: block; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, var(--teal), transparent); animation: sweep 1.2s ease-in-out infinite; }

.login.leaving .login-card { animation: cardOut .42s cubic-bezier(.4, 0, .2, 1) both; }
.login-card form:not(.hidden) { animation: formIn .35s cubic-bezier(.2, .8, .2, 1) both; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 243, 220, .3); border-top-color: #fff3dc; animation: spin .7s linear infinite;
}
#app.pre { opacity: 0; pointer-events: none; }
#app.enter { animation: sceneIn .75s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .top { animation: dropIn .6s cubic-bezier(.2, .8, .2, 1) .05s both; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { transform: scale(.88); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes sweep { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
@keyframes cardOut { to { opacity: 0; transform: translateY(-14px) scale(.97); filter: blur(4px); } }
@keyframes formIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
/* opacity only: scaling or blurring #app leaves Chrome's text layers clipped to the scaled size */
@keyframes sceneIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }

/* ---------- refresh progress ---------- */
.rprog {
  border-radius: 14px; padding: 12px 16px 14px; border: 1px solid rgba(95, 212, 196, .28);
  background: linear-gradient(180deg, rgba(28, 64, 60, .55), rgba(18, 38, 37, .62));
  box-shadow: 0 0 24px rgba(95, 212, 196, .10); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: dropIn .35s cubic-bezier(.2, .8, .2, 1) both; transition: opacity .45s ease;
}
.rprog.out { opacity: 0; }
.rp-row { display: flex; align-items: center; gap: 12px; }
.rp-ring {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(95, 212, 196, .22); border-top-color: var(--teal); animation: spin .9s linear infinite;
}
.rp-text { flex: 1; min-width: 0; }
.rp-title { font-weight: 600; font-size: 14px; }
.rp-step { font-size: 12px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-pct { flex: none; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--teal); min-width: 3.2em; text-align: right; }
.rp-track { margin-top: 10px; height: 6px; border-radius: 99px; background: rgba(150, 230, 220, .10); overflow: hidden; }
.rp-bar {
  position: relative; height: 100%; width: 0; border-radius: 99px; overflow: hidden;
  background: linear-gradient(90deg, #1fa08f, var(--teal));
  box-shadow: 0 0 12px rgba(95, 212, 196, .45);
}
.rp-bar::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: translateX(-100%); animation: rpShine 1.6s ease-in-out infinite;
}
@keyframes rpShine { to { transform: translateX(100%); } }
.rprog.done .rp-ring { animation: none; border-color: var(--good); background: radial-gradient(circle, var(--good) 0 3px, transparent 4px); }
.rprog.done .rp-pct { color: var(--good); }
.rprog.done .rp-bar { background: linear-gradient(90deg, #1fa08f, var(--good)); }
.rprog.done .rp-bar::after, .rprog.failed .rp-bar::after { animation: none; display: none; }
.rprog.failed { border-color: rgba(240, 115, 134, .35); background: var(--critical-bg); box-shadow: none; }
.rprog.failed .rp-ring { animation: none; border-color: var(--critical); }
.rprog.failed .rp-pct { display: none; }
.rprog.failed .rp-bar { background: var(--critical); box-shadow: none; }
.rprog.failed .rp-step { white-space: normal; }
@media (max-width: 640px) { .rp-pct { font-size: 18px; } }

/* ---------- open-month note ---------- */
.mtd-note { display: flex; gap: 10px; align-items: flex-start; margin: -4px 0 14px; padding: 9px 12px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-2); background: rgba(227, 190, 124, .06); border: 1px solid rgba(227, 190, 124, .2); }
.mtd-note .mi { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  font: 600 11px/1 var(--font); font-style: italic; color: var(--gold); border: 1px solid rgba(227, 190, 124, .55); }
