/* TurboChat yönetim paneli — tasarım sistemi */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e8f0fe;
  --primary-text: #1e40af;
  --success: #15803d;
  --success-soft: #e6f6ec;
  --warning: #b45309;
  --warning-soft: #fdf3e1;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  --info: #0e7490;
  --info-soft: #e3f5f9;
  --neutral-soft: #eef2f6;
  --sidebar-bg: #0b1220;
  --sidebar-text: #aab6c8;
  --sidebar-heading: #64748b;
  --sidebar-hover: #162034;
  --sidebar-active: #1e3a8a;
  --chat-in: #ffffff;
  --chat-out: #dcf3e4;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.15);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #121a2b;
    --surface-2: #0f1626;
    --border: #23304a;
    --border-strong: #334463;
    --text: #e5ecf6;
    --text-2: #c3cfe0;
    --muted: #8b9ab3;
    --primary: #4f8cff;
    --primary-hover: #6b9dff;
    --primary-soft: #16264a;
    --primary-text: #a9c4ff;
    --success: #4ade80;
    --success-soft: #11291c;
    --warning: #fbbf24;
    --warning-soft: #2c2410;
    --danger: #f87171;
    --danger-soft: #331617;
    --info: #22d3ee;
    --info-soft: #0f2a31;
    --neutral-soft: #1b2539;
    --sidebar-bg: #070b16;
    --sidebar-hover: #111a2e;
    --sidebar-active: #1c3170;
    --chat-in: #18223a;
    --chat-out: #15372a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .85em; background: var(--neutral-soft); padding: .1rem .35rem; border-radius: 4px; word-break: break-all; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.icon { flex-shrink: 0; vertical-align: middle; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mb-0 { margin-bottom: 0; }

/* ---------- Yerleşim ---------- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.1rem 1rem; color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none !important; }
.bare .brand { color: var(--text); justify-content: center; margin-bottom: 1rem; }
.brand-mark { display: inline-flex; }
.nav { flex: 1; padding: 0 .6rem 1rem; }
.nav-section { margin-top: .9rem; }
.nav-heading { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sidebar-heading); padding: 0 .6rem .35rem; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none !important; font-size: .9rem; margin-bottom: 1px;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-badge { margin-left: auto; background: #22c55e; color: #052e16; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 0 .45rem; }
.sidebar-foot { display: flex; align-items: center; gap: .4rem; padding: .75rem; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-card { flex: 1; display: flex; align-items: center; gap: .6rem; color: var(--sidebar-text); text-decoration: none !important; min-width: 0; }
.user-card:hover strong { color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #1e3a8a; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta strong { color: #e2e8f0; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--sidebar-heading); font-size: .75rem; }
.sidebar .icon-btn { color: var(--sidebar-text); }
.sidebar .icon-btn:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: .5rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-title { font-weight: 650; }
.content { padding: 1.5rem 2rem 3rem; max-width: 1400px; width: 100%; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--neutral-soft); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 40; }
  .topbar { display: flex; }
  .content { padding: 1rem 1rem 3rem; }
}

/* ---------- Sayfa başlığı ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header p { margin: .25rem 0 0; max-width: 70ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: .25rem; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }

/* ---------- Kart ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.15rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2 { margin: 0; font-size: 1rem; }
.card-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.card-body { padding: 1.15rem; }
.card-body.flush { padding: 0; }
.card-footer { padding: .75rem 1.15rem; border-top: 1px solid var(--border); }
.card.narrow { max-width: 440px; margin: 0 auto; }
.narrow-card { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack > .card { margin-bottom: 0; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- İstatistik ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); color: inherit; text-decoration: none !important; display: block; }
a.stat:hover { border-color: var(--border-strong); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat-value { font-size: 1.65rem; font-weight: 700; margin-top: .35rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-hint { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.stat-icon { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-neutral { background: var(--neutral-soft); color: var(--muted); }

/* ---------- Buton ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .95rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 550;
  font-size: .875rem; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.3;
}
.btn:disabled, .btn[aria-disabled='true'] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--neutral-soft); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { margin-left: .25rem; }

/* ---------- Rozet ---------- */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-neutral { background: var(--neutral-soft); color: var(--text-2); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 6px; background: var(--neutral-soft); color: var(--text-2); font-size: .75rem; margin: 0 .2rem .2rem 0; }

