/* YB AI — one app, Muse-like. Cream paper, dark sidebar, gold accent. */
:root {
  --bg:#f4f1e8; --card:#fffdf7; --text:#1c1a17; --muted:#6f6a5e;
  --line:#e2dccb; --gold:#c9a227; --gold-dark:#a8841c; --navy:#1a1a2e;
  --navy-2:#23233a; --navy-text:#e8e6df; --navy-muted:#9a97ad;
  --green:#2e7d4f; --amber:#b97d0d; --red:#a83226; --radius:12px;
}
* { box-sizing:border-box; }
html, body { margin:0; padding:0; height:100%; }
body { background:var(--bg); color:var(--text); font-family:Georgia,'Times New Roman',serif; line-height:1.55; }
button, input, select, textarea { font:inherit; }
a { color:var(--gold-dark); }
.muted { color:var(--muted); }
.small { font-size:13px; }

.app { display:flex; height:100vh; height:100dvh; overflow:hidden; }

/* --- Sidebar --- */
.sidebar { width:288px; flex:0 0 288px; background:var(--navy); color:var(--navy-text);
  display:flex; flex-direction:column; overflow-y:auto; padding:16px 14px; gap:12px; }
.brand-row { display:flex; gap:10px; align-items:center; }
.avatar { width:44px; height:44px; border-radius:50%; object-fit:cover; border:2px solid var(--gold); flex:0 0 44px; }
.avatar.big { width:88px; height:88px; }
.brand { font-size:22px; font-weight:bold; letter-spacing:.5px; color:#fff; }
.brand-sub { font-size:12px; color:var(--navy-muted); }
.close-side { display:none; margin-left:auto; }
.icon-btn { background:none; border:1px solid var(--line); border-radius:8px; color:var(--text);
  width:34px; height:34px; cursor:pointer; font-size:16px; }
.sidebar .icon-btn { border-color:#3a3a52; color:var(--navy-text); }
.new-chat { background:var(--gold); color:#111; border:0; border-radius:10px; padding:10px 14px;
  font-weight:bold; cursor:pointer; text-align:left; }
.new-chat:hover { background:#d9b23a; }
.nav { display:flex; flex-direction:column; gap:2px; }
.nav button { background:none; border:0; color:var(--navy-text); text-align:left; padding:9px 12px;
  border-radius:8px; cursor:pointer; font-size:15px; }
.nav button:hover { background:var(--navy-2); }
.nav button.active { background:var(--navy-2); color:#fff; box-shadow:inset 3px 0 0 var(--gold); }
.side-label { font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--navy-muted); margin-top:6px; }
.threads { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; }
.threads li button { width:100%; background:none; border:0; color:var(--navy-text); text-align:left;
  padding:8px 12px; border-radius:8px; cursor:pointer; font-size:14px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.threads li button:hover { background:var(--navy-2); }
.threads li button.active { background:var(--navy-2); color:#fff; }
.brain-box { background:var(--navy-2); border-radius:var(--radius); padding:12px; }
.brain-status { margin:0 0 8px; font-size:13px; }
.brain-label { font-size:12px; color:var(--navy-muted); display:block; margin:6px 0 4px; }
.brain-box select { width:100%; background:#12121f; color:var(--navy-text); border:1px solid #3a3a52;
  border-radius:8px; padding:8px; }
.brain-row { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.btn { background:var(--gold); color:#111; border:0; border-radius:9px; padding:9px 14px;
  font-weight:bold; cursor:pointer; }
.btn:hover { background:#d9b23a; }
.btn.ghost { background:none; border:1px solid var(--line); color:var(--text); }
.btn.danger { background:var(--red); color:#fff; }
.sidebar .btn.ghost { border-color:#3a3a52; color:var(--navy-text); }
.progress { height:6px; background:rgba(255,255,255,.15); border-radius:3px; margin-top:10px; overflow:hidden; }
.progress .bar { height:100%; width:0%; background:var(--gold); border-radius:3px; }
.side-foot { margin-top:auto; font-size:12px; color:var(--navy-muted); display:flex; flex-direction:column; gap:4px; }
.side-foot a { color:var(--navy-muted); }

/* --- Main --- */
.main { flex:1; display:flex; flex-direction:column; min-width:0; }
.topbar { display:flex; align-items:center; gap:10px; padding:10px 16px; border-bottom:1px solid var(--line);
  background:var(--card); }
.topbar .icon-btn { display:none; }
.top-title { font-size:18px; font-weight:bold; }
.top-status { font-size:13px; color:var(--muted); margin-left:auto; }
.view { flex:1; overflow-y:auto; padding:24px; max-width:860px; width:100%; margin:0 auto; }
.view[hidden] { display:none !important; }
.view h2 { margin:0 0 6px; font-size:26px; }
.view h3 { margin:22px 0 8px; font-size:19px; }
.view p { margin:0 0 10px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; margin:0 0 14px; }
.card h3 { margin:0 0 8px; }
.card ol { margin:6px 0; padding-left:22px; }
.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin:0 0 16px; }
.cards .card { margin:0; text-align:center; }
.cards .num { font-size:30px; font-weight:bold; }
.cards .lbl { font-size:13px; color:var(--muted); }
.inline { display:flex; gap:8px; margin:0 0 14px; flex-wrap:wrap; }
.inline input[type=text], .inline input[type=search] { flex:1; min-width:200px; padding:10px 12px;
  border:1px solid var(--line); border-radius:9px; background:#fff; }
.inline button, form.inline button { background:var(--gold); color:#111; border:0; border-radius:9px;
  padding:10px 16px; font-weight:bold; cursor:pointer; }

/* --- Chat --- */
#view-chat { display:flex; flex-direction:column; padding:0; max-width:none; }
.thread { flex:1; overflow-y:auto; padding:24px; }
.thread-inner { max-width:760px; margin:0 auto; display:flex; flex-direction:column; gap:14px; }
.msg { max-width:85%; padding:12px 16px; border-radius:14px; line-height:1.55; white-space:pre-wrap; word-wrap:break-word; }
.msg.user { align-self:flex-end; background:var(--navy); color:#fff; border-bottom-right-radius:4px; }
.msg.assistant { align-self:flex-start; background:var(--card); border:1px solid var(--line); border-bottom-left-radius:4px; }
.msg.assistant.thinking { color:var(--muted); font-style:italic; }
.msg .meta { display:block; font-size:11px; color:var(--muted); margin-top:8px; }
.msg .actions { display:flex; gap:10px; margin-top:8px; }
.msg .actions button { background:none; border:0; color:var(--gold-dark); cursor:pointer; font-size:12px; padding:0; text-decoration:underline; }
.build-card { align-self:flex-start; width:100%; background:var(--card); border:1px solid var(--gold);
  border-radius:var(--radius); padding:14px 16px; }
.build-card h4 { margin:0 0 8px; }
.build-card iframe { width:100%; height:420px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.build-card .row { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.empty { text-align:center; padding:48px 16px; color:var(--muted); }
.empty-name { font-size:26px; color:var(--text); font-weight:bold; margin:10px 0 4px; }
.suggest { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-top:18px; }
.suggest button { background:var(--card); border:1px solid var(--line); border-radius:20px;
  padding:8px 14px; cursor:pointer; }
.suggest button:hover { border-color:var(--gold); }
.composer { border-top:1px solid var(--line); background:var(--card); padding:14px 24px 10px; }
.composer-row { display:flex; gap:10px; max-width:760px; margin:0 auto; }
.composer-row textarea { flex:1; resize:none; border:1px solid var(--line); border-radius:12px;
  padding:12px 14px; background:#fff; min-height:48px; max-height:160px; }
.composer-row button { background:var(--gold); color:#111; border:0; border-radius:12px;
  padding:0 22px; font-weight:bold; cursor:pointer; }
.composer p { max-width:760px; margin:8px auto 0; text-align:center; }

/* --- Translate / forms --- */
.translate-box textarea, .tr-out { width:100%; }
.translate-box textarea { border:1px solid var(--line); border-radius:10px; padding:12px; background:#fff; resize:vertical; }
.tr-row { display:flex; gap:10px; align-items:center; margin:10px 0; flex-wrap:wrap; }
.tr-row select { padding:8px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.tr-out { background:var(--card); border:1px solid var(--gold); border-radius:var(--radius); padding:14px 16px; margin-top:12px; }
.tr-out-label { font-size:12px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:6px; }
.tr-out p { margin:0; white-space:pre-wrap; }
.hist-item { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:12px 14px; margin:0 0 10px; }
.hist-item .from { font-size:13px; color:var(--muted); }
.hist-item p { margin:4px 0; }
.hist-item button, .goal-item button, .memory-item button { background:none; border:0; color:var(--red);
  cursor:pointer; font-size:12px; padding:0; text-decoration:underline; }
.goal-item, .memory-item { background:var(--card); border:1px solid var(--line); border-radius:10px;
  padding:12px 14px; margin:0 0 10px; display:flex; gap:10px; align-items:baseline; justify-content:space-between; }
.goal-item.done { opacity:.65; }
.goal-item.done .goal-text { text-decoration:line-through; }
.goal-item .goal-actions, .memory-item .mem-actions { display:flex; gap:12px; flex-shrink:0; }
.goal-item .goal-actions button { color:var(--gold-dark); }
.goal-item .goal-log { font-size:12px; color:var(--muted); display:block; margin-top:4px; }
.toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background:var(--navy); color:#fff;
  padding:10px 18px; border-radius:10px; z-index:50; box-shadow:0 4px 18px rgba(0,0,0,.3); }

@media (max-width: 760px) {
  .sidebar { position:fixed; left:0; top:0; bottom:0; z-index:40; transform:translateX(-105%);
    transition:transform .2s ease; width:288px; box-shadow:0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform:translateX(0); }
  .close-side { display:block; }
  .topbar .icon-btn { display:block; }
  .view { padding:18px 14px; }
  .thread { padding:18px 14px; }
  .msg { max-width:94%; }
  .composer { padding:12px 14px 8px; }
}
