/* Code GPT - warm paper look, serif headings, phone friendly. */
:root {
  --bg: #faf9f5; --panel: #f3f1ea; --panel2: #ebe8dd; --line: #e3dfd2; --line2: #d6d1c2; --card: #ffffff;
  --text: #141413; --muted: #5d5b55; --accent: #0f7a52; --accent-dark: #0b5d3f; --accent-soft: #e5f3ec;
  --danger: #b42318; --danger-soft: #fdecea; --warn-soft: #fff6e0;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --radius: 14px; --side: 276px;
  --shadow: 0 2px 16px rgba(70, 60, 30, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
a { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .8rem; }
code, .mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .center { text-align: center; }
.ms { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr;
  -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; vertical-align: middle; user-select: none;
  width: 1em; overflow: hidden; flex: 0 0 auto; }

/* ---------- boot loader (logo while the page loads) ---------- */
#boot-loader { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; align-items: center;
  justify-content: center; transition: opacity .3s ease; }
#boot-loader .logo { animation: bootpulse 1.1s ease-in-out infinite; }
#boot-loader.gone { opacity: 0; pointer-events: none; }
@keyframes bootpulse { 0%, 100% { transform: scale(.92); opacity: .75; } 50% { transform: scale(1.04); opacity: 1; } }

/* ---------- buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: .55rem 1rem;
  border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: 500 .93rem var(--sans); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--line2); background: #fdfcf8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); border-color: transparent; background: transparent; padding-left: 0; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.small { padding: .35rem .7rem; font-size: .84rem; }
.btn.wide { width: 100%; padding: .75rem 1rem; }
.btn.disabled { opacity: .45; pointer-events: auto; cursor: not-allowed; }
.btn .ms { font-size: 18px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 10px; border: none; background: transparent; color: var(--text); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--panel2); }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: .3rem .6rem; font: inherit; font-size: .84rem; }
input, textarea, select { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: .6rem .8rem; width: 100%; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; line-height: 1.5; }
label { display: block; font-weight: 500; font-size: .9rem; }
label > input, label > textarea, label > select { margin-top: .35rem; font-weight: 400; }
label small { display: block; font-weight: 400; margin-top: .25rem; }
label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin: .15rem 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row-end { display: flex; justify-content: flex-end; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline-form { display: flex; gap: .5rem; align-items: center; margin: .8rem 0; }
.inline-form input { flex: 1; }
.flash { padding: .75rem 1rem; border-radius: 12px; margin: 0 0 1rem; border: 1px solid; font-size: .92rem; }
.flash.ok { background: var(--accent-soft); border-color: #bfe2d0; }
.flash.err { background: var(--danger-soft); border-color: #f5c2bd; }
.flash.warn { background: var(--warn-soft); border-color: #f1dca5; }
.pill { display: inline-flex; align-items: center; gap: 5px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: .18rem .7rem; font-size: .8rem; color: var(--text); text-decoration: none; }
.pill .ms { font-size: 16px; } .pill.small { font-size: .72rem; padding: .1rem .5rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }

/* ---------- app layout ---------- */
.layout { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { width: var(--side); flex: 0 0 var(--side); background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: .8rem .65rem; overflow: hidden; z-index: 40; }
.main { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; position: relative; scroll-behavior: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand span { font-family: var(--serif); font-size: 1.4rem; font-weight: 500; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: .2rem .35rem .8rem; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: .48rem .65rem; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: .93rem; }
.side-nav a:hover { background: var(--panel2); }
.side-nav a.active { background: var(--panel2); font-weight: 600; }
.side-label { font-size: .76rem; font-weight: 600; color: var(--muted); margin: 1.1rem .65rem .35rem; text-transform: uppercase; letter-spacing: .04em; }
.side-search { display: flex; align-items: center; gap: 6px; margin: 0 .3rem .35rem; padding: 0 .5rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.side-search input { border: none; box-shadow: none; padding: .42rem 0; background: transparent; font-size: .88rem; }
.recents { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 60px; }
.recent { display: flex; align-items: center; border-radius: 10px; }
.recent a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: .42rem .65rem;
  color: var(--text); text-decoration: none; font-size: .9rem; }
.recent .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .pin { font-size: 15px; color: var(--muted); }
.recent .dots { width: 30px; height: 30px; opacity: 0; }
.recent:hover, .recent.active { background: var(--panel2); }
.recent:hover .dots, .recent.active .dots, .recent .dots:focus { opacity: 1; }
.recents .empty { color: var(--muted); font-size: .86rem; padding: .4rem .65rem; }
.side-foot { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .4rem; position: relative; }
.acct { display: flex; align-items: center; gap: 10px; padding: .2rem .3rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #34d399, #0f9d68 55%, #065f46);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; flex: 0 0 auto; }
.who { flex: 1; min-width: 0; }
.who .name { font-size: .9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .sub { font-size: .74rem; color: var(--muted); }
.acct-menu { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: .35rem; }
.acct-menu a, .acct-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: .5rem .6rem;
  border-radius: 8px; border: none; background: none; color: var(--text); text-decoration: none; font: inherit; font-size: .9rem; cursor: pointer; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--panel); }
.acct-menu form { margin: 0; }
.topbar { display: none; }
.scrim { display: none; }
.only-mobile { display: none; }

/* ---------- pages ---------- */
.page { max-width: 860px; margin: 0 auto; padding: 2.2rem 1.5rem 4rem; }
.page.wide { max-width: 1080px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .88rem; margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.tile { display: flex; flex-direction: column; gap: .4rem; text-decoration: none; color: var(--text); margin: 0;
  transition: border-color .15s, transform .15s, box-shadow .15s; }
.tile:hover { border-color: var(--line2); transform: translateY(-1px); box-shadow: var(--shadow); }
.tile h3 { margin: 0; }
.tile-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; }
.tile-top { display: flex; justify-content: space-between; align-items: center; }
.tile .lang { font-family: var(--mono); font-size: .76rem; background: var(--panel); border-radius: 6px; padding: .1rem .45rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.peek { font-family: var(--mono); font-size: .74rem; background: var(--panel); border-radius: 8px; padding: .5rem .6rem;
  max-height: 120px; overflow: hidden; margin: .2rem 0; white-space: pre-wrap; word-break: break-word; }
.peek.tall { max-height: 400px; overflow: auto; }
.tile.prompt { flex-direction: row; align-items: center; justify-content: space-between; }
.tile.prompt p { margin: 0; } .tile.prompt .go { color: var(--muted); }
.lib-section { margin: 1.6rem 0; } .lib-section h2 { display: flex; align-items: center; gap: 8px; }
.empty-state { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 3rem 1rem;
  border: 1px dashed var(--line2); border-radius: var(--radius); }
.empty-state .ms { font-size: 40px; width: auto; }
.list { list-style: none; padding: 0; margin: 0; }
.list li a { display: flex; align-items: center; gap: 10px; padding: .7rem .8rem; border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none; }
.list li a:hover { background: var(--panel); }
.list li a span:not(.ms) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.list .empty, .notes .empty { color: var(--muted); padding: .8rem; }
.plain { padding-left: 1.1rem; margin: 0; } .plain li { margin: .25rem 0; }
.pre { white-space: pre-wrap; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin: 1rem 0 1.2rem; overflow-x: auto; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 6px; padding: .6rem .9rem; border: none;
  background: none; color: var(--muted); text-decoration: none; font: 500 .92rem var(--sans); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs .active { color: var(--text); border-bottom-color: var(--accent); }
.search-big { display: flex; align-items: center; gap: .6rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: .35rem .4rem .35rem .9rem; margin: 1rem 0 1.4rem; box-shadow: var(--shadow); }
.search-big input { border: none; box-shadow: none; padding: .5rem 0; }
.filters { display: flex; gap: .6rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 180px; } .filters select { width: auto; }
.notes { list-style: none; padding: 0; margin: 1rem 0; }
.notes li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .2rem .5rem .8rem;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: .45rem; background: var(--bg); }
.notes form { margin: 0; }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--panel);
  border: 2px dashed #9fd4bb; border-radius: 14px; padding: .9rem 1.1rem; margin: .4rem 0 1rem; }
.code-box .mono { font-size: 1.6rem; letter-spacing: .12em; font-weight: 600; }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stats div { background: var(--panel); border-radius: 12px; padding: .7rem 1rem; min-width: 110px; }
.stats b { display: block; font-size: 1.2rem; } .stats span { color: var(--muted); font-size: .82rem; }
.danger-zone { border-color: #f1c9c4; }
.prose { font-size: 1rem; } .prose h2 { margin-top: 1.6rem; } .prose li { margin: .3rem 0; }
.about-head { display: flex; align-items: center; gap: 14px; margin-bottom: 1rem; }
.about-head h1 { margin: 0; } .about-head p { margin: 0; }
.error-page { padding-top: 5rem; } .big-code { font-family: var(--serif); font-size: 4.5rem; color: var(--line2); line-height: 1; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }
iframe.preview { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.code-view { background: #f8f8f6; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; overflow: auto;
  max-height: 75vh; font-size: .86rem; margin: 0; }
.code-view code { background: none !important; padding: 0 !important; }

/* ---------- public pages (login, signup, help) ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-top { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; gap: 1rem; }
.public-top nav { display: flex; align-items: center; gap: 1.1rem; }
.public-top nav a:not(.btn) { color: var(--text); text-decoration: none; font-size: .93rem; }
.public-main { flex: 1; }
.public-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem; padding: 1.2rem 1.5rem;
  color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }
.public-foot a { color: var(--muted); margin-left: .8rem; }
.auth { max-width: 460px; margin: 0 auto; padding: 2rem 1.2rem 4rem; }
.auth-hero { text-align: center; margin-bottom: 1.4rem; }
.auth-hero .logo { margin-bottom: .6rem; }
.auth-hero h1 { font-size: 2.1rem; margin-bottom: .2rem; }
.auth-hero p { color: var(--muted); }
.auth-card { padding: 1.6rem; box-shadow: var(--shadow); }
.auth-card.narrow { max-width: 420px; margin: 3rem auto; }
.auth-switch { text-align: center; margin: 1.1rem 0 0; font-size: .92rem; }
.hint { text-align: center; color: var(--muted); font-size: .82rem; margin: .8rem 0 0; }
.code-input { font-family: var(--mono); font-size: 1.25rem; letter-spacing: .12em; text-transform: uppercase; text-align: center; }

/* ---------- chat ---------- */
.chat-shell { max-width: 820px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding: 0 1.25rem; }
.chat-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem 0 .6rem; background: linear-gradient(var(--bg) 75%, rgba(250, 249, 245, 0)); }
.chat-title-wrap { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.chat-title { font-size: 1.1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; align-items: center; gap: .2rem; }
.home-hero { padding-top: 18vh; }
.greet { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 1.6rem;
  font-family: var(--serif); font-size: 2.4rem; font-weight: 500; letter-spacing: -.015em; text-align: center; }
.thread { flex: 1; padding: .6rem 0 1rem; }
body.is-home .thread { flex: 0; padding: 0; }
.msg { margin: 1.1rem 0; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble { background: var(--panel2); border-radius: 18px; padding: .7rem 1.05rem; max-width: 85%;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user.pending .bubble { opacity: .7; }
.msg-files { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; margin-bottom: .4rem; max-width: 85%; }
.msg-files img { max-width: 220px; max-height: 180px; border-radius: 12px; border: 1px solid var(--line); display: block; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: .3rem .55rem; font-size: .82rem; color: var(--text); text-decoration: none; max-width: 240px; }
.file-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.file-chip .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .x { border: none; background: none; cursor: pointer; padding: 0; display: flex; color: var(--muted); }
.file-chip .x .ms { font-size: 16px; }
.msg.assistant .md { font-family: var(--serif); font-size: 1.07rem; line-height: 1.72; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md .table-scroll { margin: 0 0 .9rem; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--serif); margin: 1.3rem 0 .5rem; line-height: 1.3; }
.md h1 { font-size: 1.5rem; } .md h2 { font-size: 1.3rem; } .md h3 { font-size: 1.12rem; }
.md ul, .md ol { padding-left: 1.4rem; } .md li { margin: .2rem 0; }
.md blockquote { border-left: 3px solid var(--line2); padding-left: 1rem; color: var(--muted); }
.md :not(pre) > code { font-size: .86em; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .08em .35em; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.md img { max-width: 100%; }
.table-scroll { overflow-x: auto; }
.md table { border-collapse: collapse; font-family: var(--sans); font-size: .9rem; min-width: 50%; }
.md th, .md td { border: 1px solid var(--line); padding: .45rem .7rem; text-align: left; vertical-align: top; }
.md th { background: var(--panel); }
.codeblock { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0 0 1rem; background: #fbfbf9; font-family: var(--sans); }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: .25rem .4rem .25rem .8rem;
  background: var(--panel); border-bottom: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.code-btns { display: flex; gap: .15rem; }
.code-btns button { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; cursor: pointer;
  font: 500 .76rem var(--sans); color: var(--text); padding: .3rem .5rem; border-radius: 7px; }
.code-btns button:hover { background: var(--panel2); }
.code-btns .ms { font-size: 16px; }
.codeblock pre { margin: 0 !important; padding: .9rem 1rem; overflow-x: auto; font-size: .85rem; line-height: 1.55; }
.codeblock pre code, .codeblock pre code.hljs { background: none !important; padding: 0 !important; font-family: var(--mono); }
.steps { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .55rem .85rem; margin: 0 0 .8rem; font-family: var(--sans); }
.step { display: flex; align-items: center; gap: 10px; font-size: .9rem; padding: .18rem 0; word-break: break-word; }
.step .ms { color: var(--accent); font-size: 19px; }
.step .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite; flex: 0 0 16px; margin: 0 1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.typing { display: flex; align-items: center; gap: 6px; padding: .3rem 0; font-family: var(--sans); }
.typing .tlabel { font-size: .95rem; font-weight: 500; margin-right: 3px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: tdot 1.15s infinite ease-in-out; }
.typing i:nth-of-type(2) { animation-delay: .16s; } .typing i:nth-of-type(3) { animation-delay: .32s; }
@keyframes tdot { 0%, 80%, 100% { transform: scale(.55); opacity: .35; } 40% { transform: scale(1); opacity: 1; } }
.sources { margin: .5rem 0 .2rem; font-family: var(--sans); }
.sources:empty { display: none; }
.sources .slabel { font-size: .78rem; font-weight: 600; margin-right: .4rem; }
.sources a { display: inline-block; background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: .1rem .65rem; margin: .15rem .3rem .15rem 0; font-size: .78rem; text-decoration: none; color: var(--text); }
.sources a:hover { background: var(--panel); }
.mem-note { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--accent-dark);
  background: var(--accent-soft); border-radius: 999px; padding: .2rem .7rem; margin-bottom: .6rem; text-decoration: none; }
.mem-note .ms { font-size: 16px; }
.msg-actions { display: flex; gap: .1rem; margin-top: .3rem; opacity: .55; transition: opacity .15s; }
.msg:hover .msg-actions, .msg.last .msg-actions { opacity: 1; }
.msg-actions button { border: none; background: none; cursor: pointer; padding: .3rem; border-radius: 8px; color: var(--muted); display: flex; }
.msg-actions button:hover { background: var(--panel2); color: var(--text); }
.msg-actions .ms { font-size: 18px; }
.msg-actions .regen { display: none; } .msg.last .msg-actions .regen { display: flex; }
.msg.error { display: flex; align-items: center; gap: .6rem; background: var(--danger-soft); border: 1px solid #f5c2bd;
  border-radius: 12px; padding: .7rem 1rem; font-size: .92rem; }
.msg.error .ms { color: var(--danger); } .msg.error span:not(.ms) { flex: 1; }
.admin-thread .msg.assistant .md { font-size: 1rem; }

/* composer */
.composer-wrap { position: sticky; bottom: 0; padding: .4rem 0 .6rem; background: linear-gradient(rgba(250, 249, 245, 0), var(--bg) 28%); z-index: 4; }
body.is-home .composer-wrap { position: static; background: none; padding-top: 0; }
body.is-home .chat-shell { min-height: auto; }
.composer { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: .65rem .65rem .5rem; }
.composer:focus-within { border-color: var(--line2); }
.composer textarea { border: none; box-shadow: none; resize: none; padding: .35rem .5rem; font-size: 1rem; max-height: 40vh; min-height: 28px; background: transparent; }
.file-chips { display: flex; gap: .4rem; flex-wrap: wrap; padding: 0 .3rem .4rem; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-top: .25rem; }
.composer-bar .left, .composer-bar .right { display: flex; align-items: center; gap: .3rem; }
.composer-bar label.icon-btn { border: 1px solid var(--line); margin: 0; }
.seg { display: inline-flex; background: var(--panel); border-radius: 10px; padding: 2px; }
.seg button, .toggle { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; cursor: pointer;
  font: 500 .82rem var(--sans); color: var(--muted); padding: .32rem .6rem; border-radius: 8px; }
.seg button .ms, .toggle .ms { font-size: 17px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.toggle { border: 1px solid var(--line); }
.toggle.on { background: var(--accent-soft); color: var(--accent-dark); border-color: #bfe2d0; }
#model-select { width: auto; border: none; background: transparent; font-size: .82rem; color: var(--muted); padding: .3rem 1.3rem .3rem .4rem; cursor: pointer; box-shadow: none; }
.send { width: 36px; height: 36px; border-radius: 11px; border: none; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.send:disabled { background: #cfd9d3; cursor: default; }
.send.stop { background: var(--text); }
.voice-btn { background: conic-gradient(from 0deg, #34d399, #0f9d68, #14b8a6, #065f46, #6ee7b7, #34d399); color: #fff; border-radius: 50%; }
.voice-btn:hover { filter: brightness(1.08); background: conic-gradient(from 0deg, #34d399, #0f9d68, #14b8a6, #065f46, #6ee7b7, #34d399); }
.composer-note { text-align: center; font-size: .74rem; color: var(--muted); margin: .45rem 0 0; }
body.is-home .composer-note { display: none; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: .42rem .95rem; font: 500 .88rem var(--sans); cursor: pointer; color: var(--text); }
.chip:hover, .chip.on { background: var(--panel); border-color: var(--line2); }
.chip .ms { font-size: 18px; }
.examples { margin: .8rem auto 0; max-width: 680px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.example { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line); background: none;
  padding: .75rem 1rem; font: inherit; cursor: pointer; color: var(--text); }
.example:last-child { border-bottom: none; }
.example:hover { background: var(--panel); }
.drop-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15, 122, 82, .12); border: 3px dashed var(--accent);
  display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-overlay div { text-align: center; background: var(--card); padding: 1.5rem 2rem; border-radius: 16px; box-shadow: var(--shadow); }
.drop-overlay .ms { font-size: 40px; width: auto; color: var(--accent); }

/* ---------- menus, dialogs, toasts ---------- */
.pop-menu { position: fixed; z-index: 70; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(40, 30, 10, .15); padding: .3rem; min-width: 190px; }
.pop-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: .5rem .65rem; border: none;
  background: none; border-radius: 8px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--text); text-align: left; }
.pop-menu button:hover { background: var(--panel); }
.pop-menu button.danger { color: var(--danger); }
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(20, 20, 19, .35); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--card); border-radius: 16px; padding: 1.4rem; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal input, .modal select { margin: .4rem 0 .2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.1rem; }
.share-box { display: flex; gap: .5rem; } .share-box input { flex: 1; font-size: .85rem; }
.modal-back.full { padding: 2vh 2vw; }
.preview-modal { max-width: none; height: 96vh; display: flex; flex-direction: column; padding: .6rem; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; padding: 0 .3rem .5rem .5rem; }
.preview-modal iframe.preview { flex: 1; height: auto; }
.toasts { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: .4rem; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: #fff; padding: .55rem 1rem; border-radius: 10px; font-size: .88rem; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; }
.toast.err { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- admin ---------- */
body.admin { background: var(--bg); }
.admin-top { display: flex; align-items: center; gap: 1.2rem; padding: .7rem 1.4rem; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.admin-nav { display: flex; gap: .2rem; flex: 1; overflow-x: auto; }
.admin-nav a { display: inline-flex; align-items: center; gap: 6px; padding: .45rem .7rem; border-radius: 9px; color: var(--text); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.admin-nav a:hover { background: var(--panel2); } .admin-nav a.active { background: var(--card); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.admin-right { display: flex; gap: .4rem; align-items: center; } .admin-right form { margin: 0; }
.admin-main { max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.4rem 4rem; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; }
.metric span { display: block; color: var(--muted); font-size: .8rem; } .metric b { font-size: 1.6rem; font-weight: 600; display: block; }
.metric small { color: var(--muted); }
.metrics.small .metric b { font-size: 1.15rem; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 1.2rem; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar .fill { width: 100%; background: linear-gradient(#34d399, #0f7a52); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar .n { font-size: .72rem; color: var(--muted); margin-bottom: 3px; } .bar .d { font-size: .68rem; color: var(--muted); margin-top: 4px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: var(--bg); }
.table .empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.table .detail { font-family: var(--mono); font-size: .76rem; word-break: break-all; max-width: 560px; }
details summary { cursor: pointer; }

/* ---------- voice mode ---------- */
.voice { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
  background: radial-gradient(circle at 50% 38%, #0f3b2e 0%, #07181a 62%, #040b0c 100%); font-family: var(--sans); }
.v-title { position: absolute; top: 26px; left: 30px; font-size: 1.15rem; font-weight: 600; opacity: .9; }
.v-close { position: absolute; top: 18px; right: 24px; width: 42px; height: 42px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 24px; cursor: pointer; line-height: 1; }
.orb-wrap { width: 300px; height: 300px; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.orb-scale { position: relative; width: 210px; height: 210px; --lvl: 1; transform: scale(var(--lvl)); transition: transform .09s linear; }
.orb { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, #34d399, #0f9d68, #14b8a6, #065f46, #6ee7b7, #34d399);
  filter: blur(5px); box-shadow: 0 0 70px rgba(16, 185, 129, .6), 0 0 140px rgba(20, 184, 166, .4); animation: vspin 7s linear infinite; }
.orb-shine { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 52%); }
.voice[data-state="thinking"] .orb { animation-duration: 1.6s; }
.voice[data-state="thinking"] .orb-scale { animation: vsoft 1.3s ease-in-out infinite; }
.voice[data-state="speaking"] .orb-scale { animation: vbeat .85s ease-in-out infinite; }
.voice[data-state="idle"] .orb { animation-duration: 16s; opacity: .75; }
@keyframes vspin { to { transform: rotate(360deg); } }
@keyframes vbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.16); } }
@keyframes vsoft { 0%, 100% { transform: scale(.94); } 50% { transform: scale(1.04); } }
.v-status { margin-top: 18px; font-size: 1.2rem; font-weight: 500; min-height: 1.6em; text-align: center; padding: 0 20px; }
.v-text { margin-top: 10px; max-width: 640px; min-height: 3.2em; text-align: center; opacity: .75; padding: 0 24px; line-height: 1.5; }
.v-controls { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.v-controls button, .v-controls select { width: auto; border: none; border-radius: 999px; padding: 10px 22px; font-size: .95rem; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .14); }
.v-controls select option { color: #111; }
.v-controls .end { background: #e5484d; }

/* ---------- phones and tablets ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .18); }
  .layout.menu-open .sidebar { transform: none; }
  .layout.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 20, 19, .35); z-index: 30; }
  .only-mobile { display: inline-flex; }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    padding: .45rem .6rem; background: var(--bg); border-bottom: 1px solid var(--line); }
  .topbar-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--serif); font-size: 1.15rem; }
  .chat-head { top: 49px; }
  .recent .dots { opacity: 1; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  input, textarea, select { font-size: 16px; }
  .page { padding: 1.4rem 1rem 3rem; }
  h1 { font-size: 1.55rem; }
  .chat-shell { padding: 0 .75rem; }
  .home-hero { padding-top: 10vh; }
  .greet { font-size: 1.75rem; gap: 10px; } .greet .logo { width: 36px; height: 36px; }
  .msg.assistant .md { font-size: 1rem; line-height: 1.65; }
  .msg.user .bubble { max-width: 92%; }
  .seg button span:not(.ms), .toggle span:not(.ms) { display: none; }
  #model-select { max-width: 92px; }
  .row2 { grid-template-columns: 1fr; }
  .public-top { padding: .8rem 1rem; } .public-top nav { gap: .7rem; } .public-top nav a:not(.btn):first-child { display: none; }
  .code-box .mono { font-size: 1.25rem; }
  .chat-actions .btn span:not(.ms) { display: none; }
  .admin-top { padding: .6rem .8rem; } .admin-nav a span:not(.ms) { display: none; }
  .orb-wrap { width: 240px; height: 240px; } .orb-scale { width: 170px; height: 170px; }
  .inline-form { flex-direction: column; align-items: stretch; }
}

.profile-nudge { margin-top: 1rem; }

/* ---------- accounts ---------- */
.pw-wrap { position: relative; display: block; margin-top: .35rem; }
.pw-wrap input { margin: 0; padding-right: 2.6rem; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: none; background: none; cursor: pointer; color: var(--muted); padding: .35rem; display: flex; }
.pw-meter { display: block; height: 4px; border-radius: 4px; background: var(--panel2); margin-top: .45rem; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.otp-boxes { display: flex; gap: .5rem; justify-content: center; }
.otp-boxes input { width: 3rem; height: 3.4rem; text-align: center; font: 600 1.5rem var(--mono); padding: 0; }
.resend { margin-top: 1rem; }
.link-btn.strong { color: var(--accent-dark); font-weight: 600; font-size: .9rem; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.old-code { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: .9rem; font-size: .9rem; }
.old-code summary { color: var(--muted); }
.small-code { font-size: 1rem; letter-spacing: .08em; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 600; border-radius: 999px; padding: .12rem .55rem; margin-left: .4rem; vertical-align: middle; }
.badge .ms { font-size: 15px; } .badge.ok { background: var(--accent-soft); color: var(--accent-dark); } .badge.warn { background: var(--warn-soft); color: #8a5a00; }
.devices li { margin: .35rem 0; } .devices .ms { color: var(--muted); }
.wide-auth { max-width: 820px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.choice .ms { font-size: 30px; width: auto; color: var(--accent); }
.new-tag { margin-left: auto; font-style: normal; font-size: .66rem; font-weight: 700; background: var(--accent); color: #fff; border-radius: 6px; padding: .05rem .4rem; }
.upgrade { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid #bfe2d0; background: linear-gradient(135deg, #ecfdf5, #f0fdfa); border-radius: 12px; padding: .55rem .7rem; margin-bottom: .55rem; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.upgrade .ms { color: var(--accent); } .upgrade span { display: flex; flex-direction: column; line-height: 1.2; } .upgrade small { color: var(--muted); font-size: .74rem; }
.upgrade:hover { border-color: var(--accent); }

/* ---------- Codex list ---------- */
.cx-hero { text-align: center; max-width: 760px; margin: 1rem auto 2.4rem; }
.cx-hero h1 { font-size: 2.3rem; margin: .6rem 0 .4rem; }
.cx-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; font-size: .85rem; border-radius: 999px; padding: .25rem .8rem; }
.cx-start { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: .7rem; margin-top: 1.2rem; text-align: left; }
.cx-start textarea { border: none; box-shadow: none; resize: none; font-size: 1.02rem; }
.cx-start-bar { display: flex; justify-content: space-between; gap: .6rem; padding: .2rem; }
.cx-start-bar select { width: auto; }
.cx-ideas { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; margin-top: 1rem; }
.ws .ws-link { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .4rem; }
.ws-actions { display: flex; gap: .3rem; margin-top: .4rem; }
.danger-text { color: var(--danger); }

/* ---------- Codex workspace ---------- */
body.codex-page { overflow: hidden; }
.cx { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(320px, 400px) 230px 1fr; grid-template-rows: auto 1fr;
  grid-template-areas: "top top top" "chat files main"; background: var(--bg); }
.cx-top { grid-area: top; display: flex; align-items: center; gap: .8rem; padding: .45rem .8rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.cx-back { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--serif); font-size: 1.15rem; }
.cx-name { border: 1px solid transparent; background: none; font: 600 .95rem var(--sans); padding: .3rem .6rem; border-radius: 8px; cursor: pointer; color: var(--text); max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-name:hover { border-color: var(--line2); background: var(--card); }
.cx-top-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.cx-tabs-mobile { display: none; }
.grow { flex: 1; }
.cx-chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.cx-thread { flex: 1; overflow-y: auto; padding: 1rem .9rem; }
.cx-intro { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.cx-intro .ms { font-size: 34px; width: auto; color: var(--accent); }
.cx-intro h3 { color: var(--text); margin: .4rem 0; }
.cmsg { margin: .9rem 0; }
.cmsg.user { display: flex; justify-content: flex-end; }
.cmsg.user .bubble { background: var(--panel2); border-radius: 16px; padding: .6rem .9rem; max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .94rem; }
.cmsg.user.pending .bubble { opacity: .7; }
.cmsg.assistant .md { font-size: .95rem; line-height: 1.6; }
.cmsg.assistant .md p { margin: 0 0 .6rem; }
.fchip { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .45rem .7rem; margin: .4rem 0; font-size: .86rem; cursor: pointer; }
.fchip:hover { border-color: var(--line2); }
.fchip .ms { color: var(--accent); font-size: 18px; } .fchip.delete .ms { color: var(--danger); } .fchip.cut .ms { color: #b45309; }
.fchip i { color: var(--muted); font-style: normal; }
.fchip .spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.cx-changes { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-top: .6rem; overflow: hidden; font-size: .86rem; }
.cx-changes-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .7rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.cx-changes-acts { display: flex; gap: .3rem; }
.cx-change { display: flex; align-items: center; gap: .6rem; padding: .35rem .7rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.cx-change:last-child { border-bottom: none; } .cx-change:hover { background: var(--bg); }
.cx-change .act { font-size: .7rem; font-weight: 700; text-transform: uppercase; border-radius: 5px; padding: .05rem .35rem; background: var(--accent-soft); color: var(--accent-dark); }
.cx-change .act.deleted { background: var(--danger-soft); color: var(--danger); } .cx-change .act.updated { background: #eef2ff; color: #3730a3; }
.cx-change .p { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.cx-change .st i { font-style: normal; font-family: var(--mono); font-size: .76rem; } .st .add { color: #15803d; } .st .rem { color: var(--danger); }
.cx-composer { margin: .5rem .7rem .7rem; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: .5rem; box-shadow: var(--shadow); }
.cx-composer textarea { border: none; box-shadow: none; resize: none; font-size: .95rem; max-height: 30vh; }
.cx-composer-bar { display: flex; align-items: center; gap: .35rem; }
.cx-composer-bar select { width: auto; border: none; font-size: .8rem; color: var(--muted); padding: .25rem 1.2rem .25rem .3rem; box-shadow: none; background: transparent; }
.cx-files { grid-area: files; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.cx-files-head { display: flex; align-items: center; gap: .2rem; padding: .5rem .5rem .4rem .8rem; font-size: .88rem; }
.cx-files-head label.icon-btn { margin: 0; }
.cx-tree { list-style: none; margin: 0; padding: 0 .3rem .8rem; overflow-y: auto; flex: 1; font-size: .86rem; }
.cx-tree li { display: flex; align-items: center; gap: 6px; padding-top: .3rem; padding-bottom: .3rem; padding-right: .2rem; border-radius: 8px; }
.cx-tree li .ms { font-size: 17px; color: var(--muted); }
.cx-tree li.dir { color: var(--muted); font-size: .78rem; font-weight: 600; }
.cx-tree li.file { cursor: pointer; } .cx-tree li.file:hover { background: var(--panel2); } .cx-tree li.file.active { background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.cx-tree .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-tree .fmenu { width: 26px; height: 26px; opacity: 0; } .cx-tree li:hover .fmenu, .cx-tree li.active .fmenu { opacity: 1; }
.cx-tree .empty { color: var(--muted); padding: .6rem; }
.cx-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
.cx-main-head { display: flex; align-items: center; gap: .4rem; padding: .4rem .6rem; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.cx-view-tabs { display: flex; gap: .2rem; background: var(--panel); border-radius: 10px; padding: 2px; }
.cx-view-tabs button { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; cursor: pointer; font: 500 .82rem var(--sans); color: var(--muted); padding: .32rem .65rem; border-radius: 8px; }
.cx-view-tabs button .ms { font-size: 17px; } .cx-view-tabs button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cx-path { font-size: .78rem; color: var(--muted); max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-path.dirty::after { content: " \2022"; color: #d97706; font-size: 1rem; }
.cx-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cx-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.cx-empty .ms { font-size: 40px; width: auto; }
.cx-editor { flex: 1; min-height: 0; display: flex; }
.cx-editor textarea { flex: 1; border: none; border-radius: 0; font: .86rem/1.55 var(--mono); padding: .8rem 1rem; resize: none; box-shadow: none; white-space: pre; tab-size: 2; }
.cx-editor .CodeMirror { flex: 1; height: auto; font: .86rem/1.55 var(--mono); }
.cx-preview-bar { display: flex; align-items: center; gap: .4rem; padding: .35rem .6rem; border-bottom: 1px solid var(--line); }
.cx-frame { flex: 1; width: 100%; border: none; background: #fff; }
.cx-console { flex: 1; margin: 0; overflow: auto; background: #0f1714; color: #d7f5e6; font: .84rem/1.55 var(--mono); padding: .9rem 1rem; white-space: pre-wrap; }
.cx-console .err { color: #fca5a5; } .cx-console .muted { color: #7fa995; }
pre.diff { flex: 1; overflow: auto; margin: 0; font: .82rem/1.5 var(--mono); background: #fbfbf9; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; white-space: pre; }
pre.diff .a { background: #e7f8ee; color: #166534; display: inline-block; min-width: 100%; } pre.diff .r { background: #fdecec; color: #991b1b; display: inline-block; min-width: 100%; }
pre.diff .u { color: #6d28d9; } pre.diff .h { color: var(--muted); font-weight: 600; }
@media (max-width: 1100px) { .cx { grid-template-columns: minmax(300px, 360px) 200px 1fr; } }
@media (max-width: 900px) {
  .cx { grid-template-columns: 1fr; grid-template-rows: auto 1fr; grid-template-areas: "top" "panel"; }
  .cx-chat, .cx-files, .cx-main { grid-area: panel; display: none; border: none; }
  .cx[data-panel="chat"] .cx-chat, .cx[data-panel="files"] .cx-files, .cx[data-panel="main"] .cx-main { display: flex; }
  .cx-tabs-mobile { display: flex; gap: .2rem; margin: 0 auto; background: var(--card); border-radius: 10px; padding: 2px; }
  .cx-tabs-mobile button { display: inline-flex; align-items: center; gap: 3px; border: none; background: none; font: 500 .8rem var(--sans); padding: .32rem .55rem; border-radius: 8px; color: var(--muted); cursor: pointer; }
  .cx-tabs-mobile button.on { background: var(--accent-soft); color: var(--accent-dark); }
  .cx-name, .cx-back span, .cx-top-actions .btn span:not(.ms) { display: none; }
  .cx-top { flex-wrap: nowrap; gap: .4rem; }
  .cx-path { max-width: 40vw; }
}
@media (max-width: 480px) { .cx-tabs-mobile button span:not(.ms) { display: none; } }

/* ---------- browser check ---------- */
.bcheck { max-width: 460px; margin: 0 auto; padding: 14vh 1.2rem 3rem; text-align: center; }
.check-logo { position: relative; width: 104px; height: 104px; margin: 0 auto 1.4rem; display: flex; align-items: center; justify-content: center; }
.check-logo .ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.bcheck h1 { font-size: 1.8rem; }
.bcheck .cf-turnstile { display: flex; justify-content: center; margin: 1.2rem 0; }
.check-steps { display: flex; justify-content: center; gap: 1.2rem; flex-wrap: wrap; margin-top: 1.6rem; color: var(--muted); font-size: .84rem; }
.check-steps span { display: inline-flex; align-items: center; gap: 5px; } .check-steps .ms { font-size: 17px; color: var(--accent); }

.chat-page .help-fab { display: none; }
.inbox-item.done { opacity: .65; }
.inbox-item .row-end { gap: .4rem; }
a.metric { text-decoration: none; color: var(--text); } a.metric:hover { border-color: var(--line2); }
.admin-msg { border-top: 1px solid var(--line); padding: .7rem 0; } .admin-msg:first-of-type { border-top: none; }
.check-page #boot-loader, .check-page .public-top nav, .check-page .help-fab, .check-page .public-foot { display: none !important; }
