/* ERD web design system: components, surfaces and motion.
   Requires erd-tokens.css (and erd-fonts.css for Montserrat) loaded before it.
   Everything is plain CSS with no build step. Class names are prefixed only
   where a clash with a host theme is likely; the rest match the client portal
   so the two stay in step.

   Sections: base, atmosphere, the mark, motion, brand furniture, controls,
   surfaces, messages, badges, tabs, dashboard shell, responsive, reduced motion. */

/* ---------- base ---------- */
.erd, .erd body, body.erd {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
.erd *, .erd *::before, .erd *::after { box-sizing: border-box; }
.erd a { color: inherit; }
.erd h1, .erd h2, .erd h3, .erd .display { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; }
.erd h1 { font-weight: 700; }
.erd p { margin: 0; }

.eyebrow {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- atmosphere ----------
   Two fixed brand glows (red top right, green bottom left), a pointer light
   that follows the mouse (js/erd-cursor-glow.js) and a film grain so the
   black never reads flat. All pointer-events: none and z-index 0; give your
   content position: relative; z-index: 1 (the .erd-content helper does that). */
.glow, .glow-green {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
}
.glow {
  width: 70vmax; height: 70vmax; top: -30vmax; right: -25vmax;
  background: radial-gradient(circle, var(--red-soft) 0%, transparent 60%);
}
.glow-green {
  width: 60vmax; height: 60vmax; bottom: -35vmax; left: -20vmax;
  background: radial-gradient(circle, rgba(0, 102, 51, 0.22) 0%, transparent 62%);
}
.cursor-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0;
  transition: opacity 0.6s ease;
  background:
    radial-gradient(420px circle at var(--mx, 60%) var(--my, 40%), rgba(255, 0, 0, 0.13), transparent 62%),
    radial-gradient(900px circle at calc(var(--mx, 60%) + 260px) calc(var(--my, 40%) + 180px), rgba(34, 178, 107, 0.06), transparent 65%);
}
.cursor-glow.on { opacity: 1; }
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.035; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}
.erd-content { position: relative; z-index: 1; }

/* ---------- the mark ----------
   The registered ERD mark is served as static SVG (brand/*.svg) through an
   <img>: cached once, never inlined. erd-mark-full-anim.svg carries its own
   motion (ghost layers slide into register, red accents pulse). */
.erd-mark { display: block; max-width: 100%; height: auto; user-select: none; }

/* Outline light (js/erd-mark-beam.js): a soft white halo on the letter
   outlines that leans away from the pointer, and a slow beam that travels
   around each outline while the pointer rests. */
.mark-stage { position: relative; display: inline-block; --gx: 0px; --gy: 0px; --halo: 0.42; }
.mark-stage.moving { --halo: 0.68; }
.mark-beam {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  pointer-events: none; fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round;
}
.mark-beam .mb-halo {
  stroke-width: 1.7; opacity: var(--halo);
  transform: translate(var(--gx), var(--gy));
  transition: opacity 0.9s ease;
}
.mark-beam .mb-beam path { stroke-dasharray: 14 86; animation: beam-run 9s linear infinite; }
.mark-beam .mb-beam path:nth-child(2) { animation-delay: -3.1s; }
.mark-beam .mb-beam path:nth-child(3) { animation-delay: -6.2s; }
.mark-beam .mb-beam path:nth-child(4) { animation-delay: -1.5s; }
.mark-beam .mb-beam path:nth-child(5) { animation-delay: -4.6s; }
.mark-beam .mb-beam-soft { stroke-width: 2.6; opacity: 0.6; }
.mark-beam .mb-beam-core { stroke-width: 0.55; opacity: 0.95; }

