@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #060b1f;
  --bg2: #0b1330;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.10);
  --text: #eaf0ff;
  --muted: #9aa8d0;
  --brand: #2bc4ff;
  --brand2: #2f6bff;
  --ok: #3ddc97;
  --err: #ff6b7a;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Vazirmatn", system-ui, Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(47, 107, 255, 0.28), transparent 60%),
    radial-gradient(700px 400px at 5% 10%, rgba(43, 196, 255, 0.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: min(1040px, 92%); margin-inline: auto; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px);
  background: rgba(6, 11, 31, 0.72);
  border-bottom: 1px solid var(--card-border);
}
.nav .container { display: flex; align-items: center; gap: 1.2rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 1.1rem; margin-inline-start: auto; align-items: center; }
.nav-links a { color: var(--muted); font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* buttons */
.btn, button {
  font-family: inherit; font-size: .95rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.3rem; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  color: #04122e;
  background: linear-gradient(135deg, var(--brand), #6ee0ff);
  box-shadow: 0 6px 24px rgba(43, 196, 255, 0.25);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover, button:hover { transform: translateY(-1px); filter: brightness(1.06); text-decoration: none; }
.btn.ghost, button.ghost {
  background: transparent; color: var(--text); border-color: var(--card-border); box-shadow: none;
}
button.danger { background: rgba(255, 107, 122, .15); color: var(--err); border-color: rgba(255, 107, 122, .35); box-shadow: none; }
button.small { padding: .3rem .8rem; font-size: .85rem; }

/* cards & forms */
.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 1.5rem; margin-block: 1.2rem;
  backdrop-filter: blur(8px);
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 1.2rem; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

label { display: block; margin-bottom: .3rem; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=email], input[type=password], input[type=number] {
  font-family: inherit; font-size: .95rem; width: 100%;
  padding: .7rem .9rem; margin-bottom: .9rem; border-radius: 12px;
  color: var(--text); background: rgba(255, 255, 255, .06); border: 1px solid var(--card-border);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 196, 255, .18); }
input::placeholder { color: #6f7ca3; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-start; }
.inline-form input { width: auto; flex: 1 1 160px; margin-bottom: 0; }

.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: min(440px, 92%); }
.auth-card .brandmark { text-align: center; margin-bottom: 1rem; }
.auth-card .brandmark img { width: 76px; border-radius: 20px; }

/* hero */
.hero { padding: 4.5rem 0 2.5rem; text-align: center; }
.hero img.logo { width: min(260px, 60vw); margin-bottom: 1rem; filter: drop-shadow(0 10px 40px rgba(43, 196, 255, .35)); }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.5; margin: .3rem 0 1rem; font-weight: 800; }
.hero h1 span { background: linear-gradient(135deg, var(--brand), #8aa4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto 1.8rem; font-size: 1.05rem; }
.hero .actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.feature { text-align: center; }
.feature .ico { font-size: 2rem; margin-bottom: .4rem; }
.feature p { color: var(--muted); margin: 0; }

/* stats */
.wallet { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.wallet .amount { font-size: 2.4rem; font-weight: 800; background: linear-gradient(135deg, var(--ok), var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; direction: ltr; }
.muted { color: var(--muted); }
.badge { display: inline-block; padding: .1rem .7rem; border-radius: 999px; background: rgba(43, 196, 255, .12); color: var(--brand); font-size: .8rem; }
code, .ltr { direction: ltr; unicode-bidi: embed; }
code { font-family: ui-monospace, Consolas, monospace; background: rgba(255, 255, 255, .08); padding: .1rem .5rem; border-radius: 8px; word-break: break-all; }
.key-box { background: rgba(61, 220, 151, .1); border: 1px solid rgba(61, 220, 151, .35); border-radius: 12px; padding: .9rem 1rem; margin: .8rem 0; }

/* table */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .6rem .5rem; text-align: start; border-bottom: 1px solid var(--card-border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
td.ltr, th.ltr { direction: ltr; text-align: end; }

/* alerts */
.alert { padding: .8rem 1rem; border-radius: 12px; margin-block: .8rem; border: 1px solid; }
.alert.err { color: var(--err); background: rgba(255, 107, 122, .1); border-color: rgba(255, 107, 122, .35); }
.alert.ok { color: var(--ok); background: rgba(61, 220, 151, .1); border-color: rgba(61, 220, 151, .35); }

footer { text-align: center; color: var(--muted); padding: 2.5rem 0; font-size: .85rem; }

@media (max-width: 600px) {
  .nav-links { gap: .7rem; font-size: .9rem; }
  .brand span { display: none; }
}

/* icons */
.icon { flex-shrink: 0; vertical-align: -0.2em; }
.nav-links a { display: inline-flex; align-items: center; gap: .35rem; }
.btn .icon, button .icon { margin-inline-end: .1rem; }
.feature .ico { width: 56px; height: 56px; margin: 0 auto .8rem; display: grid; place-items: center; border-radius: 16px;
  color: var(--brand); background: linear-gradient(135deg, rgba(43,196,255,.18), rgba(47,107,255,.18)); border: 1px solid var(--card-border); }
h2 .icon, h3 .icon { color: var(--brand); margin-inline-end: .3rem; }

/* admin */
.page-head h1 { margin: 1.4rem 0 .6rem; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 1.2rem; border-bottom: 1px solid var(--card-border); }
.tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 1.1rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-block: 1rem; }
.stat { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.2rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--card-border); }
.stat-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--brand);
  background: linear-gradient(135deg, rgba(43,196,255,.16), rgba(47,107,255,.16)); }
.stat-val { font-size: 1.35rem; font-weight: 800; line-height: 1.4; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar h2 { margin: 0; }
.search { display: flex; align-items: center; gap: .5rem; }
.search input { margin: 0; min-width: 220px; }
.row-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
button.small, .btn.small { padding: .35rem .8rem; font-size: .84rem; }
button.ghost { background: transparent; color: var(--text); border-color: var(--card-border); box-shadow: none; }
.badge.ok { background: rgba(61,220,151,.14); color: var(--ok); }
.badge.off { background: rgba(255,107,122,.14); color: var(--err); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem 1rem; align-items: end; }
.form-grid input { margin-bottom: 0; }
.check-label { display: flex !important; align-items: center; gap: .5rem; color: var(--text); margin: .3rem 0 .6rem; cursor: pointer; }
.check-label input { width: auto; margin: 0; accent-color: var(--brand); }
.pager { display: flex; gap: .4rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.pager a { padding: .3rem .8rem; border-radius: 10px; border: 1px solid var(--card-border); color: var(--muted); }
.pager a.active { background: var(--brand); color: #04122e; border-color: var(--brand); }
.danger-zone { border-color: rgba(255,107,122,.35); }
hr { border: 0; border-top: 1px solid var(--card-border); margin: 1.2rem 0; }
.alert { display: flex; align-items: center; gap: .5rem; }
tr:hover td { background: rgba(255,255,255,.03); }

/* chat */
select { font-family: inherit; font-size: .92rem; padding: .5rem .8rem; border-radius: 12px; color: var(--text);
  background: rgba(255,255,255,.06); border: 1px solid var(--card-border); outline: none; direction: ltr; }
select option { background: #0b1330; color: var(--text); }
.chat-log { height: 340px; overflow-y: auto; padding: .8rem; border-radius: 14px; background: rgba(0,0,0,.22);
  border: 1px solid var(--card-border); display: flex; flex-direction: column; gap: .7rem; }
.chat-empty { margin: auto; text-align: center; max-width: 360px; }
.bubble { max-width: 82%; padding: .6rem .9rem; border-radius: 16px; line-height: 1.8; }
.bubble.user { align-self: flex-start; background: linear-gradient(135deg, rgba(43,196,255,.28), rgba(47,107,255,.28)); border-end-start-radius: 4px; }
.bubble.assistant { align-self: flex-end; background: rgba(255,255,255,.07); border: 1px solid var(--card-border); border-end-end-radius: 4px; }
.bubble.error { align-self: center; color: var(--err); background: rgba(255,107,122,.1); border: 1px solid rgba(255,107,122,.35); }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
.bubble-meta { margin-top: .3rem; font-size: .75rem; color: var(--muted); }
.chat-form { display: flex; gap: .6rem; margin-top: .8rem; align-items: stretch; }
.chat-form textarea { flex: 1; resize: vertical; min-height: 52px; max-height: 180px; font-family: inherit; font-size: .95rem; padding: .7rem .9rem;
  border-radius: 12px; color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--card-border); outline: none; }
.chat-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43,196,255,.18); }
.chat-meta { margin-top: .6rem; }
button:disabled { opacity: .6; cursor: wait; transform: none; }

/* ===== chat v2 ===== */
.chat-card { padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--card-border); background: linear-gradient(180deg, rgba(255,255,255,.05), transparent); }
.chat-title { display: flex; align-items: center; gap: .8rem; }
.chat-logo { width: 44px; height: 44px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(43,196,255,.25); }
.chat-logo img { width: 100%; height: 100%; object-fit: cover; }
.chat-sub { font-size: .8rem; line-height: 1.4; }
.chat-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.chat-log { height: 460px; border: 0; border-radius: 0; background: rgba(0,0,0,.18); padding: 1.2rem; gap: 1rem;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 8px; }
.chat-log::-webkit-scrollbar-track { background: transparent; }
.chat-empty { margin: auto; text-align: center; max-width: 440px; }
.chat-empty-ico { width: 72px; height: 72px; margin: 0 auto .8rem; border-radius: 22px; overflow: hidden; box-shadow: 0 10px 40px rgba(43,196,255,.3); }
.chat-empty-ico img { width: 100%; height: 100%; object-fit: cover; }
.chat-empty h4 { margin: .2rem 0; font-size: 1.15rem; }
.chips { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.chip { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--card-border); box-shadow: none; font-weight: 500; font-size: .85rem; padding: .45rem .9rem; border-radius: 999px; }
.chip:hover { border-color: var(--brand); background: rgba(43,196,255,.12); }

.msg { display: flex; gap: .7rem; align-items: flex-end; max-width: 100%; }
.msg.user { flex-direction: row; }
.msg.assistant, .msg.error { flex-direction: row-reverse; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; overflow: hidden;
  font-weight: 700; font-size: .9rem; color: #04122e; background: linear-gradient(135deg, var(--brand), #6ee0ff); }
.msg.assistant .avatar { background: #0a1536; border: 1px solid var(--card-border); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg.error .avatar { background: rgba(255,107,122,.2); color: var(--err); }
.bubble { max-width: min(78%, 680px); padding: .7rem 1rem; border-radius: 18px; line-height: 1.85; font-size: .95rem; }
.msg.user .bubble { background: linear-gradient(135deg, rgba(43,196,255,.30), rgba(47,107,255,.34)); border: 1px solid rgba(43,196,255,.25); border-end-start-radius: 6px; }
.msg.assistant .bubble { background: rgba(255,255,255,.06); border: 1px solid var(--card-border); border-end-end-radius: 6px; }
.msg.error .bubble { color: var(--err); background: rgba(255,107,122,.1); border: 1px solid rgba(255,107,122,.35); }
.bubble-text { white-space: normal; word-break: break-word; unicode-bidi: plaintext; }
.bubble-text h4 { margin: .4rem 0 .2rem; font-size: 1rem; }
.bubble-text ul, .bubble-text ol { margin: .3rem 0; padding-inline-start: 1.4rem; }
.bubble-text .gap { height: .5rem; }
.bubble-text code { font-size: .85em; }
.bubble-foot { display: flex; align-items: center; gap: .6rem; justify-content: space-between; margin-top: .35rem; font-size: .72rem; color: var(--muted); }
.copy-msg { background: transparent; border: 0; box-shadow: none; color: var(--muted); padding: 0 .3rem; font-size: .72rem; font-weight: 500; }
.copy-msg:hover { color: var(--brand); transform: none; filter: none; }
.code { margin: .6rem 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--card-border); background: #050a1c; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: .3rem .8rem; background: rgba(255,255,255,.06); font-size: .75rem; color: var(--muted); direction: ltr; }
.code-bar .copy-code { background: transparent; border: 0; box-shadow: none; color: var(--brand); padding: 0 .2rem; font-size: .75rem; }
.code-bar .copy-code:hover { transform: none; filter: none; text-decoration: underline; }
.code pre { margin: 0; padding: .8rem 1rem; overflow-x: auto; font-size: .85rem; line-height: 1.6; text-align: left; }
.code pre code { background: none; padding: 0; }
.dots { display: flex; gap: 5px; padding: .5rem .2rem; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); opacity: .35; animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-form { padding: .9rem 1.2rem 0; margin: 0; align-items: flex-end; }
.chat-form textarea { min-height: 48px; max-height: 180px; resize: none; border-radius: 14px; line-height: 1.7; }
.chat-form button { min-height: 48px; border-radius: 14px; padding-inline: 1.4rem; }
.chat-hint { font-size: .75rem; padding: .5rem 1.3rem 1rem; }
@media (max-width: 600px) {
  .bubble { max-width: 88%; }
  .chat-form button span { display: none; }
  .chat-log { height: 62vh; }
}

/* api keys */
.copy-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.copy-row code { flex: 1 1 220px; padding: .55rem .8rem; border-radius: 10px; font-size: .85rem; overflow-x: auto; white-space: nowrap; }
.key-box-title { display: flex; align-items: center; gap: .4rem; color: var(--ok); font-weight: 600; font-size: .9rem; }
.key-box .copy-row { margin-bottom: 0; }
.key-form { display: flex; gap: .6rem; margin-bottom: 1rem; }
.key-form input { margin: 0; flex: 1; }
.key-form button { white-space: nowrap; box-shadow: none; }
.key-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.key-list li { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid var(--card-border); }
.key-list li:hover { border-color: rgba(43,196,255,.35); }
.key-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; color: var(--brand);
  background: linear-gradient(135deg, rgba(43,196,255,.16), rgba(47,107,255,.16)); }
.key-info { flex: 1; min-width: 0; }
.key-name { font-weight: 600; }
.key-meta { display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: center; font-size: .78rem; color: var(--muted); }
.key-meta code { font-size: .78rem; }
.key-list form { margin: 0; }
.empty-state { display: grid; justify-items: center; gap: .4rem; padding: 1.4rem; color: var(--muted); border: 1px dashed var(--card-border); border-radius: 14px; }
@media (max-width: 520px) { .key-list li { flex-wrap: wrap; } .key-form { flex-direction: column; } }

/* ===== chat page (history sidebar) ===== */
.cp { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - 120px); min-height: 520px; border: 1px solid var(--card-border);
  border-radius: var(--radius); overflow: hidden; background: var(--card); }
.cp-side { display: flex; flex-direction: column; gap: .6rem; padding: .8rem; background: rgba(0,0,0,.28); border-inline-end: 1px solid var(--card-border); min-height: 0; }
.cp-new { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; }
.cp-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.cp-none { text-align: center; padding: 1rem .5rem; font-size: .85rem; }
.cp-item { display: flex; align-items: center; gap: .4rem; padding: .5rem .7rem; border-radius: 10px; cursor: pointer; font-size: .88rem; }
.cp-item:hover, .cp-item.active { background: rgba(43,196,255,.14); }
.cp-t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-acts { display: none; gap: 2px; }
.cp-item:hover .cp-acts { display: flex; }
.cp-acts button { background: transparent; border: 0; box-shadow: none; color: var(--muted); padding: 0 .3rem; font-size: .85rem; line-height: 1.4; }
.cp-acts button:hover { color: var(--brand); transform: none; filter: none; }
.cp-acts button[data-a="del"]:hover { color: var(--err); }
.cp-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cp-top { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; border-bottom: 1px solid var(--card-border); }
.cp-title { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-menu { display: none; }
.cp-log { flex: 1; height: auto; min-height: 0; }
.cp-scrim { display: none; }
.think-btn { display: inline-flex; align-items: center; gap: .45rem; background: rgba(255,255,255,.06); color: var(--muted); border: 1px solid var(--card-border);
  box-shadow: none; font-weight: 600; font-size: .85rem; padding: .35rem .7rem; border-radius: 999px; }
.think-btn:hover { filter: none; transform: none; border-color: var(--brand); }
.think-sw { width: 28px; height: 16px; border-radius: 99px; background: rgba(255,255,255,.18); position: relative; transition: .2s; }
.think-sw::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: .2s; }
.think-btn[aria-pressed="true"] { color: var(--text); border-color: var(--brand); background: rgba(43,196,255,.16); }
.think-btn[aria-pressed="true"] .think-sw { background: var(--brand); }
.think-btn[aria-pressed="true"] .think-sw::after { inset-inline-start: 14px; }
.think-box { margin-bottom: .5rem; font-size: .85rem; color: var(--muted); border: 1px dashed var(--card-border); border-radius: 10px; padding: .3rem .7rem; }
.think-box summary { cursor: pointer; font-weight: 600; }
@media (max-width: 800px) {
  .cp { grid-template-columns: 1fr; height: calc(100vh - 100px); }
  .cp-side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 82%; max-width: 320px; z-index: 40; transform: translateX(100%); transition: transform .2s; background: #0a1130; }
  .cp-side.open { transform: none; }
  .cp-menu { display: inline-flex; }
  body.cp-open .cp-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .cp-acts { display: flex; }
}

/* pager */
.pager { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; margin-top: 1rem; }
.pager a, .pager .gap { min-width: 38px; padding: .3rem .7rem; text-align: center; border-radius: 10px; border: 1px solid var(--card-border); color: var(--text); text-decoration: none; background: rgba(255,255,255,.04); }
.pager .gap { border: 0; background: none; color: var(--muted); }
.pager a:hover { border-color: var(--brand); }
.pager a.active { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #04122e; font-weight: 700; border-color: transparent; }

/* ===== theme toggle + light theme ===== */
.theme-toggle { padding: .35rem; width: 38px; height: 38px; border-radius: 12px; background: transparent; color: var(--text); border: 1px solid var(--card-border); box-shadow: none; }
.theme-toggle:hover { border-color: var(--brand); filter: none; transform: none; }
.theme-toggle .i-sun { display: none; }
[data-theme="light"] .theme-toggle .i-sun { display: block; }
[data-theme="light"] .theme-toggle .i-moon { display: none; }

[data-theme="light"] {
  --bg: #f3f6ff;
  --card: #ffffff;
  --card-border: rgba(15, 30, 80, 0.13);
  --text: #0f1b3d;
  --muted: #55648c;
  --brand: #0a84c6;
  --ok: #138a57;
  --err: #d6364a;
  color-scheme: light;
}
[data-theme="light"] body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(47, 107, 255, 0.14), transparent 60%),
    radial-gradient(700px 400px at 5% 10%, rgba(43, 196, 255, 0.14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme="light"] .nav { background: rgba(255, 255, 255, 0.82); }
[data-theme="light"] .card { box-shadow: 0 4px 24px rgba(30, 50, 120, 0.06); }
[data-theme="light"] input[type=text], [data-theme="light"] input[type=email], [data-theme="light"] input[type=password],
[data-theme="light"] input[type=number], [data-theme="light"] select, [data-theme="light"] .chat-form textarea { background: #f6f8ff; }
[data-theme="light"] input::placeholder { color: #8b97ba; }
[data-theme="light"] select option { background: #fff; }
[data-theme="light"] code { background: rgba(15, 30, 80, .07); }
[data-theme="light"] tr:hover td { background: rgba(15, 30, 80, .035); }
[data-theme="light"] .badge { background: rgba(10, 132, 198, .12); }
[data-theme="light"] .badge.ok { background: rgba(19, 138, 87, .12); }
[data-theme="light"] .badge.off { background: rgba(214, 54, 74, .12); }
[data-theme="light"] .chat-head { background: linear-gradient(180deg, rgba(15,30,80,.04), transparent); }
[data-theme="light"] .chat-log { background: #f7f9ff; scrollbar-color: rgba(15,30,80,.25) transparent; }
[data-theme="light"] .chat-log::-webkit-scrollbar-thumb { background: rgba(15,30,80,.25); }
[data-theme="light"] .msg.assistant .bubble { background: #fff; }
[data-theme="light"] .msg.user .bubble { background: linear-gradient(135deg, rgba(43,196,255,.28), rgba(47,107,255,.2)); }
[data-theme="light"] .msg.assistant .avatar { background: #fff; }
[data-theme="light"] .chip, [data-theme="light"] .think-btn, [data-theme="light"] .pager a { background: #fff; }
[data-theme="light"] .pager a.active { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; }
[data-theme="light"] .think-btn[aria-pressed="true"] { background: rgba(10,132,198,.12); }
[data-theme="light"] .think-sw { background: rgba(15,30,80,.2); }
[data-theme="light"] .cp-side { background: #f0f4ff; }
[data-theme="light"] .cp-item:hover, [data-theme="light"] .cp-item.active { background: rgba(10,132,198,.12); }
[data-theme="light"] .code-bar { background: rgba(255,255,255,.08); }
@media (max-width: 800px) { [data-theme="light"] .cp-side { background: #f0f4ff; } }

/* download button */
.dl-wrap { margin-top: 1.6rem; display: flex; justify-content: center; }
.dl-btn { display: inline-flex; align-items: center; gap: .9rem; padding: .85rem 1.6rem; border-radius: 16px; background: #fff; color: #111; text-decoration: none;
  box-shadow: 0 10px 40px rgba(43,196,255,.25); border: 1px solid rgba(0,0,0,.08); transition: transform .15s; }
.dl-btn:hover { transform: translateY(-2px); text-decoration: none; }
.dl-txt { display: flex; flex-direction: column; line-height: 1.5; text-align: start; }
.dl-txt b { font-size: 1.05rem; }
.dl-txt small { color: #666; font-size: .78rem; }
[data-theme="light"] .dl-btn { background: #101a3d; color: #fff; }
[data-theme="light"] .dl-txt small { color: #b9c4ea; }

/* hero logo: transparent, with a dark-text variant for the light theme */
.logo-light { display: none; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: inline-block; }

/* hero highlight */
.hero p.hero-free { margin: 0 auto 1rem; max-width: none; color: var(--text); font-size: clamp(1.15rem, 3vw, 1.5rem); line-height: 1.7; }
.hero p.hero-free strong { font-weight: 800; padding: .25rem 1rem; border-radius: 999px; background: linear-gradient(135deg, rgba(43,196,255,.22), rgba(47,107,255,.2)); border: 1px solid rgba(43,196,255,.4); }

/* ===== PWA bits ===== */
button[hidden], [hidden] { display: none !important; }
.ios-hint { position: fixed; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1rem; border-radius: 14px; background: #101a3d; color: #eaf0ff; font-size: .85rem; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.ios-hint span { flex: 1; }
.ios-hint button { background: transparent; border: 0; box-shadow: none; color: #9aa8d0; font-size: 1.3rem; padding: 0 .4rem; }
body { padding-top: env(safe-area-inset-top); }
.nav .container { padding-inline: max(0px, env(safe-area-inset-left)); }

/* ===== ChatGPT-style chat page ===== */
body.chat-page main.container { width: min(1280px, 100%); padding: 0; }
body.chat-page footer { display: none; }
.cp { grid-template-columns: 290px 1fr; height: calc(100vh - 80px); height: calc(100dvh - 80px); margin-top: 12px; }
.cp-side { padding: .7rem; gap: .5rem; }
.cp-side-head { display: flex; gap: .5rem; align-items: center; }
.cp-new { flex: 1; justify-content: center; border-radius: 12px; }
.cp-iconbtn { width: 40px; height: 40px; padding: 0; border-radius: 12px; background: transparent; color: var(--text); border: 1px solid var(--card-border); box-shadow: none; font-size: 1.1rem; }
.cp-iconbtn:hover { filter: none; transform: none; border-color: var(--brand); }
.cp-close, .cp-menu { display: none; }
.cp-search { margin: 0 !important; padding: .55rem .8rem !important; border-radius: 12px !important; font-size: .88rem !important; }
.cp-group { padding: .6rem .7rem .2rem; font-size: .72rem; color: var(--muted); font-weight: 600; }
.cp-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .6rem; border-top: 1px solid var(--card-border); font-size: .85rem; }
.cp-user { display: flex; align-items: center; gap: .5rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-user b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), #6ee0ff); color: #04122e; font-size: .8rem; flex-shrink: 0; }
.cp-main { position: relative; }
.cp-top { padding: .55rem .8rem; min-height: 56px; }
.cp-log { padding: 1rem clamp(.6rem, 4vw, 2.5rem) 1.5rem; gap: 1.1rem; overscroll-behavior: contain; background: transparent; }
.cp-log .msg { max-width: 760px; width: 100%; margin-inline: auto; }
.cp-log .avatar { display: none; }
.cp-log .msg.user { justify-content: flex-start; }
.cp-log .msg.user .bubble { max-width: 85%; border-radius: 20px; border-end-start-radius: 20px; padding: .6rem 1rem; }
.cp-log .msg.assistant .bubble { max-width: 100%; background: none; border: 0; padding: .2rem 0; border-radius: 0; }
.cp-log .msg.error .bubble { max-width: 100%; }
.cp-log .msg.assistant { flex-direction: row; }
.cp-log .bubble-foot { justify-content: flex-start; gap: .8rem; }
.chat-empty { max-width: 640px; width: 100%; }
.cp-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-top: 1.2rem; text-align: start; }
.cp-card { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; padding: .8rem 1rem; border-radius: 16px; background: var(--card); color: var(--text);
  border: 1px solid var(--card-border); box-shadow: none; font-weight: 400; text-align: start; }
.cp-card b { font-size: .92rem; } .cp-card span { font-size: .78rem; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-card:hover { border-color: var(--brand); transform: none; filter: none; }
.cp-jump { position: absolute; inset-inline: 0; margin-inline: auto; width: 38px; height: 38px; bottom: 150px; padding: 0; border-radius: 50%; background: var(--card); color: var(--text);
  border: 1px solid var(--card-border); box-shadow: 0 4px 16px rgba(0,0,0,.25); z-index: 5; }
.cp-composer { padding: .4rem clamp(.6rem, 4vw, 2.5rem) calc(.6rem + env(safe-area-inset-bottom)); margin: 0; display: block; }
.cp-box { max-width: 760px; margin-inline: auto; padding: .6rem .7rem .5rem; border-radius: 24px; background: var(--card); border: 1px solid var(--card-border); box-shadow: 0 6px 30px rgba(0,0,0,.18); }
.cp-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43,196,255,.15); }
.cp-box textarea { width: 100%; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: .4rem .5rem !important; resize: none; font-size: 1rem; line-height: 1.7;
  min-height: 44px; max-height: 180px; color: var(--text); outline: none; font-family: inherit; display: block; }
.cp-row { display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap; }
.cp-row select { flex: 0 1 auto; min-width: 0; max-width: 46vw; padding: .35rem .6rem; font-size: .8rem; border-radius: 999px; }
.cp-send { margin-inline-start: auto; width: 40px; height: 40px; padding: 0; border-radius: 50%; flex-shrink: 0; }
.cp-send span { display: none; }
.cp-send.stop { background: var(--text); color: var(--bg); }
.cp-hint { max-width: 760px; margin: .4rem auto 0; text-align: center; font-size: .7rem; color: var(--muted); }

@media (max-width: 800px) {
  body.chat-page .nav { display: none; }
  .cp { grid-template-columns: 1fr; height: 100vh; height: 100dvh; margin-top: 0; border-radius: 0; border: 0; }
  .cp-menu { display: inline-grid; place-items: center; }
  .cp-close { display: inline-grid; place-items: center; }
  .cp-newtop { display: inline-grid; place-items: center; }
  .cp-side { width: 86%; max-width: 340px; padding-top: calc(.7rem + env(safe-area-inset-top)); padding-bottom: calc(.7rem + env(safe-area-inset-bottom)); }
  .cp-top { padding-top: calc(.4rem + env(safe-area-inset-top)); border-bottom: 1px solid var(--card-border); backdrop-filter: blur(10px); }
  .cp-cards { grid-template-columns: 1fr; }
  .cp-jump { bottom: 160px; }
  .cp-hint { display: none; }
  .cp-acts { display: flex; }
}
@media (min-width: 801px) { .cp-newtop { display: none; } }
@media (display-mode: standalone) { body { overscroll-behavior-y: none; } }
input[type=search] { font-family: inherit; color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--card-border); outline: none; width: 100%; }
input[type=search]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43,196,255,.18); }
[data-theme="light"] input[type=search] { background: #f6f8ff; }
/* make the chat log the scroll container: the grid row must not grow with its content */
.cp { grid-template-rows: minmax(0, 1fr); }
.cp-main, .cp-side { min-height: 0; overflow: hidden; }
.cp-log { overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* code blocks keep a dark background in both themes, so their text must stay light */
.code, .code pre, .code pre code { color: #d6e2ff; }
.code pre code { background: none; }
.code-bar { color: #9aa8d0; background: rgba(255,255,255,.07); }
.code-bar .copy-code { color: #6ee0ff; }
[data-theme="light"] .code { background: #0b1330; border-color: rgba(15,30,80,.25); }

/* ===== landing page ===== */
.showcase { position: relative; margin: 1rem auto 3rem; max-width: 920px; padding: 0 .5rem; }
.showcase-glow { position: absolute; inset: 8% 6% -4%; background: radial-gradient(60% 60% at 50% 40%, rgba(43,196,255,.30), rgba(47,107,255,.18) 55%, transparent 75%); filter: blur(40px); z-index: 0; }
.app-window { position: relative; z-index: 1; margin: 0; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--card-border);
  box-shadow: 0 30px 80px rgba(8, 20, 70, .35), 0 6px 20px rgba(8, 20, 70, .18); transform: perspective(1400px) rotateX(2deg); }
.app-bar { display: flex; align-items: center; gap: 6px; padding: .55rem .8rem; background: #eceef4; border-bottom: 1px solid rgba(0,0,0,.08); direction: ltr; }
.app-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; } .app-bar i:nth-child(2) { background: #febc2e; } .app-bar i:nth-child(3) { background: #28c840; }
.app-bar span { margin-inline-start: .6rem; font-size: .75rem; color: #6b7280; font-weight: 600; }
.app-window img { display: block; width: 100%; height: auto; }
.float-chip { position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 999px; font-size: .82rem; font-weight: 600;
  background: var(--card); color: var(--text); border: 1px solid var(--card-border); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(8,20,70,.25); }
.float-chip .icon { color: var(--brand); }
.chip-a { top: 10%; inset-inline-start: -2%; } .chip-b { top: 46%; inset-inline-end: -3%; } .chip-c { bottom: 8%; inset-inline-start: 4%; }
.section-head { text-align: center; margin: 3rem 0 1.2rem; }
.section-head h2 { margin: 0 0 .3rem; font-size: clamp(1.4rem, 3.6vw, 2rem); }
.section-head p { margin: 0; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; margin-bottom: 2rem; }
.step { position: relative; padding: 1.4rem 1.3rem 1.2rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--card-border); }
.step h3 { margin: .4rem 0 .2rem; } .step p { margin: 0; color: var(--muted); }
.step-n { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-weight: 800; color: #04122e; background: linear-gradient(135deg, var(--brand), #6ee0ff); }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap; padding: 1.8rem; margin-bottom: 3rem;
  background: linear-gradient(135deg, rgba(43,196,255,.16), rgba(47,107,255,.14)); border-color: rgba(43,196,255,.35); }
.cta h2 { margin: 0 0 .2rem; } .cta p { margin: 0; }
.cta .actions { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
@media (max-width: 700px) {
  .float-chip { font-size: .7rem; padding: .3rem .65rem; } .chip-a { top: 3%; inset-inline-start: 0; } .chip-b { display: none; } .chip-c { bottom: 3%; inset-inline-start: 0; }
  .app-window { transform: none; }
}

/* landing v2 (Codex-style): soft gradient hero, app window peeking from the bottom */
.hero { position: relative; }
.hero::before { content: ""; position: absolute; inset: -2rem -50vw 0; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 55% at 22% 20%, rgba(43,196,255,.22), transparent 70%), radial-gradient(45% 60% at 80% 10%, rgba(120,110,255,.20), transparent 70%); }
.showcase { max-width: 860px; margin: .5rem auto 2.5rem; max-height: 470px; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%); mask-image: linear-gradient(to bottom, #000 72%, transparent 100%); }
.app-window { transform: none; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 60px rgba(8,20,70,.22), 0 30px 80px rgba(8,20,70,.28); }
.chip-a { top: 14%; inset-inline-start: 1.2rem; } .chip-b { top: 44%; inset-inline-end: 1.2rem; } .chip-c { bottom: 24%; inset-inline-start: 2.4rem; }
@media (max-width: 700px) { .showcase { max-height: 300px; } .float-chip { display: none; } }

/* animated hero background: slow drifting colour clouds (calm, like Codex) */
html { overflow-x: clip; }
.hero::before { display: none; }
.hero-bg { position: absolute; top: -4rem; bottom: -2rem; left: 50%; width: 100vw; transform: translateX(-50%); z-index: -1; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%); mask-image: linear-gradient(to bottom, #000 70%, transparent 100%); }
.hero-bg i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; will-change: transform; }
.hero-bg i:nth-child(1) { width: 46vw; height: 46vw; max-width: 640px; max-height: 640px; top: -10%; inset-inline-start: 4%; background: #2bc4ff; animation: drift1 22s ease-in-out infinite alternate; }
.hero-bg i:nth-child(2) { width: 42vw; height: 42vw; max-width: 600px; max-height: 600px; top: -6%; inset-inline-end: 2%; background: #7a6bff; animation: drift2 26s ease-in-out infinite alternate; }
.hero-bg i:nth-child(3) { width: 34vw; height: 34vw; max-width: 480px; max-height: 480px; top: 28%; inset-inline-start: 32%; background: #2f6bff; animation: drift3 30s ease-in-out infinite alternate; }
.hero-bg i:nth-child(4) { width: 26vw; height: 26vw; max-width: 380px; max-height: 380px; top: 8%; inset-inline-start: 46%; background: #6ee0ff; animation: drift4 20s ease-in-out infinite alternate; }
[data-theme="light"] .hero-bg i { opacity: .42; filter: blur(90px); }
[data-theme="light"] .hero-bg i:nth-child(1) { background: #8fd8ff; } [data-theme="light"] .hero-bg i:nth-child(2) { background: #b9a9ff; }
[data-theme="light"] .hero-bg i:nth-child(3) { background: #9db8ff; } [data-theme="light"] .hero-bg i:nth-child(4) { background: #c3f0ff; }
@keyframes drift1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(18vw, 14%) scale(1.25); } }
@keyframes drift2 { from { transform: translate(0, 0) scale(1.1); } to { transform: translate(-16vw, 22%) scale(.9); } }
@keyframes drift3 { from { transform: translate(-10vw, 0) scale(.9); } to { transform: translate(12vw, -12%) scale(1.3); } }
@keyframes drift4 { from { transform: translate(8vw, 10%) scale(1); } to { transform: translate(-10vw, -8%) scale(1.4); } }
@media (prefers-reduced-motion: reduce) { .hero-bg i { animation: none; } }
@media (max-width: 700px) { .hero-bg i { filter: blur(60px); } }

/* landing live demo (pure HTML/CSS + ajax-loaded script) */
.demo { --d-bg:#0d1430; --d-side:#0a1028; --d-line:rgba(255,255,255,.09); --d-text:#e8eeff; --d-mut:#8f9cc6; --d-bub:#18224a; --d-code:#070c20; background: var(--d-bg); color: var(--d-text); text-align: start; }
[data-theme="light"] .demo { --d-bg:#fff; --d-side:#f4f6fb; --d-line:rgba(15,30,80,.10); --d-text:#17224a; --d-mut:#65729a; --d-bub:#eef2fb; --d-code:#0d1430; }
.demo .app-bar { background: var(--d-side); border-color: var(--d-line); }
.demo .app-bar span { color: var(--d-mut); }
.demo-body { display: grid; grid-template-columns: 190px 1fr; height: 400px; }
.demo-side { background: var(--d-side); border-inline-end: 1px solid var(--d-line); padding: .8rem .7rem; display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.demo-brand { display: flex; align-items: center; gap: .45rem; font-weight: 800; font-size: .9rem; }
.demo-new { border: 1px dashed var(--d-line); border-radius: 10px; padding: .45rem .6rem; font-size: .78rem; color: var(--d-mut); }
.demo-chats { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.demo-chats li { padding: .42rem .6rem; border-radius: 8px; font-size: .78rem; color: var(--d-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-chats li.on { background: var(--d-bub); color: var(--d-text); }
.demo-main { display: grid; grid-template-rows: minmax(0,1fr) auto; min-width: 0; }
.demo-log { overflow: hidden; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .7rem; font-size: .84rem; line-height: 1.8; scroll-behavior: smooth; }
.m-user { align-self: flex-start; max-width: 85%; background: var(--d-bub); padding: .45rem .8rem; border-radius: 14px; }
.m-think { color: var(--d-mut); font-size: .76rem; display: flex; align-items: center; gap: .4rem; }
.m-think .dots b { display: inline-block; width: 5px; height: 5px; margin: 0 1px; border-radius: 50%; background: var(--brand); animation: dpulse 1s infinite ease-in-out; }
.m-think .dots b:nth-child(2) { animation-delay: .15s; } .m-think .dots b:nth-child(3) { animation-delay: .3s; }
@keyframes dpulse { 0%,80%,100% { opacity: .25; transform: scale(.7); } 40% { opacity: 1; transform: scale(1); } }
.m-ai p { margin: 0 0 .4rem; }
.m-ai pre { margin: .3rem 0 .5rem; padding: .7rem .9rem; border-radius: 10px; background: var(--d-code); color: #d6e2ff; font-size: .74rem; line-height: 1.6; overflow: hidden; text-align: left; }
.m-ai code { font-family: ui-monospace, Consolas, monospace; white-space: pre; }
.m-tokens { display: flex; gap: .9rem; font-size: .7rem; color: var(--d-mut); }
.demo-composer { padding: .6rem 1rem 1rem; }
.demo-input { border: 1px solid var(--d-line); border-radius: 14px; padding: .65rem .9rem; font-size: .84rem; min-height: 2.6rem; background: var(--d-side); display: flex; align-items: center; }
.demo-input:empty::before { content: ""; }
.caret { width: 2px; height: 1.1em; background: var(--brand); margin-inline-start: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.demo-tools { display: flex; gap: .5rem; margin-top: .4rem; }
.demo-tools b { font-size: .68rem; font-weight: 600; color: var(--d-mut); border: 1px solid var(--d-line); border-radius: 999px; padding: .12rem .6rem; }
.demo-off .demo-log::after { content: "Hooshia"; color: var(--d-mut); font-size: 2rem; font-weight: 800; margin: auto; opacity: .3; }
@media (max-width: 700px) { .demo-body { grid-template-columns: 1fr; height: 330px; } .demo-side { display: none; } .showcase { max-height: 400px; } }
.app-window .demo-brand img { width: 22px; height: 22px; display: inline-block; }
.showcase { max-height: 520px; -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent 100%); mask-image: linear-gradient(to bottom, #000 88%, transparent 100%); }
.demo-body { height: 430px; }
.chip-a { top: -1rem; } .chip-b { top: auto; bottom: 14%; inset-inline-end: -.6rem; } .chip-c { bottom: 4%; inset-inline-start: .6rem; }
@media (max-width: 700px) { .showcase { max-height: 420px; } .demo-body { height: 340px; } }

/* demo v2: closer to the real app */
.showcase { max-height: none; -webkit-mask-image: none; mask-image: none; margin-bottom: 3rem; }
.app-window.demo { border-radius: 16px; }
.demo-body { height: 460px; grid-template-columns: 200px 1fr; }
.demo-sec { font-size: .66rem; color: var(--d-mut); margin-top: .3rem; }
.demo-proj { font-size: .78rem; font-weight: 700; padding: 0 .3rem; }
.demo-chats { flex: 1; }
.demo-user { display: flex; align-items: center; gap: .5rem; padding-top: .6rem; border-top: 1px solid var(--d-line); font-size: .78rem; }
.demo-user b { display: block; line-height: 1.2; } .demo-user small { color: var(--d-mut); font-size: .66rem; }
.demo-user .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #04122e; font-weight: 800; background: linear-gradient(135deg, var(--brand), #6ee0ff); }
.demo-top { display: flex; align-items: center; justify-content: space-between; padding: .55rem 1.1rem; border-bottom: 1px solid var(--d-line); font-size: .8rem; }
.demo-path { direction: ltr; color: var(--d-mut); font-size: .7rem; font-family: ui-monospace, Consolas, monospace; }
.demo-main { grid-template-rows: auto minmax(0,1fr) auto; }
.demo-empty { margin: auto; text-align: center; color: var(--d-mut); }
.demo-empty img { width: 84px; height: 84px; opacity: .9; } .demo-empty p { margin: .3rem 0 0; font-weight: 600; }
.m-tool { display: flex; align-items: center; gap: .5rem; padding: .4rem .7rem; border: 1px solid var(--d-line); border-radius: 10px; font-size: .76rem; background: var(--d-side); }
.m-tool .ti svg { width: 15px; height: 15px; stroke: var(--brand); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.m-tool code { direction: ltr; font-family: ui-monospace, Consolas, monospace; font-size: .72rem; color: var(--d-mut); }
.m-tool .res { margin-inline-start: auto; color: var(--d-mut); font-size: .7rem; }
.m-tool .tick svg { width: 15px; height: 15px; stroke: #22c55e; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; display: block; }
.m-tool .spin { margin-inline-start: auto; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--d-line); border-top-color: var(--brand); animation: dspin .8s linear infinite; }
@keyframes dspin { to { transform: rotate(360deg); } }
.m-diff { direction: ltr; margin-top: -.4rem; border: 1px solid var(--d-line); border-radius: 10px; overflow: hidden; font: .72rem/1.7 ui-monospace, Consolas, monospace; text-align: left; }
.m-diff div { padding: 0 .7rem; white-space: pre; overflow: hidden; } .m-diff s { text-decoration: none; display: inline-block; width: 1.2em; opacity: .7; }
.m-diff .add { background: rgba(34,197,94,.14); color: #4ade80; } .m-diff .del { background: rgba(239,68,68,.14); color: #f87171; }
[data-theme="light"] .m-diff .add { color: #15803d; } [data-theme="light"] .m-diff .del { color: #b91c1c; }
.demo-input { background: var(--d-bg); min-height: 3.4rem; align-items: flex-start; }
.demo-bar { display: flex; align-items: center; justify-content: space-between; margin-top: .45rem; }
.demo-tools { margin: 0; }
.demo-send { width: 28px; height: 28px; border-radius: 50%; background: var(--d-bub); position: relative; transition: background .2s; }
.demo-send::after { content: ""; position: absolute; inset: 8px 9px; border: solid var(--d-mut); border-width: 2px 2px 0 0; transform: rotate(-45deg) scale(.7); }
.demo-send.on { background: var(--brand); } .demo-send.on::after { border-color: #04122e; }
@media (max-width: 700px) { .demo-body { height: 400px; } }
.demo-body { overflow: hidden; grid-template-rows: minmax(0,1fr); } .demo-main, .demo-side { min-height: 0; overflow: hidden; } .demo-log { min-height: 0; }
@media (max-width: 700px) {
  .demo-body { grid-template-columns: minmax(0,1fr); height: 420px; }
  .demo-side { display: none; }
  .demo-path { display: none; }
  .demo-log { padding: .7rem; font-size: .78rem; gap: .5rem; }
  .m-tool { padding: .3rem .5rem; gap: .35rem; font-size: .7rem; flex-wrap: nowrap; min-width: 0; }
  .m-tool code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .m-tool .res { display: none; }
  .m-diff { font-size: .62rem; }
  .demo-composer { padding: .4rem .6rem .7rem; }
  .demo-input { font-size: .78rem; min-height: 3rem; }
  .demo-empty img { width: 64px; height: 64px; }
  .showcase { padding: 0; margin-bottom: 2rem; }
  .m-tokens { gap: .6rem; flex-wrap: wrap; }
}
.dl-group { display: inline-flex; flex-direction: column; align-items: center; gap: .55rem; }
.dl-others { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem .9rem; font-size: .78rem; color: var(--muted); }
.dl-others a { color: var(--brand); text-decoration: none; font-weight: 600; } .dl-others a:hover { text-decoration: underline; }
.hero p.hero-free strong { display: inline-block; max-width: 100%; padding: .4rem 1.1rem; border-radius: 18px; line-height: 1.6; text-wrap: balance; }
@media (max-width: 600px) { .hero p.hero-free { font-size: 1.05rem; } .hero p.hero-free strong { padding: .4rem .9rem; } }
.dl-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: rgba(4,8,24,.6); backdrop-filter: blur(4px); }
.dl-modal-card { position: relative; width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 1.6rem; border-radius: 18px; background: var(--bg2); color: var(--text); border: 1px solid var(--card-border); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
[data-theme="light"] .dl-modal-card { background: #fff; }
.dl-modal-card h3 { margin: 0 0 .5rem; font-size: 1.25rem; } .dl-modal-card h4 { margin: 1rem 0 .3rem; }
.dl-modal-card ol { margin: 0 0 .8rem; padding-inline-start: 1.3rem; line-height: 2; }
.dl-modal-card ol li { unicode-bidi: plaintext; }
.dl-x { position: absolute; top: .6rem; inset-inline-start: .8rem; border: 0; background: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.dl-modal-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1rem; }
.dl-steps { margin: .4rem 0 .6rem; padding-inline-start: 1.2rem; line-height: 1.9; } .dl-steps code, .feature code { font-size: .8rem; }
.faq { display: grid; gap: .7rem; margin-bottom: 2rem; } .faq details { padding: .9rem 1.1rem; } .faq summary { cursor: pointer; font-weight: 700; } .faq p { margin: .6rem 0 0; color: var(--muted); }
.dl-modal-card { padding: 1.8rem 1.8rem 1.5rem; direction: rtl; text-align: right; }
.dl-modal-card h3 { padding-inline-end: 2.2rem; }
.dl-modal-card ol { list-style-type: persian; padding-inline-start: 1.6rem; }
.dl-modal-card ol li { unicode-bidi: normal; text-align: right; }
.dl-modal-card ol li code { direction: ltr; unicode-bidi: isolate; background: rgba(127,127,127,.18); padding: .05rem .4rem; border-radius: 6px; font-size: .78rem; }
.dl-modal .dl-x { all: unset; position: absolute; top: .7rem; inset-inline-end: .8rem; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.dl-modal .dl-x:hover { background: rgba(127,127,127,.18); color: var(--text); }

/* admin forms: every field and button the same size, aligned on one baseline */
.form-grid { align-items: start; }
.form-grid > div { min-width: 0; }
.form-grid > div > label { min-height: 1.4em; }
.form-grid input[type=text], .form-grid input[type=password], .form-grid input[type=number], .form-grid input[type=email], .form-grid select {
  width: 100%; height: 46px; box-sizing: border-box; padding: 0 .9rem; margin: 0; border-radius: 12px; font-family: inherit; font-size: .95rem;
  color: var(--text); background: rgba(255, 255, 255, .06); border: 1px solid var(--card-border); }
[data-theme="light"] .form-grid input[type=text], [data-theme="light"] .form-grid input[type=password], [data-theme="light"] .form-grid input[type=number], [data-theme="light"] .form-grid select { background: #f6f8ff; }
.form-grid select { appearance: auto; }
.form-grid > div:has(> button) { align-self: end; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.form-grid > div:has(> button) > button { height: 46px; padding: 0 1.4rem; white-space: nowrap; }
.form-grid > div:has(> button) > button.small { height: 46px; padding: 0 1rem; font-size: .88rem; }
.form-grid .check { align-self: end; min-height: 46px; display: flex; align-items: center; }
.form-grid .check .check-label { margin: 0; }
