/* =====================================================================
   Tuma Mail Pro — Tasarım Sistemi
   "Midnight rail" · indigo/violet · sakin okuma alanı
   ===================================================================== */

/* ÖNEMLİ: Overlay/modal/komut paleti gibi bileşenler `hidden` özniteliği
   ile gizlenir; ancak bu bileşenlerin kendi sınıflarında display: flex/grid
   tanımlı olduğundan, tarayıcının varsayılan [hidden]{display:none} kuralı
   ezilir. Bu tek kural (!important ile) `hidden` özniteliğinin her yerde
   güvenilir biçimde çalışmasını sağlar. */
[hidden] { display: none !important; }

:root {
  /* Marka aksanı */
  --accent: #6366F1;
  --accent-2: #8B5CF6;
  --accent-grad: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-ring: rgba(99, 102, 241, 0.35);

  /* Midnight ray (temadan bağımsız daima koyu) */
  --rail-bg: #14162B;
  --rail-bg-2: #1A1D38;
  --rail-hover: rgba(255, 255, 255, 0.06);
  --rail-active: rgba(99, 102, 241, 0.18);
  --rail-text: #A7ADD1;
  --rail-text-dim: #6E739A;
  --rail-text-bright: #FFFFFF;
  --rail-border: rgba(255, 255, 255, 0.07);

  /* Aydınlık tema (varsayılan) */
  --bg: #F4F5FB;
  --surface: #FFFFFF;
  --surface-2: #FAFBFF;
  --surface-hover: #F2F3FB;
  --border: #E7E9F4;
  --border-strong: #D5D8EC;
  --text: #1B1E33;
  --text-2: #565B78;
  --text-3: #8A8FAD;
  --shadow-sm: 0 1px 2px rgba(20, 22, 43, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 22, 43, 0.08);
  --shadow-lg: 0 12px 40px rgba(20, 22, 43, 0.16);
  --shadow-xl: 0 24px 70px rgba(20, 22, 43, 0.22);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --rail-w: 268px;
  --list-w: 400px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #0E1020;
  --surface: #171A2E;
  --surface-2: #1C1F36;
  --surface-hover: #22263F;
  --border: #282C46;
  --border-strong: #343A58;
  --text: #E7E9F7;
  --text-2: #A0A5C6;
  --text-3: #71769A;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 70px rgba(0, 0, 0, 0.6);
  --accent-soft: rgba(99, 102, 241, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-ring); color: #fff; }

/* Kaydırma çubuğu */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* İkonlar (JS ile SVG doldurulur) */
.ico { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; }
.ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.big { width: 56px; height: 56px; }
.ico.big svg { stroke-width: 1.5; }

/* =====================================================================
   GİRİŞ / KURULUM
   ===================================================================== */
.auth-body {
  display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% -10%, #23264a 0%, #14162B 45%, #0d0f1e 100%);
  position: relative; overflow: hidden;
}
.auth-aurora {
  position: absolute; inset: -20%;
  background:
    radial-gradient(500px 400px at 75% 20%, rgba(139,92,246,0.35), transparent 60%),
    radial-gradient(600px 500px at 15% 80%, rgba(99,102,241,0.30), transparent 60%);
  filter: blur(20px); animation: drift 18s var(--ease) infinite alternate;
}
@keyframes drift { to { transform: translate(40px, -30px) scale(1.1); } }

.auth-card {
  position: relative; z-index: 2;
  width: 400px; max-width: calc(100vw - 40px);
  background: rgba(23, 26, 46, 0.72);
  backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px; padding: 34px 32px;
  box-shadow: 0 40px 90px rgba(0,0,0,0.55);
  color: #EAECF7;
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo .logo-mark { font-size: 26px; }
.auth-logo strong { display: block; font-size: 18px; letter-spacing: -0.3px; color: #fff; }
.auth-logo small { color: #9BA0C4; font-size: 12px; }
.logo-mark {
  color: transparent; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text;
  font-weight: 800;
}
.logo-mark.big { font-size: 44px; display: block; margin-bottom: 8px; }

.auth-intro { color: #A7ADD1; font-size: 13.5px; line-height: 1.6; margin-bottom: 22px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: #B4B9DA; font-weight: 500; }
.auth-form input {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 11px; padding: 12px 14px; color: #fff; font-size: 14px; transition: border-color .2s, box-shadow .2s;
}
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.auth-form input::placeholder { color: #6E739A; }

.btn-primary {
  background: var(--accent-grad); color: #fff; border-radius: 11px; padding: 12px 20px;
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s var(--ease), box-shadow .2s, filter .2s;
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 26px rgba(99,102,241,0.5); }
.btn-primary:active { transform: translateY(1px) scale(0.99); }
.btn-primary.block { width: 100%; margin-top: 6px; }
.btn-primary.sm { padding: 8px 14px; font-size: 13px; }
.btn-primary .ico { width: 16px; height: 16px; }

.auth-alert { border-radius: 11px; padding: 12px 14px; font-size: 13px; margin-bottom: 18px; line-height: 1.5; }
.auth-alert.error { background: rgba(239,68,68,0.14); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.3); }
.auth-alert.success { background: rgba(16,185,129,0.14); color: #6EE7B7; border: 1px solid rgba(16,185,129,0.3); }
.auth-alert code { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 5px; }
.auth-foot { margin-top: 22px; text-align: center; color: #7A7FA4; font-size: 12px; }

/* =====================================================================
   UYGULAMA DÜZENİ
   ===================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) var(--list-w) 1fr;
  height: 100vh; overflow: hidden;
  transition: grid-template-columns .28s var(--ease);
}
.app.rail-collapsed { --rail-w: 76px; }
.app.reading { }

/* =====================================================================
   SOL RAY
   ===================================================================== */
.rail {
  background: linear-gradient(180deg, var(--rail-bg-2) 0%, var(--rail-bg) 100%);
  display: flex; flex-direction: column; color: var(--rail-text);
  border-right: 1px solid var(--rail-border); position: relative;
}
.rail-brand {
  display: flex; align-items: center; gap: 11px; padding: 20px 20px 14px;
  position: relative;
}
.rail-brand .logo-mark { font-size: 22px; }
.brand-name { font-size: 15.5px; color: var(--rail-text-bright); font-weight: 500; letter-spacing: -0.2px; white-space: nowrap; }
.brand-name b { font-weight: 800; }
.rail-collapse {
  margin-left: auto; width: 22px; height: 22px; border-radius: 6px; color: var(--rail-text-dim);
  display: grid; place-items: center; transition: background .15s, color .15s;
}
.rail-collapse::before { content: '‹'; font-size: 18px; line-height: 1; }
.rail-collapse:hover { background: var(--rail-hover); color: var(--rail-text-bright); }
.rail-collapsed .rail-collapse::before { content: '›'; }
.rail-collapsed .brand-name { display: none; }

.compose-btn {
  margin: 4px 16px 12px; padding: 12px 16px; border-radius: 13px;
  background: var(--accent-grad); color: #fff; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 11px; justify-content: flex-start;
  box-shadow: 0 8px 22px rgba(99,102,241,0.4); transition: transform .12s var(--ease), box-shadow .2s, filter .2s;
}
.compose-btn:hover { filter: brightness(1.07); box-shadow: 0 10px 28px rgba(99,102,241,0.52); }
.compose-btn:active { transform: translateY(1px) scale(0.99); }
.rail-collapsed .compose-btn { justify-content: center; padding: 12px; }
.rail-collapsed .compose-label { display: none; }

.rail-scroll { flex: 1; overflow-y: auto; padding: 0 12px 12px; }
.rail-scroll::-webkit-scrollbar { width: 6px; }
.rail-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

.rail-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: var(--rail-text);
  font-size: 13.5px; font-weight: 500; position: relative; transition: background .14s, color .14s;
  margin-bottom: 1px;
}
.rail-item:hover { background: var(--rail-hover); color: var(--rail-text-bright); }
.rail-item.active { background: var(--rail-active); color: #fff; }
.rail-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.rail-item .ico { width: 18px; height: 18px; opacity: 0.85; }
.rail-item.active .ico { opacity: 1; }
.ri-label { flex: 1; white-space: nowrap; overflow: hidden; }
.ri-badge {
  font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.1); color: var(--rail-text-bright);
  padding: 2px 8px; border-radius: 20px; min-width: 20px; text-align: center;
}
.ri-badge:empty { display: none; }
.rail-item.active .ri-badge { background: var(--accent); }
.rail-collapsed .ri-label, .rail-collapsed .ri-badge, .rail-collapsed .rail-section span, .rail-collapsed .cat-count { display: none; }

.rail-section {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 12px 7px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--rail-text-dim);
}
.rail-collapsed .rail-section { justify-content: center; padding: 14px 0 6px; }
.rail-collapsed .rail-section::after { content: '•••'; letter-spacing: 1px; }
.rail-add, .rail-icon-btn {
  width: 22px; height: 22px; border-radius: 6px; color: var(--rail-text-dim);
  display: grid; place-items: center; font-size: 17px; line-height: 1; transition: background .15s, color .15s;
}
.rail-add:hover, .rail-icon-btn:hover { background: var(--rail-hover); color: var(--rail-text-bright); }

.cat-item, .acc-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; font-size: 13px; color: var(--rail-text);
  transition: background .14s, color .14s; margin-bottom: 1px;
}
.cat-item:hover, .acc-item:hover { background: var(--rail-hover); color: var(--rail-text-bright); }
.cat-item.active, .acc-item.active { background: var(--rail-active); color: #fff; }
.cat-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.cat-name, .acc-mail { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count { font-size: 11px; color: var(--rail-text-dim); font-weight: 600; }

.acc-item { position: relative; }
.acc-avatar {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
}
.acc-provider { font-size: 9px; padding: 1px 5px; border-radius: 5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.acc-provider.microsoft { background: rgba(0,120,215,0.22); color: #7CC3FF; }
.acc-provider.google { background: rgba(234,67,53,0.22); color: #FF9B90; }
.acc-unread { font-size: 11px; font-weight: 700; color: var(--accent); }
.rail-collapsed .acc-mail, .rail-collapsed .acc-provider, .rail-collapsed .acc-unread { display: none; }

.rail-foot {
  display: flex; align-items: center; gap: 6px; padding: 12px 14px;
  border-top: 1px solid var(--rail-border);
}
.rail-user { display: flex; align-items: center; gap: 10px; flex: 1; padding: 6px; border-radius: 10px; transition: background .15s; overflow: hidden; }
.rail-user:hover { background: var(--rail-hover); }
.avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.ru-name { font-size: 13px; color: var(--rail-text-bright); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-icon-btn { width: 32px; height: 32px; }
.rail-icon-btn .ico { width: 17px; height: 17px; }
.rail-collapsed .rail-foot { flex-direction: column; }
.rail-collapsed .ru-name { display: none; }

/* =====================================================================
   MESAJ LİSTESİ
   ===================================================================== */
.list-pane { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.list-header {
  display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px;
}
.pane-back { display: none; width: 34px; height: 34px; border-radius: 9px; color: var(--text-2); }
.pane-back:hover { background: var(--surface-hover); }
.list-title { flex: 1; min-width: 0; }
.list-title h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12px; color: var(--text-3); }
.list-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; color: var(--text-2);
  display: grid; place-items: center; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.spin .ico { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-bar {
  display: flex; align-items: center; gap: 9px; margin: 0 16px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 0 12px;
  transition: border-color .2s, box-shadow .2s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-bar .ico { width: 16px; height: 16px; color: var(--text-3); }
.search-bar input { flex: 1; border: none; background: none; padding: 11px 0; }
.search-bar input:focus { outline: none; }
.search-clear { color: var(--text-3); font-size: 20px; line-height: 1; padding: 0 4px; }
.search-clear:hover { color: var(--text); }

.filter-chips { display: flex; gap: 8px; padding: 0 16px 12px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 500; padding: 6px 13px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; margin: 0 16px 10px; background: var(--accent-soft);
  border-radius: 11px; font-size: 13px; font-weight: 600; color: var(--accent);
}
.bulk-actions { display: flex; gap: 2px; }
.bulk-actions .icon-btn { width: 32px; height: 32px; color: var(--accent); }
.bulk-actions .icon-btn:hover { background: rgba(99,102,241,0.15); }

.list-scroll { flex: 1; overflow-y: auto; padding: 0 10px 20px; }

/* Mesaj kartı */
.msg {
  display: flex; gap: 12px; padding: 13px 12px; border-radius: 13px;
  cursor: pointer; position: relative; transition: background .13s;
  border: 1px solid transparent;
}
.msg:hover { background: var(--surface-hover); }
.msg.active { background: var(--accent-soft); border-color: var(--accent-ring); }
.msg.unread .msg-from, .msg.unread .msg-subject { font-weight: 700; color: var(--text); }
.msg::after {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px;
  background: var(--accent); opacity: 0; transition: opacity .15s;
}
.msg.unread::after { opacity: 1; }

.msg-check {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong);
  flex: 0 0 auto; margin-top: 12px; display: none; place-items: center; transition: all .15s;
}
.msg-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
  position: relative;
}
.msg-avatar .acc-spine {
  position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 5px;
  border: 2.5px solid var(--surface); display: grid; place-items: center; font-size: 8px; color: #fff; font-weight: 800;
}
.msg.active .msg-avatar .acc-spine, .msg:hover .msg-avatar .acc-spine { border-color: var(--surface-hover); }
.msg-body { flex: 1; min-width: 0; }
.msg-line1 { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.msg-from { font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.msg-time { font-size: 11.5px; color: var(--text-3); flex: 0 0 auto; }
.msg-subject { font-size: 13px; color: var(--text); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-snippet { font-size: 12.5px; color: var(--text-3); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.msg-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.cat-tag {
  font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.cat-tag .cat-dot { width: 6px; height: 6px; }
.msg-icons { display: flex; gap: 5px; margin-left: auto; color: var(--text-3); }
.msg-icons .ico { width: 14px; height: 14px; }
.msg-flag { color: #F59E0B; }

.msg-hover-actions {
  position: absolute; right: 10px; top: 10px; display: none; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px;
  box-shadow: var(--shadow-md);
}
.msg:hover .msg-hover-actions { display: flex; }
.msg-hover-actions .icon-btn { width: 28px; height: 28px; }
.msg-hover-actions .ico { width: 15px; height: 15px; }

/* İskelet yükleme */
.list-skeleton { display: flex; flex-direction: column; gap: 6px; padding: 6px 2px; }
.sk-row { display: flex; gap: 12px; padding: 13px 12px; }
.sk-av { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.sk-line { height: 10px; border-radius: 6px; }
.sk-shimmer { background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border) 50%, var(--surface-hover) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Boş durum listesi */
.list-empty { text-align: center; padding: 60px 30px; color: var(--text-3); }
.list-empty .ico { width: 44px; height: 44px; margin-bottom: 14px; opacity: 0.5; }
.list-empty h3 { font-size: 15px; color: var(--text-2); margin-bottom: 6px; }
.list-empty p { font-size: 13px; line-height: 1.5; }

/* =====================================================================
   OKUMA PANELİ
   ===================================================================== */
.read-pane { background: var(--bg); display: flex; flex-direction: column; min-width: 0; position: relative; }
.read-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px; color: var(--text-3); position: relative;
}
.empty-glow {
  position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%); filter: blur(30px);
}
.read-empty .ico { position: relative; margin-bottom: 20px; color: var(--accent); opacity: 0.7; }
.read-empty h2 { position: relative; font-size: 18px; color: var(--text-2); font-weight: 600; margin-bottom: 8px; }
.read-empty p { position: relative; font-size: 13.5px; max-width: 340px; line-height: 1.6; }

.read-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.read-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-wrap: wrap;
}
.read-toolbar .icon-btn:hover { background: var(--surface-hover); }
.read-toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.read-toolbar .spacer { flex: 1; }
.btn-reply {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px;
  background: var(--accent-grad); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35); transition: filter .2s, transform .12s;
}
.btn-reply:hover { filter: brightness(1.06); }
.btn-reply:active { transform: translateY(1px); }
.btn-reply .ico { width: 16px; height: 16px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-weight: 500; font-size: 13px; transition: all .15s;
}
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-ghost .ico { width: 15px; height: 15px; }
.btn-ghost.ai { color: var(--accent); border-color: var(--accent-ring); background: var(--accent-soft); }

.read-scroll { flex: 1; overflow-y: auto; padding: 26px 34px 60px; }
.read-header { margin-bottom: 22px; }
.read-subject { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.3; margin-bottom: 18px; color: var(--text); }
.read-from { display: flex; align-items: center; gap: 13px; }
.read-from .msg-avatar { width: 46px; height: 46px; font-size: 17px; }
.rf-info { flex: 1; min-width: 0; }
.rf-name { font-size: 15px; font-weight: 600; color: var(--text); }
.rf-email { font-size: 13px; color: var(--text-3); }
.rf-to { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.rf-date { font-size: 12.5px; color: var(--text-3); text-align: right; flex: 0 0 auto; }
.rf-badges { display: flex; gap: 7px; align-items: center; margin-top: 8px; }

.read-summary {
  background: var(--accent-soft); border: 1px solid var(--accent-ring); border-radius: 12px;
  padding: 14px 16px; margin: 18px 0; font-size: 13.5px; line-height: 1.6; color: var(--text);
  display: flex; gap: 11px;
}
.read-summary .ico { color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.read-summary b { color: var(--accent); }

.read-divider { height: 1px; background: var(--border); margin: 20px 0; }

.mail-body {
  font-size: 14.5px; line-height: 1.7; color: var(--text); word-break: break-word;
}
.mail-body img { max-width: 100%; height: auto; border-radius: 8px; }
.mail-body a { color: var(--accent); }
.mail-body p { margin: 0 0 14px; }
.mail-body blockquote { border-left: 3px solid var(--border-strong); padding-left: 14px; color: var(--text-2); margin: 14px 0; }
.mail-body table { max-width: 100%; }

.attachments { margin-top: 26px; }
.attachments-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); margin-bottom: 12px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.att-card {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); transition: all .15s; min-width: 200px;
}
.att-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.att-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: 0 0 auto; }
.att-info { min-width: 0; }
.att-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.att-size { font-size: 11.5px; color: var(--text-3); }

/* =====================================================================
   OLUŞTUR / YANITLA PENCERESİ
   ===================================================================== */
.composer {
  position: fixed; right: 26px; bottom: 26px; width: 620px; max-width: calc(100vw - 40px);
  max-height: 82vh; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-xl); z-index: 200;
  display: flex; flex-direction: column; overflow: hidden;
  animation: composerIn .3s var(--ease);
}
@keyframes composerIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } }
.composer.minimized { height: 52px; max-height: 52px; }
.composer.minimized .composer-body, .composer.minimized .composer-foot { display: none; }
.composer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--rail-bg); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
}
.composer-head-actions { display: flex; gap: 2px; }
.composer-head-actions .icon-btn { width: 30px; height: 30px; color: rgba(255,255,255,0.75); }
.composer-head-actions .icon-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.composer-body { flex: 1; overflow-y: auto; padding: 6px 18px; }
.composer-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border);
}
.composer-row label { font-size: 12.5px; color: var(--text-3); width: 54px; flex: 0 0 auto; font-weight: 500; }
.composer-row input, .composer-row select { flex: 1; border: none; background: none; padding: 2px 0; font-size: 14px; }
.composer-row input:focus, .composer-row select:focus { outline: none; }
.link-btn { color: var(--accent); font-size: 12.5px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-soft); }

.ai-draft-bar {
  display: flex; align-items: center; gap: 9px; margin: 12px 0; padding: 9px 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-ring); border-radius: 12px;
}
.ai-draft-bar > .ico { color: var(--accent); flex: 0 0 auto; }
.ai-draft-bar input { flex: 1; border: none; background: none; font-size: 13px; }
.ai-draft-bar input:focus { outline: none; }
.ai-draft-bar select { border: none; background: var(--surface); border-radius: 7px; padding: 5px 8px; font-size: 12px; color: var(--text-2); }
.btn-ai {
  background: var(--accent-grad); color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px; flex: 0 0 auto; transition: filter .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ai:hover { filter: brightness(1.08); }
.btn-ai:disabled { opacity: 0.6; cursor: wait; }

.composer-editor {
  min-height: 200px; padding: 14px 2px; font-size: 14.5px; line-height: 1.7; color: var(--text);
  outline: none;
}
.composer-editor:empty::before { content: attr(placeholder); color: var(--text-3); }
.composer-foot {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border);
}
.composer-status { font-size: 12.5px; color: var(--text-3); }
.composer-status.ok { color: #10B981; }
.composer-status.err { color: #EF4444; }

/* =====================================================================
   AI YANIT PANELİ
   ===================================================================== */
.ai-panel {
  position: fixed; right: 26px; bottom: 26px; width: 440px; max-width: calc(100vw - 40px);
  max-height: 78vh; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-xl); z-index: 210;
  display: flex; flex-direction: column; overflow: hidden; animation: composerIn .3s var(--ease);
}
.ai-panel-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  background: var(--accent-grad); color: #fff; font-size: 15px;
}
.ai-panel-head b { flex: 1; }
.ai-panel-head .ico { width: 19px; height: 19px; }
.ai-panel-head .icon-btn { width: 30px; height: 30px; color: rgba(255,255,255,0.85); }
.ai-panel-head .icon-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.ai-panel-sub { padding: 14px 18px 6px; font-size: 13px; color: var(--text-2); line-height: 1.5; }

.reply-types { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 10px 18px 6px; }
.reply-type {
  display: flex; align-items: center; gap: 10px; padding: 12px 13px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); text-align: left; transition: all .14s;
}
.reply-type:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.reply-type.active { border-color: var(--accent); background: var(--accent-soft); }
.rt-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.rt-icon .ico { width: 16px; height: 16px; }
.rt-name { font-size: 12.5px; font-weight: 600; color: var(--text); }

.ai-extra { padding: 12px 18px; }
.ai-extra input {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 13px;
}
.ai-extra input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.ai-loading { padding: 22px 18px; display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 13.5px; }
.spinner {
  width: 20px; height: 20px; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite; flex: 0 0 auto;
}

.ai-result { flex: 1; display: flex; flex-direction: column; overflow: hidden; border-top: 1px solid var(--border); margin-top: 6px; }
.ai-result-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.ai-result-head span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); }
.ai-result-head > div { display: flex; align-items: center; gap: 8px; }
.ai-result-body {
  flex: 1; overflow-y: auto; padding: 6px 18px 18px; font-size: 14px; line-height: 1.7; color: var(--text); outline: none;
}
.ai-result-body:focus { outline: none; }

