/* Visual language ported from the Claude Design prototype (Audit Pipeline.dc.html):
   #0D0C22 ground, #7C6CFF accent, #4ADE9C for completed state, Space Grotesk.
   Fonts are self-hosted so the page makes no external requests (strict CSP). */

@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url('/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url('/fonts/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url('/fonts/space-grotesk-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  --bg: #0D0C22;
  --panel: rgba(255, 255, 255, .04);
  --line: rgba(255, 255, 255, .12);
  --ink: #EDECFA;
  --muted: #9A97C0;
  --dim: #5b5880;
  --accent: #7C6CFF;
  --good: #4ADE9C;
  --bad: #ff7a90;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #9d91ff; text-decoration: underline; }

input, select, textarea, button {
  font-family: inherit;
  font-size: 13px;
  color-scheme: dark;
}
option { background: #15142e; color: var(--ink); }
::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(124, 108, 255, .55);
  outline-offset: 0;
}

@keyframes fmPulse { 0%, 100% { opacity: .35 } 50% { opacity: 1 } }
@keyframes fmFlow  { 0% { background-position: 0 0 } 100% { background-position: 24px 0 } }
@keyframes fmIn    { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* ---------------------------------------------------------------- layout */

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  background: rgba(13, 12, 34, .92);
  backdrop-filter: blur(8px);
}
.brand { font-weight: 700; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.topbar .spacer { flex: 1; }

.tab {
  background: none; border: 1px solid transparent; color: var(--muted);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; transition: all .15s;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); background: rgba(124, 108, 255, .16); border-color: rgba(124, 108, 255, .55); }

main { max-width: 1160px; margin: 0 auto; padding: 26px 22px 80px; animation: fmIn .3s ease; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 22px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- controls */

label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 5px; }
.field { margin-bottom: 13px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px;
  background: rgba(255, 255, 255, .04); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
}
textarea { min-height: 108px; resize: vertical; line-height: 1.5; }

button.btn {
  background: var(--accent); color: #0D0C22; font-weight: 600;
  border: none; border-radius: 999px; padding: 10px 20px; cursor: pointer;
  transition: filter .15s;
}
button.btn:hover:not(:disabled) { filter: brightness(1.12); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
button.ghost {
  background: rgba(255, 255, 255, .04); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; cursor: pointer;
}
button.ghost:hover { color: var(--ink); }

.chip {
  display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  border-radius: 9px; padding: 9px 11px; transition: all .15s;
  color: var(--muted); background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.chip .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; background: rgba(255, 255, 255, .15); }
.chip.on { color: var(--ink); background: rgba(124, 108, 255, .16); border-color: rgba(124, 108, 255, .55); }
.chip.on .dot { background: var(--accent); }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }

.pill {
  cursor: pointer; border-radius: 999px; padding: 8px 16px; transition: all .15s;
  color: var(--muted); background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.pill.on { color: #0D0C22; background: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- pipeline */
/* Node + connector styling ported from nodeStyle (app.js:453) and lineStyle (app.js:460). */

.pipeline { display: flex; align-items: flex-start; overflow-x: auto; padding: 10px 0 4px; }
.pipe-step { display: flex; flex-direction: column; align-items: center; width: 118px; flex: none; text-align: center; }
.node {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex: none; transition: all .3s;
  background: rgba(255, 255, 255, .04); border: 2px solid var(--line); color: var(--dim);
}
.node.done { background: rgba(74, 222, 156, .15); border-color: var(--good); color: var(--good); }
.node.active {
  background: rgba(124, 108, 255, .2); border-color: var(--accent); color: #c9c1ff;
  box-shadow: 0 0 24px rgba(124, 108, 255, .5); animation: fmPulse 1.2s ease-in-out infinite;
}
.pipe-line { height: 2px; width: 56px; margin-top: 31px; flex: none; border-radius: 2px; background: rgba(255, 255, 255, .1); }
.pipe-line.done { background: var(--good); }
.pipe-line.active {
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, rgba(124, 108, 255, .2) 8px 16px);
  background-size: 24px 24px; animation: fmFlow .6s linear infinite;
}
.pipe-title { font-size: 13px; font-weight: 600; margin-top: 9px; }
.pipe-title.idle { color: var(--dim); }
.pipe-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* ---------------------------------------------------------------- report */

.score { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stat { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat-label { font-size: 12px; color: var(--muted); }

.rating { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.rating.strong  { background: rgba(74, 222, 156, .15); color: var(--good); }
.rating.partial { background: rgba(124, 108, 255, .18); color: #c9c1ff; }
.rating.gap     { background: rgba(255, 122, 144, .15); color: var(--bad); }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 6px 0 6px 18px; position: relative; color: var(--muted); }
ul.plain li::before { content: '·'; position: absolute; left: 6px; color: var(--accent); font-weight: 700; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
tbody tr:hover { background: rgba(255, 255, 255, .03); }
.table-wrap { overflow-x: auto; }

.task { display: flex; gap: 11px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task .phase { font-size: 11px; color: var(--dim); }
.task.done .task-body { opacity: .55; text-decoration: line-through; }

.banner { border-radius: 9px; padding: 11px 14px; margin-bottom: 14px; font-size: 13px; }
.banner.warn { background: rgba(255, 193, 87, .12); border: 1px solid rgba(255, 193, 87, .45); color: #ffd591; }
.banner.err  { background: rgba(255, 122, 144, .12); border: 1px solid rgba(255, 122, 144, .45); color: #ffb3c0; }
.banner.info { background: rgba(124, 108, 255, .12); border: 1px solid rgba(124, 108, 255, .4); color: #c9c1ff; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }

.login-wrap { max-width: 380px; margin: 12vh auto; }
.empty { color: var(--dim); padding: 26px 0; text-align: center; }

@media (max-width: 640px) {
  main { padding: 18px 14px 60px; }
  .topbar { padding: 12px 14px; }
}