/* ---------- motion ---------- */
@keyframes beam-run { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.fade-up { animation: fade-up 0.8s var(--ease) both; }
.d1 { animation-delay: 0.15s; } .d2 { animation-delay: 0.3s; } .d3 { animation-delay: 0.45s; }
.d4 { animation-delay: 0.6s; } .d5 { animation-delay: 0.75s; } .d6 { animation-delay: 0.9s; }
/* Scroll reveal (js/erd-reveal.js adds .fade-up when the element enters the
   viewport). Hidden only when JS is running, so no-JS visitors see everything. */
html.js .reveal:not(.fade-up) { opacity: 0; }

/* ---------- brand furniture ---------- */
.wordmark span {
  display: block; font-family: var(--font-display); font-weight: 300; text-transform: uppercase;
  letter-spacing: 0.22em; line-height: 1.12;
}
.wordmark .wm-1 { color: var(--red); }
.wordmark .wm-2, .wordmark .wm-3 { color: var(--green-bright); }

.sector-strip {
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0;
  font-family: var(--font-display); font-weight: 500; letter-spacing: 0.5px; color: var(--muted);
}
.sector-strip .sector { padding: 0 12px; border-left: 2px solid var(--green-bright); line-height: 1.2; }
.sector-strip .sector:nth-child(even) { border-left-color: var(--red); }
.sector-strip .sector-end { border-left: 2px solid var(--green-bright); height: 1.2em; }

.taglines { font-family: var(--font-display); letter-spacing: 3px; text-transform: uppercase; line-height: 2; }
.taglines .tag-create { color: var(--green-bright); font-weight: 700; font-style: italic; }
.taglines .tag-smart { font-weight: 600; }
.taglines .tag-smart .r { color: var(--red); }
.taglines .tag-smart .g { color: var(--green-bright); }

.rule { width: 64px; height: 3px; margin: 0 auto; background: linear-gradient(90deg, var(--red), var(--green-bright)); border-radius: 2px; }
.accent-bar { height: 3px; width: 34px; border-radius: 2px; background: var(--red); }
.accent-bar.green { background: var(--green-bright); }
.accent-bar.dim { background: var(--line-strong); }

/* ---------- controls ---------- */
.btn {
  display: inline-block;
  background: var(--red-ui);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-display);
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.btn:hover { background: var(--red); box-shadow: 0 8px 26px rgba(255, 0, 0, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: default; box-shadow: none; pointer-events: none; }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); box-shadow: none; }
.btn-green { background: var(--green); }
.btn-green:hover { background: #0a8a47; box-shadow: 0 8px 26px rgba(34, 178, 107, 0.2); }
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn-xs { padding: 6px 12px; font-size: 12px; }

.field { margin-bottom: 16px; text-align: left; }
.field label {
  display: block; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 7px; font-family: var(--font-display); font-weight: 500;
}
.field input, .field select, .field textarea, .input {
  width: 100%; background: var(--dark); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--text); font-size: 15px; outline: none; font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--dim); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft);
}
.field textarea { resize: vertical; }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

/* ---------- surfaces ---------- */
.card {
  position: relative; z-index: 1;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
/* Frosted glass: translucent ground, blur of the glows behind it, a hairline
   highlight along the top edge and a soft red halo. Needs the glows behind
   it to look right; on a flat black it is just a dark card. */
.card.glass {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.025) 45%, rgba(255, 255, 255, 0.015) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(255, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.card.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent 38%);
  mask: linear-gradient(180deg, #000, transparent 60%);
  -webkit-mask: linear-gradient(180deg, #000, transparent 60%);
}
.card.glass::after {
  content: ""; position: absolute; left: 12%; right: 12%; top: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
}
.card.glass .field input, .card.glass .field select, .card.glass .field textarea {
  background: rgba(0, 0, 0, 0.35); border-color: rgba(255, 255, 255, 0.10);
}
.card.glass .field input:focus { background: rgba(0, 0, 0, 0.5); }
.card-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 22px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-hover { position: relative; overflow: hidden; transition: transform 0.25s var(--ease), border-color 0.25s ease, box-shadow 0.25s ease; }
.panel-hover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.35s ease;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.06) 48%, transparent 62%);
}
.panel-hover:hover { transform: translateY(-3px); border-color: rgba(255, 0, 0, 0.4); box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 0, 0, 0.08); }
.panel-hover:hover::after { opacity: 1; }

