:root {
    --bg-canvas: #f5f7fb;
    --bg-card: #ffffff;
    --navy-950: #071324;
    --navy-900: #0b192c;
    --navy-800: #13294b;
    --navy-700: #1e3a66;
    --teal-600: #0d9488;
    --teal-500: #0ea5a4;
    --teal-100: #ccfbf1;
    --teal-50: #f0fdfa;
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-subtle: #64748b;
    --border-light: #e2e8f0;
    --danger-600: #dc2626;
    --danger-50: #fef2f2;
    --warn-600: #d97706;
    --warn-50: #fffbeb;
    --success-600: #059669;
    --success-50: #ecfdf5;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 6px 20px rgba(11, 25, 44, 0.08);
    --sidebar-width: 272px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-canvas);
    color: var(--text-main);
    font-family: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--teal-600);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Auth / Setup Layout */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 60%, #0f4c5c 100%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--teal-500), #0284c7);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 0.04em;
    font-size: 15px;
    flex-shrink: 0;
}

.auth-title {
    margin: 0 0 6px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--navy-900);
}

.auth-subtitle {
    margin: 0 0 24px 0;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* Main Dashboard Shell */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--navy-900);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    transition: transform 0.22s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #ffffff;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: #5eead4;
    font-weight: 500;
}

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

.nav-group-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 12px 10px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.nav-link:hover {
    background: var(--navy-800);
    color: #ffffff;
    text-decoration: none;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(14, 165, 164, 0.24), rgba(14, 165, 164, 0.08));
    color: #ffffff;
    border-left: 3px solid var(--teal-500);
    padding-left: 9px;
    font-weight: 600;
}

.nav-icon {
    width: 17px;
    height: 17px;
    opacity: 0.85;
    flex-shrink: 0;
}

.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--navy-900);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--navy-900);
}

.page-content {
    padding: 26px 28px 40px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* Cards & Grid */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy-900);
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-subtle);
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--navy-900);
    font-variant-numeric: tabular-nums;
}

.kpi-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.kpi-accent {
    border-top: 3px solid var(--teal-500);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-teal {
    background: var(--teal-100);
    color: #0f766e;
}

.badge-navy {
    background: #e2e8f0;
    color: var(--navy-900);
}

.badge-warn {
    background: var(--warn-50);
    color: var(--warn-600);
    border: 1px solid #fde68a;
}

.badge-danger {
    background: var(--danger-50);
    color: var(--danger-600);
    border: 1px solid #fecaca;
}

.badge-success {
    background: var(--success-50);
    color: var(--success-600);
    border: 1px solid #a7f3d0;
}

/* Forms & Buttons */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--navy-900);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-main);
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.15);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--teal-500);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--teal-600);
}

.btn-navy {
    background: var(--navy-900);
    color: #ffffff;
}

.btn-navy:hover {
    background: var(--navy-800);
}

.btn-outline {
    background: #ffffff;
    border-color: #cbd5e1;
    color: var(--navy-900);
}

.btn-outline:hover {
    background: #f8fafc;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
}

.alert-success {
    background: var(--success-50);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: var(--danger-50);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: var(--teal-50);
    color: #115e59;
    border: 1px solid #99f6e4;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

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

table.data-table th {
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

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

/* Progress bar */
.progress-track {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal-500), #0284c7);
    border-radius: 999px;
}

.progress-fill.warn {
    background: linear-gradient(90deg, #f59e0b, #dc2626);
}

/* Responsive */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 1100px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-backdrop.open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(7, 19, 36, 0.55);
        z-index: 35;
    }
    .main-area {
        margin-left: 0;
    }
    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
    }
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .page-content {
        padding: 18px 16px 32px;
    }
    .topbar {
        padding: 0 16px;
    }
    .wa-layout {
        grid-template-columns: 1fr !important;
    }
}

/* WhatsApp Mesajlaşma Arayüzü */
.wa-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 290px;
    gap: 16px;
    align-items: start;
}

.wa-sidebar-pane, .wa-chat-pane, .wa-info-pane {
    padding: 16px;
}

.wa-conv-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 580px;
    overflow-y: auto;
}

.wa-conv-item {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: #ffffff;
    color: var(--text-main);
    text-decoration: none;
}

.wa-conv-item:hover {
    background: #f8fafc;
    text-decoration: none;
}

.wa-conv-item.active {
    background: var(--teal-50);
    border-color: var(--teal-500);
}

.wa-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 460px;
    overflow-y: auto;
    padding: 14px 8px;
    background: #f8fafc;
    border-radius: 10px;
    margin-top: 12px;
}

.wa-bubble-row {
    display: flex;
}

.wa-bubble-row.inbound {
    justify-content: flex-start;
}

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

.wa-bubble {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: var(--shadow-sm);
}

.wa-bubble.in {
    background: #ffffff;
    border: 1px solid var(--border-light);
    color: var(--text-main);
}

.wa-bubble.out {
    background: #0b192c;
    color: #ffffff;
}

.wa-bubble.draft {
    background: #fffbeb;
    border: 1px solid #f59e0b;
    color: #0f172a;
}

