/* ==========================================================================
   ViralCore — Liquid Glass UI
   Dark mode is the default; [data-theme="light"] on <html> switches themes.
   Type matches the MyPerson app: Comfortaa body, ui-rounded display headings.
   No external dependencies.
   ========================================================================== */

@font-face {
  font-family: "Comfortaa";
  src: url("../fonts/comfortaa-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --blur: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Comfortaa", ui-rounded, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font: var(--font-body);

  /* signature brand colour — must match Logo/ViralCore (see docs/brand.md) */
  --sig: #81ffd9;
  --sig-2: #5cf2cf;
  --sig-deep: #39e6c2;
  --sig-ink: #04231c;
  --sig-text: var(--sig);
}


/* platform logos (shared by the landing page and the workspace) */
.plogo {
  display: inline-block; flex: none;
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
  background: currentColor;
}

/* ---------------------------------------------------------------- themes */
html[data-theme="dark"] {
  --bg-0: #05060b;
  --bg-1: #0a0c16;
  --text: #f4f5fa;
  --muted: #9aa2ba;
  --faint: #8f97b4;
  --panel: rgba(17, 21, 35, 0.82);
  --panel-2: rgba(27, 32, 52, 0.92);
  --panel-solid: #0c1019;
  --panel-solid-2: #111629;
  --panel-solid-sig: #0a1f1d;
  --inset: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.20);
  --stroke-soft: rgba(255, 255, 255, 0.12);
  --hi: rgba(255, 255, 255, 0.5);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.85);
  --accent: #a78bfa;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #fb7185;
  --blob-op: 0.5;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg-0: #eef1f9;
  --bg-1: #e2e7f5;
  --text: #10121c;
  --muted: #5a6178;
  --faint: #666d82;
  --panel: rgba(255, 255, 255, 0.90);
  --panel-2: rgba(255, 255, 255, 0.98);
  --panel-solid: #ffffff;
  --panel-solid-2: #f6f8ff;
  --panel-solid-sig: #effcf7;
  --inset: rgba(255, 255, 255, 0.82);
  --stroke: rgba(16, 18, 28, 0.14);
  --stroke-soft: rgba(16, 18, 28, 0.10);
  --hi: rgba(255, 255, 255, 0.95);
  --shadow: 0 24px 50px -28px rgba(38, 46, 90, 0.45);
  --accent: #7c3aed;
  --accent-2: #0e7490;
  --accent-3: #db2777;
  --sig-text: #08745c;
  --good: #147a39;
  --warn: #9a5b00;
  --bad: #e11d48;
  --blob-op: 0.45;
  color-scheme: light;
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -10%, var(--bg-1), var(--bg-0) 60%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: 1.15rem; }
h2 { font-size: 0.98rem; }
p { margin: 0; }
small { font-size: 0.72rem; }
button, input, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--stroke); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* --------------------------------------------------------------- aurora */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg-0); }
.aurora-nebula,
.aurora-nebula-haze {
  position: absolute; inset: -4%;
  background-image: url("../backdrop/nebula-dark.webp");
  background-size: cover; background-position: center;
  will-change: transform;
}
.aurora-nebula { opacity: 0.95; animation: nebulaDrift 150s ease-in-out infinite alternate; }
.aurora-nebula-haze {
  opacity: 0.3; mix-blend-mode: screen;
  animation: nebulaDriftReverse 190s ease-in-out infinite alternate;
}
html[data-theme="light"] .aurora-nebula,
html[data-theme="light"] .aurora-nebula-haze {
  background-image: url("../backdrop/nebula-light.webp");
}
html[data-theme="light"] .aurora-nebula { opacity: 1; }
html[data-theme="light"] .aurora-nebula-haze { opacity: 0.2; mix-blend-mode: normal; }
@media (max-width: 639px) {
  .aurora-nebula-haze { display: none; }
}
@keyframes nebulaDrift {
  0%   { transform: scale(1.04) translate3d(-0.6%, 0.5%, 0); }
  100% { transform: scale(1.13) translate3d(0.9%, -0.7%, 0); }
}
@keyframes nebulaDriftReverse {
  0%   { transform: scale(1.16) translate3d(0.8%, 0.6%, 0) rotate(-0.4deg); }
  100% { transform: scale(1.06) translate3d(-0.9%, -0.5%, 0) rotate(0.4deg); }
}

