:root {
    --primary: #1a3c5e;
    --primary-light: #2563a8;
    --accent: #e8b831;
    --danger: #dc3545;
    --success: #198754;
    --bg: #f0f4f8;
    --card-shadow: 0 4px 24px rgba(26,60,94,.10);
    --sidebar-w: 250px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #222;
    -webkit-text-size-adjust: 100%;
}

/* ════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #1a3c5e 0%, #2563a8 60%, #1a3c5e 100%);
}

.login-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
    padding: 2.5rem 2.2rem;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    width: 72px; height: 72px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center; justify-content: center;
    margin: 0 auto 1.2rem;
}

.login-card h1 { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.login-card p.sub { color: #666; font-size: .9rem; }

.form-control {
    border-radius: 10px;
    padding: .65rem 1rem;
    border: 1.5px solid #d0d8e4;
    font-size: 1rem;
    width: 100%;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,168,.15);
    outline: none;
}

.btn-primary-custom {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: background .2s, transform .1s;
    display: block;
    text-align: center;
}
.btn-primary-custom:hover { background: var(--primary-light); transform: translateY(-1px); }

/* ════════════════════════════════════════
   USER NAVBAR
════════════════════════════════════════ */
.navbar-custom {
    background: var(--primary);
    padding: .75rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
    flex-wrap: wrap;
    gap: .5rem;
}

.navbar-brand-custom {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
}
.navbar-brand-custom span.accent { color: var(--accent); }

.nav-user {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: rgba(255,255,255,.85);
    font-size: .85rem;
    flex-wrap: wrap;
}
.nav-user .tc-info { opacity: .65; }

.nav-user a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    padding: .3rem .8rem;
    border: 1.5px solid var(--accent);
    border-radius: 8px;
    transition: background .2s, color .2s;
    white-space: nowrap;
}
.nav-user a:hover { background: var(--accent); color: var(--primary); }

/* ════════════════════════════════════════
   USER DASHBOARD
════════════════════════════════════════ */
.page-wrapper { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }

.welcome-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 14px;
    color: #fff;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--card-shadow);
}
.welcome-bar .icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.welcome-bar h2 { font-size: 1.1rem; margin: 0; font-weight: 700; }
.welcome-bar p  { margin: .2rem 0 0; opacity: .85; font-size: .85rem; }

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    border-left: 4px solid var(--accent);
    padding-left: .75rem;
    margin-bottom: 1rem;
}

/* ── Vergi Cards ── */
.vergi-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 1.2rem 1.2rem 1.2rem 1.4rem;
    margin-bottom: 1rem;
    border-left: 5px solid var(--primary-light);
    position: relative;
    overflow: hidden;
    transition: box-shadow .15s;
}
.vergi-card:hover { box-shadow: 0 8px 32px rgba(26,60,94,.15); }
.vergi-card.gecikti   { border-left-color: var(--danger); }
.vergi-card.odendi    { border-left-color: var(--success); opacity: .85; }
.vergi-card.beklemede { border-left-color: #f59e0b; }

.vergi-card .vergi-turu {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: .25rem;
    padding-right: 5rem;
}
.vergi-card .vergi-aciklama {
    color: #555;
    font-size: .88rem;
    margin-bottom: .8rem;
    line-height: 1.5;
}

.vergi-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .6rem;
    margin-top: .6rem;
}
.vergi-meta-item {
    background: #f5f7fb;
    border-radius: 10px;
    padding: .6rem .9rem;
}
.vergi-meta-item .label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #888;
    font-weight: 600;
    margin-bottom: .1rem;
}
.vergi-meta-item .value {
    font-size: .93rem;
    font-weight: 700;
    color: var(--primary);
    word-break: break-all;
}
.vergi-meta-item .value.tutar { color: var(--danger); font-size: 1.05rem; }
.vergi-meta-item .value.iban  { font-family: monospace; letter-spacing: .04em; font-size: .82rem; }