/* =====================================================================
   MODAL / AYARLAR
   ===================================================================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 24, 0.55); backdrop-filter: blur(4px);
  z-index: 380; display: grid; place-items: center; padding: 20px; animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-xl);
  width: 480px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn .28s var(--ease); border: 1px solid var(--border);
}
.modal.wide { width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(10px); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 16px; }
.modal-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.modal-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.mtab {
  padding: 12px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-2);
  border-bottom: 2px solid transparent; transition: color .15s; white-space: nowrap;
}
.mtab:hover { color: var(--text); }
.mtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.modal-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.modal-intro { font-size: 13.5px; color: var(--text-2); line-height: 1.6; margin-bottom: 18px; }

.connect-option {
  display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-radius: 14px;
  border: 1px solid var(--border); margin-bottom: 12px; transition: all .15s; background: var(--surface-2);
}
.connect-option:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.connect-option .co-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #fff; flex: 0 0 auto; }
.connect-option.ms .co-logo { background: #0078D7; }
.connect-option.g .co-logo { background: #EA4335; }
.connect-option > div { flex: 1; }
.connect-option b { font-size: 14.5px; display: block; }
.connect-option small { font-size: 12px; color: var(--text-3); }
.connect-option .ico { color: var(--text-3); }

/* Ayar listeleri */
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.settings-row {
  display: flex; align-items: center; gap: 13px; padding: 13px 15px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.settings-row .sr-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.sr-main { flex: 1; min-width: 0; }
.sr-name { font-size: 14px; font-weight: 600; }
.sr-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.sr-actions { display: flex; gap: 4px; }
.badge-sys { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--surface-hover); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.3px; }

