:root {
    --sidebar-width: 250px;
    --brand: #1f6feb;
}

body {
    font-size: .925rem;
    background: var(--bs-tertiary-bg);
}

/* ---------- Kenar menü ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--bs-border-color);
    text-decoration: none;
    color: var(--bs-body-color);
}
.sidebar-brand img { max-height: 36px; max-width: 48px; }
.sidebar-brand .title { font-weight: 700; line-height: 1.1; }
.sidebar-brand .ver { font-size: .72rem; color: var(--bs-secondary-color); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .6rem 1rem; }
.sidebar-nav .section {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
    margin: .9rem .6rem .3rem;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: var(--bs-body-color);
    padding: .5rem .7rem;
    border-radius: .45rem;
    margin-bottom: 2px;
}
.sidebar-nav .nav-link i.fa-fw { color: var(--bs-secondary-color); }
.sidebar-nav .nav-link:hover { background: var(--bs-secondary-bg); }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; }
.sidebar-nav .nav-link.active i { color: #fff; }
.sidebar-nav .nav-link.disabled { opacity: .5; }
.sidebar-nav .nav-link .chev { margin-left: auto; font-size: .7rem; transition: transform .2s; }
.sidebar-nav .nav-link[aria-expanded="true"] .chev { transform: rotate(90deg); }
.sidebar-nav .submenu .nav-link { padding-left: 2.45rem; font-size: .88rem; }
.sidebar-nav .badge-soon { margin-left: auto; font-size: .6rem; }
.sidebar-user {
    border-top: 1px solid var(--bs-border-color);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

/* ---------- İçerik ---------- */
.main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: .6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.content { padding: 1.25rem; flex: 1; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-header h1 { font-size: 1.3rem; margin: 0; font-weight: 600; }

.card { border-color: var(--bs-border-color); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.card-header { background: transparent; font-weight: 600; }

.stat-card .icon {
    width: 46px; height: 46px; border-radius: .6rem;
    display: grid; place-items: center; font-size: 1.25rem;
}
.stat-card .value { font-size: 1.35rem; font-weight: 700; }

.table > :not(caption) > * > * { padding: .55rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); white-space: nowrap; }

.perm-group { border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .75rem 1rem; height: 100%; }
.perm-group h6 { font-size: .85rem; font-weight: 600; }

[data-product-picker] { position: relative; }
[data-product-picker] .dropdown-menu { max-height: 320px; overflow-y: auto; }

.product-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: .35rem; }
.qty { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bom-tree td:first-child { white-space: nowrap; }
.bom-tree .lvl { display: inline-block; color: var(--bs-secondary-color); }
.bom-row-excluded .fw-semibold { text-decoration: line-through; }
.search-select-native { position: absolute; inset: 0; width: 100%; opacity: 0; pointer-events: none; }
.search-select-menu { max-height: 320px; overflow-y: auto; overflow-x: hidden; }
.search-select-menu .dropdown-item { white-space: normal; }
.table-sm.table thead th { font-size: .72rem; }
.nav-tabs .nav-link { color: var(--bs-secondary-color); }
.nav-tabs .nav-link.active { color: var(--bs-body-color); font-weight: 600; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); padding: .75rem 1rem; z-index: 5; }

/* ---------- Müşteri paneli özet kartları ---------- */
/* Kartlar satırı eşit paylaşır, ama hiçbiri içeriğinden dar olmaz; sığmayan kart alt satıra geçer. */
.portal-stats { display: flex; flex-wrap: wrap; gap: 1rem; }
.portal-stats > .card { flex: 1 1 0; min-width: max-content; }
.portal-stats .value, .portal-stats .small { white-space: nowrap; }
.payment-grid { display: grid; grid-template-columns: auto auto; column-gap: 1rem; row-gap: .1rem; white-space: nowrap; }
.payment-grid .payment-sep { grid-column: 1 / -1; border-top: 1px solid var(--bs-border-color); margin-top: .15rem; }
@media (max-width: 575.98px) { .portal-stats > .card { flex-basis: 100%; min-width: 0; } }

/* ---------- Görevler ---------- */
.task-avatar {
    width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center;
    font-size: .62rem; font-weight: 700; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis);
    border: 2px solid var(--bs-body-bg); margin-left: -6px;
}
.task-avatar:first-child { margin-left: 0; }
.task-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.task-column { background: var(--bs-secondary-bg); border-radius: .6rem; display: flex; flex-direction: column; min-height: 300px; }
.task-column-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem .75rem; }
.task-column-body { flex: 1; padding: 0 .5rem .5rem; display: flex; flex-direction: column; gap: .5rem; border-radius: .6rem; transition: background .15s; }
.task-column-body.drop-target { background: var(--bs-primary-bg-subtle); }
.task-card { cursor: grab; }
.task-card.dragging { opacity: .45; }
.task-comment.system { color: var(--bs-secondary-color); font-size: .85rem; }

/* ---------- Raporlar ---------- */
.report-card { transition: border-color .15s; }
.report-card:hover { border-color: var(--brand); }
.report-card .icon { width: 40px; height: 40px; border-radius: .5rem; display: grid; place-items: center; }
.aging-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bs-secondary-bg); }

@media print {
    .sidebar, .topbar, .sidebar-backdrop, form.report-filter, .page-header .btn, .alert, .pagination { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff !important; font-size: 11px; }
    .card { box-shadow: none !important; border: 0 !important; }
    .table-responsive { overflow: visible !important; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* ---------- Giriş ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; }

/* ---------- Mobil ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1035;
    }
    .main { margin-left: 0; }
    .content { padding: 1rem; }
}
