:root {
    --bg: #0f172a;
    --bg2: #1e293b;
    --bg3: #334155;
    --text: #f1f5f9;
    --text2: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --border: #475569;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Login ── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-box {
    background: var(--bg2);
    padding: 2.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}
.login-box h1 { text-align: center; margin-bottom: 0.5rem; font-size: 1.5rem; }
.login-box .subtitle { text-align: center; color: var(--text2); margin-bottom: 2rem; font-size: 0.9rem; }

/* ── Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}
.sidebar-header {
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}
.sidebar-header h2 { font-size: 1.1rem; }
.sidebar-header .user-info { color: var(--text2); font-size: 0.8rem; margin-top: 4px; }

.sidebar nav { flex: 1; }
.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 1.25rem;
    color: var(--text2);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.sidebar a:hover, .sidebar a.active {
    background: var(--bg3);
    color: var(--text);
}
.sidebar a .emoji { font-size: 1.1rem; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}
.sidebar-footer a { color: var(--danger); }

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; }

/* ── Cards ── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.card-title { font-size: 0.85rem; color: var(--text2); margin-bottom: 0.5rem; }
.card-value { font-size: 1.75rem; font-weight: 700; }
.card-sub { font-size: 0.8rem; color: var(--text2); margin-top: 0.25rem; }

/* ── Table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg2);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: var(--bg3);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text2);
}
.data-table td { font-size: 0.9rem; }
.data-table tr:hover { background: rgba(59, 130, 246, 0.05); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-acil { background: #dc262620; color: #f87171; }
.badge-yuksek { background: #f59e0b20; color: #fbbf24; }
.badge-orta { background: #3b82f620; color: #60a5fa; }
.badge-dusuk { background: #22c55e20; color: #4ade80; }
.badge-bekliyor { background: #64748b20; color: #94a3b8; }
.badge-devam_ediyor { background: #3b82f620; color: #60a5fa; }
.badge-tamamlandi { background: #22c55e20; color: #4ade80; }
.badge-yapamadum { background: #ef444420; color: #f87171; }

/* ── Forms ── */
input, select, textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
label {
    display: block;
    font-size: 0.85rem;
    color: var(--text2);
    margin-bottom: 0.3rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h2 { margin-bottom: 1rem; font-size: 1.2rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* ── Kart Ödeme ── */
.odeme-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}
.odeme-gun { font-size: 1.5rem; font-weight: 700; min-width: 40px; text-align: center; }
.odeme-gun.bugun { color: var(--danger); }
.odeme-gun.yakin { color: var(--warning); }
.odeme-gun.normal { color: var(--success); }

/* ── Mobile Menu Toggle ── */
.menu-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1100;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.sidebar-backdrop.open { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }

    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1000;
        width: 260px;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        padding: 1rem 0.75rem;
        padding-top: 3.5rem;
        overflow-x: hidden;
        width: 100%;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .page-header h1 { font-size: 1.25rem; }

    .cards-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .card { padding: 0.75rem; }
    .card-value { font-size: 1.25rem; }
    .card-title { font-size: 0.75rem; }

    /* Chrome mobil zoom engellemek icin input font-size 16px */
    input, select, textarea { font-size: 16px; }

    /* Tablolari yatay scroll */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    .data-table { min-width: 600px; }
    .data-table th, .data-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Filtreler dikey */
    .filters { flex-direction: column; }
    .filters select, .filters input { width: 100%; min-width: unset; }

    /* Tabs scroll */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-btn { white-space: nowrap; padding: 0.5rem 0.75rem; font-size: 0.85rem; }

    /* Modal tam ekran */
    .modal-overlay.open {
        align-items: flex-start;
    }
    .modal {
        max-width: 100%;
        max-height: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
        margin: 0;
        padding: 1.25rem;
        padding-top: max(1.25rem, env(safe-area-inset-top));
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    }

    /* Dashboard 2-sutun grid tek sutuna */
    .dash-grid { grid-template-columns: 1fr !important; }

    /* Butonlar */
    .btn { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
    .btn-sm { padding: 0.3rem 0.5rem; font-size: 0.75rem; }

    /* Islem butonlari satira */
    td .btn { margin-bottom: 2px; }

    /* Odeme item responsive */
    .odeme-item { flex-wrap: wrap; gap: 0.5rem; }

    /* Login */
    .login-box { margin: 1rem; padding: 1.5rem; }

    /* Body overflow */
    body { overflow-x: hidden; }
    .app-layout { overflow-x: hidden; }
}

@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .card-value { font-size: 1.5rem; }
}

/* ── Toast ── */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    background: var(--success);
    color: white;
    font-size: 0.9rem;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Notlar ── */
.not-item {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary);
}
.not-meta { font-size: 0.75rem; color: var(--text2); margin-top: 0.5rem; }

/* ── Filters ── */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filters select, .filters input { width: auto; margin-bottom: 0; min-width: 140px; }

/* ── Tabs ── */
.tab-btn {
    background: transparent;
    border: none;
    color: var(--text2);
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ── Durum Popup ── */
.durum-popup button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
}
.durum-popup button:hover { background: var(--bg3); }

/* ── Yorum ── */
.yorum-item {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
    border-left: 3px solid var(--primary);
}

/* ── Badge ek ── */
.badge-beklemede { background: #f59e0b20; color: #fbbf24; }
.badge-onay_bekliyor { background: #8b5cf620; color: #a78bfa; }
