:root {
    --sidebar-w: 240px;
    --sidebar-bg: #1a2233;
    --sidebar-text: #c8d2e0;
    --sidebar-active: #4f8ef7;
    --topbar-h: 54px;
    --accent: #4f8ef7;
}

* { box-sizing: border-box; }

body { margin: 0; background: #f0f2f7; font-family: 'Segoe UI', sans-serif; }

/* ── Wrapper ── */
.tw-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.tw-sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width .25s ease;
    overflow: hidden;
}
.tw-sidebar.collapsed { width: 64px; }
.tw-sidebar.collapsed .tw-nav-link span,
.tw-sidebar.collapsed .nav-label,
.tw-sidebar.collapsed .tw-sidebar-footer .tw-footer-name { display: none; }
.tw-sidebar.collapsed .tw-sidebar-brand { justify-content: center; padding: 16px 0; }
.tw-sidebar.collapsed .tw-sidebar-brand img { height: 28px; }
.tw-sidebar.collapsed .tw-nav-link { justify-content: center; padding: 12px 0; }
.tw-sidebar.collapsed .tw-sidebar-footer { text-align: center; }
.tw-sidebar.collapsed .tw-sidebar-footer a { font-size: 0; padding: 6px; }
.tw-sidebar.collapsed .tw-sidebar-footer a i { font-size: 1rem; }

.tw-sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff;
}

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

.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(200,210,224,.4);
    padding: 14px 20px 4px;
}

.tw-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.tw-nav-link i { width: 18px; text-align: center; flex-shrink: 0; }
.tw-nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.tw-nav-link.active {
    color: #fff;
    background: rgba(79,142,247,.15);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.tw-sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 13px;
    color: var(--sidebar-text);
}

/* ── Main ── */
.tw-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
    min-width: 0;
}
.tw-main.expanded { margin-left: 64px; }

/* ── Topbar ── */
.tw-topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.tw-toggle-btn { color: #555; padding: 4px 8px; }
.tw-page-title { font-weight: 600; color: #333; font-size: 15px; }

/* ── Content ── */
.tw-content { padding: 24px; flex: 1; }

/* ── Stat Cards ── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 22px;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon.blue   { background: #e8f0fe; color: #4f8ef7; }
.stat-icon.green  { background: #e6f9f0; color: #34c77b; }
.stat-icon.orange { background: #fff3e8; color: #f97316; }
.stat-icon.red    { background: #fde8e8; color: #ef4444; }
.stat-icon.purple { background: #ede8fe; color: #8b5cf6; }

.stat-label { font-size: 12px; color: #888; margin-bottom: 2px; }
.stat-value { font-size: 24px; font-weight: 700; color: #1a2233; }

/* ── Panel ── */
.tw-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}
.tw-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f2f7;
    font-weight: 600;
    color: #1a2233;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tw-panel-body { padding: 20px; }

/* ── Badge durum ── */
.badge-bekliyor { background: #fff3cd; color: #856404; }
.badge-odendi   { background: #d1e7dd; color: #0f5132; }
.badge-pasif    { background: #f8d7da; color: #842029; }
.badge-aktif    { background: #d1e7dd; color: #0f5132; }

/* ── Login ── */
.tw-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2233 0%, #2d3f5e 100%);
}
.tw-login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.tw-login-logo {
    text-align: center;
    margin-bottom: 28px;
    color: var(--sidebar-bg);
}

/* ── DataTable override ── */
/* Geniş tablolar (örn. üye listesi) dar ekranda yatay kaydırılabilsin;
   böylece en sağdaki Detay butonu da erişilebilir kalır. */
.dataTables_wrapper { overflow-x: auto; }
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; }
.dataTables_wrapper .dataTables_length select { border-radius: 8px; }
table.dataTable thead th { background: #f8fafc; color: #555; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
table.dataTable tbody tr:hover { background: #f8fafc !important; }

/* ── Detail card ── */
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f0f2f7; font-size: 14px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 160px; color: #888; flex-shrink: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding-top: 1px; }
/* min-width:0 → flex öğesinin küçülmesine izin verir; overflow-wrap → uzun
   e-posta/GUID gibi kırılmaz değerler taşmadan satır kırar (mobilde kesilmeyi önler). */
.detail-value { color: #1a2233; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ── Mobil (off-canvas sidebar) ── */
@media (max-width: 768px) {
    /* Sidebar varsayılan olarak ekran dışında; toggle ile açılır */
    .tw-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;   /* .collapsed kalsa bile tam genişlik */
        box-shadow: 2px 0 14px rgba(0,0,0,.25);
        transition: transform .25s ease;
    }
    .tw-sidebar.mobile-open { transform: translateX(0); }
    /* .collapsed sınıfı masaüstüne ait; mobilde içeriği daraltmasın */
    .tw-sidebar.collapsed .tw-nav-link span,
    .tw-sidebar.collapsed .nav-label,
    .tw-sidebar.collapsed .tw-sidebar-footer .tw-footer-name { display: revert; }
    .tw-sidebar.collapsed .tw-nav-link { justify-content: flex-start; padding: 10px 20px; }

    /* İçerik tam genişlik */
    .tw-main,
    .tw-main.expanded { margin-left: 0 !important; }
    .tw-content { padding: 16px; }

    /* Detay satırları dar ekranda alt alta: etiket üstte, değer altta tam genişlik */
    .detail-row { flex-direction: column; }
    .detail-label { width: auto; margin-bottom: 2px; }

    /* Açıkken arka plan karartması */
    .tw-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 99;          /* sidebar(100) altında, içerik üstünde */
        display: none;
    }
    .tw-backdrop.show { display: block; }
}
