/* Sakura-Public — same design system as the factory dashboards
   (tracker.css tokens: glass cards, sakura pink → violet gradient,
   Cormorant Garamond display / Plus Jakarta Sans UI). */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  /* Base */
  --bg:           #08060e;
  --bg-elev:      rgba(255,255,255,0.025);
  --bg-elev-2:    rgba(255,255,255,0.045);

  /* Text */
  --text:         #f3eaf5;
  --text-dim:     #8a7d9a;
  --text-dimmer:  #5b5070;

  /* Accent (sakura) */
  --pink:         #ff90b6;
  --pink-soft:    #ffb3cf;
  --violet:       #c89bff;
  --gradient:     linear-gradient(135deg, #ff90b6 0%, #c89bff 100%);
  --pink-glow:    0 0 24px rgba(255,144,182,0.22);

  /* Glass */
  --glass-bg:     rgba(255,255,255,0.035);
  --glass-bg-hi:  rgba(255,255,255,0.07);
  --glass-line:   rgba(255,255,255,0.08);

  /* Status palette */
  --ok:    #82e8ad;
  --warn:  #ffd97c;
  --info:  #8bb8ff;
  --bad:   #ff8a9c;

  /* Type */
  --font-display: 'Cormorant Garamond', serif;
  --font-ui:      'Plus Jakarta Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(255,144,182,0.3); color: white; }
.muted { color: var(--text-dim); }
.error { color: var(--bad); margin-top: 10px; font-size: 13px; }
a { color: var(--pink); }
h1, h2, h3 { font-weight: 600; }

/* ── Ambient backdrop (same as the factory) ── */
.bg-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-glow { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.4; }
.bg-glow-1 { width: 600px; height: 600px; top: -200px; left: -150px; background: radial-gradient(circle, #ff90b6 0%, transparent 70%); }
.bg-glow-2 { width: 700px; height: 700px; top: 30%; right: -250px; background: radial-gradient(circle, #c89bff 0%, transparent 70%); opacity: 0.25; }
.bg-glow-3 { width: 500px; height: 500px; bottom: -150px; left: 30%; background: radial-gradient(circle, #5b3b7a 0%, transparent 70%); opacity: 0.3; }
.bg-grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.04;
  mix-blend-mode: overlay;
}

/* ── Login ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--glass-bg); backdrop-filter: blur(24px);
  border: 1px solid var(--glass-line); border-radius: var(--radius-lg);
  padding: 40px 44px; width: 380px; text-align: center;
}
.login-logo { font-size: 40px; }
.login-card h1 { font-family: var(--font-display); font-size: 34px; font-weight: 400; margin: 4px 0 2px; }
.login-card form { text-align: left; margin-top: 24px; }
.login-card label { display: block; font-size: 11px; font-weight: 700; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 6px; }
.login-card input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-line); background: rgba(255,255,255,0.05);
  color: var(--text); font-size: 14px; font-family: var(--font-ui);
  transition: border-color 0.15s;
}
.login-card input:focus { outline: none; border-color: var(--pink); }

/* ── App shell ── */
header.topbar {
  display: flex; align-items: center; gap: 14px; padding: 13px 24px;
  background: var(--glass-bg); backdrop-filter: blur(32px);
  border-bottom: 1px solid var(--glass-line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: 0.01em; }
.topbar .tabs { display: flex; gap: 4px; margin-left: 16px; }
.topbar .tabs button {
  background: none; border: none; color: var(--text-dim); padding: 7px 14px;
  border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600;
  font-family: var(--font-ui); transition: all 0.15s;
}
.topbar .tabs button.active {
  background: rgba(255,144,182,0.15); color: var(--pink);
  box-shadow: 0 0 12px rgba(255,144,182,0.2);
}
.topbar .spacer { flex: 1; }
main { max-width: 1000px; margin: 0 auto; padding: 28px 24px 120px; position: relative; z-index: 1; }

/* ── Components ── */
.card {
  background: var(--glass-bg); backdrop-filter: blur(24px);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 16px;
}
.card h3 { font-size: 13px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text); }
.btn {
  background: var(--glass-bg); color: var(--text-dim);
  border: 1px solid var(--glass-line); border-radius: 10px;
  padding: 9px 18px; cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: var(--font-ui); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--glass-bg-hi); color: var(--text); }
.btn.primary { background: var(--gradient); border: none; color: white; font-weight: 600; }
.btn.primary:hover { opacity: 0.88; color: white; }
.btn.primary:active { transform: scale(0.97); }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn.danger { background: rgba(255,90,110,0.12); color: var(--bad); border-color: rgba(255,138,156,0.22); }
.btn.danger:hover { background: rgba(255,90,110,0.2); color: var(--bad); }
.btn.wide { width: 100%; margin-top: 22px; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

input.text, textarea.text, select.text {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-line); background: rgba(255,255,255,0.05);
  color: var(--text); font-size: 13px; font-family: var(--font-ui);
  transition: border-color 0.15s;
}
input.text:focus, textarea.text:focus, select.text:focus { outline: none; border-color: var(--pink); }
textarea.text { resize: vertical; min-height: 70px; line-height: 1.55; }
select.text option { background: #1a1424; }
label.field {
  display: block; font-size: 11px; font-weight: 700; color: var(--text-dimmer);
  text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 6px;
}

.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }

/* Project list */
.proj-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--glass-bg); backdrop-filter: blur(24px);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.proj-item:hover { border-color: rgba(255,144,182,0.4); background: var(--glass-bg-hi); }
.proj-item .title { flex: 1; font-weight: 600; font-size: 14px; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  background: rgba(255,255,255,0.04); color: var(--text-dimmer);
  border: 1px solid rgba(255,255,255,0.06); white-space: nowrap;
}
.badge.stage-idea     { color: var(--text-dim); }
.badge.stage-brief    { background: rgba(255,200,80,0.12); color: var(--warn); border-color: rgba(255,200,80,0.25); }
.badge.stage-research { background: rgba(100,160,255,0.12); color: var(--info); border-color: rgba(139,184,255,0.25); }
.badge.stage-script,
.badge.stage-done     { background: rgba(110,230,160,0.12); color: var(--ok); border-color: rgba(130,232,173,0.22); }
.badge.pending        { background: rgba(255,200,80,0.12); color: var(--warn); border-color: rgba(255,200,80,0.25); }

/* Stage breadcrumb (factory style) */
.stages { display: flex; align-items: center; gap: 8px; margin: 12px 0 18px; flex-wrap: wrap; }
.stages .st {
  display: flex; align-items: center; gap: 6px; padding: 6px 13px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  color: var(--text-dimmer); background: var(--glass-bg);
  border: 1px solid var(--glass-line); transition: all 0.2s;
}
.stages .st.on {
  background: rgba(255,144,182,0.15); color: var(--pink);
  box-shadow: 0 0 12px rgba(255,144,182,0.2); border-color: transparent;
}
.stages .st.done { color: var(--ok); }
.stages .st.done::after { content: ' ✓'; }

.status-line { font-size: 13px; color: var(--warn); margin: 10px 0; min-height: 20px; }
.status-line.ok { color: var(--ok); }
.status-line.err { color: var(--bad); }

h2 { font-family: var(--font-display); font-size: 28px; font-weight: 400; line-height: 1.3; }

pre.doc {
  background: rgba(255,255,255,0.03); border: 1px solid var(--glass-line);
  border-radius: var(--radius-sm); padding: 16px;
  white-space: pre-wrap; font: 12.5px/1.6 var(--font-mono);
  color: var(--text); max-height: 480px; overflow: auto;
}
.shortlist-item { display: flex; gap: 8px; margin-bottom: 6px; }
.kv { margin-bottom: 14px; }
.kv .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dimmer); margin-bottom: 4px; }

table.admin { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin th, table.admin td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--glass-line); }
table.admin th { color: var(--text-dimmer); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }

.pw-reveal {
  background: rgba(255,144,182,0.08); border: 1px dashed rgba(255,144,182,0.4);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 12px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
}
.modal-back {
  position: fixed; inset: 0; background: rgba(8,6,14,0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: rgba(20,16,28,0.95); border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg); padding: 22px; width: min(860px, 92vw);
  max-height: 86vh; overflow: auto;
}

/* Compute meter */
.meter-card { padding: 14px 20px; }
.meter {
  height: 6px; border-radius: 99px; background: rgba(255,255,255,0.06);
  margin-top: 10px; overflow: hidden;
}
.meter-fill {
  height: 100%; border-radius: 99px; background: var(--gradient);
  transition: width 0.4s ease;
}
.meter-fill.warn { background: linear-gradient(135deg, var(--warn) 0%, var(--bad) 100%); }
.meter-warn { color: var(--warn); }

/* Indeterminate progress bar (research/script runs) */
.prog {
  height: 6px; border-radius: 99px; background: rgba(255,255,255,0.06);
  margin-top: 12px; overflow: hidden; position: relative;
}
.prog-bar {
  position: absolute; height: 100%; width: 34%; border-radius: 99px;
  background: var(--gradient);
  animation: prog-slide 1.6s ease-in-out infinite;
}
@keyframes prog-slide {
  0%   { left: -34%; }
  100% { left: 100%; }
}

/* Workspace two-column layout: idea bank left, work right */
.ws-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.bank-card { position: sticky; top: 76px; }
.bank-item {
  background: rgba(255,255,255,0.03); border: 1px solid var(--glass-line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.bank-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
@media (max-width: 920px) {
  .ws-grid { grid-template-columns: 1fr; }
  .bank-card { position: static; }
}
