/* =====================================================================
   Prisma Chat 1.0.0 — arayüz stilleri
   Harici font/CDN yok: ilk açılış hızlı olsun diye sistem fontları kullanılır.
   ===================================================================== */

:root {
  --bg:          #faf9f7;
  --bg-elev:     #ffffff;
  --sidebar:     #f2f0ec;
  --sidebar-hov: #e8e5df;
  --text:        #23211e;
  --text-soft:   #55504a;
  --muted:       #857f77;
  --line:        #e3dfd8;
  --line-soft:   #edeae4;
  --accent:      #2f6f6b;
  --accent-hov:  #255854;
  --accent-soft: #e4efee;
  --bubble:      #f0eee9;
  --danger:      #b4342b;
  --danger-soft: #fbeae8;
  --warn:        #9a6b12;
  --code-bg:     #f6f4f0;
  --code-head:   #ebe7e0;
  --shadow-sm:   0 1px 2px rgba(35,33,30,.06);
  --shadow-md:   0 6px 24px rgba(35,33,30,.10);
  --shadow-lg:   0 18px 48px rgba(35,33,30,.18);
  --radius:      12px;
  --radius-lg:   18px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg:          #1a1917;
  --bg-elev:     #232120;
  --sidebar:     #141312;
  --sidebar-hov: #262422;
  --text:        #ece8e2;
  --text-soft:   #c3bdb4;
  --muted:       #8d8781;
  --line:        #322f2c;
  --line-soft:   #282523;
  --accent:      #5fb8b0;
  --accent-hov:  #7bcac2;
  --accent-soft: #1f3634;
  --bubble:      #2b2825;
  --danger:      #e88479;
  --danger-soft: #3a2320;
  --warn:        #d7a94c;
  --code-bg:     #1f1e1c;
  --code-head:   #2a2825;
  --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
  --shadow-md:   0 6px 24px rgba(0,0,0,.45);
  --shadow-lg:   0 18px 48px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===================================================== uygulama iskeleti */

.app {
  display: grid;
  grid-template-columns: 274px 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* ===================================================== kenar çubuğu */

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
}

.sidebar-head { padding: 14px 12px 8px; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 6px 12px;
  font-weight: 650;
  letter-spacing: -.01em;
  font-size: 16px;
}
.brand-mark {
  width: 26px; height: 26px; flex: none;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #8a6ad0));
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.brand small { color: var(--muted); font-weight: 500; font-size: 11px; margin-left: 2px; }

.btn-new {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-weight: 550;
  transition: background .12s, border-color .12s;
}
.btn-new:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.search-wrap { position: relative; margin: 10px 0 4px; }
.search-wrap .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input {
  width: 100%;
  padding: 8px 10px 8px 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--sidebar) 60%, var(--bg-elev));
  transition: border-color .12s, background .12s;
}
.search-input:focus { outline: none; border-color: var(--accent); background: var(--bg-elev); }

.chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 12px;
  scrollbar-gutter: stable;
}
.list-label {
  padding: 12px 8px 6px;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.chat-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-soft);
  transition: background .1s;
}
.chat-item:hover { background: var(--sidebar-hov); }
.chat-item.is-active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.chat-item-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}
.chat-item .pin-dot { color: var(--accent); }
.chat-item-menu {
  opacity: 0;
  padding: 3px;
  border-radius: 6px;
  color: var(--muted);
  transition: opacity .1s, background .1s;
}
.chat-item:hover .chat-item-menu,
.chat-item.is-active .chat-item-menu,
.chat-item-menu:focus-visible { opacity: 1; }
.chat-item-menu:hover { background: var(--line); color: var(--text); }

.list-empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 13.5px; }
.list-loading { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.avatar {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650;
}
.who { flex: 1; min-width: 0; line-height: 1.25; }
.who b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 11.5px; color: var(--muted); }
.icon-btn {
  padding: 7px;
  border-radius: 8px;
  color: var(--text-soft);
  transition: background .1s, color .1s;
}
.icon-btn:hover { background: var(--sidebar-hov); color: var(--text); }

