/* MAXTR Mesaj — WhatsApp benzeri arayüz. Mobil öncelikli, açık/koyu mod. */

:root {
  --bg-app: #eae6df;
  --panel: #ffffff;
  --panel-header: #f0f2f5;
  --chat-bg: #efeae2;
  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --text: #111b21;
  --text-2: #667781;
  --text-3: #8696a0;
  --accent: #00a884;
  --accent-strong: #008069;
  --accent-soft: #d9fdd3;
  --tick-blue: #53bdeb;
  --border: #e9edef;
  --hover: #f5f6f6;
  --active: #f0f2f5;
  --danger: #ea0038;
  --warn-bg: #fff3c4;
  --warn-text: #6b5300;
  --unread: #25d366;
  --day-bubble: #ffffff;
  --day-text: #54656f;
  --shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --input-bg: #ffffff;
  --search-bg: #f0f2f5;
  --chip-bg: #f0f2f5;
  --chip-active-bg: #d9fdd3;
  --chip-active-text: #008069;
  --tpl-btn-bg: rgba(11, 20, 26, 0.04);
  --tpl-btn-text: #027eb5;
  --modal-backdrop: rgba(11, 20, 26, 0.45);
  --doodle: rgba(0, 0, 0, 0.035);
  --radius: 7.5px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-app: #0c1317;
    --panel: #111b21;
    --panel-header: #202c33;
    --chat-bg: #0b141a;
    --bubble-out: #005c4b;
    --bubble-in: #202c33;
    --text: #e9edef;
    --text-2: #8696a0;
    --text-3: #8696a0;
    --accent: #00a884;
    --accent-strong: #00a884;
    --accent-soft: #0a332c;
    --border: #222d34;
    --hover: #202c33;
    --active: #2a3942;
    --danger: #f15c6d;
    --warn-bg: #3d3416;
    --warn-text: #f5d76e;
    --day-bubble: #182229;
    --day-text: #8696a0;
    --shadow: 0 1px 0.5px rgba(11, 20, 26, 0.5);
    --input-bg: #2a3942;
    --search-bg: #202c33;
    --chip-bg: #202c33;
    --chip-active-bg: #0a332c;
    --chip-active-text: #00a884;
    --tpl-btn-bg: rgba(255, 255, 255, 0.05);
    --tpl-btn-text: #53bdeb;
    --modal-backdrop: rgba(0, 0, 0, 0.6);
    --doodle: rgba(255, 255, 255, 0.025);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
  background: var(--panel);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--accent-strong); }
button { font: inherit; color: inherit; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--text-2);
  cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--active); }

