/* Super Sonic - premium UI, teal/cyan on deep navy */
:root {
  --bg: #060b14;
  --bg2: #0a1220;
  --panel: #0e1828;
  --panel2: #12203a;
  --line: rgba(94, 234, 212, 0.10);
  --line2: rgba(255, 255, 255, 0.07);
  --txt: #e6edf6;
  --mut: #8b9bb0;
  --acc: #2dd4bf;
  --acc2: #22d3ee;
  --grad: linear-gradient(135deg, #2dd4bf, #22d3ee);
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --r: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  line-height: 1.55;
}
a { color: var(--acc2); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #04222b; border: none; border-radius: 12px;
  padding: 13px 24px; font-weight: 800; font-size: 15px; letter-spacing: .2px;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.18);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(34, 211, 238, 0.28); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: transparent; color: var(--txt);
  border: 1px solid var(--line2); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--acc); }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: var(--danger); color: #2a0606; box-shadow: none; }

.card {
  background: var(--panel); border: 1px solid var(--line2);
  border-radius: var(--r); padding: 22px;
}
.muted { color: var(--mut); }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.pill.on { background: rgba(52, 211, 153, .15); color: var(--ok); }
.pill.off { background: rgba(248, 113, 113, .15); color: var(--danger); }
.pill.wait { background: rgba(251, 191, 36, .15); color: var(--warn); }

/* Landing */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 5vw; position: sticky; top: 0; z-index: 50;
  background: rgba(6, 11, 20, .8); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line2);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
.brand .dot {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #04222b; box-shadow: 0 6px 18px rgba(34, 211, 238, .35);
}
.hero {
  text-align: center; padding: 80px 5vw 60px; position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: -40% -20% auto; height: 600px;
  background: radial-gradient(ellipse at center, rgba(45, 212, 191, .14), transparent 60%);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 60px); font-weight: 800; letter-spacing: -1.5px;
  line-height: 1.08; position: relative;
}
.hero h1 .g {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.sub { color: var(--mut); font-size: 18px; max-width: 620px; margin: 18px auto 30px; position: relative; }
.hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; }
.stats { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 44px; position: relative; }
.stat { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 16px 26px; min-width: 140px; }
.stat b { font-size: 24px; display: block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--mut); font-size: 13px; }

.section { padding: 56px 5vw; max-width: 1100px; margin: 0 auto; }
.section h2 { font-size: 30px; letter-spacing: -.5px; margin-bottom: 8px; }
.section .lede { color: var(--mut); margin-bottom: 28px; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feat { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 24px; transition: border-color .2s, transform .2s; }
.feat:hover { border-color: var(--acc); transform: translateY(-3px); }
.feat .ic { font-size: 26px; margin-bottom: 12px; }
.feat h3 { font-size: 17px; margin-bottom: 6px; }
.feat p { color: var(--mut); font-size: 14px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 26px; position: relative; }
.plan.hot { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc), 0 16px 40px rgba(34, 211, 238, .12); }
.plan .tag { position: absolute; top: -11px; right: 18px; background: var(--grad); color: #04222b; font-size: 11px; font-weight: 800; padding: 3px 12px; border-radius: 999px; }
.plan h3 { font-size: 18px; }
.plan .price { font-size: 28px; font-weight: 800; margin: 10px 0 14px; }
.plan .price span { font-size: 13px; color: var(--mut); font-weight: 500; }
.plan ul { list-style: none; margin-bottom: 18px; }
.plan li { color: var(--mut); font-size: 14px; padding: 5px 0 5px 22px; position: relative; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--acc); font-weight: 800; }

