:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1f2630;
  --border: #2d333b;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #76b900;      /* NVIDIA yeşili */
  --accent-dark: #5a8f00;
  --danger: #f85149;
  --user-bubble: #1f6feb22;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- AUTH ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; height: 100vh;
  background: radial-gradient(ellipse at top, #16261a 0%, var(--bg) 60%); }
.auth-card { width: 380px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; }
.brand { font-size: 28px; font-weight: 800; letter-spacing: 2px; text-align: center; }
.brand.small { font-size: 20px; text-align: left; padding: 4px 2px 12px; }
.brand-logo { color: var(--accent); }
.auth-sub { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 13px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; padding: 9px; background: var(--bg3); color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 14px; }
.auth-tabs button.active { background: var(--accent); color: #08130a; font-weight: 700; border-color: var(--accent); }
form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
form input, .admin-panel input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none;
}
form input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.btn-primary { width: 100%; margin-top: 18px; padding: 11px; background: var(--accent);
  color: #08130a; font-weight: 700; border: none; border-radius: 8px; cursor: pointer; font-size: 15px; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.error { margin-top: 14px; color: var(--danger); font-size: 13px; text-align: center; }

/* ---------- LAYOUT ---------- */
.app { display: flex; height: 100vh; }
.sidebar { width: 300px; min-width: 300px; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px; gap: 10px; overflow-y: auto; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.btn-new { padding: 10px; background: transparent; border: 1px dashed var(--accent);
  color: var(--accent); border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.btn-new:hover { background: #76b90011; }

.side-section { display: flex; flex-direction: column; gap: 6px; }
.side-section.grow { flex: 1; min-height: 80px; }
.side-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; }
.cat-hint { font-size: 12px; color: var(--muted); }
.model-info { font-size: 12.5px; color: var(--muted); line-height: 1.45; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.model-info .stars { color: #e3b341; font-size: 13px; }
.model-info .rationale { font-style: italic; }

.conv-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.conv-item { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--text); }
.conv-item:hover, .conv-item.active { background: var(--bg3); }
.conv-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .del { visibility: hidden; background: none; border: none; color: var(--muted); cursor: pointer; }
.conv-item:hover .del { visibility: visible; }
.conv-item .del:hover { color: var(--danger); }

.side-footer { border-top: 1px solid var(--border); padding-top: 10px; font-size: 13px; }
.side-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn-ghost { padding: 7px 12px; background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn-ghost:hover { border-color: var(--accent); }

/* ---------- CHAT ---------- */
.messages { flex: 1; overflow-y: auto; padding: 28px 12%; display: flex; flex-direction: column; gap: 18px; }
.welcome { margin: auto; text-align: center; color: var(--muted); }
.welcome-logo { font-size: 56px; color: var(--accent); }
.welcome h2 { color: var(--text); margin: 10px 0 8px; }

.msg { display: flex; gap: 12px; max-width: 100%; }
.msg .avatar { width: 34px; height: 34px; min-width: 34px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.msg.user .avatar { background: #1f6feb; color: #fff; }
.msg.assistant .avatar { background: var(--accent); color: #08130a; }
.msg .bubble { padding: 10px 14px; border-radius: 10px; line-height: 1.6; overflow-wrap: break-word; min-width: 0; }
.msg.user .bubble { background: var(--user-bubble); border: 1px solid #1f6feb44; }
.msg.assistant .bubble { background: var(--bg2); border: 1px solid var(--border); flex: 1; }
.msg .bubble img.attached { max-width: 260px; border-radius: 8px; display: block; margin-top: 8px; }
.msg .bubble pre { background: #0a0e14; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow-x: auto; margin: 8px 0; font-size: 13px; }
.msg .bubble code { font-family: Consolas, monospace; font-size: 13px; background: #0a0e14;
  padding: 1px 5px; border-radius: 4px; }
.msg .bubble pre code { padding: 0; background: none; }
.msg .bubble.error-bubble { border-color: var(--danger); color: var(--danger); }
.typing { color: var(--muted); font-style: italic; }

.composer { padding: 14px 12% 20px; border-top: 1px solid var(--border); background: var(--bg); }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { resize: none; max-height: 180px; flex: 1; }
.btn-send { width: 44px; height: 42px; background: var(--accent); border: none; border-radius: 8px;
  color: #08130a; font-size: 17px; cursor: pointer; }
.btn-send:disabled { opacity: .4; cursor: not-allowed; }
.btn-attach { width: 44px; height: 42px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 17px; }
.composer-note { font-size: 12px; color: var(--muted); margin-top: 8px; text-align: center; }
.file-chip { display: inline-block; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-preview { position: relative; display: inline-block; margin-bottom: 10px; }
.img-preview img { max-height: 90px; border-radius: 8px; border: 1px solid var(--border); }
.img-preview button { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: var(--danger); color: #fff; cursor: pointer; font-size: 11px; }

/* ---------- MODAL ---------- */
.modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center;
  justify-content: center; z-index: 50; }
.modal-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; width: 480px; max-height: 86vh; overflow-y: auto; }
.modal-box.wide { width: min(900px, 94vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.small-note { font-size: 12.5px; margin-bottom: 14px; }

.ratings-body h4 { margin: 16px 0 8px; color: var(--accent); font-size: 14px; }
table.rt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rt th, table.rt td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.rt th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--bg2); }
table.rt .stars { color: #e3b341; white-space: nowrap; }
table.rt td.mid { font-family: Consolas, monospace; font-size: 12.5px; }

/* ---------- ADMIN ---------- */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-tabs button { padding: 8px 16px; background: var(--bg3); color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.admin-tabs button.active { color: var(--text); border-color: var(--accent); }
.admin-panel label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.row-gap { display: flex; gap: 10px; margin-top: 16px; }
.row-gap .btn-primary { width: auto; margin-top: 0; padding: 9px 18px; }
.admin-msg { margin-top: 12px; font-size: 13px; }
.admin-msg.ok { color: var(--accent); }
.admin-msg.err { color: var(--danger); }
.switch { cursor: pointer; }

@media (max-width: 800px) {
  .sidebar { position: fixed; z-index: 40; height: 100vh; left: 0; }
  .messages, .composer { padding-left: 4%; padding-right: 4%; }
}