/* ---------- Uyarı ---------- */
.alert { display: flex; gap: .65rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert > .icon { margin-top: .1rem; }
.alert > div, .alert > span { flex: 1; }
.alert-title { display: block; margin-bottom: .15rem; }
.alert-info { background: var(--info-soft); color: var(--text); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-info > .icon { color: var(--info); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-success > .icon { color: var(--success); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-warning > .icon { color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-danger > .icon { color: var(--danger); }
.alert-close { background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.alert ul { margin: .25rem 0 0; padding-left: 1.2rem; }

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-weight: 600; font-size: .85rem; color: var(--text-2); }
.req { color: var(--danger); }
.help { color: var(--muted); font-size: .78rem; }
.field-error { color: var(--danger); font-size: .8rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='search'], input[type='tel'], input[type='url'],
input[type='datetime-local'], input[type='date'], input:not([type]), select, textarea {
  width: 100%; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  color: var(--text); font: inherit; font-size: .9rem; min-height: 38px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 1px; border-color: var(--primary); }
input[type='file'] { font: inherit; font-size: .85rem; }
.check { display: flex; align-items: flex-start; gap: .55rem; cursor: pointer; padding: .3rem 0; }
.check input { margin-top: .2rem; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--primary); }
.form-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.toolbar > input, .toolbar > select { width: auto; min-width: 160px; flex: 1 1 160px; max-width: 320px; }
.toolbar .grow { flex: 2 1 240px; max-width: none; }

/* ---------- Tablo ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; padding: .65rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table.compact td, .table.compact th { padding: .4rem .6rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.details-cell code { white-space: normal; font-size: .75rem; }
.table input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- Boş durum ---------- */
.empty { text-align: center; padding: 2.5rem 1rem; }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--neutral-soft); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.empty p { max-width: 52ch; margin-left: auto; margin-right: auto; }

/* ---------- Sayfalama ---------- */
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pagination-links { display: flex; gap: .25rem; }
.pagination-links a, .pagination-links span { padding: .3rem .65rem; border-radius: 6px; border: 1px solid var(--border); font-size: .85rem; }
.pagination-links .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-links .disabled { color: var(--muted); opacity: .6; }

/* ---------- Sekmeler ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; font-weight: 550; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { margin-left: .35rem; background: var(--neutral-soft); color: var(--text-2); border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }

/* ---------- Tanım listesi ---------- */
.dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: .55rem 1rem; margin: 0 0 1rem; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; word-break: break-word; }
@media (max-width: 600px) { .dl { grid-template-columns: 1fr; gap: .1rem; } .dl dd { margin-bottom: .5rem; } }

/* ---------- Ölçer ---------- */
.meter { height: 8px; background: var(--neutral-soft); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; }
.meter-fill.tone-primary { background: var(--primary); }
.meter-fill.tone-success { background: var(--success); }
.meter-fill.tone-warning { background: var(--warning); }
.meter-fill.tone-danger { background: var(--danger); }
.meter-fill.tone-info { background: var(--info); }

/* ---------- Yetki matrisi ---------- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .9rem .75rem; margin: 0; }
.perm-group legend { padding: 0 .35rem; font-weight: 650; }
.perm-group legend .check { padding: 0; }
.perm-summary { margin: 0; padding-left: 1.1rem; }
.perm-summary li { margin-bottom: .35rem; }
.channel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .25rem 1rem; margin-top: .5rem; }

/* ---------- Giriş / sade sayfalar ---------- */
body.bare { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.bare-main { width: 100%; max-width: 760px; }
.login-title { font-size: 1.25rem; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--border-strong); line-height: 1; margin-bottom: .5rem; }
.prose { max-width: 760px; margin: 0 auto; }
.prose h2 { margin-top: 1.25rem; }
.secret-value { font-size: 1rem; padding: .3rem .6rem; user-select: all; }

/* ---------- Sihirbaz (adımlar) ---------- */
.steps { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; counter-reset: step; padding: 0; list-style: none; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .85rem; font-weight: 550; }
.steps li::before { content: counter(step); width: 24px; height: 24px; border-radius: 50%; background: var(--neutral-soft); display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; }
.steps li.done::before { background: var(--success-soft); color: var(--success); content: '✓'; }
.steps li.current { color: var(--text); }
.steps li.current::before { background: var(--primary); color: #fff; }
.steps li:not(:last-child)::after { content: ''; width: 24px; height: 1px; background: var(--border-strong); margin-left: .25rem; }

/* ---------- WhatsApp önizleme ---------- */
.wa-preview { background: #e5ddd5; border-radius: var(--radius); padding: 1rem; min-height: 140px; }
@media (prefers-color-scheme: dark) { .wa-preview { background: #0d1418; } }
.wa-bubble { background: var(--chat-in); border-radius: 8px; padding: .5rem .65rem .35rem; max-width: 340px; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); white-space: pre-wrap; word-wrap: break-word; font-size: .9rem; }
.wa-bubble .wa-header { font-weight: 700; margin-bottom: .25rem; }
.wa-bubble .wa-media { background: var(--neutral-soft); border-radius: 6px; height: 120px; display: flex; align-items: center; justify-content: center; color: var(--muted); margin-bottom: .4rem; }
.wa-bubble .wa-media-img { display: block; width: 100%; max-height: 240px; object-fit: contain; border-radius: 6px; margin-bottom: .4rem; background: var(--neutral-soft); }
.wa-bubble .wa-footer { color: var(--muted); font-size: .78rem; margin-top: .3rem; }
.wa-bubble .wa-buttons { border-top: 1px solid var(--border); margin-top: .45rem; }
.wa-bubble .wa-btn { display: block; text-align: center; color: #0284c7; padding: .35rem 0; border-bottom: 1px solid var(--border); font-weight: 550; font-size: .85rem; }
.wa-bubble .wa-btn:last-child { border-bottom: 0; }

/* ---------- Gelen kutusu ---------- */
.inbox { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 150px); min-height: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.inbox-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.inbox-filters { padding: .6rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .4rem; }
.inbox-items { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: .6rem; padding: .7rem .8rem; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--primary-soft); }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: .5rem; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-alias { font-weight: 400; color: var(--muted); font-size: .8rem; margin-left: .4rem; }
.inbox-markall { display: flex; justify-content: flex-end; padding: 0 .75rem .25rem; }
.conv-time { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.conv-preview { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-unread { background: #22c55e; color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 .35rem; }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-head { padding: .7rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.thread-msgs { flex: 1; overflow-y: auto; padding: 1rem; background: var(--bg); display: flex; flex-direction: column; gap: .35rem; }
.msg { max-width: min(560px, 80%); padding: .45rem .7rem .3rem; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); white-space: pre-wrap; word-wrap: break-word; }
.msg.in { background: var(--chat-in); align-self: flex-start; border-top-left-radius: 2px; }
.msg.out { background: var(--chat-out); align-self: flex-end; border-top-right-radius: 2px; }
.msg-meta { display: flex; justify-content: flex-end; gap: .4rem; font-size: .7rem; color: var(--muted); margin-top: .15rem; }
.msg-source { font-size: .7rem; color: var(--muted); margin-bottom: .15rem; }
.msg img { max-width: 260px; border-radius: 6px; display: block; }
.day-sep { align-self: center; font-size: .72rem; color: var(--muted); background: var(--surface); border-radius: 999px; padding: .1rem .6rem; margin: .5rem 0; }
.composer { border-top: 1px solid var(--border); padding: .6rem; display: flex; gap: .5rem; align-items: flex-end; background: var(--surface); }
.composer textarea { min-height: 42px; max-height: 160px; }
.composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .45rem .8rem 0; border-top: 1px solid var(--border); background: var(--surface); font-size: .8rem; }
.composer-tools select { width: auto; max-width: 100%; padding: .2rem .4rem; font-size: .8rem; }
.msg-translation { margin-top: .3rem; padding-top: .25rem; border-top: 1px dashed var(--border); font-size: .88rem; }
.msg-translation-label { display: block; font-size: .68rem; color: var(--muted); }
.composer-tools + .composer { border-top: 0; }
.composer-attachment { display: flex; align-items: center; gap: .5rem; padding: .45rem .8rem 0; border-top: 1px solid var(--border); background: var(--surface); }
.composer-attachment img { max-height: 64px; max-width: 120px; border-radius: 6px; display: block; }
.composer-tools + .composer-attachment, .composer-attachment + .composer { border-top: 0; }
.composer-note { padding: .5rem .8rem; font-size: .8rem; border-top: 1px solid var(--border); background: var(--warning-soft); }
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox.has-thread .inbox-list { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .thread-msgs { min-height: 50vh; }
}

/* ---------- QR ---------- */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 1rem; }
.qr-box img, .qr-box svg { width: 264px; height: 264px; background: #fff; padding: 8px; border-radius: 8px; }

/* ---------- Grafik ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); margin-top: .5rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- İlerleme ---------- */
.progress-row { display: flex; align-items: center; gap: .75rem; }
.progress-row .meter { flex: 1; }

/* ---------- Diyalog ---------- */
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; max-width: 560px; width: calc(100% - 2rem); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(2, 6, 23, .45); }
.dialog-body { padding: 1.25rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.25rem; border-top: 1px solid var(--border); }

/* ---------- Bildirim (toast) ---------- */
.toast-area { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast { background: var(--text); color: var(--bg); padding: .6rem .9rem; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: .85rem; max-width: 360px; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Grafik (veri görselleştirme) ----------
   Kategorik sıra: mavi, turuncu, aqua — panel yüzeylerine göre doğrulandı
   (açık #ffffff, koyu #121a2b; CVD ΔE ≥ 9.2). Aqua açık modda 3:1 altında: lejant + tablo görünümü zorunlu. */
.viz {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --viz-grid: #e8ebf0;
  --viz-axis: #c3c9d4;
  --viz-ink: #0f172a;
  --viz-ink-2: #475569;
  --viz-muted: #7b8597;
  position: relative;
}
@media (prefers-color-scheme: dark) {
  .viz {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --viz-grid: #1f2a40;
    --viz-axis: #33415e;
    --viz-ink: #e5ecf6;
    --viz-ink-2: #b8c4d6;
    --viz-muted: #8190a8;
  }
}
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz svg:focus { outline: none; }
.viz svg:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 4px; border-radius: 4px; }
.viz .grid { stroke: var(--viz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz .baseline { stroke: var(--viz-axis); stroke-width: 1; shape-rendering: crispEdges; }
.viz .tick { fill: var(--viz-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .end-label { fill: var(--viz-ink-2); font-size: 11.5px; font-weight: 600; }
.viz .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .series-dot { stroke: var(--surface); stroke-width: 2; }
.viz .s1 { stroke: var(--series-1); } .viz .f1 { fill: var(--series-1); }
.viz .s2 { stroke: var(--series-2); } .viz .f2 { fill: var(--series-2); }
.viz .s3 { stroke: var(--series-3); } .viz .f3 { fill: var(--series-3); }
.viz .crosshair { stroke: var(--viz-axis); stroke-width: 1; pointer-events: none; }
.viz .hover-dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.viz .bar { shape-rendering: geometricPrecision; }
.viz .bar:hover, .viz .bar.active { opacity: .82; }
.viz-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin: 0 0 .6rem; padding: 0; list-style: none; font-size: .8rem; color: var(--text-2); }
.viz-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.viz-legend .key-line { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }
.viz-legend .key-rect { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-tip {
  position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 8px; padding: .45rem .6rem; font-size: .78rem; min-width: 140px; z-index: 5;
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}
.viz-tip .tip-title { color: var(--muted); margin-bottom: .2rem; }
.viz-tip .tip-row { display: flex; align-items: center; gap: .45rem; }
.viz-tip .tip-row strong { font-variant-numeric: tabular-nums; min-width: 2.5rem; }
.viz-tip .tip-key { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.viz-table { margin-top: .5rem; }
.viz-table summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.viz-table table { margin-top: .5rem; }
@media (forced-colors: active) {
  .viz .series-line { stroke: CanvasText; }
  .viz .s2 { stroke-dasharray: 6 3; }
  .viz .s3 { stroke-dasharray: 2 3; }
}
.menu-back { display: none; }
@media (max-width: 900px) { .menu-back { display: inline-flex; } }
.msg-body { white-space: pre-wrap; }
.msg-status { font-size: .72rem; }

/* ---------- Menü: "Tüm Mesajlar" ve hatlar (açılır kapanır) ---------- */
.nav-group > summary { list-style: none; cursor: pointer; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group-head { padding-right: .4rem; }
.nav-group-link { display: flex; align-items: center; gap: .65rem; flex: 1; min-width: 0; color: inherit; text-decoration: none !important; font-weight: 600; }
.nav-caret { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; flex-shrink: 0; }
.nav-caret::before { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .18s ease; opacity: .8; }
.nav-group[open] .nav-caret::before { transform: rotate(45deg) translate(-1px, -1px); }
.nav-caret:hover { background: rgba(255, 255, 255, .08); }
.nav-group-head .nav-badge { margin-left: 0; }
.nav-sub { position: relative; margin: .15rem 0 .2rem 1.05rem; padding-left: .55rem; border-left: 1px solid rgba(255, 255, 255, .09); }
.nav-sublink { display: flex; align-items: center; gap: .5rem; padding: .42rem .55rem; border-radius: 8px; color: var(--sidebar-text); text-decoration: none !important; font-size: .86rem; margin-bottom: 1px; transition: background .15s ease, color .15s ease; }
.nav-sublink:hover { background: var(--sidebar-hover); color: #fff; }
.nav-sublink.active { background: var(--sidebar-active); color: #fff; }
.nav-sub-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-sub-empty { display: block; padding: .4rem .55rem; font-size: .8rem; color: var(--sidebar-heading); }
.line-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; flex-shrink: 0; }
.line-dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
.nav-badge[hidden] { display: none; }

/* ---------- Avatar renkleri ---------- */
.avatar.av-c0 { background: #2563eb; } .avatar.av-c1 { background: #0d9488; } .avatar.av-c2 { background: #7c3aed; } .avatar.av-c3 { background: #db2777; }
.avatar.av-c4 { background: #ea580c; } .avatar.av-c5 { background: #0891b2; } .avatar.av-c6 { background: #65a30d; } .avatar.av-c7 { background: #4f46e5; }
.conv-phone { display: block; color: var(--muted); font-size: .76rem; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-line { display: block; color: var(--muted); font-size: .72rem; margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Gelen kutusu (yeni düzen) ---------- */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
.inbox2 .inbox-list { view-transition-name: inbox-list; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; }

.content:has(> .inbox2) { max-width: none; padding: .75rem; }
.inbox2 {
  --ib-chat-bg: #efeae2; --ib-out: #d9fdd3; --ib-in: #ffffff; --ib-hover: #f3f6fb; --ib-active: #e9f0ff;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); height: calc(100vh - 1.5rem); height: calc(100dvh - 1.5rem); min-height: 520px;
  border: 0; border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 28px rgba(15, 23, 42, .07);
}
@media (prefers-color-scheme: dark) {
  .inbox2 { --ib-chat-bg: #0c1424; --ib-out: #144d37; --ib-in: #1a2438; --ib-hover: #172036; --ib-active: #1a2a50; }
}
.inbox2 .inbox-list { background: var(--surface); }
.inbox2 .ib-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .95rem 1rem .5rem; }
.inbox2 .ib-title { min-width: 0; }
.inbox2 .ib-title h1 { margin: 0; font-size: 1.15rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox2 .ib-new { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; flex-shrink: 0; transition: transform .15s ease, background .15s ease; text-decoration: none !important; }
.inbox2 .ib-new:hover { background: var(--primary-hover); transform: scale(1.06); }
.inbox2 .inbox-filters { border-bottom: 0; padding: .25rem 1rem .6rem; gap: .5rem; }
.inbox2 .ib-search { display: flex; align-items: center; gap: .5rem; background: var(--neutral-soft); border-radius: 999px; padding: 0 .85rem; color: var(--muted); transition: box-shadow .15s ease, background .15s ease; }
.inbox2 .ib-search:focus-within { background: var(--surface); box-shadow: 0 0 0 2px var(--primary); }
.inbox2 .ib-search input { border: 0; background: transparent; box-shadow: none; padding: .55rem 0; outline: none; }
.inbox2 .ib-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.inbox2 .ib-chips select { width: auto; border-radius: 999px; padding: .25rem 1.7rem .25rem .7rem; font-size: .8rem; background-color: var(--neutral-soft); border-color: transparent; }
.inbox2 .ib-markall { margin-left: auto; border: 0; background: none; color: var(--primary); font-size: .78rem; font-weight: 600; cursor: pointer; padding: .25rem .35rem; border-radius: 6px; }
.inbox2 .ib-markall:hover { background: var(--primary-soft); }
.inbox2 .inbox-items { padding: 0 .45rem .5rem; scroll-behavior: smooth; }
.inbox2 .ib-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: 2rem 1rem; }
.inbox2 .conv { border-bottom: 0; border-radius: 12px; padding: .65rem .65rem; margin-bottom: 2px; align-items: center; transition: background .12s ease; }
.inbox2 .conv:hover { background: var(--ib-hover); }
.inbox2 .conv.active { background: var(--ib-active); }
.inbox2 .conv .avatar { width: 46px; height: 46px; font-size: 1rem; }
.inbox2 .conv-name { font-weight: 550; font-size: .93rem; }
.inbox2 .conv.unread .conv-name { font-weight: 750; }
.inbox2 .conv.unread .conv-preview { color: var(--text-2); font-weight: 550; }
.inbox2 .conv.unread .conv-time { color: #16a34a; font-weight: 600; }
.inbox2 .conv-preview { font-size: .84rem; margin-top: .1rem; }
.inbox2 .conv-unread { animation: ib-pop .25s ease-out; }

.inbox2 .thread { background: var(--ib-chat-bg); min-width: 0; }
.inbox2 .thread-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: .6rem 1rem; }
.inbox2 .th-who { display: flex; align-items: center; gap: .7rem; min-width: 0; flex: 1; }
.inbox2 .th-who .avatar { width: 42px; height: 42px; font-size: .95rem; }
.inbox2 .thread-head { flex-wrap: nowrap; }
.inbox2 .thread-head > .toolbar { flex-shrink: 0; }
.inbox2 .th-text { min-width: 0; flex: 1; }
.inbox2 .th-name strong { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox2 .composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox2 .th-name { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: 1rem; }
.inbox2 .th-sub { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox2 .thread-msgs {
  background-color: var(--ib-chat-bg);
  background-image: radial-gradient(rgba(15, 23, 42, .05) 1px, transparent 1px);
  background-size: 18px 18px; padding: 1rem 5% 1.25rem; gap: .3rem; scroll-behavior: smooth;
}
.inbox2 .msg { border-radius: 14px; padding: .45rem .75rem .3rem; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); animation: ib-in .18s ease-out; max-width: min(620px, 75%); }
.inbox2 .msg.in { background: var(--ib-in); border-top-left-radius: 4px; }
.inbox2 .msg.out { background: var(--ib-out); border-top-right-radius: 4px; }
.inbox2 .msg img { border-radius: 10px; max-width: 300px; }
.inbox2 .composer { background: var(--surface); border-top: 0; padding: .6rem .8rem; align-items: center; }
.inbox2 .composer textarea { border-radius: 22px; background: var(--neutral-soft); border-color: transparent; padding: .6rem 1rem; resize: none; }
.inbox2 .composer textarea:focus { background: var(--surface); }
.inbox2 .composer .btn-primary { width: 44px; height: 44px; border-radius: 50%; padding: 0; justify-content: center; flex-shrink: 0; transition: transform .15s ease; }
.inbox2 .composer .btn-primary:hover { transform: scale(1.06); }
.inbox2 .composer-tools, .inbox2 .composer-attachment { background: var(--surface); }
.inbox2 .composer-note { background: var(--surface); border-top: 1px solid var(--border); }
.inbox2 .thread > .empty { margin: auto; }

@keyframes ib-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ib-pop { from { transform: scale(.4); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .inbox2 .msg, .inbox2 .conv-unread { animation: none; }
  @view-transition { navigation: none; }
}
@media (max-width: 960px) {
  .content:has(> .inbox2) { padding: 0; }
  .inbox2 { height: calc(100dvh - 53px); border-radius: 0; box-shadow: none; }
}
@media (max-width: 900px) {
  .inbox2 { grid-template-columns: minmax(0, 1fr); }
  .inbox2 .th-name .conv-alias { display: none; }
  .inbox2 .thread-head { flex-wrap: wrap; padding: .5rem .6rem; gap: .4rem; }
  .inbox2 .th-who { flex: 1 1 100%; gap: .5rem; }
  .inbox2 .th-name { flex-wrap: nowrap; }
  .inbox2 .thread-head > .toolbar { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .inbox2 .thread-head > .toolbar select { width: auto; }
  .inbox2 .thread-msgs { min-height: 0; padding: .75rem .6rem; }
  .inbox2 .msg { max-width: 88%; }
}

/* ---------- Mesajdaki medya: video, ses, dosya kartı ---------- */
.msg .msg-video { display: block; width: 320px; max-width: 100%; max-height: 360px; border-radius: 10px; background: #000; margin-bottom: .25rem; }
.msg .msg-audio { display: block; width: 280px; max-width: 100%; height: 40px; margin: .1rem 0 .2rem; }
.msg .msg-sticker img { max-width: 140px; box-shadow: none; background: transparent; }
.msg-file { display: flex; align-items: center; gap: .6rem; min-width: 220px; max-width: 320px; padding: .55rem .65rem; margin-bottom: .25rem; border-radius: 10px; background: rgba(15, 23, 42, .05); color: inherit; text-decoration: none !important; transition: background .15s ease; }
.msg-file:hover { background: rgba(15, 23, 42, .09); }
.msg-file-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.msg-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.msg-file-name { font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file-meta { font-size: .72rem; color: var(--muted); }
.msg-file-dl { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); color: var(--muted); flex-shrink: 0; font-size: .85rem; }
@media (prefers-color-scheme: dark) { .msg-file { background: rgba(255, 255, 255, .06); } .msg-file:hover { background: rgba(255, 255, 255, .1); } }

/* Numara (hat) sekmeleri: Kişiler, Kişi Grupları, Kampanyalar, Mesaj Şablonları */
.line-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.line-tab { display: inline-flex; align-items: center; padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .85rem; font-weight: 550; white-space: nowrap; text-decoration: none !important; }
.line-tab:hover { border-color: var(--primary); color: var(--text); }
.line-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (max-width: 640px) { .line-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .3rem; margin-left: -.25rem; margin-right: -.25rem; padding-left: .25rem; padding-right: .25rem; } }

/* ---------- Tanıtım sayfası ve yasal alt bilgi ---------- */
.lead { font-size: 1.1rem; color: var(--muted); }
.legal-info { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .5rem 0 1.25rem; }
.legal-info dt { font-weight: 600; color: var(--muted); }
.legal-info dd { margin: 0; }
.legal-footer { margin-top: 1.25rem; text-align: center; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.legal-footer p { margin: .15rem 0; }
.legal-footer a { color: inherit; text-decoration: underline; }
@media (max-width: 520px) { .legal-info { grid-template-columns: 1fr; } .legal-info dd { margin-bottom: .4rem; } }
