/* ==========================================================================
   WhatsApp CRM — arayüz tasarım sistemi

   Koyu tema esas alındı: temsilciler paneli gün boyu açık tutuyor.
   Renk, boşluk ve yazı ölçeği değişkenlerle tanımlandı; tek yerden
   değiştirilebilsin diye hiçbir bileşende sabit renk kullanılmadı.
   ========================================================================== */

:root {
    /* --- Zemin katmanları (slate) --- */
    --bg-base: #020617;
    --bg-surface: #0f172a;
    --bg-raised: #1e293b;
    --bg-hover: #263449;
    --bg-input: #0b1220;

    /* --- Kenarlıklar --- */
    --border: #1e293b;
    --border-strong: #334155;

    /* --- Metin --- */
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* --- Marka: WhatsApp yeşili --- */
    --accent: #25d366;
    --accent-hover: #1fb855;
    --accent-dim: rgba(37, 211, 102, 0.14);
    --accent-text: #052e16;

    /* --- Durum renkleri --- */
    --danger: #f87171;
    --danger-dim: rgba(248, 113, 113, 0.14);
    --warning: #fbbf24;
    --warning-dim: rgba(251, 191, 36, 0.14);
    --info: #60a5fa;
    --info-dim: rgba(96, 165, 250, 0.14);
    --success: var(--accent);

    /* --- Mesaj balonları --- */
    --bubble-in: #1e293b;
    --bubble-out: #075e54;
    --bubble-out-text: #e8f5e9;

    /* --- Ölçüler --- */
    --sidebar-w: 280px;
    --list-w: 360px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);

    --font: 'Segoe UI', system-ui, -apple-system, 'Inter', Roboto, Arial, sans-serif;

    /* Hareketi azalt tercihine saygı duyulacak şekilde tanımlandı. */
    --transition: 140ms ease;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --transition: 0ms;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

* {
    box-sizing: border-box;
}

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

body {
    background: var(--bg-base);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

#app {
    height: 100%;
}

/* --------------------------------------------------------------- Açılış ekranı */

.boot-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    color: var(--accent);
}

.boot-title {
    color: var(--text);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.boot-spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------- Blazor hata çubuğu */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 12px 20px;
    background: var(--danger);
    color: #1a0000;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}

#blazor-error-ui .reload {
    color: #1a0000;
    text-decoration: underline;
    margin-left: 12px;
}

#blazor-error-ui .dismiss {
    float: right;
    cursor: pointer;
}

/* --------------------------------------------------------------- Genel yerleşim */

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.sidebar-brand svg {
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin-bottom: 3px;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
    background: var(--bg-raised);
    color: var(--text);
}

.nav-link.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-link .badge {
    margin-left: auto;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.topbar {
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.topbar h1 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.topbar-spacer {
    flex: 1;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
}

.content.flush {
    padding: 0;
    overflow: hidden;
}

/* Konuşmalar ekranının üç kolonlu düzeni */
.split-view {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.split-list {
    width: var(--list-w);
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
}

.split-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.split-aside {
    width: 300px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: var(--bg-surface);
    overflow-y: auto;
    padding: 18px;
}

/* --------------------------------------------------------------- Kartlar ve ızgara */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 14px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-stats {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* İstatistik kutusu */
.stat {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;

    /* Sayılar değişince sütun genişliği zıplamasın. */
    font-variant-numeric: tabular-nums;
}

.stat-delta {
    font-size: 12px;
    margin-top: 6px;
    font-weight: 500;
}

.stat-delta.up { color: var(--accent); }
.stat-delta.down { color: var(--danger); }
.stat-delta.flat { color: var(--text-dim); }

/* --------------------------------------------------------------- Düğmeler */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-raised);
}

.btn-danger {
    background: var(--danger-dim);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #1a0000;
}

.btn-sm {
    padding: 6px 11px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    transition: background var(--transition), color var(--transition);
}

.btn-icon:hover {
    background: var(--bg-raised);
    color: var(--text);
}

.btn-block {
    width: 100%;
}

/* --------------------------------------------------------------- Form öğeleri */

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-dim);
}

.input.invalid,
.select.invalid,
.textarea.invalid {
    border-color: var(--danger);
}

.textarea {
    resize: vertical;
    min-height: 90px;
}

.field-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 5px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    user-select: none;
}

.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Arama kutusu */
.search-box {
    position: relative;
}

.search-box svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-box .input {
    padding-left: 34px;
}

/* --------------------------------------------------------------- Rozetler */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info { background: var(--info-dim); color: var(--info); }
.badge-muted { background: var(--bg-raised); color: var(--text-muted); }

.badge-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    justify-content: center;
    background: var(--accent);
    color: var(--accent-text);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- Sekmeler */