.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Avatar ───────────────────────────────────────────────────────────── */
.avatar {
  flex: none; width: 49px; height: 49px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 18px; letter-spacing: 0.3px;
  background: #dfe5e7; overflow: hidden; user-select: none;
}
.avatar svg { width: 100%; height: 100%; }
.avatar-sm { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
.avatar-xl { width: 120px; height: 120px; font-size: 44px; }
@media (prefers-color-scheme: dark) { .avatar { background-color: #6a7175; } }

/* ── Uygulama düzeni ──────────────────────────────────────────────────── */
.app-page { overflow: hidden; background: var(--bg-app); }
.app {
  position: fixed; inset: 0;
  display: flex;
  background: var(--panel);
}
.sidebar {
  display: flex; flex-direction: column;
  width: 100%; min-width: 0; height: 100%;
  background: var(--panel);
}
.chat {
  display: none; flex-direction: column; flex: 1; min-width: 0; height: 100%;
  position: relative; background: var(--chat-bg);
}
.chat-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.chat-open .sidebar { display: none; }
.chat-open .chat { display: flex; }

@media (min-width: 900px) {
  .app-page .app { inset: 0; max-width: 1700px; margin: 0 auto; box-shadow: 0 6px 18px rgba(11,20,26,.05); }
  .sidebar { width: 30%; min-width: 340px; max-width: 440px; border-right: 1px solid var(--border); }
  .chat, .chat-open .chat { display: flex; }
  .chat-open .sidebar { display: flex; }
  .back-btn { display: none !important; }
}

/* ── Kenar çubuğu ─────────────────────────────────────────────────────── */
.side-header, .chat-header, .info-header, .page-header {
  display: flex; align-items: center; gap: 8px;
  min-height: 59px; padding: 8px 12px 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--panel-header); flex: none;
}
.side-title { font-size: 22px; font-weight: 700; margin: 0; flex: 1; }
@media (min-width: 900px) { .side-title { font-size: 19px; } }
.header-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.push-banner {
  display: flex; align-items: center; gap: 14px; text-align: left;
  border: 0; width: 100%; padding: 14px 16px; cursor: pointer;
  background: #53bdeb; color: #fff;
}
.push-banner-icon {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #53bdeb;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}

.search-wrap { padding: 8px 12px 6px; border-bottom: 1px solid var(--border); flex: none; }
.search {
  display: flex; align-items: center; gap: 12px;
  background: var(--search-bg); border-radius: 8px; padding: 0 12px; height: 36px; color: var(--text-2);
}
.search input {
  flex: 1; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 15px; height: 100%; min-width: 0;
}
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.filters { display: flex; gap: 8px; padding: 10px 0 4px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  border: 0; border-radius: 16px; padding: 6px 12px; cursor: pointer; white-space: nowrap;
  background: var(--chip-bg); color: var(--text-2); font-size: 14px;
}
.chip.active { background: var(--chip-active-bg); color: var(--chip-active-text); font-weight: 600; }

.chat-list {
  list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom);
}
.chat-item {
  display: flex; align-items: center; gap: 13px; padding: 0 0 0 13px;
  cursor: pointer; text-decoration: none; color: inherit;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item-main {
  flex: 1; min-width: 0; padding: 12px 15px 12px 0;
  border-bottom: 1px solid var(--border);
}
.chat-item-row { display: flex; align-items: baseline; gap: 6px; }
.chat-item-name {
  flex: 1; min-width: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item-time { font-size: 12px; color: var(--text-2); flex: none; }
.chat-item.unread .chat-item-time { color: var(--unread); font-weight: 600; }
.chat-item-preview {
  flex: 1; min-width: 0; color: var(--text-2); font-size: 14px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 3px;
}
.chat-item-preview .preview-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-badges { display: flex; gap: 6px; align-items: center; flex: none; margin-top: 2px; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--unread); color: #fff; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
@media (prefers-color-scheme: dark) { .badge { color: #111b21; } }
.window-dot {
  font-size: 11px; color: var(--accent-strong); background: var(--accent-soft);
  padding: 1px 6px; border-radius: 8px; white-space: nowrap;
}
.list-empty, .list-loading { padding: 32px 16px; text-align: center; }

/* ── Sohbet başlığı ───────────────────────────────────────────────────── */
.chat-header { padding-left: 4px; gap: 4px; border-left: 1px solid var(--border); }
@media (min-width: 900px) { .chat-header { padding-left: 16px; } }
.chat-title {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  border: 0; background: none; padding: 0; text-align: left; cursor: pointer;
}
.chat-title .avatar { width: 40px; height: 40px; font-size: 15px; }
.chat-title-text { display: flex; flex-direction: column; min-width: 0; }
.chat-name { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 899px) {
  .chat-sub { white-space: normal; line-height: 16px; }
  .chat-sub .chat-sep { display: none; }
  .chat-sub .chat-phone, .chat-sub .window-open, .chat-sub .window-closed {
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}
.bubble.loc-only .location { margin-bottom: 16px; }
.chat-sub .window-open { color: var(--accent-strong); }
.chat-sub .window-closed { color: var(--danger); }

/* ── Mesaj alanı ──────────────────────────────────────────────────────── */
.messages {
  flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;
  padding: 8px 4% 8px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background-color: var(--chat-bg);
  background-image:
    radial-gradient(var(--doodle) 1.2px, transparent 1.3px),
    radial-gradient(var(--doodle) 1.2px, transparent 1.3px);
  background-size: 26px 26px;
  background-position: 0 0, 13px 13px;
}
@media (min-width: 900px) { .messages { padding: 12px 7% 8px; } }
.older-loader { text-align: center; padding: 8px; }
.message-list { display: flex; flex-direction: column; }

.day-sep { display: flex; justify-content: center; margin: 10px 0 8px; position: sticky; top: 4px; z-index: 2; }
.day-sep span {
  background: var(--day-bubble); color: var(--day-text); font-size: 12.5px;
  padding: 5px 12px; border-radius: 7.5px; box-shadow: var(--shadow); text-transform: none;
}

.row { display: flex; margin-top: 2px; }
.row.first { margin-top: 10px; }
.row.out { justify-content: flex-end; }
.row.in { justify-content: flex-start; }

.bubble {
  position: relative; max-width: min(85%, 560px); min-width: 80px;
  padding: 6px 7px 8px 9px; border-radius: var(--radius);
  box-shadow: var(--shadow); word-wrap: break-word; overflow-wrap: anywhere;
  font-size: 14.5px; line-height: 19px; cursor: default;
  -webkit-user-select: text; user-select: text;
}
@media (min-width: 900px) { .bubble { max-width: min(65%, 560px); } }
.row.out .bubble { background: var(--bubble-out); }
.row.in .bubble { background: var(--bubble-in); }
.row.out .bubble.clickable { cursor: pointer; }
.row.first.out .bubble { border-top-right-radius: 0; }
.row.first.in .bubble { border-top-left-radius: 0; }
.row.first .bubble::before {
  content: ""; position: absolute; top: 0; width: 8px; height: 13px;
}
.row.first.out .bubble::before {
  right: -8px; background: var(--bubble-out);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.row.first.in .bubble::before {
  left: -8px; background: var(--bubble-in);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.bubble.has-media { padding: 3px 3px 6px; }
.bubble.has-media .text, .bubble.has-media .tpl-label, .bubble.has-media .note { padding: 0 5px; }

.tpl-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--text-2); margin-bottom: 3px; font-weight: 500;
}
.tpl-label svg { flex: none; }
.source-label { font-size: 11.5px; color: var(--text-2); margin-bottom: 2px; }
.tpl-header-text { font-weight: 700; margin-bottom: 4px; }
.tpl-footer { font-size: 13px; color: var(--text-2); margin-top: 4px; }

.text { white-space: pre-wrap; }
.text a { color: var(--tpl-btn-text); }
/* Saat/tik için yer ayıran görünmez boşluk (WhatsApp tekniği) */
.meta-spacer { display: inline-block; width: 70px; height: 1px; vertical-align: bottom; }
.row.in .meta-spacer { width: 46px; }
.bubble-content { position: relative; }
.meta {
  position: absolute; right: -2px; bottom: -5px;
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-2); white-space: nowrap; line-height: 15px;
}
.bubble.media-only .meta {
  color: #fff; background: rgba(11,20,26,.35); border-radius: 10px; padding: 0 5px; right: 5px; bottom: 6px;
}
.bubble.media-only .tick.read { color: #8fd8ff; }
@media (pointer: coarse) {
  /* Uzun basma kanıt görünümünü açar; iOS menüsü çıkmasın */
  .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}
.tick { display: inline-flex; width: 16px; height: 15px; }
.tick svg { width: 16px; height: 15px; }
.tick.read { color: var(--tick-blue); }
.tick.failed { color: var(--danger); width: 15px; }
.tick.pending { width: 14px; }

.pending-body { font-style: italic; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.pending-body .spinner { width: 14px; height: 14px; border-width: 2px; }

.note {
  font-size: 11.5px; line-height: 15px; margin-top: 4px; color: var(--warn-text);
  background: var(--warn-bg); border-radius: 5px; padding: 3px 6px; display: inline-block;
}
.error-line { font-size: 12px; color: var(--danger); margin-top: 3px; display: flex; gap: 4px; align-items: center; }

.reaction {
  position: absolute; bottom: -14px; font-size: 14px; line-height: 1;
  background: var(--bubble-in); border-radius: 12px; padding: 3px 5px;
  box-shadow: 0 1px 3px rgba(11,20,26,.2); z-index: 1;
}
.row.out .reaction { right: 10px; }
.row.in .reaction { left: 10px; }
.row.has-reaction { margin-bottom: 14px; }

/* Template butonları: WhatsApp'taki gibi balonun altında satırlar */
.tpl-buttons { display: flex; flex-direction: column; margin: 6px -7px -8px -9px; border-top: 1px solid rgba(134,150,160,.2); }
.bubble.has-media .tpl-buttons { margin: 6px -3px -6px; }
.tpl-button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 8px; font-size: 14px; color: var(--tpl-btn-text);
  background: var(--tpl-btn-bg);
  border-top: 1px solid rgba(134,150,160,.15);
}
.tpl-button:first-child { border-top: 0; }
.tpl-button:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }

/* Medya */
.media-box { position: relative; border-radius: 6px; overflow: hidden; margin-bottom: 3px; background: rgba(11,20,26,.06); }
.media-box { max-width: 330px; }
.media-box img, .media-box video { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.tpl-media .media-box { max-width: none; }
.media-box img { cursor: zoom-in; min-height: 80px; }
.tpl-media .media-box img, .tpl-media .media-box video { max-height: 160px; }
.sticker img { width: 150px; height: 150px; object-fit: contain; background: transparent; cursor: default; }
.bubble.sticker-bubble { background: transparent !important; box-shadow: none; }
.bubble.sticker-bubble::before { display: none; }
.audio-player { width: 260px; max-width: 100%; height: 40px; display: block; margin: 2px 0 4px; }
.doc {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px;
  background: rgba(11,20,26,.05); color: inherit; text-decoration: none; margin-bottom: 4px; min-width: 220px;
}
@media (prefers-color-scheme: dark) { .doc, .media-box { background: rgba(255,255,255,.05); } }
.doc-icon {
  width: 34px; height: 40px; border-radius: 4px; background: #e34b4b; color: #fff; flex: none;
  display: flex; align-items: flex-end; justify-content: center; font-size: 9px; font-weight: 700; padding-bottom: 5px;
}
.doc-icon.word { background: #2b579a; }
.doc-icon.excel { background: #217346; }
.doc-icon.other { background: #8696a0; }
.doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.media-missing {
  display: flex; align-items: center; gap: 8px; padding: 12px 10px; font-size: 13px;
  color: var(--text-2); font-style: italic; background: rgba(11,20,26,.04); border-radius: 6px; margin-bottom: 4px;
}
.location {
  display: block; text-decoration: none; color: inherit; border-radius: 6px; overflow: hidden; margin-bottom: 4px;
  background: rgba(11,20,26,.05); min-width: 230px;
}
.location-map {
  height: 110px; display: flex; align-items: center; justify-content: center; font-size: 34px;
  background:
    linear-gradient(90deg, rgba(0,168,132,.12) 1px, transparent 1px) 0 0/22px 22px,
    linear-gradient(rgba(0,168,132,.12) 1px, transparent 1px) 0 0/22px 22px,
    #e6efe9;
}
@media (prefers-color-scheme: dark) { .location-map { background-color: #1d2a30; } }
.location-name { padding: 7px 9px; font-size: 14px; color: var(--tpl-btn-text); }
.unsupported { font-style: italic; color: var(--text-2); }

.scroll-down {
  position: absolute; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--panel); color: var(--text-2); box-shadow: 0 1px 3px rgba(11,20,26,.25); z-index: 5;
  display: flex; align-items: center; justify-content: center;
}
.scroll-down-badge {
  position: absolute; top: -6px; right: -4px; background: var(--unread); color: #fff;
  font-size: 11px; border-radius: 10px; min-width: 20px; height: 20px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Yazma alanı ──────────────────────────────────────────────────────── */
.composer {
  flex: none; background: var(--panel-header);
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
}
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.attach-btn { margin-bottom: 2px; }
#composer-input {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0;
  background: var(--input-bg); color: var(--text);
  border-radius: 21px; padding: 10px 14px; font: inherit; font-size: 16px; line-height: 21px;
  max-height: 140px; min-height: 42px;
}
.send-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.send-btn:disabled { opacity: 0.45; cursor: default; }
.send-btn svg { margin-left: 3px; }
.composer-locked {
  display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  color: var(--text-2); font-size: 14px; padding: 12px 10px;
}
.attachment-preview {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px; font-size: 14px;
}
.attachment-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Karşılama ekranı ─────────────────────────────────────────────────── */
.chat-intro {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px; background: var(--panel-header); border-bottom: 6px solid var(--accent);
}
.chat-intro h2 { font-weight: 300; font-size: 30px; margin: 20px 0 8px; }
.chat-intro img { border-radius: 24px; opacity: .9; }

/* ── Bilgi paneli ─────────────────────────────────────────────────────── */
.info-panel {
  position: fixed; inset: 0; z-index: 30; background: var(--panel-header);
  display: flex; flex-direction: column;
}
@media (min-width: 900px) {
  .info-panel { position: static; width: 380px; flex: none; border-left: 1px solid var(--border); }
}
.info-header h2 { font-size: 16px; font-weight: 500; margin: 0; }
.info-body { flex: 1; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
.info-hero {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--panel); padding: 28px 16px 20px; margin-bottom: 10px; text-align: center;
}
.info-hero .avatar { margin-bottom: 12px; }
.info-hero-name { font-size: 22px; }
.info-hero-phone { color: var(--text-2); font-size: 16px; }
.info-section { background: var(--panel); padding: 14px 20px; margin-bottom: 10px; }
.info-section h3 { font-size: 14px; color: var(--text-2); font-weight: 400; margin: 0 0 10px; }
.res-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.res-card:last-child { margin-bottom: 0; }
.res-ref { font-weight: 600; font-size: 16px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.res-tag { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); }
.res-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.res-grid dt { color: var(--text-2); }
.res-grid dd { margin: 0; overflow-wrap: anywhere; }

/* ── Modal (kanıt) ────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 50; background: var(--modal-backdrop);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .modal { align-items: center; } }
.modal-card {
  background: var(--panel); width: 100%; max-width: 560px; max-height: 92dvh;
  border-radius: 14px 14px 0 0; display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 700px) { .modal-card { border-radius: 12px; } }
.modal-header { display: flex; align-items: center; padding: 10px 8px 10px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; }
.modal-body { overflow-y: auto; padding: 16px 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.proof-bubble {
  background: var(--chat-bg); padding: 12px; border-radius: 10px; margin-bottom: 16px;
}
.proof-bubble .bubble { max-width: 100%; margin-left: auto; cursor: default; }
.proof-times { margin: 0 0 14px; }
.proof-time { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.proof-time:last-child { border-bottom: 0; }
.proof-time .tick { margin-top: 2px; flex: none; }
.proof-time-label { font-size: 14px; }
.proof-time-value { font-size: 15px; font-variant-numeric: tabular-nums; }
.proof-time.primary { background: var(--accent-soft); border-radius: 8px; padding: 10px; border-bottom: 0; margin-bottom: 4px; }
.proof-time.primary .proof-time-value { font-weight: 700; }
.proof-primary-tag { font-size: 11px; font-weight: 600; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .4px; }
.proof-time.note .proof-time-value { font-size: 13px; color: var(--text-2); font-style: italic; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ── Görsel görüntüleyici ─────────────────────────────────────────────── */
.viewer {
  position: fixed; inset: 0; z-index: 60; background: rgba(11,20,26,.96);
  display: flex; align-items: center; justify-content: center;
}
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-bar {
  position: absolute; top: 0; right: 0; left: 0; display: flex; justify-content: flex-end; gap: 4px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
}
.viewer-bar .icon-btn { color: #fff; }
.viewer-bar .icon-btn:hover { background: rgba(255,255,255,.1); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(90px + env(safe-area-inset-bottom));
  background: #323739; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  max-width: calc(100% - 32px); box-shadow: 0 4px 12px rgba(0,0,0,.25); text-align: center;
}

/* ── Basit sayfalar (giriş, ayarlar, kullanıcılar) ────────────────────── */
.page { background: var(--panel-header); min-height: 100%; }
.page-header { position: sticky; top: 0; z-index: 2; padding-left: 4px; }
.page-header h1 { font-size: 19px; font-weight: 500; margin: 0; }
.page-main { max-width: 640px; margin: 0 auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
.card { background: var(--panel); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; color: var(--accent-strong); }
.list-card { padding: 0; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--hover); }
.list-row.inactive { opacity: .55; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-size: 16px; }
.role-chip { font-size: 12px; padding: 3px 9px; border-radius: 10px; background: var(--chip-bg); color: var(--text-2); }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li a { display: block; padding: 10px 0; text-decoration: none; font-size: 16px; }
.profile-row { display: flex; align-items: center; gap: 14px; }
.profile-name { font-size: 19px; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); }
.form label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 15px; }
.form input[type=text], .form input[type=password], .form select {
  font: inherit; font-size: 16px; color: var(--text); background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; outline: 0;
}
.form input:focus, .form select:focus { border-color: var(--accent); }
.form input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.form-error, .field-error { color: var(--danger); font-size: 13.5px; }
.form-error { background: rgba(234,0,56,.08); padding: 10px 12px; border-radius: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 22px; padding: 10px 20px; cursor: pointer;
  background: var(--panel); color: var(--accent-strong); font-weight: 500; text-decoration: none; font-size: 15px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #111b21; } }
.btn-danger { color: var(--danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.card .btn-row { margin-bottom: 0; }
.flash { list-style: none; margin: 0 0 12px; padding: 0; }
.flash li { background: var(--accent-soft); color: var(--accent-strong); padding: 10px 14px; border-radius: 8px; }

.auth-page { background: var(--panel-header); display: flex; align-items: center; justify-content: center; min-height: 100%; padding: 16px; }
.auth-card {
  background: var(--panel); border-radius: 14px; padding: 32px 24px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 2px 12px rgba(11,20,26,.08);
}
.auth-card h1 { font-size: 22px; font-weight: 500; margin: 12px 0 4px; }
.auth-card .form { margin-top: 20px; text-align: left; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-logo { border-radius: 18px; }