.badge-durum {
    position: absolute;
    top: .9rem; right: .9rem;
    padding: .25rem .7rem;
    border-radius: 20px;
    font-size: .73rem;
    font-weight: 700;
}
.badge-beklemede { background: #fef3c7; color: #92400e; }
.badge-odendi    { background: #d1fae5; color: #065f46; }
.badge-gecikti   { background: #fee2e2; color: #991b1b; }

.empty-state { text-align: center; padding: 3rem 1rem; color: #999; }
.empty-state .icon { font-size: 3rem; margin-bottom: .5rem; }

/* ════════════════════════════════════════
   ADMIN LAYOUT
════════════════════════════════════════ */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
    padding: 1.3rem 1.3rem .9rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand h2 { color: #fff; font-size: 1.05rem; font-weight: 800; }
.sidebar-brand h2 span { color: var(--accent); }
.sidebar-brand p { color: rgba(255,255,255,.55); font-size: .78rem; margin-top: .2rem; }

.sidebar-nav { padding: .8rem 0; flex: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: rgba(255,255,255,.78);
    text-decoration: none;
    padding: .75rem 1.3rem;
    font-size: .93rem;
    font-weight: 500;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-left-color: var(--accent);
}
.sidebar-nav a .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: .9rem 1.3rem;
    border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-footer + .sidebar-footer { border-top: none; padding-top: 0; }
.sidebar-footer a {
    color: rgba(255,255,255,.6);
    font-size: .82rem;
    text-decoration: none;
    display: flex; align-items: center; gap: .5rem;
}
.sidebar-footer a:hover { color: #fff; }

/* Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 199;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Content */
.admin-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-topbar {
    background: #fff;
    padding: .85rem 1.5rem;
    border-bottom: 1px solid #e5eaf2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.admin-topbar h1 { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin: 0; }
.admin-topbar .breadcrumb-custom { font-size: .78rem; color: #888; margin-top: .1rem; }

/* Hamburger button (hidden on desktop) */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: .3rem;
    flex-shrink: 0;
    color: var(--primary);
    border-radius: 8px;
}
.hamburger-btn:hover { background: #f0f4f8; }
.hamburger-btn svg { display: block; }

.admin-main { padding: 1.5rem; flex: 1; }

/* ── Stat Cards ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.8rem;
}
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.2rem;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: .9rem;
    transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.yellow { background: #fef9c3; color: #a16207; }
.stat-icon.red    { background: #fee2e2; color: #b91c1c; }
.stat-icon.green  { background: #dcfce7; color: #15803d; }
.stat-info .num { font-size: 1.5rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat-info .lbl { font-size: .75rem; color: #888; margin-top: .1rem; }

/* ── Tables ── */
.table-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.table-card-header {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid #eef1f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
}
.table-card-header h3 { font-size: .98rem; font-weight: 700; color: var(--primary); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { margin: 0; width: 100%; border-collapse: collapse; }
.table thead th {
    background: #f5f7fb;
    color: #555;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
    border-bottom: 2px solid #e5eaf2;
    padding: .75rem 1rem;
    white-space: nowrap;
}
.table tbody td {
    padding: .8rem 1rem;
    vertical-align: middle;
    font-size: .88rem;
    border-bottom: 1px solid #f0f3f8;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfd; }

.badge { font-size: .72rem; padding: .28em .65em; border-radius: 6px; font-weight: 600; }
.bg-warning { background-color: #fef3c7 !important; color: #92400e !important; }
.bg-success  { background-color: #d1fae5 !important; color: #065f46 !important; }
.bg-danger   { background-color: #fee2e2 !important; color: #991b1b !important; }

/* ── Buttons ── */
.btn-sm-custom {
    padding: .3rem .65rem;
    border-radius: 7px;
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: none;
    cursor: pointer;
    transition: opacity .15s;
    white-space: nowrap;
}
.btn-sm-custom:hover { opacity: .82; }
.btn-edit   { background: #dbeafe; color: #1e40af; }
.btn-delete { background: #fee2e2; color: #991b1b; }
.btn-view   { background: #ede9fe; color: #6d28d9; }
.btn-add    { background: var(--primary); color: #fff; padding: .45rem 1rem; font-size: .85rem; border-radius: 9px; }
.btn-accent { background: var(--accent); color: var(--primary); padding: .45rem 1rem; font-size: .85rem; border-radius: 9px; font-weight: 700; }

/* ── Forms ── */
.form-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    padding: 1.8rem;
    max-width: 760px;
}
.form-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: #444;
    margin-bottom: .3rem;
}
.form-control, .form-select {
    border-radius: 9px;
    border: 1.5px solid #d0d8e4;
    padding: .6rem .9rem;
    font-size: .93rem;
    width: 100%;
    transition: border-color .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,168,.12);
    outline: none;
}
.form-section-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #888;
    margin: 1.4rem 0 .7rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid #eef1f6;
}

/* ── Alerts ── */
.alert-custom {
    padding: .8rem 1rem;
    border-radius: 10px;
    font-size: .88rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    flex-wrap: wrap;
}
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ════════════════════════════════════════
   GRID HELPERS
════════════════════════════════════════ */
.row { display: flex; flex-wrap: wrap; margin-left: -.5rem; margin-right: -.5rem; }
.g-3 > * { padding: .5rem; }
.col-12 { width: 100%; }
.col-6  { width: 50%; }
.col-md-2 { width: 16.666%; }
.col-md-4 { width: 33.333%; }
.col-md-5 { width: 41.666%; }
.col-md-6 { width: 50%; }
.col-md-7 { width: 58.333%; }
.col-md-8 { width: 66.666%; }

.me-1 { margin-right: .25rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .25rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: #888; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.gap-1 { gap: .5rem; }

/* ════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1024px)
════════════════════════════════════════ */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    /* Admin dashboard two-col layout → stack */
    .admin-main > div[style*="grid-template-columns:1fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* ════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Sidebar: slide out left ── */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.3);
    }
    .admin-content { margin-left: 0; }
    .hamburger-btn { display: flex; align-items: center; justify-content: center; }

    /* ── Admin topbar ── */
    .admin-topbar { padding: .7rem 1rem; }
    .admin-topbar h1 { font-size: 1rem; }
    .admin-main { padding: 1rem; }

    /* ── Stat grid: 2 col ── */
    .stat-grid { grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1.2rem; }
    .stat-card { padding: .9rem; gap: .6rem; }
    .stat-icon { width: 40px; height: 40px; font-size: 1.2rem; border-radius: 10px; }
    .stat-info .num { font-size: 1.2rem; }
    .stat-info .lbl { font-size: .7rem; }

    /* ── Grid cols: all full width ── */
    .col-md-2, .col-md-4, .col-md-5,
    .col-md-6, .col-md-7, .col-md-8 { width: 100%; }
    .col-6 { width: 100%; }

    /* ── Forms ── */
    .form-card { padding: 1.2rem; border-radius: 12px; }

    /* ── Vergi cards ── */
    .vergi-meta { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .vergi-card { padding: 1rem 1rem 1rem 1.1rem; }
    .vergi-card .vergi-turu { font-size: .95rem; padding-right: 4.5rem; }

    /* ── Welcome bar ── */
    .welcome-bar { padding: 1rem; }
    .welcome-bar .icon { display: none; }
    .welcome-bar h2 { font-size: 1rem; }
    .welcome-bar p { font-size: .82rem; }

    /* ── Navbar user info ── */
    .nav-user .tc-info { display: none; }

    /* ── Table: responsive cards on mobile ── */
    .table-responsive-cards thead { display: none; }
    .table-responsive-cards tbody tr {
        display: block;
        background: #fff;
        border-radius: 12px;
        margin-bottom: .8rem;
        padding: .9rem 1rem;
        box-shadow: 0 2px 10px rgba(26,60,94,.08);
    }
    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: .3rem 0;
        border: none;
        font-size: .85rem;
        flex-wrap: wrap;
        gap: .3rem;
    }
    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: #888;
        font-weight: 700;
        flex-shrink: 0;
    }
    .table-responsive-cards tbody td:empty { display: none; }

    /* ── Login card ── */
    .login-card { padding: 2rem 1.4rem; border-radius: 14px; }

    /* ── Admin topbar user name: shorten ── */
    .topbar-user-label { display: none; }

    /* ── Table scroll hint ── */
    .table-scroll::before {
        content: '← kaydırın →';
        display: block;
        text-align: center;
        font-size: .7rem;
        color: #bbb;
        padding: .3rem;
    }
}

/* ════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤ 400px)
════════════════════════════════════════ */
@media (max-width: 400px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .vergi-meta { grid-template-columns: 1fr; }
    .stat-info .num { font-size: 1.1rem; }
    .login-card { padding: 1.5rem 1.1rem; }
}

/* ════════════════════════════════════════
   ADMIN DASHBOARD & USERS — mobile fixes
════════════════════════════════════════ */
@media (max-width: 768px) {
    .dash-grid { grid-template-columns: 1fr !important; }
    .users-layout { flex-direction: column; }
    .users-layout > div:last-child { width: 100% !important; }
    .add-user-grid { grid-template-columns: 1fr 1fr !important; }
    .add-user-grid > div:last-child { grid-column: 1 / -1; }
}
