:root {
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 64px;
    --text-muted: #8a94a6;
    --brand: #2f6fed;
    --ok-bg: #d7f5df;
    --ok-text: #146c2e;
    --danger-bg: #fbdadb;
    --danger-text: #9a1c22;
    --warn-bg: #fff3cd;
    --warn-text: #8a6100;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f6f9;
    color: #1f2937;
}

/* ---------------------------------------------------------------- Layout */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    transition: grid-template-columns .2s ease;
}
.app-shell.collapsed {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

.sidebar {
    background: #1b2430;
    color: #e7ebf0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 20;
}
.sidebar-brand {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c3cad6;
    padding: 10px 20px;
    font-size: .92rem;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
}
.sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: rgba(47,111,237,.18); border-left-color: var(--brand); color: #fff; }

.sidebar-toggle {
    border: none;
    background: rgba(255,255,255,.05);
    color: #c3cad6;
    padding: 10px;
    cursor: pointer;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.1); }

.brand-mini { display: none; }
.app-shell.collapsed .brand-full { display: none; }
.app-shell.collapsed .brand-mini { display: inline; }
.app-shell.collapsed .sidebar .label { display: none; }
.app-shell.collapsed .sidebar-brand { text-align: center; padding: 18px 8px; }
.app-shell.collapsed .nav-link { justify-content: center; padding: 10px 0; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-bottom: 1px solid #e5e9f0;
    padding: 12px 22px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-header-title { font-weight: 600; font-size: 1.05rem; flex: 1; }
.app-content { padding: 22px; flex: 1; }

.mobile-toggle { border: none; background: none; font-size: 1.3rem; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: 0; top: 0; width: 260px;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .mobile-toggle.d-none { display: inline-block !important; }
    .sidebar-toggle { display: none; }
    .backdrop {
        position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; display: none;
    }
    .backdrop.show { display: block; }
}

/* ---------------------------------------------------------------- Stat cards */
.stat-card {
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-label { color: var(--text-muted); font-size: .85rem; }

/* ---------------------------------------------------------------- Report boxes (Raporlar anasayfa) */
.report-box {
    display: block;
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    text-decoration: none;
    color: #1f2937;
    transition: box-shadow .15s ease, transform .15s ease;
}
.report-box:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); color: #1f2937; }
.report-box i { font-size: 2rem; color: var(--brand); margin-bottom: 10px; display: block; }

/* ---------------------------------------------------------------- Tables */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.table-toolbar .filters { display: flex; gap: 8px; flex-wrap: nowrap; flex: 1; min-width: 220px; max-width: 420px; }
.table-toolbar .filters .form-control { flex: 1 1 auto; min-width: 0; }
table.table td.text-num, table.table th.text-num { text-align: right; }
table.table td.text-actions, table.table th.text-actions { text-align: right; white-space: nowrap; }

.cell-ok { background: var(--ok-bg) !important; color: var(--ok-text); }
.cell-danger { background: var(--danger-bg) !important; color: var(--danger-text); }
.cell-warn { background: var(--warn-bg) !important; color: var(--warn-text); }
.cell-neutral { background: transparent; }

/* ---------------------------------------------------------------- Help icon (tooltip standardı fallback) */
.help-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
    border-radius: 50%; border: 1px solid var(--text-muted); color: var(--text-muted);
    font-size: .68rem; line-height: 1; margin-left: 4px; cursor: help; user-select: none;
}
.form-floating .help-icon-floating {
    position: absolute; top: 6px; right: 10px; z-index: 5;
}

/* ---------------------------------------------------------------- Misc */
.badge-scope { text-transform: capitalize; }
.flash-stack { margin-bottom: 16px; }
.cursor-pointer { cursor: pointer; }
.log-detail-row:hover { background: #f4f6f9; cursor: pointer; }