.tabs {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.tab:hover {
    background: var(--bg-raised);
    color: var(--text);
}

.tab.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.tab .count {
    margin-left: 5px;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- Konuşma listesi */

.conv-list {
    flex: 1;
    overflow-y: auto;
}

.conv-item {
    display: flex;
    gap: 11px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    transition: background var(--transition);
}

.conv-item:hover {
    background: var(--bg-raised);
}

.conv-item.active {
    background: var(--bg-raised);
}

/* Seçili konuşmanın sol kenarında yeşil çizgi */
.conv-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
}

/* Cevap bekleyen konuşma kırmızı işaretlenir */
.conv-item.waiting::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--danger);
}

.conv-body {
    flex: 1;
    min-width: 0;
}

.conv-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}

.conv-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-time {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.conv-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-preview .text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

/* --------------------------------------------------------------- Avatar */

.avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg-raised);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    user-select: none;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.avatar-lg {
    width: 60px;
    height: 60px;
    font-size: 20px;
}

.avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

/* Çevrimiçi göstergesi */
.presence-dot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    background: var(--text-dim);
}

.presence-dot.online {
    background: var(--accent);
}

/* --------------------------------------------------------------- Mesaj alanı */

.chat-head {
    /* Sabit yükseklik yerine en az yükseklik: içerik beklenenden
       uzun gelirse başlıktan taşmak yerine bir miktar büyüsün. */
    min-height: 62px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

/* Başlıktaki eylemler daralma karşısında küçülmesin; yalnızca
   ad/telefon alanı esnesin. */
.chat-head > *:not(.chat-head-info) {
    flex-shrink: 0;
}

.chat-head-info {
    min-width: 0;
    flex: 1;
}

.chat-head-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Telefon numarası uzun olduğunda sarmalanıp başlığı bozuyordu;
   tek satırda kalıp sonu üç noktayla kısalıyor. */
.chat-head-sub {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-head-sub .mono {
    font-size: 12px;
}

/* Dar ekranda başlık kalabalıklaşıyor: durum rozeti listede zaten
   görünüyor, burada gizlenebilir. */
@media (max-width: 1100px) {
    .chat-head .badge {
        display: none;
    }

    .chat-head .btn-sm span {
        display: none;
    }
}

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;

    /* İnce dokulu zemin, balonların okunurluğunu artırıyor. */
    background-image: radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.05) 1px, transparent 0);
    background-size: 22px 22px;
}

.chat-day {
    align-self: center;
    margin: 14px 0 10px;
    padding: 3px 12px;
    background: var(--bg-raised);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.bubble-row {
    display: flex;
    max-width: 100%;
}

.bubble-row.out {
    justify-content: flex-end;
}

.bubble {
    max-width: min(68%, 560px);
    padding: 8px 11px 6px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.45;

    /* Uzun bağlantı ve kelimeler taşmasın */
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.bubble.in {
    background: var(--bubble-in);
    border-bottom-left-radius: 4px;
}

.bubble.out {
    background: var(--bubble-out);
    color: var(--bubble-out-text);
    border-bottom-right-radius: 4px;
}

.bubble.failed {
    background: var(--danger-dim);
    border: 1px solid var(--danger);
}

.bubble-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 3px;
    font-size: 10.5px;
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

.bubble-media img {
    max-width: 100%;
    border-radius: var(--radius);
    display: block;
    margin-bottom: 5px;
}

.bubble-file {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.22);
    border-radius: var(--radius);
    margin-bottom: 5px;
}

.bubble-file .name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bubble-file .size {
    font-size: 11px;
    opacity: 0.7;
}

/* Yapay zekâ etiketleri */
.ai-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

/* Teslim durumu ikonları */
.status-icon {
    display: inline-flex;
    align-items: center;
}

.status-icon.read {
    color: #53bdeb;
}

/* Yazıyor göstergesi */
.typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--bubble-in);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
}

.typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing-bounce 1.3s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* --------------------------------------------------------------- Mesaj yazma kutusu */

.composer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 11px 14px;
}

.composer-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
}

.composer textarea {
    flex: 1;
    max-height: 150px;
    min-height: 42px;
    padding: 11px 13px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    resize: none;
    transition: border-color var(--transition);
}

.composer textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.composer-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-dim);
}

.send-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Yapay zekâ yanıt önerileri */
.quick-replies {
    display: flex;
    gap: 7px;
    margin-bottom: 9px;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
}

.quick-reply {
    flex-shrink: 0;
    max-width: 280px;
    padding: 7px 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: border-color var(--transition), background var(--transition);
}

.quick-reply:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* --------------------------------------------------------------- Tablo */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-raised);
}

.table-wrap {
    overflow-x: auto;
}

/* Kart içi liste satırı: solda simge/avatar, ortada metin, sağda işlemler.
   Ekip ve etkinlik listeleri aynı ritmi paylaşsın diye tek yerde tanımlı. */
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.list-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.list-row:first-child {
    padding-top: 0;
}

/* Satır içi metin bloğu taşarsa kısaltılsın; işlem düğmeleri
   asla ekran dışına itilmesin. */
.list-row > .grow {
    min-width: 0;
}