/* Stat card and feature tile (the dashboard overview) */
.stat { padding: 20px; }
.stat .accent-bar { width: 28px; margin-bottom: 14px; }
.stat .eyebrow { letter-spacing: 1.5px; margin-bottom: 6px; }
.stat .value { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.stat .value.red { color: var(--red); }
.stat .value.green { color: var(--green-bright); }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tile { padding: 24px; }
.tile .accent-bar { margin-bottom: 16px; }
.tile h2, .tile h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.tile p { color: var(--muted); font-size: 14px; line-height: 1.55; margin-bottom: 18px; }
.tile.soon { opacity: 0.55; }
.tile.soon p { margin-bottom: 0; }
.grid-stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-tiles { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- messages ---------- */
.error, .notice, .success {
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; margin-bottom: 16px; text-align: left; border: 1px solid;
}
.error { background: var(--red-soft); border-color: rgba(255, 0, 0, 0.4); color: #ff9b9e; }
.notice { background: rgba(255, 255, 255, 0.05); border-color: var(--line); color: var(--muted); }
.success { background: var(--green-soft); border-color: rgba(34, 178, 107, 0.4); color: var(--green-bright); }

/* ---------- badges ----------
   Tinted pill: set --badge to any colour and the fill, text and border follow. */
.badge {
  --badge: var(--muted);
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  color: var(--badge); background: color-mix(in srgb, var(--badge) 13%, transparent); border: 1px solid color-mix(in srgb, var(--badge) 33%, transparent);
}
.badge-red { --badge: var(--red); }
.badge-green { --badge: var(--green-bright); }
.badge-amber { --badge: var(--amber); }
.badge-blue { --badge: var(--blue); }
.badge-grey { --badge: #7a7a7a; }

/* ---------- tabs (the pill strip above framed tools) ---------- */
.pill-tabs {
  display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; flex-wrap: wrap;
}
.pill-tabs a, .pill-tabs button {
  text-decoration: none; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 7px; white-space: nowrap;
  background: transparent; color: var(--text); border: 0; cursor: pointer; font-family: inherit;
}
.pill-tabs a:hover, .pill-tabs button:hover { background: rgba(255, 255, 255, 0.05); }
.pill-tabs .active, .pill-tabs [aria-current="page"] { background: var(--red); color: #fff; }
.pill-tabs .ext { opacity: 0.6; }

/* ---------- info cell (label over value) ---------- */
.info { padding: 14px 16px; }
.info .eyebrow { letter-spacing: 1.5px; margin-bottom: 6px; }
.info .value { font-weight: 600; font-size: 15px; }
.info .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- centred page (hero / sign-in) ---------- */
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 20px 64px; position: relative; overflow: hidden;
}
.splash {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px 72px; position: relative; overflow: hidden; text-align: center;
}
.splash-inner { position: relative; z-index: 1; max-width: 640px; width: 100%; }
.splash h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 700; line-height: 1.15; margin-bottom: 14px; }
.splash .lede { color: var(--muted); font-size: 16px; line-height: 1.65; max-width: 520px; margin: 0 auto 36px; }
.splash .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
footer.credit {
  position: fixed; bottom: 18px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: var(--dim); z-index: 1;
}
footer.credit a { color: #8a8a8a; text-decoration: none; }

/* ---------- dashboard shell ---------- */
.shell { display: flex; min-height: 100vh; }
.shell .sidebar, .shell .main { position: relative; z-index: 1; }
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--dark); border-right: 1px solid var(--line);
  padding: 26px 16px 20px; display: flex; flex-direction: column;
}
.sidebar-brand { padding: 0 8px 22px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-brand a { display: inline-block; line-height: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.nav a, .nav .soon {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover { background: rgba(255, 255, 255, 0.04); }
.nav a.active, .nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.05); color: #fff; font-weight: 600; }
.nav a.active::before, .nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--red);
}
.nav .ext { color: var(--muted); font-size: 12px; margin-left: auto; }
.nav .soon { color: var(--dim); cursor: default; }
.nav .soon small { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; margin-left: auto; color: #4a4a4a; }
.sidebar-foot { margin-top: auto; padding: 18px 8px 0; display: flex; flex-direction: column; gap: 12px; }
.user {
  display: block; text-decoration: none; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  transition: border-color 0.15s ease;
}
.user:hover { border-color: var(--line-strong); }
.user .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.sidebar .credit-inline { font-size: 11px; color: var(--dim); }
.sidebar .credit-inline a { color: #8a8a8a; text-decoration: none; }
.sidebar .taglines { letter-spacing: 2px; line-height: 1.6; }
.sidebar .taglines .tag-smart { display: none; }
.main { flex: 1; padding: 36px 40px; min-width: 0; position: relative; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin-bottom: 6px; }
.page-head p { color: var(--muted); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    padding: 10px 14px 6px; position: sticky; top: 0; z-index: 20;
    border-right: 0; border-bottom: 1px solid var(--line);
    background: rgba(13, 13, 13, 0.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .sidebar-brand { padding: 0; flex-direction: row; align-items: center; gap: 10px; order: 1; }
  .sidebar-brand .erd-mark { width: 72px; height: auto; }
  .sidebar-brand .eyebrow, .sidebar-foot .taglines, .sidebar .credit-inline, .user .sub { display: none; }
  .sidebar-foot { margin-top: 0; padding: 0; flex-direction: row; align-items: center; gap: 8px; order: 2; margin-left: auto; }
  .user { padding: 7px 10px; }
  .user .name { max-width: 110px; font-size: 12px; }
  .sidebar-foot .btn { padding: 7px 10px; font-size: 12px; }
  .nav {
    order: 3; flex-basis: 100%; flex-direction: row; overflow-x: auto; gap: 2px;
    scrollbar-width: none; margin: 0 -14px; padding: 0 10px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav .soon { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .nav a.active::before, .nav a[aria-current="page"]::before { left: 10px; right: 10px; top: auto; bottom: 0; width: auto; height: 2px; }
  .nav .soon small { margin-left: 4px; }
  .main { padding: 22px 16px 40px; }
  .card { padding: 30px 22px; }
  .page-head h1 { font-size: 22px; }
}

/* ---------- reduced motion ----------
   Movement stops, nothing disappears: the glows, halo and every component
   still render in their designed resting state. */
@media (prefers-reduced-motion: reduce) {
  .fade-up, html.js .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
  .cursor-glow { display: none; }
  .mark-beam .mb-beam { display: none; }
  .mark-beam .mb-halo { transition: none; transform: none; }
  .panel-hover, .btn, .nav a, .user { transition: none; }
  .panel-hover:hover { transform: none; }
}
