/* Custom CSS on top of Tailwind: theme tokens + reusable components. */
:root {
  --bg: #f4f6fb; --panel: #ffffff; --panel-2: #f8fafc; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --brand: #4f46e5; --brand-2: #7c3aed; --brand-soft: #eef2ff;
  --ok: #16a34a; --ok-soft: #dcfce7; --bad: #dc2626; --bad-soft: #fee2e2; --warn: #d97706; --warn-soft: #fef3c7;
  --side: #0f172a; --side-text: #cbd5e1; --side-muted: #64748b; --side-hover: #1e293b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --panel: #121a2e; --panel-2: #0f172a; --text: #e2e8f0; --muted: #94a3b8; --line: #1f2a44;
    --brand-soft: #1e1b4b; --ok-soft: #052e1a; --bad-soft: #3b0d0d; --warn-soft: #3a2506;
    --side: #080c18; --side-hover: #121a2e;
  }
}
html, body { background: var(--bg); color: var(--text); }
body { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
a { color: var(--brand); }
::selection { background: var(--brand); color: #fff; }

/* layout */
.sidebar { background: var(--side); color: var(--side-text); }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: .6rem; color: var(--side-text); text-decoration: none; font-weight: 500; transition: background .15s; }
.side-link:hover { background: var(--side-hover); color: #fff; }
.side-link.active { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 20px -8px var(--brand); }
.side-link svg { width: 1.15rem; height: 1.15rem; flex: none; }
.side-label { color: var(--side-muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; padding: 0 .8rem; }
.topbar { background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }

/* components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: .85rem; padding: .9rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); min-width: 0; }
.card-title { font-weight: 600; font-size: .92rem; margin-bottom: .6rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.muted { color: var(--muted); }
.line { border-color: var(--line); }
.field { display: flex; flex-direction: column; gap: .35rem; font-size: .75rem; font-weight: 500; color: var(--muted); }
.input { font: inherit; font-size: .875rem; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: .6rem; padding: .55rem .7rem; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
textarea.input { min-height: 4.5rem; resize: vertical; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; line-height: 1.55; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-size: .85rem; font-weight: 600; border-radius: .6rem; padding: .55rem 1rem; cursor: pointer; border: 1px solid transparent; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn.btn-primary { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; }
.btn.btn-success { background: var(--ok); color: #fff; }
.btn.btn-danger { background: var(--bad); color: #fff; }
.btn.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.btn-ghost:hover { background: var(--panel-2); }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.pill-on, .s-bid { background: var(--ok-soft); color: var(--ok); }
.pill-off, .s-failed { background: var(--bad-soft); color: var(--bad); }
.s-match { background: var(--brand-soft); color: var(--brand); }
.s-skipped, .s-search { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.dot { width: .5rem; height: .5rem; border-radius: 999px; background: currentColor; }
.stat-icon { width: 2.6rem; height: 2.6rem; border-radius: .8rem; display: grid; place-items: center; flex: none; }
.stat-icon svg { width: 1.3rem; height: 1.3rem; }
button.tab { font-size: .8rem; font-weight: 600; padding: .4rem .85rem; border-radius: .6rem; color: var(--muted); border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
button.tab.active { background: var(--text); color: var(--panel); border-color: var(--text); }
.logs { font-family: ui-monospace, monospace; font-size: .75rem; line-height: 1.5; max-height: 22rem; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--panel-2); border-radius: .6rem; padding: .8rem; }
.pre { white-space: pre-wrap; word-break: break-word; }
.err { color: var(--bad); } .okc { color: var(--ok); }
.bidbox { border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 45%, transparent); border-radius: .8rem; padding: 1rem; }
details > summary { cursor: pointer; color: var(--muted); font-size: .82rem; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; }
details[open] > summary::before { content: '▾ '; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: .65rem 1rem; border-radius: .7rem; display: none; max-width: calc(100% - 2rem); z-index: 60; font-size: .875rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.spinner { width: 1rem; height: 1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* new-project pop-ups */
.ptoast-stack { position: fixed; top: 4.25rem; right: 1rem; z-index: 70; display: flex; flex-direction: column; gap: .6rem; width: min(23rem, calc(100vw - 2rem)); pointer-events: none; }
.ptoast { pointer-events: auto; position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: .9rem; padding: .85rem .85rem .85rem .9rem; box-shadow: 0 18px 40px -12px rgba(0,0,0,.45); animation: ptin .28s cubic-bezier(.2,.9,.3,1.2); }
.ptoast.out { animation: ptout .25s ease forwards; }
.ptoast-bar { position: absolute; left: 0; top: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transform-origin: left; animation: ptbar 12s linear forwards; }
.ptoast.paused .ptoast-bar { animation-play-state: paused; }
.ptoast-icon { width: 2.2rem; height: 2.2rem; border-radius: .65rem; display: grid; place-items: center; flex: none; color: var(--brand); background: var(--brand-soft); }
.ptoast-icon svg { width: 1.1rem; height: 1.1rem; }
.ptoast-x { background: transparent; border: 0; color: var(--muted); font-size: .8rem; padding: .1rem .3rem; border-radius: .35rem; cursor: pointer; }
.ptoast-x:hover { color: var(--text); background: var(--panel-2); }
.badge-nav { margin-left: auto; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; display: inline-grid; place-items: center; }
@keyframes ptin { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: none; } }
@keyframes ptout { to { opacity: 0; transform: translateX(110%); } }
@keyframes ptbar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.badge-nav.hidden { display: none; }