/* ===================================================== ana bölüm */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  min-height: 52px;
}
.topbar-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-tag {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.drawer-toggle { display: none; }

/* ===================================================== mesaj akışı */

.thread {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 8px 0 12px;
  overscroll-behavior: contain;
}
@media (prefers-reduced-motion: reduce) { .thread { scroll-behavior: auto; } }

.thread-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

.load-more { display: flex; justify-content: center; padding: 14px 0 4px; }
.load-more button {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 13px;
  color: var(--text-soft);
}
.load-more button:hover { border-color: var(--accent); color: var(--accent); }

.msg { padding: 14px 0; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }

.bubble {
  background: var(--bubble);
  padding: 11px 15px;
  border-radius: var(--radius-lg);
  max-width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg.assistant .body {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.68;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .12s;
}
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg.is-streaming .msg-actions { opacity: 0; pointer-events: none; }
.act {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--muted);
}
.act:hover { background: var(--bubble); color: var(--text); }
.act.danger:hover { background: var(--danger-soft); color: var(--danger); }

.cursor-dot {
  display: inline-block;
  width: 9px; height: 17px;
  vertical-align: -3px;
  margin-left: 2px;
  background: var(--accent);
  border-radius: 2px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor-dot { animation: none; } }

.thinking { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.thinking i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.1s infinite ease-in-out;
}
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

.msg-error {
  margin-top: 8px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 13.5px;
  font-family: var(--sans);
}

/* ------------------------------------------- karşılama ekranı */

.welcome {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  min-height: 55vh;
  text-align: center;
  padding: 32px 20px;
}
.welcome h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -.015em;
  margin: 0 0 8px;
}
.welcome p { color: var(--muted); margin: 0 0 22px; max-width: 460px; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }
.starter {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 13.5px;
  color: var(--text-soft);
  transition: border-color .12s, color .12s;
}
.starter:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------- markdown içeriği */

.body > *:first-child { margin-top: 0; }
.body > *:last-child { margin-bottom: 0; }
.body p { margin: 0 0 14px; }
.body h1, .body h2, .body h3, .body h4 {
  font-family: var(--sans);
  line-height: 1.3;
  margin: 24px 0 10px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.body h1 { font-size: 22px; }
.body h2 { font-size: 19px; }
.body h3 { font-size: 17px; }
.body h4 { font-size: 15.5px; }
.body ul, .body ol { margin: 0 0 14px; padding-left: 26px; }
.body li { margin: 4px 0; }
.body li > ul, .body li > ol { margin: 4px 0; }
.body blockquote {
  margin: 0 0 14px;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line);
  color: var(--text-soft);
}
.body hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.body strong { font-weight: 650; }
.body a { text-decoration: underline; text-underline-offset: 2px; }

.body code {
  font-family: var(--mono);
  font-size: .855em;
  background: var(--code-bg);
  border: 1px solid var(--line-soft);
  padding: .12em .38em;
  border-radius: 5px;
  word-break: break-word;
}

.body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-family: var(--sans);
  font-size: 14px;
  display: block;
  overflow-x: auto;
}
.body th, .body td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; }
.body th { background: var(--code-bg); font-weight: 620; }

/* ------------------------------------------- kod bloğu */

.code-block {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--code-bg);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  background: var(--code-head);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-soft);
  border: 1px solid transparent;
  transition: background .1s, color .1s, border-color .1s;
}
.copy-btn:hover { background: var(--bg-elev); border-color: var(--line); color: var(--text); }
.copy-btn.done { color: var(--accent); }
.code-block pre {
  margin: 0;
  padding: 13px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
}
.code-block pre code { background: none; border: none; padding: 0; font-size: inherit; }

/* ------------------------------------------- ekler */

.files-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; justify-content: flex-end; }
.msg.assistant .files-grid { justify-content: flex-start; }

.file-thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  max-width: 240px;
}
.file-thumb img, .file-thumb video {
  display: block;
  max-width: 240px;
  max-height: 240px;
  width: auto; height: auto;
  cursor: zoom-in;
  background: var(--code-bg);
}
.file-thumb video { cursor: default; }

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  max-width: 280px;
  font-family: var(--sans);
}
.file-card .fi {
  width: 32px; height: 32px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
}
.file-card .fmeta { min-width: 0; line-height: 1.3; }
.file-card .fmeta b { display: block; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fmeta span { font-size: 11.5px; color: var(--muted); }
.file-dl { color: var(--muted); padding: 5px; border-radius: 6px; }
.file-dl:hover { background: var(--bubble); color: var(--text); }

/* ===================================================== yazma kutusu */

.composer-wrap {
  padding: 0 20px 14px;
  background: linear-gradient(to top, var(--bg) 65%, transparent);
}
.composer {
  max-width: 780px;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: border-color .15s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.composer.dragover { border-color: var(--accent); background: var(--accent-soft); }

.pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 12px 0;
}
.pending {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 30px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-size: 12.5px;
  max-width: 220px;
}
.pending img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; flex: none; }
.pending .pi {
  width: 34px; height: 34px; flex: none; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 10px; font-weight: 700;
}
.pending .pn { min-width: 0; }
.pending .pn b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.pending .pn span { color: var(--muted); font-size: 11px; }
.pending .rm {
  position: absolute; top: 4px; right: 4px;
  padding: 3px; border-radius: 5px; color: var(--muted); line-height: 0;
}
.pending .rm:hover { background: var(--bubble); color: var(--danger); }
.pending.uploading { opacity: .65; }
.pending progress { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 3px; width: auto; }

