/* Tasarım: Open WebUI düzenini örnek alır. Yuvarlak köşeler, Inter yazı tipi, yumuşak gri yüzeyler;
   boş sohbette yazma kutusu ortada durur. Varsayılan tema siyah zemin ve beyaz vurgudur.
   Renkler yalnızca aşağıdaki tema değişkenlerinden gelir. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --column: 768px;
  --sidebar-w: 340px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 7.1L22 12l-7.1 2.9L12 22l-2.9-7.1L2 12l7.1-2.9z'/%3E%3C/svg%3E");
  --i-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
  --i-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
}

/* Temalar yalnızca renk değişkenlerini tanımlar. Seçici :root ile sınırlı değildir;
   böylece tema menüsündeki küçük önizlemeler de kendi temasının renkleriyle çizilir. */
/* Kod renkleri (highlight.js sınıfları; bkz. web/src/app/markdown.ts highlightCode). Açık temada koyu tonlar. */
:root { --hl-comment: #8b949e; --hl-keyword: #ff7b72; --hl-string: #a5d6ff; --hl-number: #79c0ff; --hl-title: #d2a8ff; --hl-tag: #7ee787; --hl-built: #ffa657; }
[data-theme="light"] { --hl-comment: #6e7781; --hl-keyword: #cf222e; --hl-string: #0a3069; --hl-number: #0550ae; --hl-title: #8250df; --hl-tag: #116329; --hl-built: #953800; }
.hljs-comment, .hljs-quote, .hljs-meta { color: var(--hl-comment); }
.hljs-comment, .hljs-quote { font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-deletion, .hljs-template-tag { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: var(--hl-string); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet, .hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-link { color: var(--hl-number); }
.hljs-title, .hljs-section, .hljs-selector-id, .hljs-selector-class { color: var(--hl-title); }
.hljs-name, .hljs-type { color: var(--hl-tag); }
.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: var(--hl-built); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* Dosya türü renkleri (dosya kartlarındaki simge kutuları). Açık temada koyu tonları kullanılır. */
:root { --file-blue: #60a5fa; --file-orange: #f59e0b; --file-green: #4ade80; --file-red: #f87171; --file-teal: #2dd4bf; --file-violet: #a78bfa; }
[data-theme="light"] { --file-blue: #2563eb; --file-orange: #c2410c; --file-green: #15803d; --file-red: #dc2626; --file-teal: #0f766e; --file-violet: #6d28d9; }

:root, [data-theme="black"] {
  --token: #7cb2ff;
  --token-bg: rgb(124 178 255 / .16);
  --bg: #000000;
  --sidebar: #000000;
  --hover: #1c1c1c;
  --surface: #262626;
  --surface-soft: #171717;
  --popover: #171717;
  --code: #0d0d0d;
  --composer: #0d0d0d;
  --border: #262626;
  --border-strong: #5c5c5c;
  --text: #ececec;
  --text-strong: #ffffff;
  --text-muted: #b4b4b4;
  --text-faint: #9b9b9b;
  --accent: #ffffff;
  --accent-ink: #000000;
  --accent-off: #4e4e4e;
  --accent-off-ink: #171717;
  --warn: #facc15;
  --err: #f87171;
  --err-soft: #2b1414;
  --shadow: 0 12px 40px rgb(0 0 0 / .6);
  color-scheme: dark;
}
[data-theme="soft"] {
  --bg: #171717;
  --sidebar: #0d0d0d;
  --hover: #262626;
  --surface: #2f2f2f;
  --surface-soft: #212121;
  --popover: #212121;
  --code: #0d0d0d;
  --composer: #212121;
  --border: #333333;
  --border-strong: #676767;
  --text: #ececec;
  --text-strong: #ffffff;
  --text-muted: #b4b4b4;
  --text-faint: #a3a3a3;
  --accent: #ffffff;
  --accent-ink: #000000;
  --accent-off: #4e4e4e;
  --accent-off-ink: #171717;
  --warn: #facc15;
  --err: #f87171;
  --err-soft: #3a1b1b;
  --shadow: 0 12px 40px rgb(0 0 0 / .5);
  color-scheme: dark;
}
[data-theme="ivory"] {
  --bg: #000000;
  --sidebar: #000000;
  --hover: #1d1b18;
  --surface: #2a2723;
  --surface-soft: #171512;
  --popover: #171512;
  --code: #0d0c0a;
  --composer: #0d0c0a;
  --border: #2a2723;
  --border-strong: #605c52;
  --text: #ece7da;
  --text-strong: #f8f4e9;
  --text-muted: #bdb8aa;
  --text-faint: #a09b8d;
  --accent: #f5f1e6;
  --accent-ink: #000000;
  --accent-off: #4f4b43;
  --accent-off-ink: #171512;
  --warn: #facc15;
  --err: #f87171;
  --err-soft: #2b1414;
  --shadow: 0 12px 40px rgb(0 0 0 / .6);
  color-scheme: dark;
}
[data-theme="light"] {
  --token: #1a5fd0;
  --token-bg: rgb(26 95 208 / .1);
  --bg: #ffffff;
  --sidebar: #f9f9f9;
  --hover: #ececec;
  --surface: #f0f0f0;
  --surface-soft: #f6f6f6;
  --popover: #ffffff;
  --code: #f9f9f9;
  --composer: #ffffff;
  --border: #e3e3e3;
  --border-strong: #949494;
  --text: #171717;
  --text-strong: #000000;
  --text-muted: #4e4e4e;
  --text-faint: #616161;
  --accent: #000000;
  --accent-ink: #ffffff;
  --accent-off: #cdcdcd;
  --accent-off-ink: #ffffff;
  --warn: #a16207;
  --err: #b91c1c;
  --err-soft: #fdecec;
  --shadow: 0 12px 40px rgb(0 0 0 / .14);
  color-scheme: light;
}

/* ---------- Temel ---------- */
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--surface) transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--text-faint); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.icon { width: 1.4em; height: 1.4em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.app { display: flex; height: 100dvh; overflow: hidden; }

/* ---------- Kenar çubuğu ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px;
  background: var(--sidebar); border-right: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
  font-size: 13.5px; transition: margin-left .25s var(--ease);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 2px 4px 8px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-strong); font-size: 15px; font-weight: 600; }
.brand-mark, .avatar { position: relative; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); }
.brand-mark::after, .avatar::after {
  content: ""; position: absolute; inset: 20%; background: var(--accent-ink);
  -webkit-mask: var(--mark) center/contain no-repeat; mask: var(--mark) center/contain no-repeat;
}
.side-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--r);
  background: none; color: var(--text); font-size: 13.5px; text-align: left; transition: background-color .15s;
}
.side-btn:hover { background: var(--hover); }
.side-search { display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: var(--r); color: var(--text); transition: background-color .15s; }
.side-search:hover, .side-search:focus-within { background: var(--hover); }
.search { flex: 1; min-width: 0; padding: 7px 0; border: 0; outline: none; background: none; font-size: 13.5px; }
.search::placeholder { color: var(--text); opacity: 1; }
.search:focus::placeholder { color: var(--text-faint); }
.conv-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.conv-group { padding: 12px 10px 4px; color: var(--text-faint); font-size: 12px; font-weight: 500; }
.conv-item { position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 2px; min-height: 34px; padding: 0 4px 0 10px; border-radius: var(--r); cursor: pointer; transition: background-color .15s; }
.conv-item:hover, .conv-item.active { background: var(--hover); }
.conv-item.active .conv-title { color: var(--text-strong); }
/* Ad ve (aramada) içerik alıntısı alt alta durur. */
.conv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.conv-snippet { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin: -1px 0 5px; color: var(--text-faint); font-size: 12px; }
.conv-title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }
.conv-del { display: none; place-items: center; width: 26px; height: 26px; flex-shrink: 0; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-faint); }
.conv-item:hover .conv-del, .conv-item:focus-within .conv-del { display: grid; }
.conv-del:hover { background: var(--surface); color: var(--err); }
.busy-dot { width: 8px; height: 8px; flex-shrink: 0; margin-right: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.side-btn[hidden] { display: none; }
a.side-btn { text-decoration: none; }
.sidebar-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.account-btn { min-height: 40px; }
.account-btn .account-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn.has-user .account-name { color: var(--text-strong); font-weight: 500; }
.account-avatar { display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; line-height: 1; }
.account-avatar[hidden] { display: none; }
/* Kullanıcı yokken (tek kişilik mod) solda dişli, varken baş harfli yuvarlak durur; sağda menü işareti. */
.account-gear { display: grid; flex-shrink: 0; }
.account-btn.has-user .account-gear { display: none; }
.account-more { display: grid; flex-shrink: 0; color: var(--text-faint); transition: color .15s; }
.account-btn:hover .account-more { color: var(--text); }
.account-btn .side-badge { margin-left: 0; }
.account-menu { position: fixed; inset: auto auto 54px 8px; width: 244px; max-width: calc(100vw - 16px); margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); color: var(--text); box-shadow: var(--shadow); }
.account-menu:popover-open { animation: rise .16s var(--ease) both; }
.account-menu .menu-row[hidden], .account-head[hidden], .menu-sep[hidden] { display: none; }
.account-head { display: grid; gap: 1px; padding: 6px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); line-height: 1.35; }
.account-head strong { overflow: hidden; color: var(--text-strong); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.account-head small { overflow: hidden; color: var(--text-faint); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; margin: 4px 0; background: var(--border); }

/* ---------- Giriş ve kayıt ---------- */
.auth-dialog .dialog-body { gap: 14px; padding: 22px 24px 20px; }
.auth-dialog.auth-gate::backdrop { background: var(--bg); backdrop-filter: none; }
.auth-brand { display: flex; align-items: center; gap: 10px; color: var(--text-strong); font-size: 14px; font-weight: 600; }
.auth-hint { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.auth-hint[hidden], .auth-switch .link-btn[hidden], .auth-dialog .field[hidden], .auth-dialog small[hidden], .auth-dialog .icon-btn[hidden] { display: none; }
.auth-submit { width: 100%; padding: 10px 18px; margin-top: 2px; }
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-submit[hidden] { display: none; }
.auth-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.auth-switch:not(:has(.link-btn:not([hidden]))) { display: none; }

/* ---------- Ayarlar → Kullanıcılar ---------- */
.settings-tab[data-off] { display: none; }
.user-count { color: var(--text-faint); font-size: 12.5px; }
.user-list { display: grid; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.user-row + .user-row { border-top: 1px solid var(--border); }
.user-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.user-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.user-name strong { overflow: hidden; color: var(--text-strong); font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.user-main small { overflow: hidden; color: var(--text-faint); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.user-tag { padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); font-size: 11.5px; line-height: 16px; white-space: nowrap; }
.user-row.pending .user-tag { border-color: var(--warn); color: var(--warn); }
.user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; flex-shrink: 0; }
.user-action { padding: 5px 9px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted); font-size: 12.5px; white-space: nowrap; transition: background-color .15s, color .15s; }
.user-action:hover { background: var(--hover); color: var(--text-strong); }
.user-action.strong { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.user-action.strong:hover { opacity: .88; }
.user-action.danger:hover { color: var(--err); }
.user-empty { margin: 0; padding: 14px 0; color: var(--text-faint); font-size: 13.5px; }
/* Kayıt bağlantıları (Ayarlar → Kullanıcılar) */
.invite-hint { display: block; margin: 0 0 8px; color: var(--text-faint); font-size: 12.5px; line-height: 1.45; }
.invite-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 0 6px; }
.invite-form > input { flex: 1 1 220px; min-width: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); transition: border-color .15s; }
.invite-form > input:focus { border-color: var(--border-strong); outline: none; }
.invite-opt { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12.5px; }
.invite-created { display: grid; gap: 6px; margin: 8px 0 6px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--r); }
.invite-created strong { color: var(--text-strong); font-size: 13.5px; font-weight: 600; }
.invite-created small { color: var(--text-faint); font-size: 12.5px; line-height: 1.45; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.invite-link input:focus { border-color: var(--border-strong); outline: none; }
.invite-row.dead .user-name strong { color: var(--text-faint); }
.invite-row .account-avatar .icon { width: 15px; height: 15px; }
@media (max-width: 640px) {
  .user-row { flex-wrap: wrap; }
  .user-actions { flex-basis: 100%; justify-content: flex-start; padding-left: 38px; }
}
.scrim { display: none; }

/* ---------- Üst çubuk ---------- */
.main { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar { position: relative; z-index: 5; display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 8px 12px; background: var(--bg); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; background: linear-gradient(var(--bg), transparent); pointer-events: none; }
.title-wrap { flex: 1; min-width: 0; text-align: right; }
.topbar h1 {
  display: inline-block; max-width: 100%; margin: 0; padding: 2px 8px; overflow: hidden; border-radius: var(--r-sm); color: var(--text-faint);
  font-size: 13px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; cursor: text;
}
.topbar h1:hover { background: var(--hover); color: var(--text); }
.model-picker { position: relative; min-width: 0; }
.model-button {
  display: inline-flex; align-items: center; gap: 6px; max-width: min(60vw, 460px); padding: 6px 10px; border: 0; border-radius: var(--r);
  background: none; color: var(--text-strong); font-size: 17px; font-weight: 500; transition: background-color .15s;
}
.model-button:hover, .model-button[aria-expanded="true"] { background: var(--hover); }
.model-button .icon { width: 15px; height: 15px; color: var(--text-faint); stroke-width: 2; }
.model-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.model-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: flex; flex-direction: column; width: 420px; max-width: calc(100vw - 24px);
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); box-shadow: var(--shadow);
  animation: pop .16s var(--ease) both;
}
.model-menu[hidden] { display: none; }
.model-search { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-faint); }
.model-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font-size: 14px; }
.model-search input::placeholder { color: var(--text-faint); }
.provider-tabs { display: flex; gap: 4px; padding: 8px 10px 2px; overflow-x: auto; scrollbar-width: none; }
.provider-tab { flex-shrink: 0; padding: 4px 11px; border: 0; border-radius: 999px; background: none; color: var(--text-muted); font-size: 12.5px; white-space: nowrap; transition: background-color .15s, color .15s; }
.provider-tab:hover { background: var(--hover); color: var(--text); }
.provider-tab[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.model-list { max-height: min(340px, 48vh); overflow-y: auto; padding: 6px; }
.model-option { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; }
.model-option:hover, .model-option.active { background: var(--hover); }
.model-option .avatar { width: 24px; height: 24px; }
.avatar.logo { display: grid; place-items: center; background: var(--surface); }
.avatar.logo::after { display: none; }
.avatar.logo img { display: block; width: 66%; height: 66%; }
.avatar.logo i { display: block; width: 66%; height: 66%; background: var(--text-strong); -webkit-mask: var(--logo) center/contain no-repeat; mask: var(--logo) center/contain no-repeat; }
.model-logo { display: inline-flex; flex-shrink: 0; }
.model-logo .avatar { width: 22px; height: 22px; }
.model-logo .avatar:not(.logo) { display: none; }
.agent-mark { display: grid; place-items: center; background: color-mix(in srgb, var(--c) 26%, var(--bg)); color: var(--c); font-size: 13px; font-weight: 600; }
.agent-mark::after { display: none; }
.agent-mark .icon { width: 58%; height: 58%; }
.agent-mark { overflow: hidden; }
.agent-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.model-text { flex: 1; display: grid; min-width: 0; }
.model-text strong { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
.model-price { flex-shrink: 0; color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.model-price.free { color: var(--text-muted); }
.model-text small { overflow: hidden; color: var(--text-faint); font-size: 12px; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
.model-note { padding: 10px; color: var(--text-muted); font-size: 13.5px; }
/* Anahtar alanları (web/src/host/secretField.ts): metin kutusu, ama yazı parola gibi noktalanır; tarayıcı doldurmaz */
.secret-field { -webkit-text-security: disc; }
.model-group { padding: 10px 10px 4px; color: var(--text-faint); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.model-group:first-child { padding-top: 4px; }
.model-foot { padding: 4px 6px 6px; border-top: 1px solid var(--border); }
.menu-link { display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-faint); font-size: 13px; }
.menu-link:hover { background: var(--hover); color: var(--text); }
.spinning .icon { animation: spin .9s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border: 0; border-radius: 10px; background: none; color: var(--text-muted); transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text-strong); }

/* ---------- Sohbet sütunu ---------- */
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 34px; scroll-behavior: smooth; }
.messages > * { width: 100%; max-width: var(--column); margin-inline: auto; }

/* Boş sohbet: karşılama ve yazma kutusu birlikte ekranın ortasında durur */
.main.is-empty { overflow-y: auto; }
.main.is-empty .messages { flex: 0 0 auto; margin-top: auto; padding-top: 0; padding-bottom: 14px; overflow: visible; }
.main.is-empty .composer-wrap { margin-bottom: auto; padding-bottom: 7vh; background: none; }
.main.is-empty .composer-wrap::before { display: none; }
.welcome { text-align: center; }
.welcome-head { display: flex; align-items: center; justify-content: center; gap: 12px; max-width: 100%; }
.welcome .avatar { width: 40px; height: 40px; font-size: 18px; }
.welcome h2 { margin: 0; overflow: hidden; color: var(--text-strong); font-size: 26px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.welcome p { max-width: 560px; margin: 6px auto 0; color: var(--text-faint); font-size: 14px; }
.suggestions { display: none; max-width: 680px; margin: 14px auto 0; }
.main.is-empty .suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
.suggestions-title { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: 0 12px 4px; color: var(--text-faint); font-size: 13px; }
.suggestions button { display: block; min-width: 0; padding: 8px 12px; border: 0; border-radius: var(--r); background: none; text-align: left; transition: background-color .15s; }
.suggestions button:hover { background: var(--hover); }
.suggestions strong { display: block; color: var(--text); font-size: 14px; font-weight: 500; }
.suggestions span { display: block; overflow: hidden; color: var(--text-faint); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- Mesajlar ---------- */
.turn { padding-top: 8px; }
.msg.user { display: flex; justify-content: flex-end; margin: 10px 0 4px; }
.msg.user .user-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; width: 100%; min-width: 0; }
.msg.user .bubble {
  width: fit-content; max-width: 90%; padding: 8px 16px; border-radius: var(--r-xl); background: var(--surface); color: var(--text-strong);
  font-size: 15.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.user .bubble.clamped { max-height: 16em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.msg.user textarea.bubble { width: min(640px, 100%); max-width: 100%; padding: 12px 16px; border: 1px solid var(--border-strong); outline: none; resize: vertical; }
.msg.user .user-images { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.msg.user .user-images img { max-width: 200px; max-height: 200px; border-radius: var(--r-lg); object-fit: cover; }
/* Çıktı sınırında kesilen yanıtın altındaki "Devam et" düğmesi (her zaman görünür). */
.continue-row { margin: 10px 0 4px; }
.continue-btn { height: 34px; padding: 0 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); color: var(--text-strong); font-size: 13.5px; font-weight: 500; transition: background-color .15s, border-color .15s; }
.continue-btn:hover { background: var(--hover); border-color: var(--text-faint); }
.msg-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions button { padding: 3px 9px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-faint); font-size: 12.5px; transition: background-color .15s, color .15s; }
.msg-actions button:hover { background: var(--hover); color: var(--text-strong); }
.msg-actions .action-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; font-size: 14px; }

.msg.assistant { margin-bottom: 10px; }
.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; min-height: 32px; margin: 2px 0 0 -6px; color: var(--text-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-meta, .msg:focus-within .msg-meta, .turn:last-child .msg-meta { opacity: 1; }
.msg-meta .msg-actions { opacity: 1; }
.msg-meta .rate { color: var(--text-muted); font-weight: 500; }
.working {
  margin-left: 6px; font-size: 14px; color: transparent;
  background: linear-gradient(90deg, var(--text-faint) 30%, var(--text-strong) 50%, var(--text-faint) 70%) 0 0/200% 100%;
  -webkit-background-clip: text; background-clip: text; animation: shimmer 1.8s linear infinite;
}

.part-text { margin: 4px 0 10px; color: var(--text); font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.part-text > :first-child { margin-top: 0; }
.part-text > :last-child { margin-bottom: 0; }
.part-text p { margin: 0 0 .9em; }
.part-text h1, .part-text h2, .part-text h3, .part-text h4 { margin: 1.5em 0 .5em; color: var(--text-strong); font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.part-text h1 { font-size: 24px; } .part-text h2 { font-size: 20px; } .part-text h3 { font-size: 17px; } .part-text h4 { font-size: 16px; }
.part-text strong { color: var(--text-strong); font-weight: 600; }
.part-text a { text-decoration: underline; text-decoration-color: var(--text-faint); text-underline-offset: 3px; }
.part-text a:hover { text-decoration-color: currentColor; }
.part-text ul, .part-text ol { margin: 0 0 .9em; padding-left: 1.4em; }
.part-text li { margin: .3em 0; padding-left: .2em; }
.part-text li::marker { color: var(--text-faint); }
.part-text blockquote { margin: 0 0 .9em; padding: 2px 0 2px 16px; border-left: 3px solid var(--surface); color: var(--text-muted); }
/* Tablo sütuna sığmazsa kendi alanında kayar; sütunlar içeriği kadar açılır, başlık üstte kalır */
.table-wrap { max-height: min(70dvh, 640px); margin: 0 0 1.1em; overflow: auto; border: 1px solid var(--border); border-radius: var(--r); }
.part-text table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 1.45; }
.part-text th, .part-text td { max-width: 22rem; padding: 7px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.part-text th[align="right"], .part-text td[align="right"] { text-align: right; }
.part-text th[align="center"], .part-text td[align="center"] { text-align: center; }
.part-text tr:last-child td { border-bottom: 0; }
.part-text tbody tr:hover td { background: var(--surface-soft); }
.part-text th { position: sticky; top: 0; z-index: 1; background: var(--surface-soft); color: var(--text-strong); font-weight: 600; white-space: nowrap; }
.part-text code { padding: .14em .38em; border-radius: 6px; background: var(--surface); font: .86em var(--mono); }
.part-text pre { margin: 0 0 1.1em; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--code); }
.part-text pre code { display: block; padding: 14px 16px; overflow-x: auto; border-radius: 0; background: none; font-size: 13.5px; line-height: 1.6; }
.part-text pre .code-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 6px 5px 14px; background: var(--surface-soft); color: var(--text-faint); font: 500 12.5px var(--font); }
.part-text pre .code-head button { padding: 3px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted); font-size: 12.5px; transition: background-color .15s, color .15s; }
.part-text pre .code-head button:hover { background: var(--surface); color: var(--text-strong); }
.part-text hr { height: 1px; margin: 1.6em 0; border: 0; background: var(--border); }
.part-text img { max-width: 100%; border-radius: var(--r); }
.part-text a.cite {
  display: inline-block; min-width: 1.5em; margin-left: .25em; padding: 0 .4em; border-radius: 6px; background: var(--surface); color: var(--text-muted);
  font-size: .68em; font-weight: 600; line-height: 1.6; text-align: center; text-decoration: none; vertical-align: .16em; transition: background-color .15s, color .15s;
}
.part-text a.cite:hover { background: var(--accent); color: var(--accent-ink); }
.part-sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.source-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 240px; padding: 3px 11px 3px 4px; border-radius: 999px; background: var(--surface-soft);
  color: var(--text-muted); font-size: 12.5px; text-decoration: none; transition: background-color .15s, color .15s;
}
.source-chip:hover { background: var(--surface); color: var(--text-strong); }
.source-chip .n { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 11px; font-weight: 600; }
.source-chip .label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Düşünme ve araç adımları: kapalıyken tek satır, açılınca içerik */
.part-thinking, .part-tool, .part-server { margin: 0 0 2px; font-size: 14px; }
.part-text + .part-thinking, .part-text + .part-tool, .part-text + .part-server { margin-top: 10px; }
.part-thinking + .part-text, .part-tool + .part-text, .part-server + .part-text { margin-top: 8px; }
.part-thinking > summary, .part-tool > summary, .part-server > summary {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 28px; color: var(--text-faint); cursor: pointer; list-style: none; user-select: none; transition: color .15s;
}
.part-thinking > summary::-webkit-details-marker, .part-tool > summary::-webkit-details-marker, .part-server > summary::-webkit-details-marker { display: none; }
.part-thinking > summary::after, .part-tool > summary::after, .part-server > summary::after {
  content: ""; width: 10px; height: 10px; flex-shrink: 0; background: currentColor; transition: transform .15s;
  -webkit-mask: var(--i-right) center/contain no-repeat; mask: var(--i-right) center/contain no-repeat;
}
details[open] > summary::after { transform: rotate(90deg); }
.part-thinking > summary:hover, .part-tool > summary:hover, .part-server > summary:hover { color: var(--text-strong); }
.part-thinking.live .thinking-label {
  color: transparent; background: linear-gradient(90deg, var(--text-faint) 30%, var(--text-strong) 50%, var(--text-faint) 70%) 0 0/200% 100%;
  -webkit-background-clip: text; background-clip: text; animation: shimmer 1.8s linear infinite;
}
/* Bekleme satırı mesajın alt bilgisinde durur: tam genişlik, düşünce bölümüyle aynı hiza. */
.msg-meta > .part-thinking.waiting { flex-basis: 100%; margin: 0 0 0 6px; }
.part-thinking.waiting .thinking-body { margin-bottom: 4px; font-size: 13.5px; }
.tool-name { flex-shrink: 0; font-weight: 500; }
.tool-detail { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: .8; }
.tool-status { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tool-status.error, .part-tool.skill .tool-name.error { color: var(--err); }
.tool-status.running::before { content: ""; width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.thinking-body, .tool-body { margin: 4px 0 10px 5px; padding: 2px 0 2px 14px; border-left: 2px solid var(--surface); }

/* Aktivite listesi: bir yanıttaki araç adımları tek blokta; kapalıyken özet satırı, açılınca adımlar */
.activity { margin: 0 0 4px; font-size: 14px; }
.part-text + .activity, .part-thinking + .activity { margin-top: 10px; }
.activity + .part-text, .activity-outputs + .part-text { margin-top: 8px; }
.activity > summary {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 30px; color: var(--text-faint);
  cursor: pointer; list-style: none; user-select: none; transition: color .15s;
}
.activity > summary::-webkit-details-marker, .activity-step > summary::-webkit-details-marker { display: none; }
.activity > summary::after, .activity-step > summary::after {
  content: ""; width: 10px; height: 10px; flex-shrink: 0; background: currentColor; transition: transform .15s;
  -webkit-mask: var(--i-right) center/contain no-repeat; mask: var(--i-right) center/contain no-repeat;
}
.activity > summary:hover { color: var(--text-strong); }
.activity-summary { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.activity.has-error > summary .activity-summary::after { content: " · hata var"; color: var(--err); }
.activity-spinner, .activity-step[data-status="running"] .act-mark::before {
  content: ""; width: 11px; height: 11px; flex-shrink: 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
.activity-spinner[hidden] { display: none; }
.activity-list { display: grid; gap: 1px; margin: 2px 0 8px 5px; padding: 2px 0 2px 10px; border-left: 2px solid var(--surface); }
.activity-step > summary {
  display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 3px 8px 3px 6px; border-radius: var(--r-sm);
  color: var(--text); font-size: 13.5px; cursor: pointer; list-style: none; transition: background-color .15s;
}
.activity-step > summary:hover { background: var(--hover); }
.activity-step > summary::after { opacity: .55; }
.act-mark { display: grid; place-items: center; width: 14px; height: 14px; flex-shrink: 0; color: var(--text-faint); }
.act-mark svg { width: 14px; height: 14px; }
.activity-step[data-status="running"] .act-mark { color: var(--text-muted); }
.activity-step[data-status="error"] .act-mark { color: var(--err); }
.activity-step.thinking .act-title { color: var(--text-faint); font-style: italic; }
.act-title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.act-title strong { color: var(--text-strong); font-weight: 600; }
.act-thumbs { display: flex; gap: 4px; flex-shrink: 0; }
.act-thumbs:empty { display: none; }
.act-thumb img { display: block; width: 28px; height: 28px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; }
.act-body { display: grid; gap: 6px; min-width: 0; margin: 4px 0 8px 28px; }
.act-body h4 { margin: 2px 0 0; color: var(--text-faint); font-size: 12px; font-weight: 500; }
.act-body pre {
  max-height: 240px; margin: 0; padding: 10px 12px; overflow: auto; border-radius: var(--r); background: var(--code);
  font: 12px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.act-thinking { max-height: 240px; overflow: auto; color: var(--text-muted); font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.activity-outputs { display: grid; gap: 8px; margin: 4px 0 8px; }
.activity-outputs:empty { display: none; }
/* Dar ekranda özet kesilmesin (sondaki "hata var" uyarısı görünsün); adımlar tek satırda kalır. */
@media (max-width: 560px) {
  .activity-summary { white-space: normal; }
  .activity-list { margin-left: 2px; padding-left: 8px; }
  .act-body { margin-left: 8px; }
}
.thinking-body { max-height: 360px; overflow-y: auto; color: var(--text-faint); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.tool-body { display: grid; gap: 6px; }
.tool-body h4 { margin: 2px 0 0; color: var(--text-faint); font-size: 12.5px; font-weight: 500; }
.tool-body pre { max-height: 280px; margin: 0; padding: 10px 12px; overflow-y: auto; border-radius: var(--r); background: var(--code); font: 12.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.search-results { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.search-results a { color: var(--text); font-size: 13.5px; text-decoration: none; }
.search-results a:hover { text-decoration: underline; text-underline-offset: 3px; }
.search-results .host { margin-left: 8px; color: var(--text-faint); font-size: 12.5px; }

/* Derin araştırma kartı */
.part-research { margin: 2px 0 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-soft); font-size: 14px; }
.part-research > summary { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 14px; color: var(--text); cursor: pointer; list-style: none; user-select: none; }
.part-research > summary::-webkit-details-marker { display: none; }
.part-research > summary::after { content: ""; width: 10px; height: 10px; flex-shrink: 0; margin-left: auto; background: var(--text-faint); transition: transform .15s; -webkit-mask: var(--i-right) center/contain no-repeat; mask: var(--i-right) center/contain no-repeat; }
.research-name { flex-shrink: 0; font-weight: 500; }
.research-level { flex-shrink: 0; padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: 12px; }
.part-research .tool-detail { color: var(--text-faint); font-size: 13px; }
.research-steps { display: grid; gap: 7px; margin: 0; padding: 2px 14px 12px; list-style: none; }
.research-steps li { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-faint); }
.research-steps li.done { color: var(--text-muted); }
.research-steps li.running { color: var(--text-strong); }
.research-steps li.error { color: var(--err); }
.step-mark { display: grid; place-items: center; flex-shrink: 0; width: 16px; height: 16px; font-size: 12px; }
.step-mark::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.done > .step-mark::before, .error > .step-mark::before { display: none; }
.running > .step-mark::before { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; background: none; animation: spin .8s linear infinite; }
.step-title { flex-shrink: 0; }
.step-detail { min-width: 0; margin-left: auto; overflow: hidden; color: var(--text-faint); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.research-log { padding: 0 14px 10px; color: var(--text-faint); font-size: 13px; }
.research-log > summary { cursor: pointer; }
.research-log ul { display: grid; gap: 3px; max-height: 240px; margin: 8px 0 0; padding: 0; overflow-y: auto; list-style: none; overflow-wrap: anywhere; }
.research-levels { display: flex; gap: 4px; padding: 0 6px 6px 38px; }

/* Üretilen dosya kartı */
.file-card { display: flex; align-items: center; margin: 4px 0 8px; border-radius: var(--r-lg); background: var(--surface-soft); transition: background-color .15s; }
.file-card:has(button.file-open:hover) { background: var(--surface); }
.file-open { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 12px 6px 12px 14px; border: 0; border-radius: inherit; background: none; color: inherit; font: inherit; text-align: left; }
button.file-open { cursor: pointer; }
.file-open:focus-visible { outline: 2px solid var(--text-faint); outline-offset: -2px; }
/* Tür simgesi: kategori rengi --c ile gelir; kutu aynı rengin soluk tonudur. */
.file-mark { --c: var(--text-muted); display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-size: 17px; }
.file-mark[data-cat="text"], .file-mark[data-cat="doc"] { --c: var(--file-blue); }
.file-mark[data-cat="web"], .file-mark[data-cat="slides"] { --c: var(--file-orange); }
.file-mark[data-cat="table"] { --c: var(--file-green); }
.file-mark[data-cat="image"], .file-mark[data-cat="pdf"] { --c: var(--file-red); }
.file-mark[data-cat="audio"] { --c: var(--file-teal); }
.file-mark[data-cat="video"], .file-mark[data-cat="chart"] { --c: var(--file-violet); }
.file-mark[data-cat="code"], .file-mark[data-cat="archive"], .file-mark[data-cat="file"] { background: var(--surface); }
.file-text { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.file-text strong { overflow: hidden; color: var(--text-strong); font-size: 15px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.file-text small { overflow: hidden; color: var(--text-faint); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.file-card .file-note { display: block; color: var(--warn); }
/* İndirme düğmesi kartın üstüne gelince (ya da klavyeyle içine girince) belirir; dokunmatikte hep görünür. */
.file-dl { flex-shrink: 0; margin-right: 10px; opacity: 0; transition: opacity .15s, background-color .15s; }
.file-card:hover .file-dl, .file-card:focus-within .file-dl { opacity: 1; }
@media (hover: none) { .file-dl { opacity: 1; } }

/* Damalı desen: şeffaf alanlar görünsün (görsel ve SVG önizlemesi) */
:root { --checker: repeating-conic-gradient(#d9d9d9 0 25%, #fff 0 50%) 0 0 / 16px 16px; }

/* Görseller: mesajın içinde küçük resim (en-boy korunur, en çok 360 px), birden çoksa galeri */
.image-gallery { max-width: 520px; margin: 4px 0 10px; }
.image-gallery.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.image-tile { display: block; max-width: 100%; min-width: 120px; min-height: 120px; padding: 0; overflow: hidden; border: 0; border-radius: var(--r-lg); background: var(--surface-soft); cursor: zoom-in; }
.image-tile.loaded { min-width: 0; min-height: 0; }
.image-tile img { display: block; max-width: 100%; max-height: 360px; width: auto; height: auto; }
.image-gallery.grid .image-tile { width: 100%; aspect-ratio: 4 / 3; }
.image-gallery.grid .image-tile img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.image-missing { display: block; padding: 48px 12px; color: var(--text-faint); font-size: 13px; }
.image-gallery figcaption { grid-column: 1 / -1; margin-top: 4px; color: var(--text-faint); font-size: 12.5px; }

/* Tam ekran görüntüleyici */
.lightbox { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; overflow: hidden; border: 0; background: none; color: #fff; }
.lightbox::backdrop { background: rgb(0 0 0 / .88); }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: zoom-in; }
.viewer-stage.zoomed { cursor: grab; }
.viewer-stage.zoomed:active { cursor: grabbing; }
.viewer-stage img { max-width: calc(100vw - 32px); max-height: calc(100dvh - 96px); border-radius: 4px; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.viewer-stage[data-backdrop="checker"] img { background: var(--checker); }
.viewer-stage[data-backdrop="light"] img { background: #fff; }
.viewer-stage[data-backdrop="dark"] img { background: #111; }
.viewer-bar { position: absolute; top: 10px; left: 50%; display: flex; align-items: center; gap: 2px; max-width: calc(100vw - 20px); padding: 4px; border-radius: var(--r); background: rgb(23 23 23 / .92); transform: translateX(-50%); }
.viewer-bar .icon-btn { color: #f5f5f5; }
.viewer-bar .icon-btn:disabled { opacity: .35; }
.viewer-title { min-width: 0; max-width: 32vw; padding: 0 8px; overflow: hidden; font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
.viewer-zoom { min-width: 46px; color: #d4d4d4; font-size: 12.5px; text-align: center; font-variant-numeric: tabular-nums; }
.icon-btn.flip svg { transform: scaleX(-1); }
@media (max-width: 560px) {
  .viewer-bar { top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .viewer-title, .viewer-bar .zoom-ctl { display: none; }
}

/* Panelde görsel ve SVG önizlemesi */
.file-preview.media { display: grid; padding: 0; overflow: auto; }
.media-preview { display: grid; place-items: center; min-height: 100%; padding: 16px; }
.media-preview img { max-width: 100%; max-height: calc(100dvh - 150px); margin: 0; border-radius: 0; }
.media-preview[data-backdrop="checker"] { background: var(--checker); }
.media-preview[data-backdrop="light"] { background: #fff; }
.media-preview[data-backdrop="dark"] { background: #111; }
.preview-failed { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 70%; padding: 24px; color: var(--text-muted); text-align: center; }
.preview-failed p { margin: 6px 0 0; color: var(--text-strong); font-size: 15px; font-weight: 500; }
.preview-failed small { margin-bottom: 10px; color: var(--text-faint); font-size: 13px; }
.preview-failed-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface); color: var(--text-muted); font-size: 20px; }

/* PDF: kartta ilk sayfa, panelde pdf.js görüntüleyicisi */
.file-preview.pdf { display: flex; padding: 0; overflow: hidden; }
.pdf-viewer { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.pdf-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.pdf-counter { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.pdf-page-input { width: 3.2em; padding: 3px 4px; border: 1px solid var(--border); border-radius: var(--r-sm, 8px); background: var(--surface-soft); color: var(--text); font: inherit; text-align: center; }
.pdf-spacer { flex: 1; }
.pdf-zoom { min-width: 46px; color: var(--text-muted); font-size: 12.5px; text-align: center; font-variant-numeric: tabular-nums; }
.pdf-pages { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; gap: 12px; min-height: 0; padding: 16px; overflow: auto; scrollbar-gutter: stable; background: var(--surface-soft); outline: none; }
.pdf-page { flex-shrink: 0; overflow: hidden; border-radius: 2px; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .35); }
.pdf-page canvas { display: block; }
.pdf-page[data-error] { background: repeating-linear-gradient(45deg, #f4f4f4 0 10px, #e9e9e9 10px 20px); }

/* Artifact paneli */
/* Önizleme paneli: sohbetin yanında duran, yuvarlak köşeli ayrı bir kart. */
.artifact-panel { position: relative; flex: 0 0 var(--panel-w, min(50%, 720px)); display: flex; flex-direction: column; min-width: 0; max-width: calc(100vw - 360px); margin: 8px 8px 8px 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface-soft); container-type: inline-size; }
/* Sürükleme tutamacı: panelin sol kenarı */
.panel-resizer { position: absolute; inset: 0 auto 0 0; z-index: 2; width: 8px; cursor: col-resize; touch-action: none; }
.panel-resizer:hover, .panel-resizer:focus-visible { background: linear-gradient(90deg, var(--text-faint) 0 2px, transparent 2px); outline: none; }
.artifact-panel.resizing { user-select: none; }
.artifact-panel.resizing iframe { pointer-events: none; }
.artifact-panel[hidden] { display: none; }
.artifact-panel header { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); }
.panel-mark { display: grid; flex-shrink: 0; }
.panel-title { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.artifact-panel h2 { margin: 0; overflow: hidden; color: var(--text-strong); font-size: 15px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.panel-sub { overflow: hidden; color: var(--text-faint); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.panel-view { flex-shrink: 0; }
.panel-view[hidden], .artifact-panel .icon-btn[hidden] { display: none; }
.panel-actions { display: flex; flex-shrink: 0; align-items: center; gap: 2px; }
/* Dar panelde Önizleme / Kod geçişi başlığın altına, kendi satırına iner. */
@container (max-width: 500px) {
  .artifact-panel header { flex-wrap: wrap; row-gap: 8px; }
  .panel-view { order: 5; margin-left: 44px; }
  .panel-title { flex-basis: 40px; }
}
/* Kod görünümü açıkken önizleme gizlenir; kapalıyken kaynak kabı gizlidir. */
.artifact-panel.show-source > iframe, .artifact-panel.show-source > .file-preview:not(.source-view), .artifact-panel:not(.show-source) > .source-view { display: none; }
.artifact-panel iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.file-preview { flex: 1; min-height: 0; padding: 18px 22px 24px; overflow: auto; overflow-wrap: anywhere; }
.file-preview.code, .file-preview.source-view { padding: 0; }
.file-preview.markdown { padding: 22px 28px 32px; }
.file-preview.markdown > * { max-width: 760px; margin-inline: auto; }
/* Satır numaralı kaynak: numaralar yatay kaydırmada solda sabit kalır. */
.code-view { display: grid; grid-template-columns: auto minmax(0, 1fr); width: max-content; min-width: 100%; padding: 14px 0 22px; font: 13px/1.65 var(--mono); overflow-wrap: normal; }
.code-view.no-gutter { grid-template-columns: minmax(0, 1fr); }
.code-view pre { margin: 0; overflow: visible; border: 0; border-radius: 0; background: none; font: inherit; }
.code-view pre code { display: block; padding: 0; overflow: visible; border-radius: 0; background: none; font: inherit; white-space: pre; }
.code-gutter { position: sticky; left: 0; padding: 0 14px 0 18px; background: var(--surface-soft); color: var(--text-faint); text-align: right; user-select: none; font-variant-numeric: tabular-nums; }
.code-text { padding: 0 24px 0 4px; }
.code-view.no-gutter .code-text { padding-left: 20px; }
.file-preview pre.plain-text { margin: 0; border: 0; border-radius: 0; background: none; }
.file-preview pre.plain-text code { padding: 0; overflow: visible; font: 13.5px/1.7 var(--mono); }
.file-preview[hidden] { display: none; }
.file-preview img { display: block; max-width: 100%; height: auto; margin: auto; border-radius: var(--r); }
.file-preview > pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
.file-preview:has(> iframe) { display: flex; padding: 0; overflow: hidden; }
.file-caption { margin: 4px 0 6px; color: var(--text-muted); font-size: 14px; }

.part-notice { margin: 4px 0 10px; padding: 8px 14px; border-radius: var(--r); background: var(--surface-soft); color: var(--text-muted); font-size: 14px; }
.part-notice.refusal { color: var(--warn); }
.part-error { margin: 4px 0 10px; padding: 10px 14px; border-radius: var(--r); background: var(--err-soft); color: var(--err); font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- Yazma kutusu ---------- */
.composer-wrap { position: relative; z-index: 4; padding: 0 20px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); }
.composer-wrap::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 26px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.composer {
  max-width: var(--column); margin: 0 auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-xl);
  background: var(--composer); box-shadow: 0 8px 28px color-mix(in srgb, var(--text-strong) 3%, rgb(0 0 0 / .12)); transition: border-color .15s;
}
.composer:hover { border-color: color-mix(in srgb, var(--border-strong) 55%, var(--border)); }
.composer:focus-within { border-color: var(--border-strong); }
.composer { position: relative; }
.slash-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 20; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); box-shadow: var(--shadow); animation: rise .16s var(--ease) both; }
.slash-menu[hidden] { display: none; }
/* Boş sohbette yazma kutusunun üstünde yer az olabilir; öneriler alanının üzerine açılır */
.main.is-empty .slash-menu { top: calc(100% + 8px); bottom: auto; }
.slash-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; }
.slash-item.active, .slash-item:hover { background: var(--hover); }
.slash-item code { flex-shrink: 0; color: var(--text-faint); font: 12.5px var(--mono); }
.composer.dragover { border-style: dashed; border-color: var(--text-faint); }
.composer textarea {
  display: block; width: 100%; max-height: 240px; padding: 6px 8px; border: 0; outline: none; resize: none; background: none;
  color: var(--text-strong); font-size: 16px; line-height: 1.5;
}
.input-mirror { display: none; position: absolute; left: 10px; right: 10px; padding: 6px 8px; overflow: hidden; color: var(--text-strong); font-size: 16px; line-height: 1.5; max-height: 240px; white-space: pre-wrap; overflow-wrap: break-word; pointer-events: none; }
.composer.has-token .input-mirror { display: block; }
.composer.has-token textarea { position: relative; z-index: 1; color: transparent; caret-color: var(--text-strong); scrollbar-width: none; }
.slash-token { border-radius: 6px; background: var(--token-bg); box-shadow: 0 0 0 3px var(--token-bg); color: var(--token); }
.msg.user .bubble .slash-token { margin-right: 8px; }
.slash-item code { color: var(--token); }
.composer textarea::placeholder { color: var(--text-faint); opacity: 1; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.composer-left, .composer-actions { display: flex; align-items: center; gap: 4px; min-width: 0; }
.composer-actions { flex-shrink: 0; }
.round-btn { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); transition: background-color .15s; }
.round-btn:hover { background: var(--hover); }
#activeTools { display: flex; gap: 4px; min-width: 0; }
.active-tool { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; padding: 4px 10px; border: 0; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; white-space: nowrap; transition: background-color .15s; }
.active-tool:hover { background: var(--border-strong); }
select[data-themed] { display: none; }
.themed-select { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); font-size: 13.5px; text-align: left; transition: background-color .15s, border-color .15s, color .15s; }
.themed-select:hover:not(:disabled), .themed-select[aria-expanded="true"] { border-color: var(--border-strong); }
.themed-select:disabled { opacity: .55; cursor: not-allowed; }
.themed-select .select-value { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.themed-select .icon { flex-shrink: 0; width: 13px; height: 13px; color: var(--text-faint); stroke-width: 2; transition: transform .15s; }
.themed-select[aria-expanded="true"] .icon { transform: rotate(180deg); }
.select-menu { position: fixed; inset: auto; width: max-content; max-width: min(460px, calc(100vw - 16px)); margin: 0; padding: 6px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); color: var(--text); box-shadow: var(--shadow); font-size: 14px; font-weight: 400; }
.select-menu:popover-open { animation: rise .16s var(--ease) both; }
.select-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; color: var(--text); font-size: 14px; text-align: left; transition: background-color .15s; }
.select-option:hover:not(:disabled), .select-option:focus-visible { outline: none; background: var(--hover); }
.select-option:disabled { color: var(--text-faint); cursor: not-allowed; }
.select-option[aria-selected="true"] { color: var(--text-strong); font-weight: 500; }
.select-option .icon { flex-shrink: 0; width: 17px; height: 17px; stroke-width: 2; }
/* Yazma kutusundaki effort seçimi metin düğmesi gibi durur */
.select-wrap { display: inline-flex; }
.select-wrap:has(select:disabled) { display: none; }
.select-wrap .themed-select { width: auto; gap: 4px; height: 30px; padding: 0 7px 0 9px; border: 0; border-radius: 10px; background: none; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.select-wrap .themed-select:hover, .select-wrap .themed-select[aria-expanded="true"] { background: var(--hover); color: var(--text-strong); }
.mini-select > span:first-child { display: none; }
.send-btn { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); transition: background-color .15s, transform .1s; }
.send-btn:hover { opacity: .88; }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { background: var(--accent-off); color: var(--accent-off-ink); opacity: 1; cursor: default; }
.send-btn.stop { background: var(--accent); }
.send-btn.stop::before { content: ""; width: 11px; height: 11px; border-radius: 2px; background: currentColor; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 4px; }
.attachments:not(:empty) { margin-bottom: 6px; }
.attachment { position: relative; }
.attachment img { display: block; width: 64px; height: 64px; border-radius: var(--r); object-fit: cover; }
.attachment button { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: var(--text-strong); color: var(--bg); font-size: 11px; }
.attachment.doc { display: flex; align-items: center; gap: 8px; max-width: 240px; padding: 6px 14px 6px 6px; border-radius: var(--r); background: var(--surface); font-size: 13px; }
.attachment.doc > span:not(.file-mark) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment.doc .file-mark { width: 26px; height: 26px; border-radius: 7px; font-size: 14px; }
.attachment.doc.loading { color: var(--text-faint); }
.msg.user .user-docs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 90%; margin-bottom: 4px; }
.doc-chip { display: inline-flex; align-items: center; gap: 10px; max-width: 260px; padding: 8px 14px 8px 10px; border-radius: var(--r-lg); background: var(--surface-soft); text-align: left; }
.doc-chip .file-mark { width: 28px; height: 28px; font-size: 15px; }
.doc-chip .file-text strong { font-size: 13.5px; }
.doc-chip .file-text small { font-size: 12px; }
.hint { max-width: var(--column); min-height: 18px; margin: 6px auto 0; color: var(--text-faint); font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.hint.warn { color: var(--warn); }
.hint.conv-usage { margin-top: 2px; min-height: 0; font-variant-numeric: tabular-nums; }
.hint[hidden] { display: none; }

/* Araç menüsü */
.tool-menu { position: fixed; inset: auto auto 0 0; width: 280px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 90px); overflow-y: auto; margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); color: var(--text); box-shadow: var(--shadow); }
.tool-menu:popover-open { animation: rise .16s var(--ease) both; }
.menu-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; color: var(--text); font-size: 14px; text-align: left; transition: background-color .15s; }
.menu-row:hover:not(:disabled) { background: var(--hover); }
.menu-row:disabled { color: var(--text-faint); cursor: not-allowed; }
.menu-label { flex: 1; min-width: 0; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.switch { position: relative; flex-shrink: 0; width: 32px; height: 18px; border-radius: 999px; background: var(--surface); transition: background-color .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-faint); transition: transform .18s var(--ease), background-color .15s; }
.menu-row[aria-checked="true"] .switch { background: var(--accent); }
.menu-row[aria-checked="true"] .switch::after { background: var(--accent-ink); transform: translateX(14px); }

/* ---------- Diyaloglar ---------- */
.dialog {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border); border-radius: var(--r-xl);
  background: var(--popover); color: var(--text); box-shadow: var(--shadow);
}
.dialog[open] { animation: pop .18s var(--ease) both; }
.dialog.small { width: min(420px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(3px); }
.dialog-body { display: flex; flex-direction: column; gap: 16px; padding: 16px 20px 18px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { margin: 0; color: var(--text-strong); font-size: 18px; font-weight: 600; }
.dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dialog-foot small { color: var(--text-faint); }
.tabs { display: flex; flex-direction: column; gap: 2px; overflow-x: auto; }
.tab { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; border: 0; border-radius: var(--r); background: none; color: var(--text-muted); font-size: 14px; text-align: left; white-space: nowrap; transition: background-color .15s, color .15s; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab[aria-selected="true"] { background: var(--hover); color: var(--text-strong); font-weight: 500; }
.tab .dot { flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); }
.tab .dot.ok { background: var(--text-strong); }
.panel { display: grid; gap: 12px; }
.panel[hidden] { display: none; }
.field { display: grid; gap: 5px; font-size: 13.5px; }
.field > span { color: var(--text); font-weight: 500; }
.field small { color: var(--text-faint); font-size: 12.5px; }
.field input, .field textarea, .field select, .inline input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); transition: border-color .15s; }
.field input:focus, .field textarea:focus, .field select:focus, .inline input:focus { border-color: var(--border-strong); outline: none; }
.field textarea { min-height: 80px; resize: vertical; font-size: 13.5px; }
.field.check { display: flex; align-items: center; gap: 8px; }
.field.check input { width: auto; accent-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.primary { padding: 8px 18px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 500; transition: opacity .15s; }
.primary:hover { opacity: .88; }
.secondary { padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: none; font-size: 13.5px; white-space: nowrap; transition: background-color .15s; }
.secondary:hover { background: var(--hover); }
.secondary:disabled { opacity: .5; cursor: progress; }
.badge { color: var(--text-faint); font-size: 12.5px; }
.error { min-height: 1em; margin: 0; color: var(--err); font-size: 13px; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 50; max-width: calc(100vw - 32px); padding: 9px 16px; transform: translateX(-50%); border: 1px solid var(--border); border-radius: var(--r); background: var(--popover); color: var(--text); font-size: 14px; box-shadow: var(--shadow); animation: rise-toast .18s var(--ease) both; }

.local-status { margin: -4px 0 0; color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
.local-actions { display: flex; gap: 8px; }
.local-results { display: grid; gap: 6px; }
.local-results:empty { display: none; }
.local-results small { color: var(--text-muted); }
.local-server { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: none; text-align: left; transition: background-color .15s; }
.local-server:hover { background: var(--hover); }
.local-server small { grid-column: 1 / -1; color: var(--text-faint); }
.mono { color: var(--text-muted); font: 12.5px var(--mono); overflow-wrap: anywhere; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.field progress { width: 100%; height: 6px; accent-color: var(--accent); }
.pull-status { white-space: pre-wrap; overflow-wrap: anywhere; }
.local-help { padding: 10px 14px; border-radius: var(--r); background: var(--surface-soft); color: var(--text-muted); font-size: 13px; }
.local-help[hidden] { display: none; }
.local-help strong { color: var(--text); font-weight: 600; }
.local-help ul { display: grid; gap: 4px; margin: 6px 0 0; padding-left: 1.2em; }
.local-help code { padding: .08em .35em; border-radius: 5px; background: var(--surface); font: 12px var(--mono); overflow-wrap: anywhere; }

/* Tema menüsü */
.theme-swatch { position: relative; flex-shrink: 0; width: 38px; height: 28px; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); }
.theme-swatch i { position: absolute; top: 5px; right: 4px; width: 18px; height: 7px; border-radius: 4px; background: var(--surface); }
.theme-swatch::after { content: ""; position: absolute; left: 5px; bottom: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes rise-toast { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- Geniş ekran ve telefon ---------- */
@media (min-width: 861px) {
  .app.sidebar-closed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
  .app:not(.sidebar-closed) #openSidebar { display: none; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(340px, 88vw); transform: translateX(-100%); transition: transform .22s var(--ease); }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .55); }

  .topbar { padding: 6px 8px; }
  .title-wrap { display: none; }
  .model-picker { flex: 1; }
  .model-button { max-width: 100%; }
  .model-menu { position: fixed; top: 58px; left: 12px; right: 12px; width: auto; max-width: none; }
  .messages { padding: 10px 14px 30px; }
  .composer-wrap { padding: 0 10px calc(4px + env(safe-area-inset-bottom)); }
  .main.is-empty .composer-wrap { padding-bottom: 4vh; }
  .main.is-empty .suggestions { grid-template-columns: 1fr; }
  .msg-actions, .msg-meta { opacity: 1; }
  .row { grid-template-columns: 1fr; }
  .dialog-body { padding: 14px 16px 16px; }
}

/* Dokunmatik ekranda fareyle üzerine gelme yoktur */
@media (hover: none) {
  .conv-del { display: grid; }
}

/* En az 44 px dokunma alanı; iOS'un yakınlaştırmaması için 16 px yazı */
@media (pointer: coarse), (max-width: 860px) {
  .search, .model-search input, .field input, .field textarea, .field select, .inline input { font-size: 16px; }
  .icon-btn, .round-btn, .send-btn { width: 44px; height: 44px; }
  .model-button, .side-btn, .side-search, .tab, .menu-row, .provider-tab, .menu-link, .themed-select, .select-option { min-height: 44px; }
  .composer textarea, .input-mirror { min-height: 44px; padding: 10px 8px; }
  .active-tool { min-height: 44px; padding: 0 12px; }
  .conv-item { min-height: 44px; }
  .conv-del { width: 44px; height: 44px; }
  .msg-actions button { min-height: 44px; padding: 0 12px; }
  .msg-actions .action-btn { width: 44px; height: 44px; }
  .attachment button::after { content: ""; position: absolute; inset: -12px; }
  .part-thinking > summary, .part-tool > summary, .part-server > summary { min-height: 44px; }
  .suggestions button { padding: 10px 12px; }
  .model-option { padding: 10px; }
}

/* Sistemde hareket azaltma açıksa animasyonlar durur; durum metinleri bilgiyi taşımaya devam eder */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .working, .part-thinking.live .thinking-label { color: var(--text-muted); background: none; }
}

/* Agents sayfası */
#main.page-open .messages, #main.page-open .composer-wrap, #main.page-open .model-picker, #main.page-open .title-wrap { display: none; }
.side-btn.active { background: var(--hover); color: var(--text-strong); }
.agents-page { flex: 1; min-height: 0; overflow-y: auto; }
.agents-page[hidden] { display: none; }
.agents-inner { width: min(900px, 100%); margin: 0 auto; padding: 8px 20px 48px; }
.agents-inner h1 { margin: 0 0 26px; color: var(--text-strong); font-size: 26px; font-weight: 500; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin: 22px 0 10px; }
.section-head h2 { margin: 0; color: var(--text-strong); font-size: 15px; font-weight: 500; }
.link-btn { padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted); font-size: 13.5px; }
.link-btn:hover { background: var(--hover); color: var(--text-strong); }
.new-agent { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px 9px 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 500; }
.new-agent:hover { opacity: .88; }
.preset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.preset-card { position: relative; border-radius: var(--r-xl); background: var(--surface-soft); transition: background-color .15s; }
.preset-card:hover { background: var(--hover); }
.preset-card .card-open { display: grid; gap: 4px; justify-items: start; width: 100%; height: 100%; padding: 16px; border: 0; border-radius: inherit; background: none; color: var(--text); text-align: left; }
.preset-card .avatar { width: 30px; height: 30px; margin-bottom: 12px; }
.preset-card strong { color: var(--text-strong); font-size: 14px; font-weight: 500; }
.preset-card .card-open > span:last-child { display: -webkit-box; overflow: hidden; color: var(--text-muted); font-size: 13px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.card-more { position: absolute; top: 10px; right: 8px; }
.agent-rows { display: grid; gap: 8px; }
.agent-row { display: flex; align-items: center; gap: 2px; padding-right: 8px; border-radius: var(--r-lg); background: var(--surface-soft); transition: background-color .15s; }
.agent-row:hover { background: var(--hover); }
.agent-row .card-open { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 8px 12px 16px; border: 0; border-radius: inherit; background: none; color: var(--text); text-align: left; }
.agent-row .avatar { width: 36px; height: 36px; font-size: 15px; }
.agent-text { display: grid; min-width: 0; }
.agent-text strong { overflow: hidden; color: var(--text-strong); font-size: 14px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.agent-text span { overflow: hidden; color: var(--text-muted); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.agents-empty { margin: 0; padding: 18px 16px; border-radius: var(--r-lg); background: var(--surface-soft); color: var(--text-muted); font-size: 14px; }
.row-menu { position: fixed; inset: auto; width: 220px; margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); color: var(--text); box-shadow: var(--shadow); }
.editor-head { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.editor-head h1 { flex: 1; margin: 0; font-size: 20px; }
.agent-editor { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 20px; align-items: start; }
.agent-form { display: grid; gap: 12px; min-width: 0; }
.agent-identity { display: flex; align-items: flex-end; gap: 12px; }
.agent-identity .field { flex: 1; min-width: 0; }
.icon-pick { flex-shrink: 0; padding: 0; border: 0; border-radius: 50%; background: none; }
.icon-pick .avatar { width: 42px; height: 42px; font-size: 18px; }
.icon-picker { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-soft); }
.icon-picker[hidden] { display: none; }
.icon-options, .color-options { display: flex; flex-wrap: wrap; gap: 4px; }
.icon-option { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--text-muted); font-size: 14px; font-weight: 600; }
.icon-option:hover { background: var(--hover); }
.icon-option[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.color-option { width: 26px; height: 26px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--c); }
.color-option[aria-pressed="true"] { border-color: var(--text-strong); }
.avatar-tools { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.avatar-tools input[type="text"], .avatar-tools > input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); font-size: 13.5px; }
.avatar-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-tools small { color: var(--text-faint); font-size: 12.5px; }
.agent-chat { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; height: min(70dvh, 640px); padding: 12px; border-radius: var(--r-lg); background: var(--surface-soft); }
.agent-chat h2 { margin: 0; color: var(--text-strong); font-size: 14px; font-weight: 500; }
.agent-log { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; }
.agent-bubble { max-width: 92%; margin: 0; padding: 7px 12px; border-radius: var(--r-lg); font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-bubble.user { align-self: flex-end; background: var(--surface); color: var(--text-strong); }
.agent-bubble.model { align-self: flex-start; padding-inline: 2px; color: var(--text); }
.agent-prompt { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); }
.agent-prompt textarea { flex: 1; min-width: 0; padding: 5px 6px; border: 0; outline: none; resize: none; background: none; color: var(--text-strong); }
.field > .field-foot { display: flex; justify-content: space-between; gap: 12px; color: inherit; font-weight: 400; }
.char-count { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.field small.char-count.near { color: var(--warn); }
.field small.char-count.over { color: var(--err); font-weight: 500; }
.agent-switches { display: grid; }
.agent-switches .menu-row { min-height: 34px; padding: 4px 6px; font-weight: 400; }
.menu-note { margin: 0; padding: 6px 10px; color: var(--text-muted); font-size: 13px; }
.menu-select { display: grid; gap: 4px; padding: 2px 10px 8px 38px; color: var(--text-faint); font-size: 12.5px; }
.menu-select .themed-select { padding: 5px 8px; border-radius: var(--r-sm); font-size: 13px; }
.conv-agent { flex-shrink: 0; margin-right: 6px; color: var(--text-faint); font-size: 12px; }
@media (max-width: 860px) {
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-editor { grid-template-columns: minmax(0, 1fr); }
  .agent-chat { position: static; order: -1; height: 340px; }
  .agents-inner { padding: 8px 14px 32px; }
}

/* Sohbet daralmasın diye dar ekranda artifact paneli üstte açılır */
@media (max-width: 1180px) {
  .artifact-panel { position: fixed; inset: 8px 8px 8px auto; z-index: 40; width: var(--panel-w, min(680px, 100vw)); max-width: calc(100vw - 16px); margin: 0; box-shadow: var(--shadow); }
}

/* Sohbet kartları */
.card { max-width: 640px; margin: 6px 0 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-soft); font-size: 14.5px; }
.card p { margin: 6px 0 0; }
.card h4 { margin: 14px 0 6px; font-size: 13.5px; color: var(--text-muted); }
.card-title { margin: 0 0 8px; color: var(--text-strong); font-size: 15.5px; font-weight: 600; }
.card-sub { color: var(--text-muted); font-size: 13.5px; }
.card-note, .card-source { color: var(--text-faint); font-size: 12.5px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head strong { color: var(--text-strong); font-size: 15.5px; }
.card-price { color: var(--text-muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.card-link { display: inline-block; margin-top: 8px; color: var(--token); font-size: 13.5px; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.card-link.as-button { padding: 0; border: 0; background: none; cursor: pointer; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card-actions a.secondary { color: var(--text); text-decoration: none; }
.card-tabs { display: flex; gap: 4px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.card-tab { flex: none; padding: 6px 12px; border: 0; border-radius: 999px; background: none; color: var(--text-muted); font-size: 13.5px; cursor: pointer; }
.card-tab:hover { background: var(--hover); }
.card-tab[aria-selected="true"] { background: var(--surface); color: var(--text-strong); }
.pager-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.pager-position { color: var(--text-muted); font-size: 13px; }
.card .table-wrap { margin: 0; }
.card table { width: 100%; }
.chart { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--text-muted); font-size: 11.5px; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--text-muted); font-size: 13px; }
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.chart-key { width: 10px; height: 10px; border-radius: 3px; }
.quiz-prompt { margin: 0 0 10px; color: var(--text-strong); font-weight: 500; }
.quiz-options { display: grid; gap: 6px; }
.quiz-option { padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background-color .15s; }
.quiz-option:hover:enabled { background: var(--hover); }
.quiz-option:disabled { cursor: default; }
.quiz-option.right { border-color: #2fb37c; }
.quiz-option.wrong { border-color: var(--err); }
.quiz-result strong { color: var(--text-strong); }
.quiz-hint { color: var(--text-muted); }
.quiz-score { color: var(--text-muted); font-size: 13px; }
.flash-back { margin-bottom: 10px; }
.recipe-servings { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.recipe-step { width: 30px; height: 30px; border: 1px solid var(--border); font-size: 17px; }
.recipe-count { min-width: 92px; text-align: center; color: var(--text-strong); font-weight: 500; }
.recipe-items { margin: 0; padding: 0; list-style: none; }
.recipe-items li { display: grid; grid-template-columns: minmax(96px, 30%) 1fr; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.recipe-amount { color: var(--text-muted); }
.recipe-steps { margin: 0; padding-left: 20px; }
.recipe-steps li { margin-bottom: 10px; }
.recipe-timer { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; color: var(--text-muted); font-size: 12.5px; }
.recipe-timer svg { width: 14px; height: 14px; }
.message-subject { margin: 0 0 8px; }
.message-body { max-height: 420px; padding: 10px 12px; overflow: auto; border-radius: var(--r); background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; }
.map-area { height: 320px; overflow: hidden; border-radius: var(--r); background: var(--surface); }
.map-area.failed { display: flex; align-items: center; justify-content: center; height: 120px; color: var(--text-muted); }
.map-mark { display: flex; align-items: center; justify-content: center; border: 2px solid #fff; border-radius: 50%; background: #1a5fd0; color: #fff; font: 600 12px var(--font); }
.leaflet-container { font-family: var(--font); }
.map-list { margin: 10px 0 0; padding: 0; list-style: none; }
.map-list li, .step-item { display: flex; gap: 10px; padding: 6px 0; }
.map-index { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); color: var(--text-strong); font-size: 12px; font-weight: 600; }
.itinerary { margin: 0; padding: 0; list-style: none; }
.itinerary li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.itinerary li:last-child { border-bottom: 0; }
.itinerary-time { display: inline-block; min-width: 72px; color: var(--text-muted); font-size: 13px; }
.link-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-width: 640px; margin: 6px 0 12px; }
.link-card { display: block; margin: 0; color: var(--text); text-decoration: none; transition: background-color .15s; }
.link-card:hover { background: var(--hover); }
.link-card strong { display: block; color: var(--text-strong); }
.option-item, .place-item { padding: 10px 0; border-top: 1px solid var(--border); }
.option-item:first-of-type, .place-item:first-child { border-top: 0; }
.option-item ul { margin: 6px 0 0; padding-left: 18px; }
.place-tips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.place-tips span { padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: 12.5px; }
.translation { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.translation-text { color: var(--text-strong); font-size: 16px; }
.weather-now { display: flex; align-items: center; gap: 14px; }
.weather-temp { color: var(--text-strong); font-size: 40px; font-weight: 500; line-height: 1; }
.weather-days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.weather-day { display: grid; gap: 2px; padding: 8px 4px; border-radius: var(--r); background: var(--surface); text-align: center; font-size: 13.5px; }
.sports-list { margin: 0; padding: 0; list-style: none; }
.sports-list li { display: grid; grid-template-columns: 1fr auto 1fr 64px; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sports-meta { grid-column: 1 / -1; color: var(--text-faint); font-size: 12px; }
.sports-team:nth-of-type(2) { text-align: right; }
.sports-score { min-width: 48px; color: var(--text-strong); text-align: center; }
.sports-state { color: var(--text-muted); font-size: 12.5px; text-align: right; }
.sports-list li.live .sports-state { color: #2fb37c; font-weight: 600; }
.card-permission { border-color: var(--border-strong); }
@media (max-width: 560px) {
  .translation { grid-template-columns: 1fr; }
  .weather-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sports-list li { grid-template-columns: 1fr auto 1fr; }
  .sports-state { grid-column: 1 / -1; text-align: center; }
  .map-area { height: 260px; }
}

/* Ara metin (araç çağrıları arasında modelin yazdığı not): aktivite listesinde tek satır, soluk. */
.activity-step.note .act-title { color: var(--text-muted); }
.activity-step.note .act-mark::before { content: "·"; color: var(--text-faint); }

/* ---------------------------------------------------------------- soru kartı (AskUserQuestion) */
.question-dock { max-width: var(--column); margin: 0 auto; }
.question-dock:empty { display: none; }
.question-card {
  margin-bottom: 10px; padding: 14px 14px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  background: var(--popover); box-shadow: var(--shadow); animation: rise .16s var(--ease) both; max-height: 60vh; overflow-y: auto;
}
.q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; color: var(--text-strong); }
.q-head svg { width: 18px; height: 18px; }
.q-list { display: grid; gap: 14px; }
.q-block { margin: 0; padding: 0; border: 0; min-width: 0; }
.q-block legend { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 8px; padding: 0; color: var(--text-strong); }
.q-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.q-text { font-weight: 500; }
.q-hint { margin: -4px 0 6px; color: var(--text-faint); font-size: 12px; }
.q-body { display: grid; gap: 8px; }
.q-body:has(.q-preview:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.q-options { display: grid; gap: 6px; }
.q-option { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; transition: border-color .12s, background .12s; }
.q-option:hover { background: var(--hover); }
.q-option.selected { border-color: var(--border-strong); background: var(--surface-soft); }
.q-option input { margin-top: 3px; accent-color: var(--accent); }
.q-option-text { display: grid; gap: 2px; min-width: 0; }
.q-option-text strong { font-weight: 500; color: var(--text-strong); }
.q-desc { color: var(--text-muted); font-size: 13px; }
.q-other-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); font: inherit; }
.q-preview { margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--code); font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow: auto; max-height: 260px; }
.q-notes { width: 100%; margin-top: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--r); background: transparent; color: var(--text); font: inherit; font-size: 13px; resize: vertical; }
.q-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.q-keys { margin-right: auto; color: var(--text-faint); font-size: 12px; }
.question-record { display: flex; align-items: center; gap: 8px; }
.question-record svg { width: 15px; height: 15px; flex-shrink: 0; }
.question-record.answered { display: grid; gap: 6px; margin: 6px 0 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-lg); }
.qr-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; font-size: 14px; }
.qr-q { color: var(--text-muted); }
.qr-a { color: var(--text-strong); font-weight: 500; }
.qr-note { flex-basis: 100%; color: var(--text-faint); font-size: 13px; }
@media (max-width: 560px) {
  /* Mobilde alttan açılan sayfa gibi: tam genişlik, önizleme seçeneklerin altında. */
  .question-card { border-radius: var(--r-xl) var(--r-xl) var(--r) var(--r); max-height: 70vh; }
  .q-body:has(.q-preview:not([hidden])) { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- onay kartı */
.approval-details { margin: 6px 0 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--code); font: 12px/1.5 var(--mono); white-space: pre-wrap; max-height: 280px; overflow: auto; }

/* ---------------------------------------------------------------- görev listesi */
.tasks { display: grid; gap: 8px; }
.tasks-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--text-strong); font: inherit; text-align: left; }
.tasks-title { font-weight: 600; font-size: 13px; }
.tasks-current { flex: 1; min-width: 0; overflow: hidden; color: var(--text-muted); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.tasks-count { margin-left: auto; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tasks-caret { display: grid; place-items: center; color: var(--text-faint); transition: transform .15s; }
.tasks-caret svg { width: 15px; height: 15px; }
.tasks-caret.open { transform: rotate(180deg); }
.tasks-progress { height: 3px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.tasks-progress span { display: block; height: 100%; background: var(--text-muted); transition: width .3s var(--ease); }
.tasks-items { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.task { display: flex; align-items: flex-start; gap: 9px; padding: 4px 2px; font-size: 13px; color: var(--text); }
.task-mark { display: grid; place-items: center; flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px; border: 1.5px solid var(--text-faint); border-radius: 50%; color: var(--text-muted); }
.task-mark svg { width: 10px; height: 10px; }
.task.in_progress .task-mark { border-color: var(--text-muted) transparent var(--text-muted) var(--text-muted); }
/* Gösterge yalnızca yanıt akarken döner; tur bitince yarım halka olarak durur. */
.is-streaming .task.in_progress .task-mark { animation: spin 0.9s linear infinite; }
.task.completed .task-mark { border-color: var(--text-faint); background: var(--surface); }
.task.completed .task-subject { color: var(--text-faint); text-decoration: line-through; }
.task.blocked .task-mark { border: 0; }
.task-text { display: grid; gap: 1px; min-width: 0; }
.task-wait { color: var(--text-faint); font-size: 12px; }
.task.in_progress .task-subject { color: var(--text-strong); }
/* Masaüstü: sohbetin sağında panel. */
.task-panel { position: absolute; top: 60px; right: 16px; z-index: 3; width: 250px; max-height: calc(100% - 200px); overflow-y: auto; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); }
.task-bar { max-width: var(--column); margin: 0 auto 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); }
.task-bar[hidden], .task-panel[hidden], .tasks-items[hidden] { display: none; }
@media (min-width: 1360px) { .task-bar { display: none; } }
@media (max-width: 1359px) { .task-panel { display: none; } }

/* ---------------------------------------------------------------- görsel arama galerisi */
.search-gallery { display: flex; gap: 8px; margin: 8px 0 12px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
.sg-item { flex: 0 0 auto; margin: 0; scroll-snap-align: start; }
.sg-open { display: block; padding: 0; border: 0; border-radius: var(--r); background: var(--surface); overflow: hidden; cursor: zoom-in; }
.sg-open img { display: block; height: 168px; width: auto; max-width: 300px; object-fit: cover; transition: transform .2s var(--ease); }
.sg-open:hover img { transform: scale(1.02); }
.sg-open:focus-visible { outline: 2px solid var(--border-strong); outline-offset: 2px; }
.sg-item figcaption { margin-top: 4px; color: var(--text-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.image-search-status, .widget-status { margin: 6px 0 10px; color: var(--text-faint); font-size: 13px; }
.search-lightbox { display: none; }
.search-lightbox[open] { display: grid; gap: 8px; justify-items: center; }
.search-lightbox img { max-height: 82dvh; }
.slb-caption { display: grid; gap: 2px; max-width: 90vw; padding: 8px 12px; border-radius: var(--r); background: var(--popover); color: var(--text); font-size: 13px; text-align: center; }
.slb-title { color: var(--text-strong); font-weight: 500; }
.slb-meta { color: var(--text-muted); }
.slb-link { color: var(--token); }
@media (max-width: 560px) { .sg-open img { height: 132px; max-width: 220px; } }

/* ---------------------------------------------------------------- widget (show_widget) */
.widget-card { position: relative; margin: 8px 0 12px; }
.widget-frame { display: block; width: 100%; border: 0; background: transparent; }
.widget-menu { position: absolute; top: -6px; right: 0; z-index: 1; display: flex; gap: 2px; padding: 2px; border-radius: var(--r-sm); background: var(--popover); opacity: 0; transition: opacity .15s; }
.widget-card:hover .widget-menu, .widget-card:focus-within .widget-menu { opacity: 1; }
@media (hover: none) { .widget-menu { opacity: 1; position: static; justify-content: flex-end; margin-bottom: 4px; background: none; } }
.widget-card.loading { display: flex; align-items: center; gap: 10px; min-height: 120px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--r-lg); color: var(--text-muted); font-size: 14px; }
.widget-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--text-muted); border-radius: 50%; animation: spin .8s linear infinite; }
.widget-warn { margin-top: 6px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--err-soft); color: var(--err); font-size: 12px; }
.widget-warn[hidden] { display: none; }

/* ---------------------------------------------------------------- zamanlanmış görevler */
.side-badge { margin-left: auto; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.side-badge[hidden] { display: none; }
.schedule-page h2 { margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 600; }
.schedule-section { display: grid; gap: 12px; margin-bottom: 32px; }
.schedule-section-head { display: flex; align-items: center; justify-content: space-between; }
.schedule-list, .notes { display: grid; gap: 10px; }
.schedule-row { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); }
.schedule-row.off { opacity: .7; }
.schedule-body { display: grid; gap: 6px; }
.schedule-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-strong); }
.schedule-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-muted); font-size: 13px; }
.schedule-prompt { margin: 2px 0; color: var(--text); font-size: 14px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.schedule-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.schedule-actions .spacer { flex: 1; }
.schedule-actions button { padding: 6px 10px; font-size: 13px; }
.schedule-actions .danger { color: var(--err); }
.switch-row { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.switch-row input { accent-color: var(--accent); }
.schedule-runs { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.schedule-run { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.schedule-error { flex-basis: 100%; color: var(--err); font-size: 12px; }
.schedule-edit { display: grid; gap: 10px; }
.schedule-edit label { display: grid; gap: 4px; color: var(--text-muted); font-size: 13px; }
.schedule-edit input, .schedule-edit textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); color: var(--text); font: inherit; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.chip.status-succeeded { color: #4ade80; }
.chip.status-failed { color: var(--err); }
.chip.status-running, .chip.status-queued { color: var(--warn); }
.link-btn { padding: 0; border: 0; background: none; color: var(--token); font: inherit; font-size: 13px; cursor: pointer; }
.muted { color: var(--text-faint); }
.note { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.note.unread { border-color: var(--border-strong); background: var(--surface-soft); }
.note-title { display: flex; justify-content: space-between; gap: 8px; color: var(--text-strong); font-size: 14px; }
.note-time { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.note-body { color: var(--text-muted); font-size: 13px; }
.schedule-card .card-head { display: flex; align-items: center; gap: 8px; }
.schedule-card .card-head svg { width: 18px; height: 18px; }
.schedule-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0; font-size: 14px; }
.schedule-facts dt { color: var(--text-muted); }
.schedule-facts dd { margin: 0; color: var(--text); }

/* ---------------------------------------------------------------- /loop */
.loop-strip { display: flex; align-items: center; gap: 10px; max-width: var(--column); width: calc(100% - 40px); margin: 6px auto 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-soft); font-size: 13px; color: var(--text-muted); }
.loop-strip[hidden] { display: none; }
.loop-icon svg { width: 17px; height: 17px; }
.loop-mode { color: var(--text-strong); font-weight: 500; white-space: nowrap; }
.loop-task, .loop-reason { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.loop-task { flex: 1; color: var(--text); }
.loop-reason { flex: 1; color: var(--text-faint); }
.loop-when { white-space: nowrap; }
.loop-strip button { padding: 4px 10px; font-size: 12px; }
#main.page-open .loop-strip { display: none; }
.bubble.system-bubble { background: none; border: 1px dashed var(--border-strong); color: var(--text-muted); }
.bubble-label { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--text-faint); font-size: 12px; }
.bubble-label svg { width: 14px; height: 14px; }
.noop-group { max-width: var(--column); margin: 4px auto; }
.noop-group > summary { color: var(--text-faint); font-size: 13px; cursor: pointer; list-style: none; padding: 4px 0; }
.noop-group > summary::before { content: "↻ "; }

/* ---------------------------------------------------------------- Monitor */
.monitor-chip { margin: 6px 0 10px; border: 1px solid var(--border); border-radius: var(--r-lg); font-size: 13px; }
.monitor-chip > summary { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; list-style: none; }
.monitor-chip > summary::-webkit-details-marker { display: none; }
.mon-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--text-faint); }
.monitor-chip.running .mon-dot { background: #4ade80; animation: pulse 1.6s ease-in-out infinite; }
.mon-desc { min-width: 0; flex: 1; overflow: hidden; color: var(--text-strong); font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.mon-status, .mon-count { color: var(--text-muted); white-space: nowrap; }
.monitor-chip button { padding: 3px 10px; font-size: 12px; }
.mon-log { max-height: 280px; overflow: auto; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--code); font: 12px/1.5 var(--mono); }
.mon-line { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; }
.mon-line time { flex-shrink: 0; color: var(--text-faint); }
.monitor-note { margin: 6px 0; padding: 8px 12px; border-left: 2px solid var(--border-strong); color: var(--text-muted); font-size: 13px; }
.monitor-note strong { color: var(--text); font-weight: 500; }
.monitor-note pre { margin: 4px 0 0; white-space: pre-wrap; font: 12px/1.5 var(--mono); }

/* Mermaid önizlemesi: çerçeve temaya uyar; hata notu */
.artifact-panel iframe.themed { background: var(--bg); }
.mermaid-error { margin: 0 0 10px; color: var(--err); font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.file-preview .mermaid-error + pre { margin-top: 0; }

/* Mobil: önizleme alttan açılan tam ekran sayfa; geri hareketi kapatır (bkz. web/src/chat/preview/panel.tsx) */
@media (max-width: 860px) {
  .artifact-panel { inset: 0; width: 100vw; max-width: 100vw; height: 100dvh; border: 0; border-radius: 0; animation: sheet-up .22s ease-out; }
  .artifact-panel header { padding-top: calc(8px + env(safe-area-inset-top)); }
  .panel-resizer { display: none; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .artifact-panel { animation: none; } }
.artifact-panel h2:focus { outline: none; }
.artifact-panel h2:focus-visible { outline: 2px solid var(--text-faint); outline-offset: 2px; border-radius: 4px; }

/* Skill market: vitrin (arama, kategoriler, kartlar) ve skill sayfası */
/* position: görünmez durum satırı sayfayı uzatmasın. container: düzen, kenar çubuğu çıkınca kalan genişliğe göredir. */
.market-page { position: relative; container: market / inline-size; }
.market-inner { width: min(1040px, 100%); margin: 0 auto; padding: 8px 24px 72px; }
.market-top { display: flex; flex-direction: column; align-items: center; padding: 28px 0 8px; text-align: center; }
.market-top h1 { margin: 0; color: var(--text-strong); font-size: clamp(28px, 4vw, 38px); font-weight: 600; letter-spacing: -.025em; line-height: 1.15; }
.market-intro { max-width: 54ch; margin: 10px 0 0; color: var(--text-muted); font-size: 15px; line-height: 1.55; text-wrap: balance; }
.market-search { display: flex; align-items: center; gap: 12px; width: min(620px, 100%); margin-top: 24px; padding: 0 18px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); color: var(--text-faint); font-size: 17px; cursor: text; transition: border-color .15s; }
.market-search:hover, .market-search:focus-within { border-color: var(--border-strong); }
.market-search input { flex: 1; min-width: 0; padding: 13px 0; border: 0; outline: none; background: none; color: var(--text); font-size: 15px; }
.market-search input::placeholder { color: var(--text-faint); opacity: 1; }
.market-tabs { display: flex; gap: 6px; max-width: 100%; margin-top: 18px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.market-tabs::-webkit-scrollbar { display: none; }
.market-tabs button { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; min-height: 36px; padding: 0 15px; border: 0; border-radius: 999px; background: none; color: var(--text-muted); font-size: 14px; white-space: nowrap; transition: background-color .15s, color .15s; }
.market-tabs button:focus-visible { outline-offset: -2px; }
.market-tabs button:hover { background: var(--hover); color: var(--text-strong); }
.market-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text-strong); font-weight: 500; }
.market-n { color: var(--text-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.market-body { margin-top: 20px; }
.market-section + .market-section { margin-top: 36px; }
.market-section > h2 { margin: 0 0 12px; color: var(--text-strong); font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); gap: 12px; }
.market-card { position: relative; display: flex; align-items: center; gap: 16px; min-height: 96px; padding: 16px 18px 16px 16px; border-radius: 20px; background: var(--surface-soft); transition: background-color .15s; }
.market-card:not(.skeleton):hover { background: var(--hover); }
.market-card:has(.market-open:focus-visible) { outline: 2px solid var(--text-faint); outline-offset: 2px; }
.market-text { flex: 1; min-width: 0; }
.market-card h3 { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.market-open { max-width: 100%; padding: 0; overflow: hidden; border: 0; outline: none; background: none; color: var(--text-strong); font: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.market-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.market-tagline { display: -webkit-box; margin: 3px 0 0; overflow: hidden; color: var(--text-muted); font-size: 13.5px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.market-side { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; pointer-events: none; }
.market-add { min-width: 72px; min-height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--text-strong) 10%, transparent); color: var(--text-strong); font-size: 13.5px; font-weight: 600; pointer-events: auto; transition: background-color .15s, color .15s, transform .12s; }
.market-add:hover { background: var(--accent); color: var(--accent-ink); }
.market-add:active { transform: scale(.96); }
.market-add:disabled { opacity: .5; cursor: progress; }

/* Skill simgesi: uygulama simgesi gibi renkli kare. Renkler temadan bağımsızdır (beyaz simge her temada okunur). */
.market-icon { --a: #6b7280; --b: #374151; display: grid; place-items: center; flex-shrink: 0; width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(150deg, var(--a), var(--b)); color: #fff; font-size: 22px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), inset 0 0 0 1px rgb(255 255 255 / .06); }
.market-icon[data-color="orange"] { --a: #f97316; --b: #b93a0a; }
.market-icon[data-color="blue"] { --a: #3b82f6; --b: #1e46c0; }
.market-icon[data-color="violet"] { --a: #8b5cf6; --b: #5b21b6; }
.market-icon[data-color="red"] { --a: #dc2626; --b: #6f1414; }
.market-icon[data-color="rose"] { --a: #ec4899; --b: #9d174d; }
.market-icon[data-color="teal"] { --a: #0d9f8c; --b: #0b5b56; }
.market-icon[data-color="cyan"] { --a: #0891b2; --b: #0f5672; }
.market-icon[data-color="indigo"] { --a: #6366f1; --b: #3730a3; }
.market-icon.mid { width: 60px; height: 60px; border-radius: 17px; font-size: 24px; }
.market-icon.big { width: 92px; height: 92px; border-radius: 26px; font-size: 37px; }

/* Açık skill'lerin rafı */
.market-shelf { display: flex; gap: 4px; margin: 0 -22px; /* simgeler kartların kenarıyla hizalı */ padding: 2px 0; overflow-x: auto; scrollbar-width: thin; }
.market-shelf-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 0 0 104px; padding: 10px 6px; border: 0; border-radius: 18px; background: none; color: var(--text); transition: background-color .15s; }
.market-shelf-item:hover { background: var(--hover); }
.market-shelf-item:focus-visible { outline-offset: -2px; }
.market-shelf-icon { position: relative; }
.market-shelf-name { display: -webkit-box; max-width: 100%; overflow: hidden; font-size: 12.5px; line-height: 1.35; text-align: center; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.market-dot { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border: 3px solid var(--bg); border-radius: 50%; background: var(--warn); }
.market-dot.error { background: var(--err); }

.market-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.market-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.market-pill.ok { color: var(--text-muted); }
.market-pill.ok::before { background: var(--ok, #3fb950); }
.market-pill.pending, .market-pill.warn { color: var(--warn); }
.market-pill.pending::before { animation: pulse 1.2s ease-in-out infinite; }
.market-pill.error { color: var(--err); }

.market-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0; padding: 56px 0; color: var(--text-muted); font-size: 15px; text-align: center; overflow-wrap: anywhere; }
.market-empty p { margin: 0; }
.market-card.skeleton { cursor: default; }
.market-card.skeleton .market-icon { background: var(--surface); box-shadow: none; }
.market-card.skeleton .market-text { display: grid; gap: 9px; }
.market-card.skeleton i { height: 10px; border-radius: 5px; background: var(--surface); }
.market-card.skeleton i:first-child { width: 42%; height: 13px; }
.market-card.skeleton i:last-child { width: 68%; }
.market-card.skeleton { animation: pulse 1.6s ease-in-out infinite; }

/* Skill sayfası */
.market-back { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; margin: 4px 0 0 -12px; padding: 0 14px 0 12px; border: 0; border-radius: 999px; background: none; color: var(--text-muted); font-size: 14px; transition: background-color .15s, color .15s; }
.market-back:hover { background: var(--hover); color: var(--text-strong); }
.market-hero { display: flex; align-items: center; gap: 22px; padding: 26px 0 30px; }
.market-hero-text { flex: 1; min-width: 0; }
.market-hero h1 { margin: 0; color: var(--text-strong); font-size: clamp(24px, 3.4vw, 32px); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; text-wrap: balance; }
.market-hero h1:focus { outline: none; }
.market-by { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0 0; color: var(--text-muted); font-size: 14.5px; }
.market-actions { display: flex; flex-wrap: wrap; gap: 10px; flex-shrink: 0; }
.market-actions .primary, .market-actions .secondary { min-height: 42px; padding: 0 22px; font-size: 14.5px; }
.market-actions .primary:disabled { opacity: .5; cursor: progress; }
.market-alert { margin: 0 0 28px; padding: 13px 18px; border-radius: 16px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.market-alert.error { background: var(--err-soft); }
.market-columns { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; padding-top: 28px; border-top: 1px solid var(--border); }
.market-block + .market-block { margin-top: 30px; }
.market-block h2 { margin: 0 0 8px; color: var(--text-strong); font-size: 16px; font-weight: 600; }
.market-block p { max-width: 68ch; margin: 0; color: var(--text); font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.market-commands { display: grid; gap: 8px; }
.market-command { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; width: 100%; padding: 12px 16px; border: 0; border-radius: 14px; background: var(--surface-soft); color: var(--text-muted); font-size: 13.5px; line-height: 1.45; text-align: left; transition: background-color .15s; }
.market-command:hover { background: var(--hover); }
.market-command code { padding: 0; background: none; color: var(--token, var(--text-strong)); font: 500 13.5px var(--mono); }
.market-command span { flex: 1 1 240px; min-width: 0; }
.market-facts { margin: 0; padding: 6px 20px; border-radius: 20px; background: var(--surface-soft); }
.market-facts > div { padding: 13px 0; }
.market-facts > div + div { border-top: 1px solid var(--border); }
.market-facts dt { color: var(--text-faint); font-size: 12.5px; }
.market-facts dd { margin: 3px 0 0; color: var(--text); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.market-facts a { color: inherit; text-underline-offset: 3px; }

@media (pointer: coarse), (max-width: 860px) { .market-search input { font-size: 16px; } } /* iOS yakınlaştırmasın */
@container market (max-width: 860px) {
  .market-columns { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
@container market (max-width: 640px) {
  .market-inner { padding: 4px 16px 48px; }
  .market-top { padding-top: 12px; }
  .market-shelf { margin: 0 -16px; padding-inline: 0 16px; }
  .market-tabs { align-self: stretch; margin-inline: -16px; padding-inline: 16px; max-width: none; }
  .market-tabs button { min-height: 44px; }
  .market-card { gap: 12px; padding: 14px; }
  .market-add { min-height: 44px; }
  .market-icon:not(.mid):not(.big) { width: 48px; height: 48px; border-radius: 14px; font-size: 19px; }
  .market-back { min-height: 44px; }
  .market-hero { flex-wrap: wrap; gap: 16px; padding: 14px 0 24px; }
  .market-hero .market-icon.big { width: 72px; height: 72px; border-radius: 20px; font-size: 29px; }
  .market-hero-text { flex-basis: calc(100% - 88px); }
  .market-actions { width: 100%; }
  .market-actions button { flex: 1; min-height: 46px; }
}


/* Ses dosyası kartı: oynatıcı kartın altında tam genişlikte */
.file-card.has-media { flex-wrap: wrap; }
.file-card audio { flex: 0 0 calc(100% - 24px); width: calc(100% - 24px); height: 36px; margin: 0 12px 12px; }
.file-card.has-video { max-width: 560px; }
.file-card video { display: block; flex: 0 0 calc(100% - 16px); width: calc(100% - 16px); max-height: 420px; margin: 0 8px 8px; border-radius: var(--r); background: #000; }

/* Ayarlar → Bağlantılar ve Araçlar */
.integrations { display: grid; gap: 10px; }
.integration { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-soft); }
.integration-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.integration-head strong { color: var(--text-strong); font-weight: 600; }
.integration-state { color: var(--text-faint); font-size: 13px; }
.integration-state.ok { color: var(--ok, #3fb950); }
.integration-purpose { color: var(--text-muted); }
.integration-purpose a { color: inherit; }
.integration-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.integration-row input { flex: 1 1 220px; min-width: 0; }
.integration-row .switch-row input { flex: none; }
.login-code { justify-self: start; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text-strong); font: 600 20px/1.2 var(--mono); letter-spacing: .12em; user-select: all; }

/* Ayarlar → Modeller → CLIProxy: şirketler ve model kataloğu */
.cliproxy-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.cliproxy-status .integration-state { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.cliproxy-companies { display: grid; gap: 6px; }
.cliproxy-company { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-soft); }
.cliproxy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; }
.cliproxy-name { display: grid; flex: 1 1 160px; min-width: 0; }
.cliproxy-name strong { color: var(--text-strong); font-weight: 600; }
.cliproxy-name small { color: var(--text-faint); }
.cliproxy-badge { color: var(--text-faint); font-size: 12.5px; white-space: nowrap; }
.cliproxy-badge.connected { color: var(--ok, #3fb950); }
.cliproxy-row .link-btn { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.cliproxy-row .link-btn:hover { color: var(--text-strong); }
.cliproxy-body { display: grid; gap: 6px; padding: 0 12px 10px; }
.cliproxy-models { display: grid; gap: 2px; max-height: 260px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.cliproxy-model { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-items: baseline; width: 100%; padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; transition: background-color .15s; }
.cliproxy-model:hover:not(:disabled) { background: var(--hover); }
.cliproxy-model:disabled { color: var(--text-faint); cursor: default; }
.cliproxy-model-name { overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.cliproxy-model code { grid-column: 1; overflow: hidden; color: var(--text-faint); font: 12px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.cliproxy-model small { grid-column: 2; grid-row: 1; color: var(--text-faint); white-space: nowrap; }
.cliproxy-ok { grid-column: 2; grid-row: 2; justify-self: end; color: var(--ok, #3fb950); font-size: 12px; }
.integration-result:empty { display: none; }
.integration-result.ok { color: var(--ok, #3fb950); }
.integration-result.error { color: var(--err); overflow-wrap: anywhere; }
.tool-toggles { display: grid; gap: 14px; }
.tool-group[hidden], .tool-toggle[hidden] { display: none; }
.tool-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 4px; padding: 0 10px; }
.tool-group-head h4 { margin: 0; color: var(--text-faint); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.tool-group-head .link-btn { color: var(--text-faint); font-size: 12px; }
.tool-group-head .link-btn:hover:not(:disabled) { color: var(--text-strong); }
.tool-group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 8px; }
.tool-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: 12px; cursor: pointer; transition: background-color .15s; }
.tool-toggle:hover { background: var(--hover); }
.tool-toggle-text { display: grid; min-width: 0; font-size: 13.5px; }
.tool-toggle-text small { color: var(--text-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-toggle.unavailable { opacity: .5; }

/* ---------- Ayarlar (Open WebUI düzeni) ---------- */
.settings-dialog { width: min(920px, calc(100vw - 32px)); height: min(700px, calc(100dvh - 48px)); max-height: none; overflow: hidden; }
.settings { display: flex; flex-direction: column; height: 100%; }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 4px 24px; }
.settings-head h2 { margin: 0; color: var(--text-strong); font-size: 18px; font-weight: 600; }
.settings-shell { display: grid; flex: 1; grid-template-columns: 210px minmax(0, 1fr); gap: 0 20px; min-height: 0; padding: 4px 0 0 16px; }

.settings-nav { display: flex; flex-direction: column; gap: 2px; min-height: 0; padding: 4px 0 16px; overflow-y: auto; }
.settings-search { display: flex; align-items: center; gap: 8px; height: 38px; margin-bottom: 6px; padding: 0 10px; border: 1px solid var(--border); border-radius: 12px; color: var(--text-faint); transition: border-color .15s, background-color .15s; }
.settings-search:focus-within { border-color: var(--border-strong); color: var(--text-muted); }
.settings-search .icon { flex-shrink: 0; width: 17px; height: 17px; }
.settings-search input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font-size: 13.5px; outline: none; }
.settings-search input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }
.settings-tabs { display: flex; flex-direction: column; gap: 2px; }
.settings-tab { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 12px; background: none; color: var(--text-faint); font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap; transition: background-color .15s, color .15s; }
.settings-tab .icon { flex-shrink: 0; width: 19px; height: 19px; }
.settings-tab:hover { background: var(--hover); color: var(--text); }
.settings-tab[aria-selected="true"] { background: var(--surface); color: var(--text-strong); }
.settings-tab[hidden] { display: none; }
.settings-tab:focus-visible { outline: 2px solid var(--text-faint); outline-offset: -2px; }
.settings-nomatch { margin: 6px 12px; color: var(--text-faint); font-size: 13px; }

.settings-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.settings-scroll { flex: 1; min-height: 0; padding: 4px 24px 12px 4px; overflow-y: auto; scrollbar-gutter: stable; }
.settings-panel[hidden] { display: none; }
.settings-panel { animation: fade .16s var(--ease) both; }
.settings-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 24px 18px 4px; border-top: 1px solid var(--border); }
.settings-dirty { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 12.5px; }
.settings-dirty::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.settings-dirty[hidden] { display: none; }

.set-group { padding: 6px 0 20px; }
.set-group + .set-group { padding-top: 18px; border-top: 1px solid var(--border); }
.set-group[hidden] { display: none; }
.set-title { margin: 0 0 6px; color: var(--text-strong); font-size: 14px; font-weight: 600; }
.set-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.set-count { color: var(--text-faint); font-size: 12.5px; }
.set-note { margin: 0 0 12px; color: var(--text-faint); font-size: 12.5px; line-height: 1.5; }
.set-note[hidden] { display: none; }
.set-group > .field + .field, .set-group > .set-row + .field, .set-group > .field + .set-row { margin-top: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 52px; padding: 8px 0; }
label.set-row { cursor: pointer; }
.set-row.stack { flex-direction: column; align-items: stretch; gap: 10px; }
.set-text { display: grid; flex: 1; gap: 2px; min-width: 0; }
.set-label { color: var(--text); font-size: 14px; font-weight: 500; }
.set-text small { color: var(--text-faint); font-size: 12.5px; line-height: 1.45; }
.set-control { display: flex; flex-shrink: 0; justify-content: flex-end; width: min(240px, 45%); }
.set-control .themed-select { border-radius: 10px; }

/* Anahtar (switch): gerçek onay kutusu görünmez ama odaklanabilir ve tıklanabilir kalır. */
.toggle { position: relative; display: inline-flex; flex-shrink: 0; }
.toggle input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.toggle input:disabled { cursor: not-allowed; }
.toggle .switch { width: 36px; height: 20px; }
.toggle .switch::after { width: 16px; height: 16px; }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { background: var(--accent-ink); transform: translateX(16px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--text-faint); outline-offset: 2px; }
.toggle input:disabled + .switch { opacity: .45; }

.theme-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.theme-card { position: relative; display: grid; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.theme-card:hover { background: var(--hover); }
.theme-card:has(input:checked) { border-color: var(--text-strong); background: var(--hover); }
.theme-card:has(input:focus-visible) { outline: 2px solid var(--text-faint); outline-offset: 2px; }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card .theme-swatch { width: 100%; height: 54px; border-radius: 9px; }
.theme-card .theme-swatch i { top: 9px; right: 9px; width: 46%; height: 9px; }
.theme-card .theme-swatch::after { left: 9px; bottom: 9px; width: 12px; height: 12px; }
.theme-card-name { display: grid; gap: 1px; min-width: 0; }
.theme-card-name strong { color: var(--text-strong); font-size: 13px; font-weight: 500; }
.theme-card-name small { overflow: hidden; color: var(--text-faint); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

.provider-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.provider-pills .tab { gap: 7px; min-height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
.provider-pills .tab[aria-selected="true"] { border-color: var(--border-strong); background: var(--surface); }
.provider-pills .tab .dot { order: -1; }
.provider-panels .panel { gap: 14px; }

.inline-search { margin: 0 0 12px; }
.memory-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.secondary.danger { color: var(--err); }
.field-foot .link-btn { flex-shrink: 0; font-size: 12.5px; }

.about-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.about-head .brand-mark { width: 40px; height: 40px; }
.about-head div { display: grid; gap: 2px; }
.about-head strong { color: var(--text-strong); font-size: 16px; font-weight: 600; }
.about-head small { color: var(--text-faint); font-size: 12.5px; }
.about-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; margin: 0; font-size: 13.5px; }
.about-list dt { color: var(--text-faint); }
.about-list dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.about-list a { color: var(--text-strong); }

@media (max-width: 720px) {
  .settings-dialog { width: 100vw; max-width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .settings-head { padding: 12px 10px 4px 16px; }
  .settings-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); padding: 0; }
  .settings-nav { padding: 4px 16px 8px; overflow: visible; }
  .settings-tabs { flex-direction: row; gap: 4px; margin: 0 -16px; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; }
  .settings-tab { min-height: 40px; padding: 0 12px; }
  .settings-scroll { padding: 4px 16px 12px; }
  .settings-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
  .theme-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set-row:has(.set-control) { flex-wrap: wrap; }
  .set-control { width: 100%; }
  .tool-group-list { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Bağlam göstergesi (effort seçicisinin solunda) ---------- */
.context-ring { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-muted); transition: background-color .15s; }
.context-ring:hover, .context-ring:focus-visible { background: var(--hover); outline: none; }
.context-ring[hidden] { display: none; }
.context-ring svg { width: 19px; height: 19px; transform: rotate(-90deg); overflow: visible; }
.context-ring circle { fill: none; stroke-width: 2.6; }
.ring-track { stroke: var(--surface); }
.context-ring:hover .ring-track { stroke: var(--border-strong); }
.ring-fill { stroke: var(--text-muted); stroke-dasharray: 0 100; stroke-linecap: round; transition: stroke-dasharray .4s var(--ease), stroke .2s; }
.context-ring[data-level="warn"] .ring-fill { stroke: var(--warn); }
.context-ring[data-level="high"] .ring-fill { stroke: var(--err); }
.context-ring.unknown .ring-track { stroke-dasharray: 2.2 3.1; stroke: var(--border-strong); }
.context-pop { position: fixed; inset: auto; width: min(312px, calc(100vw - 16px)); margin: 0; padding: 14px 16px 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--popover); color: var(--text); box-shadow: var(--shadow); font-size: 13px; overflow: hidden auto; }
.context-pop:popover-open { animation: rise .16s var(--ease) both; }
.ctx-title { display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.ctx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.ctx-pct { color: var(--text-strong); font-size: 14px; font-weight: 600; }
.ctx-pct.warn { color: var(--warn); }
.ctx-pct.high { color: var(--err); }
.ctx-nums { color: var(--text-strong); }
/* Parçalı çubuk: her kalem kendi renginde; renkler aşağıdaki satırların kareleriyle aynıdır. */
.ctx-bar { display: flex; gap: 2px; height: 6px; margin: 9px 0 12px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.ctx-bar i { flex: 0 1 auto; min-width: 2px; border-radius: 1px; transition: width .3s var(--ease); }
.ctx-bar .c-messages, .ctx-dot.c-messages { background: var(--file-blue); }
.ctx-bar .c-tools, .ctx-dot.c-tools { background: var(--file-orange); }
.ctx-bar .c-system, .ctx-dot.c-system { background: var(--file-teal); }
.ctx-bar .c-rules, .ctx-dot.c-rules { background: var(--file-violet); }
.ctx-bar .c-skills, .ctx-dot.c-skills { background: var(--file-green); }
.ctx-bar .c-memory, .ctx-dot.c-memory { background: var(--file-red); }
.ctx-bar .c-since, .ctx-dot.c-since { background: var(--text-faint); }
.ctx-auto { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.ctx-auto span:last-child { color: var(--text-muted); }
.ctx-note { margin: 0; color: var(--text-faint); font-size: 12px; line-height: 1.5; }
.ctx-rows { display: grid; margin: 10px -8px 0; }
.ctx-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 52px; align-items: center; gap: 10px; width: 100%; padding: 4px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted); font: inherit; text-align: left; }
.ctx-dot { width: 10px; height: 10px; border-radius: 3px; }
.ctx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-tokens { color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.ctx-share { color: var(--text-strong); text-align: right; font-variant-numeric: tabular-nums; }
.ctx-row.more { cursor: pointer; transition: background-color .15s; }
.ctx-row.more:hover, .ctx-row.more:focus-visible { background: var(--hover); outline: none; }
.ctx-row.more .ctx-name { text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--text-faint); }
.ctx-items { display: grid; gap: 1px; max-height: 180px; margin: 2px 8px 6px 28px; padding-left: 10px; border-left: 1px solid var(--border); overflow: hidden auto; font-size: 12px; }
.ctx-item { display: flex; justify-content: space-between; gap: 12px; padding: 2px 8px 2px 0; color: var(--text-faint); }
.ctx-item .ctx-tokens { color: var(--text-faint); }
.ctx-foot { margin: 8px 0 0; color: var(--text-faint); font-size: 11.5px; }
@keyframes fade { from { opacity: 0; } }
.integration-row input { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); font-size: 13.5px; transition: border-color .15s; }
.integration-row input:focus { border-color: var(--border-strong); outline: none; }
.integration-row input:disabled { opacity: .55; }
.provider-panels + .set-note { margin-top: 14px; }
@media (pointer: coarse), (max-width: 860px) {
  .context-ring { width: 44px; height: 44px; }
}

/* ---------- Ayarlar → Kullanım ---------- */
.set-title-row .link-btn { color: var(--text-faint); font-size: 12.5px; }
.set-title-row .link-btn:hover { color: var(--text-strong); }
.balance-list { display: grid; }
.balance-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 8px 0; }
.balance-row + .balance-row { border-top: 1px solid var(--border); }
.balance-row.missing .set-label { color: var(--text-muted); }
.balance-value { display: grid; justify-items: end; flex-shrink: 0; gap: 1px; text-align: right; }
.balance-value strong { color: var(--text-strong); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance-value small { color: var(--text-faint); font-size: 12px; }
.balance-value.muted { color: var(--text-faint); }
.balance-link { display: inline-flex; flex-shrink: 0; align-items: center; gap: 5px; color: var(--text-muted); font-size: 13px; text-decoration: none; }
.balance-link:hover { color: var(--text-strong); }
.balance-link .icon { width: 14px; height: 14px; }
.error-text { color: var(--err) !important; }

.segmented { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 999px; }
.segmented button { min-height: 26px; padding: 0 11px; border: 0; border-radius: 999px; background: none; color: var(--text-faint); font-size: 12.5px; transition: background-color .15s, color .15s; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text-strong); }

.usage-body { display: grid; gap: 16px; }
.usage-empty { margin: 4px 0; padding: 22px; border: 1px dashed var(--border); border-radius: var(--r-lg); color: var(--text-faint); font-size: 13.5px; text-align: center; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat-tile { display: grid; align-content: start; gap: 3px; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); }
.stat-tile small { color: var(--text-faint); font-size: 12px; }
.stat-tile strong { overflow: hidden; color: var(--text-strong); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.stat-tile span { overflow: hidden; color: var(--text-faint); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

.usage-chart { margin: 0; }
.usage-chart figcaption { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; color: var(--text-muted); font-size: 12.5px; }
.usage-chart figcaption small { color: var(--text-faint); font-size: 11.5px; }
.bar-wrap { position: relative; }
.bar-plot { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); align-items: end; height: 120px; border-bottom: 1px solid var(--border); background: linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 100% 50%; }
.bar-col { display: flex; align-items: flex-end; justify-content: center; height: 100%; padding: 0 1px; outline: none; cursor: default; }
.bar-col i { display: block; width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--text-muted); transition: background-color .15s; }
.bar-col:hover i, .bar-col:focus-visible i { background: var(--text-strong); }
.bar-col:focus-visible { box-shadow: inset 0 0 0 1px var(--border-strong); border-radius: 4px; }
.chart-tip { position: absolute; bottom: calc(100% + 6px); z-index: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--popover); color: var(--text); box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
.chart-tip[hidden] { display: none; }
.bar-axis { display: flex; justify-content: space-between; margin-top: 5px; color: var(--text-faint); font-size: 11.5px; }

.usage-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.usage-table th { padding: 0 8px 6px; border-bottom: 1px solid var(--border); color: var(--text-faint); font-size: 12px; font-weight: 500; text-align: right; }
.usage-table td { padding: 8px; border-bottom: 1px solid var(--border); color: var(--text); text-align: right; white-space: nowrap; }
.usage-table th:first-child, .usage-table td:first-child { padding-left: 0; text-align: left; }
.usage-table th:last-child, .usage-table td:last-child { padding-right: 0; }
.usage-table tr:last-child td { border-bottom: 0; }
.model-cell { display: grid; min-width: 0; max-width: 260px; }
.model-cell strong { overflow: hidden; font-weight: 500; text-overflow: ellipsis; }
.model-cell small { color: var(--text-faint); font-size: 11.5px; }
.usage-more { display: inline-flex; align-items: center; gap: 6px; justify-self: start; color: var(--text-muted); font-size: 13px; text-decoration: none; }
.usage-more:hover { color: var(--text-strong); }
.usage-more .icon { width: 14px; height: 14px; }

@media (max-width: 720px) {
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set-title-row:has(.segmented) { flex-wrap: wrap; align-items: center; }
  .model-cell { max-width: 150px; }
}
.balance-missing { margin: 8px 0 0; color: var(--text-faint); font-size: 12.5px; }

/* Otonomlar: video üretim hattı sayfası (web/src/pages/otonom). Tasarım dili Ajanlar / Zamanlanmış görevler ile aynı. */
.otonom-inner { display: grid; gap: 14px; align-content: start; }
.otonom-inner h1 { margin-bottom: 0; }
.otonom-inner h2 { margin: 0; color: var(--text-strong); font-size: 17px; font-weight: 500; }
.otonom-inner h3, .otonom-inner h4 { margin: 0; color: var(--text-strong); font-weight: 500; }
.otonom-inner h3 { font-size: 15px; }
.otonom-inner h4 { font-size: 13.5px; }
.otonom-lead { margin: 0; max-width: 70ch; font-size: 14px; line-height: 1.55; }
.otonom-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.otonom-error { margin: 0; padding: 10px 14px; border-radius: var(--r); background: var(--err-soft); color: var(--err); font-size: 13.5px; }
.otonom-note { margin: 0; font-size: 12.5px; }
.otonom-sub { margin-top: 10px; }
.otonom-form { display: grid; gap: 14px; max-width: 720px; min-width: 0; margin: 0; padding: 0; border: 0; }
.otonom-form .field.check { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.otonom-form .field.check small { grid-column: 2; }
.otonom-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.otonom-actions .muted { font-size: 13px; }

.otonom-list { display: grid; gap: 8px; }
.otonom-row { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); transition: background-color .15s; }
.otonom-row:hover { background: var(--hover); }
.otonom-row-main { display: grid; flex: 1; gap: 6px; min-width: 0; padding: 14px 16px; border: 0; background: none; color: inherit; text-align: left; }
.otonom-row-title { display: flex; align-items: center; gap: 8px; color: var(--text-strong); font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.otonom-row-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-faint); font-size: 12.5px; }
.otonom-row .icon-btn { margin-right: 8px; }

.chip.otonom-status.running { color: var(--warn); }
.chip.otonom-status.approval { color: var(--warn); background: var(--err-soft); }
.chip.otonom-status.done { color: #4ade80; }
.chip.otonom-status.error { color: var(--err); }

.otonom-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin: 0; }
.otonom-facts > div { min-width: 0; }
.otonom-facts dt { color: var(--text-faint); font-size: 12px; }
.otonom-facts dd { margin: 2px 0 0; color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.otonom-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.otonom-summary .warn { color: var(--warn); }

.otonom-failure { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--err); border-radius: var(--r-lg); background: var(--err-soft); }
.otonom-failure p { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.otonom-failure .primary { justify-self: start; margin-top: 4px; }

.otonom-stop, .otonom-package { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); min-width: 0; }
.otonom-stop > p, .otonom-package > p { margin: 0; font-size: 13.5px; line-height: 1.55; }

.otonom-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.otonom-step { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); min-width: 0; }
.otonom-step.current { border-color: var(--border-strong); }
.otonom-step-head { display: flex; align-items: center; gap: 10px; }
.otonom-step-no { display: inline-grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); color: var(--text-muted); font-size: 12px; }
.otonom-step-title { display: grid; flex: 1; min-width: 0; }
.otonom-step-title .muted { font-size: 12.5px; }
.otonom-step-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--text-faint); font-size: 12.5px; }
.otonom-progress { display: grid; gap: 4px; font-size: 13px; color: var(--text-muted); }
.otonom-progress progress { width: 100%; height: 6px; accent-color: var(--accent); }
.otonom-await { margin: 0; color: var(--warn); font-size: 13px; }
.otonom-step > .link-btn { justify-self: start; padding: 2px 0; }
.otonom-output { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); min-width: 0; }
.otonom-plain { display: grid; gap: 6px; margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.5; }
.otonom-pre { margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--surface); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; }
.otonom-log { font-size: 12.5px; }
.otonom-log ul { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }

.otonom-sources { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.otonom-sources > li { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.otonom-sources > li.off { opacity: .55; }
.otonom-source-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.otonom-source-head input { accent-color: var(--accent); }
.otonom-source-title { color: var(--text-strong); font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.otonom-source-meta { display: grid; gap: 2px; color: var(--text-faint); font-size: 12.5px; overflow-wrap: anywhere; }
.otonom-source-meta a, .otonom-claims a { color: var(--token); }
.otonom-source-summary { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.otonom-sources .link-btn { justify-self: start; padding: 2px 0; }
.otonom-passages { display: grid; gap: 6px; margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.otonom-passages code, .otonom-log code { color: var(--text-faint); font-size: 11.5px; }
.otonom-skipped { font-size: 12.5px; color: var(--text-muted); }
.otonom-skipped ul { display: grid; gap: 4px; margin: 6px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
.otonom-add { display: flex; align-items: flex-start; gap: 10px; }
.otonom-add .secondary { margin-top: 26px; }
.otonom-add .field { flex: 1; min-width: 0; }

.otonom-script { display: grid; gap: 18px; max-height: 70vh; overflow-y: auto; padding-right: 6px; }
.otonom-section { display: grid; gap: 10px; }
.otonom-para { display: block; margin: 0; font-size: 14.5px; line-height: 1.75; }
.otonom-inline { display: inline; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: text; border-radius: 3px; }
.otonom-inline:hover { background: var(--hover); }
.otonom-sentence { display: grid; gap: 8px; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); line-height: 1.6; }
.otonom-sentence.flagged { border-color: var(--warn); }
.otonom-sentence.decided { border-color: var(--border); opacity: .9; }
.otonom-sentence textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); font: inherit; resize: vertical; }
.otonom-struck { text-decoration: line-through; color: var(--text-faint); }
.otonom-sentence-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.otonom-sentence-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.otonom-sentence-actions .secondary { padding: 5px 12px; font-size: 13px; }
.otonom-pending { color: var(--warn); font-size: 12.5px; font-weight: 500; }
.otonom-note-text { color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }
.otonom-claims { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.otonom-claims > li { display: grid; gap: 4px; justify-items: start; font-size: 13px; }
.otonom-claim { color: var(--text-strong); }
.otonom-claims blockquote { justify-self: stretch; margin: 0; padding: 6px 12px; border-left: 2px solid var(--border-strong); color: var(--text-muted); font-size: 12.5px; line-height: 1.55; }
.otonom-claims cite { display: block; margin-top: 4px; color: var(--text-faint); font-style: normal; font-size: 12px; }
.otonom-label { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface); font-size: 12px; white-space: nowrap; }
.otonom-label.ok { color: #4ade80; }
.otonom-label.warn { color: var(--warn); }
.otonom-label.bad { color: var(--err); }
.otonom-label.none { color: var(--text-faint); }
.otonom-scenes { font-size: 12.5px; color: var(--text-muted); }
.otonom-scenes textarea { display: block; width: 100%; margin: 8px 0 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); font: inherit; font-size: 13px; resize: vertical; }

.otonom-video { display: block; width: 100%; max-height: 62vh; border-radius: var(--r); background: #000; aspect-ratio: 16 / 9; }
.otonom-video.loading { display: grid; place-items: center; color: var(--text-faint); font-size: 13px; }
.otonom-video-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--text-muted); font-size: 13px; }
.otonom-warnings { margin: 0; padding-left: 18px; color: var(--warn); font-size: 13px; }
.otonom-warnings:not(ul) { padding-left: 0; line-height: 1.55; }
.otonom-link-btn { display: inline-flex; align-items: center; text-decoration: none; }
.primary.otonom-link-btn { color: var(--accent-ink); }
.secondary.otonom-link-btn { color: var(--text); }
.otonom-youtube { display: grid; gap: 12px; margin-top: 8px; }
.otonom-youtube p { margin: 0; font-size: 13.5px; line-height: 1.55; }
.otonom-howto { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); font-size: 13.5px; line-height: 1.55; }
.otonom-howto summary { cursor: pointer; font-weight: 500; }
.otonom-howto ol { margin: 8px 0; padding-left: 20px; display: grid; gap: 4px; }
.otonom-howto code { overflow-wrap: anywhere; }
.otonom-youtube-result p { margin: 0; }
.otonom-field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.otonom-title-options { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.otonom-option { padding: 4px 12px; border: 1px solid var(--border); background: var(--bg); white-space: normal; text-align: left; cursor: pointer; font-size: 13px; }
.chip.otonom-option.on { border-color: var(--accent); color: var(--text-strong); }
.field small.otonom-over { color: var(--err); font-weight: 500; }
.otonom-covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.otonom-cover-card { display: grid; gap: 8px; align-content: start; padding: 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.otonom-cover-card.on { border-color: var(--accent); }
.otonom-cover { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-sm); background: var(--surface); object-fit: cover; color: var(--text-faint); font-size: 12.5px; }
.otonom-cover-idea { margin: 0; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }
.otonom-cover-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.otonom-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.otonom-thumbs figure { display: grid; gap: 4px; margin: 0; align-content: start; }
.otonom-thumbs img, .otonom-thumb { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-sm); background: var(--surface); object-fit: cover; }
.otonom-thumbs figcaption { color: var(--text-faint); font-size: 11.5px; line-height: 1.4; overflow-wrap: anywhere; }
.otonom-output audio { width: 100%; }

@media (max-width: 720px) {
  .otonom-add { flex-direction: column; align-items: stretch; }
  .otonom-add .secondary { margin-top: 0; }
  .otonom-script { max-height: none; }
}
