/* Vision by Emerge Digital: the client portal. Emerge's brand (black, white, orange, General Sans)
   with Vision's own touch, the same as the staff page: a faceted gem whose core glows gold, fine
   lines and a little light. Dark by default, light when the computer asks for it, or as chosen with
   the button in the header. Calm motion, switched off for anyone who prefers reduced motion. */

@font-face { font-family: 'General Sans'; src: url('/fonts/GeneralSans-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('/fonts/GeneralSans-Medium.otf') format('opentype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('/fonts/GeneralSans-Semibold.otf') format('opentype'); font-weight: 600 700; font-display: swap; }

/* ---------- Tokens: dark (Vision's home) ---------- */
:root {
  --bg: #08090b;
  --surface: #121316;
  --surface-2: #181a1e;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #f3f2ef;
  --muted: #a6a5a1;
  --dim: #74736f;
  --accent: #ff6536;
  --accent-text: #ff8a5c;
  --accent-soft: rgba(255, 101, 54, 0.12);
  --gold: #ffc857;
  --on-accent: #0a0a0a;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --fail: #f87171;
  --fail-soft: rgba(248, 113, 113, 0.13);
  --series-1: #f0572a;
  --series-2: #4a8ef0;
  --header: rgba(8, 9, 11, 0.78);
  --glow-a: rgba(255, 101, 54, 0.10);
  --glow-b: rgba(255, 200, 87, 0.06);
  --grid: rgba(255, 255, 255, 0.025);
  --shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.8);
  --font: 'General Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}
/* ---------- Tokens: light (the computer's setting, or chosen in the header) ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4f1; --surface: #ffffff; --surface-2: #faf9f7; --line: rgba(10, 10, 10, 0.09); --line-2: rgba(10, 10, 10, 0.18);
    --text: #0c0c0d; --muted: #5c5b57; --dim: #8a8984; --accent: #f05a28; --accent-text: #c2410c; --accent-soft: rgba(240, 90, 40, 0.10);
    --gold: #d99a14; --on-accent: #ffffff; --ok: #15803d; --ok-soft: rgba(21, 128, 61, 0.10); --warn: #a16207; --fail: #b91c1c; --fail-soft: rgba(185, 28, 28, 0.09);
    --series-1: #f05a28; --series-2: #2563eb; --header: rgba(245, 244, 241, 0.82); --glow-a: rgba(240, 90, 40, 0.08); --glow-b: rgba(217, 154, 20, 0.07);
    --grid: rgba(10, 10, 10, 0.035); --shadow: 0 20px 40px -28px rgba(10, 10, 10, 0.25);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f4f1; --surface: #ffffff; --surface-2: #faf9f7; --line: rgba(10, 10, 10, 0.09); --line-2: rgba(10, 10, 10, 0.18);
  --text: #0c0c0d; --muted: #5c5b57; --dim: #8a8984; --accent: #f05a28; --accent-text: #c2410c; --accent-soft: rgba(240, 90, 40, 0.10);
  --gold: #d99a14; --on-accent: #ffffff; --ok: #15803d; --ok-soft: rgba(21, 128, 61, 0.10); --warn: #a16207; --fail: #b91c1c; --fail-soft: rgba(185, 28, 28, 0.09);
  --series-1: #f05a28; --series-2: #2563eb; --header: rgba(245, 244, 241, 0.82); --glow-a: rgba(240, 90, 40, 0.08); --glow-b: rgba(217, 154, 20, 0.07);
  --grid: rgba(10, 10, 10, 0.035); --shadow: 0 20px 40px -28px rgba(10, 10, 10, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column;
  /* A little light from the top corners, over a faint grid. */
  background:
    radial-gradient(900px 500px at 8% -10%, var(--glow-a), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, var(--glow-b), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}
a { color: var(--accent-text); }
h1, h2, h3 { margin: 0 0 0.4em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.8em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--header); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.mark { width: 28px; height: 28px; }
.mark .core { animation: core 5s ease-in-out infinite; }
@keyframes core { 0%, 100% { fill: #fff3d1; opacity: 0.85; } 50% { fill: #ffe39a; opacity: 1; } }
.wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark .name { font-weight: 600; font-size: 1.05rem; letter-spacing: 0.22em; text-transform: uppercase; }
.wordmark .by { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.04em; }
#tabs { display: flex; gap: 4px; }
#tabs a { padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 500; transition: background 0.2s var(--ease), color 0.2s var(--ease); }
#tabs a:hover { color: var(--text); background: var(--surface-2); }
#tabs a.active { color: var(--on-accent); background: var(--accent); }
.you { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; }
.who .org { font-weight: 600; }
.who .user { color: var(--muted); }
.theme { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.theme:hover { color: var(--accent-text); border-color: var(--accent); }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme .moon { display: none; }
:root[data-theme="light"] .theme .sun { display: none; }
:root[data-theme="light"] .theme .moon { display: inline; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme .sun { display: none; }
  :root:not([data-theme="dark"]) .theme .moon { display: inline; }
}

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px; }
main:focus { outline: none; }
.foot { color: var(--dim); font-size: 0.8rem; text-align: center; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
/* Three across on a wide screen, every row the height of the tallest card, so cards match. */
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; }
@media (max-width: 960px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.three { grid-template-columns: 1fr; grid-auto-rows: auto; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
/* Space between stacked blocks; never between cards side by side in a grid. */
main > div > * + *, main > * + * { margin-top: 16px; }
.grid > * + * { margin-top: 0; }
.signin { max-width: 480px; margin: 10vh auto 0; text-align: center; padding: 40px 32px; }
.signin .mark { width: 48px; height: 48px; margin-bottom: 12px; }

/* ---------- Home ---------- */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; padding: 40px 40px; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: auto -10% -60% 40%; height: 120%; background: radial-gradient(closest-side, var(--glow-a), transparent); pointer-events: none; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 14px; }
.eyebrow::before { content: ''; width: 22px; height: 2px; border-radius: 2px; background: var(--accent); }
.hero h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.03em; line-height: 1.08; margin-bottom: 14px; }
.glow { background: linear-gradient(100deg, var(--text) 10%, var(--accent) 70%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 62ch; font-size: 1.02rem; }
.hero .actions { margin-top: 22px; }
/* The gem's box grows with its caption, so the caption never spills onto the text below. */
.hero-gem { width: 150px; position: relative; justify-self: center; }
.hero-gem::before { content: ''; position: absolute; inset: -34px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 200, 87, 0.28), rgba(255, 101, 54, 0.12) 55%, transparent); animation: halo 6s ease-in-out infinite; }
.hero-gem svg { position: relative; display: block; width: 100%; height: auto; aspect-ratio: 1; animation: float 7s ease-in-out infinite; filter: drop-shadow(0 12px 30px rgba(255, 101, 54, 0.35)); }
.hero-gem .core { animation: core 5s ease-in-out infinite; }
.hero-gem .by { position: relative; text-align: center; margin-top: 14px; font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
@keyframes halo { 50% { transform: scale(1.08); opacity: 0.8; } }
@keyframes float { 50% { transform: translateY(-6px) rotate(2deg); } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.feature { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; transition: transform 0.25s var(--ease), border-color 0.25s var(--ease); }
a.feature:hover { transform: translateY(-3px); border-color: var(--accent); }
.feature .icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.feature .icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feature h3 { margin: 4px 0 0; }
.feature p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.feature .go { margin-top: auto; padding-top: 8px; font-size: 0.85rem; font-weight: 500; color: var(--accent-text); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; counter-reset: step; }
.step { position: relative; padding-left: 52px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 20px; top: 20px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 600; background: var(--accent); color: var(--on-accent); }
.step h3 { margin-top: 2px; }
.step p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Home: Microsoft 365 at a glance ---------- */
.m365 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.figure-card { display: flex; flex-direction: column; gap: 6px; min-height: 210px; }
.figure-card p { margin: 0; }
.figure-title { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); }
.big { font-size: 2.2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big .unit { font-size: 0.9rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 8px; }
.fine { margin-top: auto !important; font-size: 0.76rem; color: var(--dim); }
.ring-row { display: flex; align-items: center; gap: 16px; }
.ring { width: 96px; height: 96px; flex: none; }
.ring-track { fill: none; stroke: var(--surface-2); }
.ring-fill { fill: none; stroke: var(--series-1); stroke-linecap: round; transition: stroke-dasharray 0.8s var(--ease); }
.ring-fill.high { stroke: var(--fail); }
.ring-text { fill: var(--text); font: 600 22px var(--font); }
.spark { width: 100%; height: 56px; margin: 4px 0; }
.spark-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--accent-soft); }
.spark-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
/* Licence rows: the name and figure on one line, the bar under them, so names are not cut short. */
.bars.compact { gap: 8px; margin-top: 8px; }
.bars.compact .row { font-size: 0.8rem; grid-template-columns: 1fr auto; grid-template-areas: 'name value' 'track track'; row-gap: 3px; }
.bars.compact .name { grid-area: name; }
.bars.compact .value { grid-area: value; }
.bars.compact .track { grid-area: track; height: 6px; }
.ring-row .big { font-size: 1.7rem; white-space: nowrap; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; text-decoration: none; color: inherit; }
.tile .label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tile .value { font-size: 1.8rem; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .note { color: var(--dim); font-size: 0.8rem; }
.tile.accent { border-color: var(--accent); background: var(--accent-soft); }
a.tile:hover { border-color: var(--accent); }
.skeleton { display: inline-block; width: 60px; height: 28px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--accent-soft), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 7px 16px; cursor: pointer; font-weight: 500; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Report cards: the same size, the button at the bottom of each ---------- */
.report-card { display: flex; flex-direction: column; min-height: 190px; }
.report-card p { flex: 1; }
.report-card .actions { margin-top: 12px; }

/* ---------- Forms (the report builder) ---------- */
.builder { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; margin: 12px 0 16px; }
.builder label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); }
.builder select, .builder input { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: var(--surface-2); }
.table-note { color: var(--dim); font-size: 0.8rem; margin-top: 8px; }

/* ---------- Pills ---------- */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.fail { background: var(--fail-soft); color: var(--fail); border-color: transparent; }
.pill.busy { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* ---------- Charts ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bars .row { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; align-items: center; gap: 10px; font-size: 0.86rem; }
.bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--series-1); border-radius: 999px; }
.bars .value { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 2.5em; text-align: right; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-2); }
.chart .grid-line { stroke: var(--line); }
.chart .label { fill: var(--dim); font-size: 10px; font-family: var(--font); }
.chart .raised { fill: var(--series-1); }
.chart .closed { fill: var(--series-2); }
.legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .raised { background: var(--series-1); }
.legend .closed { background: var(--series-2); }

/* ---------- Messages ---------- */
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.notice.error { background: var(--fail-soft); border-color: transparent; color: var(--fail); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 28px 24px; }
  .hero-gem { width: 96px; justify-self: start; order: -1; }
  .hero-gem::before { inset: -20px; }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .you { margin-left: 0; width: 100%; justify-content: space-between; }
  main { padding: 16px; }
}
