/* JAYME web — same paper/black/gold design language as the native app.
   Light is the default; dark applies via prefers-color-scheme OR an explicit
   data-theme="dark" on <html> (the in-app sun/moon toggle), mirroring the
   native AppAppearance system/light/dark tri-state. */

:root {
  --app-bg: #F5F2EA;
  --bg2: #FBF8F1;
  --surface: #FEFDF9;
  --text: #1C1B17;
  --text2: #5E5B52;
  --text3: #8E8A7D;
  --hairline: #E7E2D5;
  --brand: #C0891A;
  --brand-fill: #F2D06B;
  --on-brand: #241C05;
  --logo-ink: #0B0B0C;
  --logo-glyph: #FFFFFF;
  --critical: #9A3434;
  --warning: #7E5210;
  --strong: #14664F;
  --shadow: rgba(0,0,0,0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --dark-scheme: 1; }
}

html[data-theme="dark"], html:not([data-theme="light"]) body.follow-dark {
  --app-bg: #000000;
  --bg2: #0A0A0A;
  --surface: #141414;
  --text: #F3F2ED;
  --text2: #A3A198;
  --text3: #716E64;
  --hairline: #262626;
  --brand: #F2D06B;
  --brand-fill: #E8C455;
  --on-brand: #241C05;
  --logo-ink: #F3F2ED;
  --logo-glyph: #121316;
  --critical: #E39A9A;
  --warning: #DE9A38;
  --strong: #6BC2A0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
.serif { font-family: ui-serif, Georgia, "Times New Roman", serif; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Onboarding ---------- */
.onboard {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  padding: 56px 24px;
}
.onboard-card { width: 100%; max-width: 780px; display: flex; flex-direction: column; gap: 34px; align-items: center; }

.logo-tile {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--logo-ink); color: var(--logo-glyph);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 600;
  box-shadow: 0 12px 24px rgba(0,0,0,0.18);
}
.wordmark { text-align: center; }
.wordmark h1 { font-size: 36px; letter-spacing: 5px; margin: 16px 0 6px; font-weight: 600; }
.wordmark .tag { font-size: 11px; letter-spacing: 2.4px; color: var(--text2); font-weight: 500; text-transform: uppercase; }
.rule { width: 44px; height: 1.5px; background: color-mix(in srgb, var(--brand) 65%, transparent); margin: 6px auto 0; }

.step-title { font-size: 25px; font-weight: 600; letter-spacing: -.3px; text-align: center; width: 100%; }

.choice-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; width: 100%; }
.choice-card {
  flex: 1; min-width: 150px; max-width: 220px;
  background: var(--surface); border: .5px solid var(--hairline); border-radius: 14px;
  padding: 30px 12px; text-align: center; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  box-shadow: 0 1px 3px var(--shadow);
}
.choice-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px var(--shadow); border-color: color-mix(in srgb, var(--text3) 45%, transparent); }
.choice-card.selected { border-color: var(--brand); border-width: 1.5px; background: color-mix(in srgb, var(--brand-fill) 12%, var(--surface)); }
.choice-card .icon { font-size: 22px; margin-bottom: 8px; color: var(--text2); }
.choice-card.selected .icon { color: var(--brand); }
.choice-card .title { font-size: 21px; font-weight: 600; letter-spacing: -.2px; }
.choice-card .subtitle { font-size: 12px; color: var(--text2); margin-top: 6px; }

.login-box { display: flex; flex-direction: column; gap: 12px; align-items: center; width: 100%; }
.login-box input {
  width: 300px; max-width: 100%; padding: 9px 12px; border-radius: 7px;
  border: .5px solid var(--hairline); background: var(--surface); color: var(--text); font-size: 13.5px;
}
.login-box input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: 1px; }
.login-error { color: var(--critical); font-size: 12px; }
.login-badge {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--surface); border: .8px solid color-mix(in srgb, var(--strong) 35%, transparent);
  border-radius: 9px; font-size: 12px; color: var(--text2);
}
.login-badge .dot { color: var(--strong); font-size: 14px; }

.onboard-footer { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 520px; margin-top: 10px; }
.step-dots { display: flex; gap: 7px; }
.step-dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--hairline); transition: all .15s ease; }
.step-dots span.active { width: 20px; background: var(--brand); }
.step-dots span.done { background: color-mix(in srgb, var(--brand) 35%, transparent); }

