/* ══ Gemini Dashboard — gold + navy, phỏng theo PBD ══ */
:root {
  --gold: #c8a24c; --gold-2: #b98a3e; --gold-soft: #e9dcc0;
  --navy: #171a24; --navy-2: #1f2330;
  --bg: #f4efe6; --card: #ffffff; --card-2: #faf6ee;
  --ink: #2a2c33; --muted: #9a9488; --line: #ece5d8;
  --green: #7cb342; --blue: #4a90d9; --yellow: #e6b422; --red: #e0654a;
  --shadow: 0 8px 24px rgba(60,50,30,.08);
  --radius: 18px;
}
[data-theme="dark"] {
  --bg: #10121a; --card: #191c27; --card-2: #1f2330;
  --ink: #e7e4dc; --muted: #8b8a94; --line: #262a37;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Plus Jakarta Sans", -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mb { margin-bottom: 14px; }
a { color: inherit; text-decoration: none; cursor: pointer; }
code { background: var(--card-2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; border: 1px solid var(--line); }

/* ── Logo ── */
.logo-mark { color: var(--gold); font-size: 20px; line-height: 1; }
.logo-mark.big { font-size: 42px; }
.logo-word { font-weight: 700; font-size: 17px; letter-spacing: -.3px; }
.logo-word b { color: var(--gold); font-weight: 800; }

/* ── Buttons ── */
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; border: none;
  padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn-gold:hover { filter: brightness(1.05); }
.btn-gold:disabled { opacity: .55; cursor: default; }
.btn-light { background: #fff; color: #6a5322; border: none; padding: 10px 18px; border-radius: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-ghost.small { padding: 6px 12px; font-size: 12.5px; }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

/* ══ AUTH SCREEN ══ */
.auth-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 30% -10%, rgba(200,162,76,.18), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 34px 30px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.auth-sub { color: var(--muted); margin: 6px 0 20px; }
.auth-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.auth-card input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--ink); font-size: 14.5px; font-family: inherit; }
.auth-card input:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.auth-card .btn-gold { width: 100%; margin-top: 22px; }
.auth-error { background: rgba(224,101,74,.12); color: var(--red); border: 1px solid rgba(224,101,74,.3);
  padding: 9px 12px; border-radius: 10px; font-size: 13px; margin-top: 14px; }
.auth-hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 16px; }