/* ----------------------------------------------------------- glass core */
.glass {
  position: relative;
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(170%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
}
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(255,255,255,.10), transparent 42%, transparent 62%, rgba(255,255,255,.05));
  opacity: .45;
}
.glass-inset {
  background: var(--inset);
  border: 1px solid var(--stroke-soft);
  border-radius: 999px;
}

/* ------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 248px 1fr; gap: 18px; padding: 18px; min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.sidebar { padding: 18px 14px; display: flex; flex-direction: column; gap: 22px; height: calc(100vh - 36px); position: sticky; top: 18px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px; }
.brand-mark {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 12px;
  background: radial-gradient(120% 130% at 50% 0%, rgba(129,255,217,.18), rgba(6,9,15,.92) 70%);
  border: 1px solid color-mix(in oklab, var(--sig) 28%, transparent);
  box-shadow: 0 0 20px -8px var(--sig), inset 0 1px 0 rgba(255,255,255,.14);
}
html[data-theme="light"] .brand-mark {
  background: radial-gradient(120% 130% at 50% 0%, #0d1512, #05080c 72%);
  border-color: color-mix(in oklab, var(--sig) 45%, transparent);
}
.brand-mark img { width: 30px; height: 30px; display: block; }
.brand-text strong { display: block; font-family: var(--font-display); font-size: 0.95rem; letter-spacing: -0.02em; }
.brand-text strong em { font-style: normal; color: var(--sig-text); }
.brand-text small { color: var(--muted); white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer; text-align: left; transition: all .22s var(--ease);
}
.nav button svg { width: 17px; height: 17px; flex: none; }
.nav button:hover { color: var(--text); background: var(--panel-2); border-color: var(--stroke-soft); }
.nav button.active {
  color: var(--text); background: var(--panel-2); border-color: var(--stroke);
  box-shadow: inset 0 1px 0 var(--hi), 0 8px 22px -14px var(--accent);
}
.nav .count { margin-left: auto; font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--stroke-soft); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 6px; }
.gate-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; padding: 7px 11px; border-radius: 999px;
  background: color-mix(in oklab, var(--good) 16%, transparent); border: 1px solid color-mix(in oklab, var(--good) 40%, transparent); }
.gate-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); }
.ver { color: var(--faint); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px; flex-wrap: wrap; }
.page-title p { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; padding: 9px 14px; min-width: 260px; }
.search svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.search input { background: transparent; border: 0; outline: none; width: 100%; }

.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--stroke); cursor: pointer; transition: all .22s var(--ease); }
.icon-btn:hover { background: var(--panel-2); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }
html[data-theme="dark"] .ico-moon { display: none; }
html[data-theme="light"] .ico-sun { display: none; }

.btn { border-radius: 12px; padding: 10px 16px; border: 1px solid var(--stroke); background: var(--panel);
  cursor: pointer; transition: all .22s var(--ease); font-weight: 550; font-size: 0.85rem; }
.btn:hover { transform: translateY(-1px); background: var(--panel-2); }
.btn.primary {
  background: linear-gradient(135deg, color-mix(in oklab, var(--sig) 52%, white), var(--sig) 45%, var(--sig-2));
  border-color: color-mix(in oklab, var(--sig-deep) 55%, transparent);
  color: var(--sig-ink);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  box-shadow: 0 12px 30px -12px color-mix(in oklab, var(--sig) 60%, transparent),
              inset 0 1px 0 rgba(255,255,255,.6);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 16px 34px -12px color-mix(in oklab, var(--sig) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.65); }
.btn.wide { width: 100%; }
.btn.small { padding: 7px 12px; font-size: 0.78rem; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: color-mix(in oklab, var(--bad) 45%, transparent); color: var(--bad); }

/* -------------------------------------------------------------- views */
.views { flex: 1; min-width: 0; }
.view { display: none; flex-direction: column; gap: 18px; animation: rise .45s var(--ease); }
.view.active { display: flex; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1080px) { .grid.two { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }

.card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hint { color: var(--faint); font-size: 0.74rem; }

/* --------------------------------------------------------------- chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 0.74rem; padding: 6px 11px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--stroke-soft); color: var(--muted); cursor: pointer; transition: all .2s var(--ease); }
.chip:hover { color: var(--text); }
.chip.on { color: var(--text); border-color: color-mix(in oklab, var(--accent) 50%, transparent);
  background: color-mix(in oklab, var(--accent) 18%, transparent); }
.chip.banned { color: color-mix(in oklab, var(--bad) 75%, var(--text)); border-color: color-mix(in oklab, var(--bad) 32%, transparent);
  background: color-mix(in oklab, var(--bad) 12%, transparent); cursor: default; }

.pill { font-size: 0.7rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--stroke);
  background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill.good { color: var(--good); border-color: color-mix(in oklab, var(--good) 40%, transparent); background: color-mix(in oklab, var(--good) 12%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 40%, transparent); background: color-mix(in oklab, var(--warn) 12%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 40%, transparent); background: color-mix(in oklab, var(--bad) 12%, transparent); }

/* ---------------------------------------------------------------- KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
@media (max-width: 1400px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 16px; border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 6px; }
.kpi .v { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.03em; }
.kpi .v small { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.kpi .l { color: var(--muted); font-size: 0.76rem; }
.kpi .spark { display: flex; gap: 3px; align-items: flex-end; height: 22px; margin-top: 2px; }
.kpi .spark i { width: 4px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); opacity: .8; }

/* --------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--inset); border: 1px solid var(--stroke-soft); transition: all .22s var(--ease);
}
.row:hover { border-color: var(--stroke); background: var(--panel-2); transform: translateY(-1px); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-size: 0.85rem; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 0.73rem; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .actions { display: flex; gap: 8px; flex: none; }
.avatar { width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 0.72rem; font-weight: 650;
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 55%, transparent), color-mix(in oklab, var(--accent-2) 45%, transparent));
  border: 1px solid var(--stroke); }
.empty { color: var(--faint); font-size: 0.8rem; padding: 10px 4px; }

/* ------------------------------------------------------------- metrics */
.meter { width: 96px; height: 6px; border-radius: 999px; background: var(--inset); overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.metrics { display: flex; gap: 14px; color: var(--muted); font-size: 0.72rem; }
.metrics b { color: var(--text); font-weight: 600; }

/* -------------------------------------------------------------- formats */
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.format { padding: 16px; border-radius: var(--radius-md); background: var(--inset); border: 1px solid var(--stroke-soft);
  display: flex; flex-direction: column; gap: 12px; transition: all .25s var(--ease); }
.format:hover { transform: translateY(-3px); border-color: var(--stroke); box-shadow: 0 22px 40px -26px var(--accent); }
.format .sig { font-size: 0.86rem; font-weight: 620; }
.format .hook { font-size: 0.75rem; color: var(--muted); line-height: 1.5; }
.format .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.score { font-size: 0.75rem; color: var(--accent-2); font-weight: 650; }

/* ------------------------------------------------------------- pipeline */
.pipeline { display: flex; gap: 10px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.pipeline li { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-radius: 999px;
  background: var(--inset); border: 1px solid var(--stroke-soft); font-size: 0.78rem; color: var(--muted); }
.pipeline li b { color: var(--text); font-weight: 600; }
.pipeline li .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.68rem;
  background: color-mix(in oklab, var(--accent) 30%, transparent); color: var(--text); border: 1px solid var(--stroke); }

/* ---------------------------------------------------------------- form */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.72rem; color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--inset); border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; transition: border-color .2s var(--ease); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: color-mix(in oklab, var(--accent) 55%, transparent); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--inset); border: 1px solid var(--stroke-soft); }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: 0.78rem; }
.seg button.on { background: var(--panel-2); color: var(--text); border: 1px solid var(--stroke); }