button { font-family: inherit; cursor: pointer; }
.btn-brand {
  background: var(--brand-fill); color: var(--on-brand); border: none; border-radius: 7px;
  padding: 9px 18px; font-size: 12.5px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.btn-brand:disabled { opacity: .45; cursor: default; }
.btn-ghost { background: none; border: none; color: var(--text2); font-size: 12.5px; padding: 9px 10px; border-radius: 7px; }
.btn-ghost:hover { background: var(--bg2); color: var(--text); }

/* ---------- Shell (post-login) ---------- */
.shell { flex: 1; display: flex; height: 100vh; }
.sidebar {
  width: 210px; background: var(--bg2); border-right: .5px solid var(--hairline);
  display: flex; flex-direction: column; padding: 14px 0;
}
.sidebar-header { display: flex; align-items: center; gap: 9px; padding: 0 14px 14px; border-bottom: .5px solid var(--hairline); margin-bottom: 8px; }
.sidebar-header .logo-tile { width: 27px; height: 27px; font-size: 16px; border-radius: 7px; box-shadow: none; }
.sidebar-header .info { flex: 1; min-width: 0; }
.sidebar-header .info .name { font-size: 15px; font-weight: 600; letter-spacing: 2px; }
.sidebar-header .info .role { font-size: 10px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: none; color: var(--text3); font-size: 13px; padding: 4px; border-radius: 5px; }
.icon-btn:hover { background: var(--hairline); color: var(--text); }

.nav-group { padding: 10px 10px 4px; font-size: 10px; letter-spacing: .8px; color: var(--text3); text-transform: uppercase; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 14px; margin: 1px 6px; border-radius: 7px;
  color: var(--text2); font-size: 13px; cursor: pointer;
}
.nav-item:hover { background: var(--hairline); }
.nav-item.active { background: color-mix(in srgb, var(--brand-fill) 22%, transparent); color: var(--text); font-weight: 500; }

.main { flex: 1; display: flex; flex-direction: column; background: var(--app-bg); min-width: 0; }
.page-header { padding: 20px 24px 14px; border-bottom: .5px solid var(--hairline); }
.page-header h2 { font-family: ui-serif, Georgia, serif; font-size: 23px; font-weight: 600; letter-spacing: -.3px; margin: 0 0 4px; }
.page-header p { font-size: 13.5px; color: var(--text2); margin: 0; }

/* Assistant chat */
.chat-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.bubble-row { display: flex; }
.bubble-row.user { justify-content: flex-end; }
.bubble {
  max-width: 560px; padding: 9px 13px; border-radius: 13px; font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 1px 2px var(--shadow); white-space: pre-wrap;
}
.bubble.assistant { background: var(--surface); border: .5px solid var(--hairline); color: var(--text); }
.bubble.user { background: var(--brand-fill); color: var(--on-brand); }
.bubble-label { font-size: 9px; font-weight: 600; letter-spacing: .8px; color: var(--text3); margin-bottom: 4px; }
.thinking { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--hairline); border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.suggestions { display: flex; flex-direction: column; gap: 7px; }
.suggest-row {
  background: none; border: .5px solid transparent; text-align: left; padding: 7px 11px; border-radius: 8px;
  font-family: ui-serif, Georgia, serif; font-style: italic; font-size: 13.5px; color: var(--brand);
}
.suggest-row:hover { background: var(--surface); border-color: var(--hairline); color: var(--text); }

.chat-input-bar { border-top: .5px solid var(--hairline); background: var(--bg2); padding: 12px; display: flex; gap: 8px; align-items: flex-end; }
.chat-input-bar textarea {
  flex: 1; resize: none; border-radius: 18px; border: .5px solid var(--hairline);
  background: var(--surface); color: var(--text); padding: 9px 13px; font-size: 13.5px; font-family: inherit;
  max-height: 120px;
}
.send-btn { background: none; border: none; font-size: 26px; color: var(--brand); line-height: 1; padding: 0 4px; }
.send-btn:disabled { color: var(--text3); }

.empty-hint { max-width: 560px; margin: 0 auto; text-align: center; padding-top: 40px; color: var(--text2); }
.empty-hint .big { font-size: 28px; margin-bottom: 10px; }
.empty-hint h3 { font-family: ui-serif, Georgia, serif; font-size: 20px; color: var(--text); margin: 0 0 8px; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: .5px solid var(--hairline); }
  .sidebar-header { border: none; margin: 0; }
  .nav-group { display: none; }
  .nav-item { white-space: nowrap; }
}