/* ══ SHELL ══ */
.shell { display: grid; grid-template-columns: 236px 1fr 300px; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar { background: var(--navy); color: #cfd2dc; display: flex; flex-direction: column; padding: 22px 16px; }
.sidebar .brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 22px; }
.sidebar .logo-word { color: #fff; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: #a7abba; font-weight: 600; font-size: 13.5px; transition: .15s; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; box-shadow: 0 6px 16px rgba(185,138,62,.4); }
.sidebar-bottom { margin-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.05);
  padding: 9px 10px; border-radius: 14px; margin-bottom: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg,var(--gold),var(--gold-2));
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 15px; flex: none; }
.user-meta { flex: 1; min-width: 0; }
.user-meta b { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #8fd18f; }
.status-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.logout { background: transparent; border: none; color: #8b8fa0; cursor: pointer; font-size: 15px; padding: 4px; }
.logout:hover { color: var(--red); }
.theme-toggle { display: flex; gap: 6px; background: rgba(0,0,0,.25); padding: 4px; border-radius: 12px; }
.theme-btn { flex: 1; background: transparent; border: none; color: #9599a8; padding: 7px; border-radius: 9px;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.theme-btn.active { background: var(--gold); color: #fff; }

/* ── Main ── */
.main { overflow-y: auto; padding: 26px 30px; }
.main-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.main-head h1 { font-size: 25px; font-weight: 800; letter-spacing: -.5px; }
.crumb { color: var(--muted); font-size: 13px; margin-top: 3px; }
.head-right { display: flex; gap: 8px; }
.pill { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.on .dot { background: var(--green); }
.pill.off .dot { background: var(--red); }

/* ── Welcome banner ── */
.welcome { background: linear-gradient(120deg, #cbaa63 0%, #b8934f 55%, #a37e3f 100%);
  border-radius: 22px; padding: 28px 30px; color: #fff; display: flex; align-items: center;
  gap: 20px; margin-bottom: 22px; box-shadow: 0 12px 30px rgba(163,126,63,.35); position: relative; overflow: hidden; }
.welcome::after { content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.welcome-text { flex: 1; z-index: 1; }
.welcome-text h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.welcome-text p { color: rgba(255,255,255,.85); font-size: 13.5px; max-width: 440px; line-height: 1.5; }
.welcome-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-ghost.welcome, .welcome .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.welcome .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }
.welcome-avatar { width: 78px; height: 78px; border-radius: 50%; background: rgba(255,255,255,.25);
  border: 3px solid rgba(255,255,255,.6); display: grid; place-items: center; font-size: 30px; font-weight: 800; z-index: 1; flex: none; }

/* ── Stat row ── */
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-2);
  display: grid; place-items: center; font-size: 18px; flex: none; }
.stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.stat small { color: var(--muted); font-size: 12px; }

/* ── Cards ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.badge { background: var(--card-2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--muted); }
.badge.on { background: rgba(124,179,66,.15); color: #5a8a2a; border-color: rgba(124,179,66,.3); }

/* ── Donut usage ── */
.usage-body { display: flex; align-items: center; gap: 34px; }
.donut { width: 160px; height: 160px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--line) 0 100%); display: grid; place-items: center; }
.donut::before { content: ""; position: absolute; inset: 22px; background: var(--card); border-radius: 50%; }
.donut span { position: relative; font-size: 30px; font-weight: 800; }
.legend { flex: 1; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.legend .lg-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend .lg-name { flex: 1; font-weight: 600; }
.legend .lg-val { font-weight: 800; }
.legend .lg-empty { color: var(--muted); }

/* ── Chat ── */
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 130px); padding: 0; margin: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-head select { background: var(--card-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-family: inherit; font-size: 13.5px; font-weight: 600; }
.chat-head .muted { flex: 1; font-size: 12.5px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 22px; }
.chat-empty { text-align: center; margin-top: 12vh; }
.chat-empty h3 { margin: 12px 0 4px; font-size: 18px; }
.msg { display: flex; gap: 12px; margin-bottom: 18px; }
.msg .av { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.msg.user .av { background: var(--navy-2); color: #fff; }
.msg.ai .av { background: linear-gradient(135deg,var(--gold),var(--gold-2)); color: #fff; }
.msg .bd { padding-top: 3px; line-height: 1.62; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.msg .rl { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; font-weight: 600; }
.composer { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; background: var(--card-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; font-size: 14.5px; font-family: inherit; max-height: 160px; }
.composer textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.composer .send { width: 46px; padding: 0; height: 46px; border-radius: 14px; font-size: 16px; }

/* ── Models grid ── */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(230px,1fr)); gap: 14px; }
.model-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.model-card h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.model-card p { color: var(--muted); font-size: 12.5px; line-height: 1.5; min-height: 34px; }
.model-card button { margin-top: 12px; width: 100%; }
.model-card .tag { font-size: 10.5px; background: var(--gold-soft); color: var(--gold-2); padding: 2px 8px; border-radius: 20px; font-weight: 700; }

/* ── Pro / cookie ── */
.steps { margin: 0 0 14px 18px; color: var(--ink); font-size: 13.5px; line-height: 1.9; }
.cookie-box { width: 100%; background: var(--card-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; font-family: ui-monospace, monospace; font-size: 12.5px; resize: vertical; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.row-between > div { display: flex; gap: 8px; }
.warn { margin-top: 14px; font-size: 12.5px; color: #b07a2a; background: rgba(224,180,60,.1);
  border: 1px solid rgba(224,180,60,.3); padding: 10px 12px; border-radius: 10px; }

/* ── nhiều tài khoản Pro ── */
.acc-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.acc-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card-2); }
.acc-item.active { border-color: var(--gold); background: rgba(200,162,76,.08); }
.acc-item .acc-radio { flex: 1; }
.acc-radio { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.acc-radio input { accent-color: var(--gold); width: 16px; height: 16px; }
.acc-item .acc-name { font-weight: 700; }
.acc-item .acc-meta { font-size: 11.5px; color: var(--muted); margin-left: 4px; }
.acc-item .acc-active-tag { font-size: 10.5px; background: var(--gold); color: #fff; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.acc-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 6px; }
.acc-del:hover { color: var(--red); }
.acc-none-row { padding-top: 10px; border-top: 1px solid var(--line); }
.acc-empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.fld-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.acc-input { width: 100%; background: var(--card-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; }
.acc-input:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.head-actions { display: flex; align-items: center; gap: 8px; }

/* ── panel kiểm tra kết nối ── */
.test-result { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tr-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 700; }
.tr-head.ok { background: rgba(124,179,66,.14); color: #4e7d22; }
.tr-head.warn { background: rgba(230,180,34,.15); color: #a67c14; }
.tr-head.fail { background: rgba(224,101,74,.14); color: #b23c26; }
.tr-head .tr-badge { margin-left: auto; font-size: 11px; padding: 3px 10px; border-radius: 20px; background: rgba(0,0,0,.08); }
.tr-body { padding: 6px 14px 14px; }
.tr-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.tr-row:last-child { border: none; }
.tr-row .tr-ic { width: 20px; flex: none; text-align: center; }
.tr-row .tr-ic.ok { color: var(--green); } .tr-row .tr-ic.no { color: var(--red); }
.tr-row b { font-weight: 700; }
.tr-sample { background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 12.5px; margin-top: 4px; color: var(--muted); }
.tr-run { padding: 14px; font-size: 13.5px; color: var(--muted); }

/* ── API tích hợp ── */
.mono { font-family: ui-monospace, "SF Mono", monospace; font-size: 13px; }
.url-row { display: flex; gap: 8px; align-items: center; }
.url-row .acc-input { flex: 1; }
.key-new { margin: 14px 0; padding: 14px; border-radius: 12px; background: rgba(124,179,66,.1);
  border: 1px solid rgba(124,179,66,.35); }
.key-new .kn-title { font-weight: 700; color: #4e7d22; margin-bottom: 8px; font-size: 13.5px; }
.key-new .kn-key { display: flex; gap: 8px; align-items: center; }
.key-new code { flex: 1; word-break: break-all; background: var(--card); padding: 8px 10px; font-size: 12.5px; }
.key-new .kn-warn { font-size: 12px; color: #b07a2a; margin-top: 8px; }
.key-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.key-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.key-item.revoked { opacity: .55; }
.key-item .k-mono { font-family: ui-monospace, monospace; font-size: 12.5px; font-weight: 700; }
.key-item .k-label { color: var(--muted); font-size: 12px; }
.key-item .k-meta { margin-left: auto; font-size: 11.5px; color: var(--muted); text-align: right; }
.key-item .k-revoke { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 12px; }
.key-item .k-revoke:hover { border-color: var(--red); color: var(--red); }
.key-item .k-tag { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.key-item .k-tag.on { background: rgba(124,179,66,.16); color: #5a8a2a; }
.key-item .k-tag.off { background: rgba(224,101,74,.14); color: #b23c26; }
.code-block { background: var(--navy); color: #dfe3ec; border-radius: 12px; padding: 14px 16px;
  font-family: ui-monospace, monospace; font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre; margin-bottom: 14px; }

/* ── kv / notes / activity ── */
.kv, .notes, .activity-list { list-style: none; }
.kv li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv li:last-child { border: none; }
.kv span { color: var(--muted); }
.notes li { padding: 7px 0 7px 18px; position: relative; font-size: 13.5px; color: var(--muted); }
.notes li::before { content: "•"; position: absolute; left: 4px; color: var(--gold); }
.activity-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border: none; }
.activity-list .a-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); color: var(--gold-2); display: grid; place-items: center; flex: none; }
.activity-list .a-txt { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-list .a-time { font-size: 11.5px; color: var(--muted); }

/* ── Right column ── */
.rightcol { background: var(--card); border-left: 1px solid var(--line); padding: 24px 20px; overflow-y: auto; }
.rc-block { margin-bottom: 26px; }
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rc-head h4 { font-size: 14px; font-weight: 700; }
.view-all { font-size: 12px; color: var(--gold-2); font-weight: 600; }
.rc-status { display: flex; flex-direction: column; gap: 10px; }
.rc-status .st { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.rc-status .st i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; margin-right: 6px; }
.rc-status .st.on i { background: var(--green); }
.rc-status .st.off i { background: var(--red); }
.rc-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rc-list li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--card-2); cursor: pointer; }
.rc-list li:hover { outline: 1px solid var(--gold-soft); }
.rc-list .rc-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--gold-soft); color: var(--gold-2); display: grid; place-items: center; font-size: 13px; flex: none; }
.rc-list .rc-t { flex: 1; min-width: 0; }
.rc-list .rc-t b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-list .rc-t small { font-size: 11px; color: var(--muted); }

/* ── Responsive ── */
@media (max-width: 1080px) {
  .shell { grid-template-columns: 220px 1fr; }
  .rightcol { display: none; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stat-row { grid-template-columns: repeat(2,1fr); }
  .welcome { flex-direction: column; text-align: center; }
}