footer { border-top: 1px solid var(--line2); padding: 28px 5vw; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; color: var(--mut); font-size: 14px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card .dot { width: 58px; height: 58px; border-radius: 16px; background: var(--grad); display: inline-flex; align-items: center; justify-content: center; font-size: 30px; margin-bottom: 16px; box-shadow: 0 10px 30px rgba(34, 211, 238, .3); }
.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.login-card .mut { margin-bottom: 26px; }
.gsi-slot { display: flex; justify-content: center; min-height: 46px; }
.notice { margin-top: 18px; padding: 14px; border-radius: 12px; font-size: 14px; display: none; text-align: left; }
.notice.show { display: block; }
.notice.wait { background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .3); }
.notice.bad { background: rgba(248, 113, 113, .12); border: 1px solid rgba(248, 113, 113, .3); }

/* App shell */
.shell { display: flex; height: 100vh; overflow: hidden; }
.side {
  width: 264px; background: var(--bg2); border-right: 1px solid var(--line2);
  display: flex; flex-direction: column; padding: 14px; gap: 6px; flex-shrink: 0;
}
.side .brand { padding: 6px 8px 16px; font-size: 17px; }
.side .newchat { width: 100%; margin-bottom: 8px; }
.side .hist { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.side .hist .h {
  padding: 9px 12px; border-radius: 10px; color: var(--mut); font-size: 13.5px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side .hist .h:hover, .side .hist .h.on { background: var(--panel2); color: var(--txt); }
.side .who { border-top: 1px solid var(--line2); padding-top: 12px; font-size: 13px; }
.side .who b { display: block; font-size: 14px; }
.side .who .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-bottom: 1px solid var(--line2); background: var(--bg2);
}
.topbar .tab {
  padding: 8px 16px; border-radius: 10px; background: transparent; border: none;
  color: var(--mut); font-weight: 700; font-size: 14px;
}
.topbar .tab.on { background: var(--panel2); color: var(--txt); }
.topbar .spacer { flex: 1; }
.counter {
  font-size: 13px; color: var(--mut); font-weight: 700;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 999px; padding: 5px 14px;
}
.counter b { color: var(--acc); }
.burger { display: none; background: none; border: 1px solid var(--line2); border-radius: 10px; color: var(--txt); padding: 7px 11px; font-size: 16px; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 5vw; display: flex; flex-direction: column; gap: 18px; }
.msg { max-width: 760px; width: 100%; margin: 0 auto; display: flex; gap: 12px; }
.msg .av { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; }
.msg.user .av { background: var(--panel2); color: var(--acc2); }
.msg.ai .av { background: var(--grad); color: #04222b; }
.msg .bubble { flex: 1; min-width: 0; }
.msg .who-name { font-size: 12px; font-weight: 800; color: var(--mut); margin-bottom: 3px; }
.msg .text { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.msg.user .text { background: var(--panel2); border-radius: 12px; padding: 10px 14px; }
.msg .text img.att { border-radius: 10px; margin-bottom: 8px; max-height: 240px; display: block; }
.chat-empty { margin: auto; text-align: center; color: var(--mut); max-width: 460px; }
.chat-empty .big { font-size: 40px; margin-bottom: 10px; }
.chat-empty h3 { color: var(--txt); margin-bottom: 6px; }
.sugg { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.sugg button { background: var(--panel); border: 1px solid var(--line2); color: var(--mut); border-radius: 999px; padding: 8px 14px; font-size: 13px; }
.sugg button:hover { border-color: var(--acc); color: var(--txt); }

.composer { padding: 14px 5vw 18px; border-top: 1px solid var(--line2); background: var(--bg2); }
.composer .box {
  max-width: 760px; margin: 0 auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 16px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.composer .box:focus-within { border-color: var(--acc); }
.composer textarea {
  background: none; border: none; outline: none; resize: none; color: var(--txt);
  font-family: inherit; font-size: 15px; width: 100%; min-height: 24px; max-height: 160px;
}
.composer .row { display: flex; align-items: center; gap: 6px; }
.composer .icobtn {
  background: none; border: none; color: var(--mut); font-size: 18px; padding: 7px 9px; border-radius: 9px;
}
.composer .icobtn:hover { background: var(--panel2); color: var(--txt); }
.composer .icobtn.rec { color: var(--danger); }
.composer .send { margin-left: auto; }
.attach-chip {
  display: flex; align-items: center; gap: 8px; background: var(--panel2);
  border-radius: 10px; padding: 7px 12px; font-size: 13px; width: fit-content;
}
.attach-chip img { height: 34px; border-radius: 6px; }
.attach-chip .x { background: none; border: none; color: var(--mut); font-size: 15px; }
.hint { text-align: center; color: var(--mut); font-size: 12px; margin-top: 8px; }

/* Image studio */
.studio { flex: 1; overflow-y: auto; padding: 26px 5vw; display: none; }
.studio.on { display: block; }
.studio-inner { max-width: 760px; margin: 0 auto; }
.studio .prompt-row { display: flex; gap: 10px; margin: 14px 0 8px; }
.studio input[type=text] {
  flex: 1; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px;
  padding: 13px 16px; color: var(--txt); font-family: inherit; font-size: 15px; outline: none;
}
.studio input[type=text]:focus { border-color: var(--acc); }
.meter { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.meter i { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 20px; }
.gen { background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; }
.gen img { display: block; width: 100%; aspect-ratio: 3/2; object-fit: cover; }
.gen .cap { padding: 10px 12px; font-size: 12.5px; color: var(--mut); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.gen .cap a { font-weight: 700; }
.spin {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--panel2);
  border-top-color: var(--acc); animation: sp 0.9s linear infinite; margin: 40px auto;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* Upgrade modal */
.modal-bk {
  position: fixed; inset: 0; background: rgba(2, 6, 12, .75); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 18px; z-index: 100;
}
.modal-bk.on { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; padding: 26px; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; }
.modal h3 { font-size: 21px; margin-bottom: 4px; }
.modal .mut { margin-bottom: 18px; font-size: 14px; }
.modal .x { float: right; background: none; border: none; color: var(--mut); font-size: 20px; }

/* Admin */
.admin-wrap { max-width: 980px; margin: 0 auto; padding: 30px 4vw 60px; }
.admin-wrap h1 { font-size: 26px; margin-bottom: 4px; }
.admin-tabs { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.admin-tabs .tab { padding: 9px 18px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line2); color: var(--mut); font-weight: 700; }
.admin-tabs .tab.on { color: var(--txt); border-color: var(--acc); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--mut); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding: 10px 12px; border-bottom: 1px solid var(--line2); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.015); }
.tbl-wrap { overflow-x: auto; }
.kill-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: rgba(248,113,113,.07); border: 1px solid rgba(248,113,113,.25);
  border-radius: var(--r); padding: 16px 20px; margin-bottom: 20px;
}
.kill-bar.on { background: rgba(248,113,113,.18); }

/* Mobile */
@media (max-width: 820px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 90; transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .side.open { transform: translateX(0); }
  .burger { display: inline-flex; }
  .hero { padding: 56px 5vw 40px; }
  .chat-scroll { padding: 16px 4vw; }
  .composer { padding: 10px 3vw 14px; }
  .topbar .counter { display: none; }
}

/* chat history item actions */
.side .hist .h { display: flex; align-items: center; gap: 4px; }
.side .hist .h .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .hist .h .acts { display: none; gap: 2px; }
.side .hist .h:hover .acts, .side .hist .h.on .acts { display: inline-flex; }
.side .hist .h .acts button { background: none; border: none; color: var(--mut); font-size: 12px; padding: 3px 5px; border-radius: 6px; }
.side .hist .h .acts button:hover { background: var(--panel); color: var(--txt); }

/* message action buttons */
.macts { display: flex; gap: 6px; margin-top: 7px; }
.ma {
  background: var(--panel); border: 1px solid var(--line2); color: var(--mut);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700;
}
.ma:hover { color: var(--txt); border-color: var(--acc); }

/* PDF upload success chip color */
.attach-chip { border: 1px solid var(--line2); }