.composer-input {
  width: 100%;
  border: none;
  background: none;
  resize: none;
  padding: 14px 16px 6px;
  max-height: 40vh;
  min-height: 26px;
  outline: none;
  font-size: 15.5px;
  line-height: 1.5;
  display: block;
}
.composer-input::placeholder { color: var(--muted); }

.composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 10px 10px;
}
.composer-bar .spacer { flex: 1; }

.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 13px;
  transition: background .1s;
}
.tool-btn:hover { background: var(--bubble); }

.model-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-soft);
  max-width: 260px;
}
.model-btn:hover { background: var(--bubble); }
.model-btn b { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-btn .eff { color: var(--muted); }

.send-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  transition: background .12s, transform .12s, opacity .12s;
}
.send-btn:hover:not(:disabled) { background: var(--accent-hov); }
.send-btn:disabled { opacity: .35; cursor: not-allowed; }
.send-btn.stop { background: var(--text); }

.composer-hint {
  max-width: 780px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* ===================================================== açılır menüler */

.pop {
  position: fixed;
  z-index: 70;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  animation: pop-in .12s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }

.pop-label {
  padding: 8px 10px 5px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.pop-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  font-size: 13.5px;
  color: var(--text);
}
.pop-item:hover { background: var(--bubble); }
.pop-item.is-active { background: var(--accent-soft); color: var(--accent); }
.pop-item.danger { color: var(--danger); }
.pop-item.danger:hover { background: var(--danger-soft); }
.pop-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item .tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pop-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.pop-search { padding: 6px; position: sticky; top: -6px; background: var(--bg-elev); }
.pop-search input {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg);
}
.pop-search input:focus { outline: none; border-color: var(--accent); }
.pop-empty { padding: 16px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ===================================================== görsel önizleme */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10,9,8,.9);
  display: grid;
  place-items: center;
  padding: 24px;
}
.lightbox img, .lightbox video {
  max-width: 100%;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}
.lightbox-bar {
  position: absolute;
  top: 14px; right: 14px;
  display: flex; gap: 6px;
}
.lightbox-bar button, .lightbox-bar a {
  color: #fff;
  background: rgba(255,255,255,.14);
  padding: 8px;
  border-radius: 9px;
  display: grid; place-items: center;
}
.lightbox-bar button:hover, .lightbox-bar a:hover { background: rgba(255,255,255,.26); }
.lightbox-name {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.75); font-size: 12.5px; max-width: 80%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===================================================== bildirimler */

.toasts {
  position: fixed;
  z-index: 95;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: max-content; max-width: 92vw;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .16s ease-out;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ===================================================== modal */

.modal-back {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20,18,16,.45);
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  background: var(--bg-elev);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  padding: 20px;
}
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.modal input, .modal textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  margin-bottom: 14px;
}
.modal input:focus, .modal textarea:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn {
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 14px;
  font-weight: 500;
}
.btn:hover { background: var(--bubble); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hov); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }

/* ===================================================== duyarlı düzen */

.backdrop { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 290px;
    max-width: 86vw;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .app.drawer-open .sidebar { transform: translateX(0); }

  .backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,13,12,.4);
    z-index: 55;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
  }
  .app.drawer-open .backdrop { opacity: 1; pointer-events: auto; }

  .drawer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 13px;
    color: var(--text-soft);
  }
  .drawer-toggle:hover { background: var(--bubble); }

  .thread-inner, .composer-wrap { padding-left: 12px; padding-right: 12px; }
  .msg.assistant .body { font-size: 16.5px; }
  .composer-input { font-size: 16px; }        /* iOS otomatik yakınlaştırmayı engeller */
  .topbar-tag { display: none; }
  .file-thumb img, .file-thumb video { max-width: 180px; max-height: 180px; }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .app { grid-template-columns: 240px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ===================================================== giriş / ayar sayfaları */

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; margin: 0; flex: 1; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=number], .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

.model-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.model-row:last-child { border-bottom: none; }
.model-row .mid { flex: 1; min-width: 0; }
.model-row .mid b { font-weight: 550; font-size: 14px; }
.model-row .mid span { display: block; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.chip {
  font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--line);
  border-radius: 999px;
  transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform .15s;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.alert {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert.ok { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); }
.alert.err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert.info { background: var(--code-bg); border-color: var(--line); color: var(--text-soft); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
table.data tr:last-child td { border-bottom: none; }

/* giriş ekranı */

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-md);
}
.auth-card .brand { justify-content: center; padding-bottom: 6px; }
.auth-card h1 { font-family: var(--serif); font-weight: 500; font-size: 22px; text-align: center; margin: 0 0 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 4px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); }