.list-row > *:not(.grow) {
    flex-shrink: 0;
}

/* Başarı/başarısızlık noktası — etkinlik kaydında satırın solunda durur. */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.dot-ok {
    background: var(--accent);
}

.dot-fail {
    background: var(--danger);
}

/* Açılan ayrıntı kutusu */
.detail-box {
    background: var(--bg-raised);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
}

.detail-key {
    flex: 0 0 108px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

/* JSON ayrıntısı uzun olabilir: kutunun içinde kaydırılsın,
   sayfayı yatay olarak asla itmesin. */
.detail-json {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 12px;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 180px;
    overflow-y: auto;
}

/* Tıklanabilir satır (etkinlik kaydında ayrıntıyı açar) */
.list-row.clickable {
    cursor: pointer;
    padding-left: 8px;
    padding-right: 8px;
    margin-left: -8px;
    margin-right: -8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.list-row.clickable:hover {
    background: var(--bg-raised);
}

/* Skor çubuğu */
.score {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 110px;
}

.score-track {
    flex: 1;
    height: 6px;
    background: var(--bg-raised);
    border-radius: 999px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 320ms ease;
}

.score-value {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 24px;
    text-align: right;
}

/* --------------------------------------------------------------- Boş durum */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 56px 24px;
    text-align: center;
    color: var(--text-dim);
    height: 100%;
}

.empty svg {
    opacity: 0.35;
}

.empty-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
}

/* Yükleniyor iskeleti */
.skeleton {
    background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-hover) 50%, var(--bg-raised) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}

/* --------------------------------------------------------------- Bildirimler */

.toast-host {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-left-width: 3px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: toast-in 200ms ease;
}

.toast.success { border-left-color: var(--accent); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-text {
    flex: 1;
    font-size: 13.5px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0;
    font-size: 15px;
    line-height: 1;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --------------------------------------------------------------- Kalıcı pencere */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: rgba(2, 6, 23, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in 140ms ease;
}

.modal {
    width: 100%;
    max-width: 540px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modal-in 180ms ease;
}

.modal-head {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --------------------------------------------------------------- Giriş ekranı */

.auth-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;

    background:
        radial-gradient(ellipse 700px 520px at 50% -10%, rgba(37, 211, 102, 0.10), transparent),
        var(--bg-base);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 19px;
    font-weight: 700;
}

.auth-logo span {
    color: var(--text);
}

.auth-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 13.5px;
    margin-bottom: 26px;
}

.auth-foot {
    text-align: center;
    margin-top: 20px;
    font-size: 13.5px;
    color: var(--text-muted);
}

.auth-foot a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-foot a:hover {
    text-decoration: underline;
}

.alert {
    padding: 11px 13px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.alert-info {
    background: var(--info-dim);
    color: var(--info);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.alert-warning {
    background: var(--warning-dim);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

/* --------------------------------------------------------------- Dil seçici */

.lang-switch {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg-raised);
    border-radius: var(--radius-sm);
}

.lang-switch button {
    padding: 4px 9px;
    border: none;
    background: transparent;
    border-radius: 4px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.lang-switch button.active {
    background: var(--bg-hover);
    color: var(--text);
}

/* --------------------------------------------------------------- Bağlantı durumu */

.conn-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-dim);
}

.conn-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
}

.conn-status.online .dot {
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.conn-status.reconnecting .dot {
    background: var(--warning);
    animation: pulse 1.1s infinite;
}

.conn-status.offline .dot {
    background: var(--danger);
}

@keyframes pulse {
    50% { opacity: 0.3; }
}

/* --------------------------------------------------------------- Yardımcı sınıflar */

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: 12px; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 13px; }

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

.section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* --------------------------------------------------------------- Kaydırma çubuğu */

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Klavyeyle gezinen kullanıcı odağı görebilsin */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --------------------------------------------------------------- Duyarlı düzen */

/* Tablet: müşteri bilgi paneli gizlenir */
@media (max-width: 1200px) {
    .split-aside {
        display: none;
    }

    :root {
        --list-w: 320px;
    }
}

/* Mobil: kenar çubuğu üstüne biner, liste ve detay tek ekrana düşer */
@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 700;
        margin-left: calc(var(--sidebar-w) * -1);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        margin-left: 0;
    }

    .split-list {
        width: 100%;
        border-right: none;
    }

    /* Konuşma seçiliyken liste gizlenir, detay tam ekran olur */
    .split-view.detail-open .split-list {
        display: none;
    }

    .split-view:not(.detail-open) .split-detail {
        display: none;
    }

    .content {
        padding: 14px;
    }

    .bubble {
        max-width: 82%;
    }

    .toast-host {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

/* Mobilde kenar çubuğu açıkken arka planı karartan katman */
.sidebar-scrim {
    display: none;
}

@media (max-width: 860px) {
    .sidebar-scrim.visible {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 690;
        background: rgba(2, 6, 23, 0.6);
    }
}
