/* ─────────────────────────────────────────────────────────────
   Ralphy Desktop — app styling.
   Follows BRAND_DESIGN.md: typography over decoration, no borders,
   no shadows (save hairline pressable cue), separation via bg-step
   contrast + spacing. Depth = nest a lighter plate in a darker one.
   ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
::selection { background: var(--vio); color: var(--bg); }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }

/* Type primitives ------------------------------------------------ */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.98;
  margin: 0;
}
.acc { color: var(--vio); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mute);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: var(--r-sharp); background: var(--vio); }
.mono { font-family: var(--font-mono); }

/* Buttons — bg-step separation, no borders. Pill geometry. ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--r-pill);
  font-weight: 600; font-size: 14px; letter-spacing: 0.01em;
  background: var(--bg-2); color: var(--ink);
  transition: background 160ms ease, transform 160ms ease, color 160ms ease;
}
.btn:hover { background: var(--bg-3); transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--ink-2); }
.btn-vio { background: var(--vio); color: var(--bg); box-shadow: 0 1px 1px rgb(0 0 0 / 0.35); }
.btn-vio:hover { background: var(--vio-2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* App shell — left chat column, right project panel. ------------- */
.shell { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(340px, 460px); height: 100%; }
.titlebar {
  grid-column: 1 / -1;
  height: 44px; display: flex; align-items: center; gap: 14px;
  padding: 0 18px; background: var(--bg);
  -webkit-app-region: drag; user-select: none;
}
.titlebar .traffic { display: flex; gap: 8px; -webkit-app-region: no-drag; }
.titlebar .traffic i { width: 12px; height: 12px; border-radius: var(--r-pill); display: block; }
.titlebar .brand { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: -0.01em; font-size: 14px; }
.titlebar .project { font-family: var(--font-mono); font-size: 12px; color: var(--mute); }

/* Onboarding ----------------------------------------------------- */
.onboarding { height: 100%; display: grid; place-items: center; padding: 48px; }
.onboarding .inner { width: 100%; max-width: 720px; }
.onboarding h1 { font-size: clamp(34px, 5vw, 56px); margin: 18px 0 10px; }
.onboarding .lede { font-size: 19px; color: var(--ink-3); max-width: 56ch; margin: 0 0 36px; }
.auth-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.auth-card { background: var(--bg-1); border-radius: var(--r-card); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.auth-card.recommended { background: var(--bg-2); }
.auth-card h3 { font-family: var(--font-display); text-transform: uppercase; font-size: 17px; margin: 0; letter-spacing: -0.01em; }
.auth-card p { color: var(--ink-3); font-size: 14px; margin: 0; flex: 1; }
.auth-card .tag { align-self: flex-start; font-family: var(--font-mono); font-size: 11px; color: var(--vio); text-transform: uppercase; letter-spacing: 0.05em; }
.auth-card code { background: var(--inset); color: var(--ink-2); font-family: var(--font-mono); font-size: 12.5px; padding: 8px 10px; border-radius: var(--r-sharp); display: block; }

/* Chat column ---------------------------------------------------- */
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.messages { flex: 1; overflow-y: auto; padding: 22px 26px 8px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.msg .who { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mute); }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.user .bubble { background: var(--bg-2); }
.msg .bubble { background: var(--bg-1); border-radius: var(--r-card); padding: 13px 16px; font-size: 15px; color: var(--ink-2); white-space: pre-wrap; }
.msg.assistant .bubble { background: transparent; padding: 0; color: var(--ink); font-size: 16px; }

/* Tool-use chip — geometry over decoration. --------------------- */
.tool { display: inline-flex; align-items: center; gap: 9px; background: var(--bg-1); border-radius: var(--r-pill); padding: 7px 13px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); align-self: flex-start; }
.tool .glyph { color: var(--vio); }
.tool.running .glyph { animation: pulse 1.1s ease-in-out infinite; }
.tool .cost { color: var(--mute); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Composer ------------------------------------------------------- */
.composer { padding: 14px 18px 20px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.composer .field { background: var(--bg-1); border-radius: var(--r-card); padding: 12px 14px; display: flex; align-items: flex-end; gap: 10px; }
.composer textarea {
  flex: 1; background: transparent; border: none; outline: none; resize: none;
  color: var(--ink); font-family: var(--font-sans); font-size: 15px; line-height: 1.5; max-height: 160px;
}
.composer textarea::placeholder { color: var(--mute-2); }
.composer .hint { font-family: var(--font-mono); font-size: 11px; color: var(--mute-2); padding-left: 2px; }

/* Project panel — bento plate, one step lighter than the page. --- */
.panel { background: var(--bg-1); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.panel-section { background: var(--bg-2); border-radius: var(--r-card); padding: 16px; }
.panel-section h4 { font-family: var(--font-display); text-transform: uppercase; font-size: 13px; letter-spacing: 0; margin: 0 0 12px; color: var(--ink-2); }
.beat { display: flex; align-items: center; gap: 11px; padding: 8px 0; }
.beat .plate { width: 26px; height: 26px; border-radius: var(--r-sharp); background: var(--bg-3); display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); flex: none; }
.beat.done .plate { background: var(--vio); color: var(--bg); }
.beat .label { font-size: 14px; color: var(--ink-2); }
.beat .label small { display: block; color: var(--mute); font-size: 12px; }
.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.asset { aspect-ratio: 9 / 16; background: var(--bg-3); border-radius: var(--r-sharp); display: grid; place-items: center; font-family: var(--font-mono); font-size: 11px; color: var(--mute); }
.state-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-3); padding: 5px 0; }
.state-row .ind { width: 9px; height: 9px; border-radius: var(--r-pill); flex: none; background: var(--mute-2); }
.state-row .ind.ok { background: var(--ok); }
.state-row .ind.warn { background: var(--warn); }

/* Permission modal — confirm-with-cost gate. -------------------- */
.scrim { position: fixed; inset: 0; background: rgb(5 5 6 / 0.66); display: grid; place-items: center; z-index: 50; }
.modal { width: 440px; background: var(--bg-2); border-radius: var(--r-panel); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.modal h3 { font-family: var(--font-display); text-transform: uppercase; font-size: 19px; margin: 0; }
.modal .cmd { background: var(--inset); color: var(--ink-2); font-family: var(--font-mono); font-size: 13px; padding: 12px 14px; border-radius: var(--r-sharp); white-space: pre-wrap; }
.modal .cost { font-size: 15px; color: var(--ink-2); }
.modal .cost b { color: var(--vio); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* Scrollbars — match the inset, no chrome. ----------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: var(--r-pill); }
::-webkit-scrollbar-track { background: transparent; }