.draft { display: flex; flex-direction: column; gap: 10px; }
.draft .part { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--inset); border: 1px solid var(--stroke-soft); }
.draft .part .k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--faint); margin-bottom: 5px; }
.draft .part .val { font-size: 0.84rem; line-height: 1.55; }
.script { font-size: 0.84rem; line-height: 1.65; color: var(--muted); }
.script b { color: var(--text); }
.voice-check { font-size: 0.76rem; color: var(--good); display: flex; gap: 8px; align-items: center; }
.voice-check.bad { color: var(--bad); }

.banner { padding: 14px 16px; font-size: 0.8rem; color: var(--muted); }
.banner strong { color: var(--text); }

/* ------------------------------------------------------------- approval */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--stroke-soft);
  background: var(--inset); color: var(--muted); cursor: pointer; font-size: 0.78rem; }
.tabs button.on { color: var(--text); background: var(--panel-2); border-color: var(--stroke); }

/* ------------------------------------------------------------ settings */
.providers { display: flex; flex-direction: column; gap: 10px; }
.prov { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--inset); border: 1px solid var(--stroke-soft); }
.prov .kind { font-size: 0.68rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.prov .name { font-size: 0.85rem; font-weight: 600; }
.prov .role { font-size: 0.74rem; color: var(--muted); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 4px; font-size: 0.83rem; }
.switch { width: 44px; height: 25px; border-radius: 999px; background: var(--inset); border: 1px solid var(--stroke);
  position: relative; cursor: pointer; transition: all .25s var(--ease); flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--muted); transition: all .25s var(--ease); }