.settings-add {
  width: 100%; padding: 13px; border-radius: 13px; border: 1.5px dashed var(--border-strong);
  color: var(--accent); font-weight: 600; font-size: 13.5px; margin-top: 8px; transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.settings-add:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Form alanları (modal içi) */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea {
  padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.field-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 30px; height: 30px; border-radius: 9px; cursor: pointer; border: 2.5px solid transparent; transition: transform .1s; }
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }
.btn-danger { background: rgba(239,68,68,0.1); color: #EF4444; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; transition: background .15s; }
.btn-danger:hover { background: rgba(239,68,68,0.18); }
.btn-secondary { background: var(--surface-hover); color: var(--text-2); padding: 10px 16px; border-radius: 10px; font-weight: 500; font-size: 13px; }
.btn-secondary:hover { color: var(--text); }

/* =====================================================================
   KOMUT PALETİ
   ===================================================================== */
.cmd-overlay { position: fixed; inset: 0; background: rgba(10,12,24,0.5); backdrop-filter: blur(4px); z-index: 400; display: flex; justify-content: center; padding-top: 12vh; animation: fadeIn .15s var(--ease); }
.cmd-box { width: 580px; max-width: calc(100vw - 32px); height: fit-content; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-xl); overflow: hidden; animation: modalIn .2s var(--ease); }
.cmd-input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmd-input-wrap .ico { color: var(--text-3); }
.cmd-input-wrap input { flex: 1; border: none; background: none; font-size: 16px; }
.cmd-input-wrap input:focus { outline: none; }
.cmd-input-wrap kbd { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--surface-hover); color: var(--text-3); font-family: var(--font); }
.cmd-results { max-height: 380px; overflow-y: auto; padding: 8px; }
.cmd-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); padding: 10px 12px 4px; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.cmd-item:hover, .cmd-item.active { background: var(--accent-soft); }
.cmd-item .ico { width: 17px; height: 17px; color: var(--text-2); }
.cmd-item.active .ico { color: var(--accent); }
.cmd-item .cmd-sub { font-size: 12px; color: var(--text-3); margin-left: auto; }

/* =====================================================================
   BİLDİRİMLER
   ===================================================================== */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 11px; padding: 13px 18px; border-radius: 12px;
  background: var(--rail-bg); color: #fff; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn .3s var(--ease); max-width: 90vw;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(16px); } }
.toast .ico { width: 18px; height: 18px; flex: 0 0 auto; }
.toast.success .ico { color: #34D399; }
.toast.error .ico { color: #F87171; }
.toast.info .ico { color: #818CF8; }

/* =====================================================================
   İLK ÇALIŞTIRMA
   ===================================================================== */
.first-run { position: fixed; inset: 0; z-index: 350; background: radial-gradient(1000px 600px at 30% -10%, #23264a, #14162B 50%, #0d0f1e); display: grid; place-items: center; padding: 20px; }
.first-run-card { width: 460px; max-width: 100%; background: rgba(23,26,46,0.8); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); border-radius: 22px; padding: 40px 34px; text-align: center; color: #EAECF7; box-shadow: 0 40px 90px rgba(0,0,0,0.5); }
.first-run-card h2 { font-size: 22px; color: #fff; margin-bottom: 10px; letter-spacing: -0.4px; }
.first-run-card > p { font-size: 14px; color: #A7ADD1; line-height: 1.6; margin-bottom: 26px; }
.first-run-card .connect-option { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); text-align: left; }
.first-run-card .connect-option:hover { border-color: var(--accent); }
.first-run-card .connect-option b { color: #fff; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1200px) {
  :root { --list-w: 360px; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: var(--rail-w) 1fr; }
  .read-pane { position: fixed; inset: 0; z-index: 150; transform: translateX(100%); transition: transform .3s var(--ease); }
  .app.reading .read-pane { transform: translateX(0); }
  .read-toolbar { padding-left: 16px; }
  .read-toolbar .pane-back-r { display: grid !important; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 250; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-xl); }
  .app.rail-open .rail { transform: translateX(0); }
  .rail-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 240; display: none; }
  .app.rail-open .rail-backdrop { display: block; }
  .pane-back { display: grid; }
  .list-header { padding: 16px; }
  .composer { right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .ai-panel { right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; }
  .reply-types { grid-template-columns: 1fr 1fr; }
}

/* Erişilebilirlik: hareket azaltma */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
/* Klavye odağı */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

/* =====================================================================
   MOBİL — okuma panelinde geri düğmesi (masaüstünde satır içi display:none)
   ===================================================================== */
@media (max-width: 720px) {
  .read-toolbar .pane-back-r { display: grid !important; place-items: center; }
}

/* =====================================================================
   AYARLAR — ENTEGRASYONLAR SEKMESİ
   ===================================================================== */
.int-section { border: 1px solid var(--border); border-radius: 14px; padding: 16px 16px 6px; margin-bottom: 16px; background: var(--surface-2); }
.int-section h4 { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; margin: 0 0 15px; color: var(--text); }
.int-logo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; }
.int-logo.ms { background: #0a66c2; }
.int-logo.g { background: linear-gradient(135deg, #ea4335, #4285f4); }
.int-logo.ai { background: var(--accent-grad); }
.copy-box { display: flex; align-items: center; gap: 8px; }
.copy-box code { flex: 1; min-width: 0; font-size: 12px; background: var(--surface-hover); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; overflow-x: auto; white-space: nowrap; color: var(--text-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.copy-btn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 9px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; color: var(--text-2); transition: all .15s var(--ease); }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.copy-btn .ico { width: 14px; height: 14px; }
.int-check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; padding: 4px 0 14px; }
.int-check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* İlk çalıştırma — "önce entegrasyonları ayarla" butonu (yalnızca yönetici) */
.first-run-setup {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 15px 16px; border-radius: 14px; margin-bottom: 10px; cursor: pointer;
  background: var(--accent-soft); border: 1px solid var(--accent); color: inherit;
  transition: all .15s var(--ease); font: inherit;
}
.first-run-setup:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.first-run-setup .co-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff; flex: 0 0 auto; background: var(--accent-grad); }
.first-run-setup > div { flex: 1; }
.first-run-setup b { font-size: 14.5px; display: block; color: #fff; }
.first-run-setup small { font-size: 12px; color: #C7CBF0; }
.first-run-hint { font-size: 12px; color: #9DA3C9; line-height: 1.5; margin: 0 2px 18px; }