.switch.on { background: color-mix(in oklab, var(--good) 26%, transparent); border-color: color-mix(in oklab, var(--good) 45%, transparent); }
.switch.on::after { left: 21px; background: var(--good); box-shadow: 0 0 12px var(--good); }
.switch.locked { opacity: .55; cursor: not-allowed; }
.switch.locked::after { background: var(--faint); }
.rule { border: 0; border-top: 1px solid var(--stroke-soft); margin: 6px 0; }

/* ----------------------------------------------------------- platforms */
.platform-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.platform-group { padding: 14px; border-radius: var(--radius-md); background: var(--inset);
  border: 1px solid var(--stroke-soft); display: flex; flex-direction: column; gap: 11px; }
.platform-group .pg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.platform-group .pg-title { font-size: 0.82rem; font-weight: 620; }
.platform-list { display: flex; flex-wrap: wrap; gap: 6px; }
.platform-tag { font-size: 0.72rem; padding: 5px 10px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--stroke-soft); color: var(--muted); }
.platform-tag.on { color: var(--text); border-color: color-mix(in oklab, var(--accent) 42%, transparent);
  background: color-mix(in oklab, var(--accent) 13%, transparent); }
.platform-tag.setup { border-style: dashed; opacity: 0.8; }

/* -------------------------------------------------------------- drawer */
.drawer { position: fixed; top: 18px; right: 18px; bottom: 18px; width: min(420px, 92vw); padding: 20px;
  z-index: 40; overflow: auto; animation: slide .4s var(--ease); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .close { position: absolute; top: 12px; right: 12px; }

/* --------------------------------------------------------------- toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 999px; font-size: 0.82rem; z-index: 60;
  background: var(--panel-2); border: 1px solid var(--stroke); backdrop-filter: blur(18px);
  box-shadow: var(--shadow); transition: all .35s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------- accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, transparent); outline-offset: 2px; }

