:root {
    --bg: #f6f8fb;
    --bg-soft: #eef2f6;
    --card: rgba(255, 255, 255, 0.96);
    --card-strong: #ffffff;
    --border: #e3e8ef;
    --brand: #cb6a37;
    --brand-dark: #a84d21;
    --brand-soft: #f6ebe6;
    --accent: #3f7ae0;
    --ink: #17202d;
    --muted: #748195;
    --success: #1d7f47;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #fbfcfe 0%, var(--bg) 100%);
    color: var(--ink);
    font-family: "Manrope", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

body:not(.login-page)::before {
    content: "";
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    z-index: 0;
    pointer-events: none;
}

body.sidebar-open {
    overflow: hidden;
}

#globalAlert {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1080;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

#globalAlert .alert {
    box-shadow: 0 20px 40px rgba(24, 33, 47, .16);
    border-radius: 18px;
    border: 1px solid rgba(219, 229, 240, .95);
    pointer-events: auto;
}

.app-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    position: relative;
    z-index: 1;
}

.app-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .38);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 1030;
}

.app-sidebar {
    background: #ffffff;
    color: var(--ink);
    padding: 28px 20px 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--border);
    z-index: 1040;
    display: flex;
    flex-direction: column;
}

.sidebar-nav,
.sidebar-bottom {
    width: 100%;
}

.sidebar-close-btn,
.mobile-menu-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    box-shadow: none;
}

.brand-block {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 28px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: #fff;
    font-weight: 700;
    font-size: 24px;
    box-shadow: none;
}

.brand-title { font-size: 20px; font-weight: 700; }
.brand-subtitle { font-size: 13px; color: var(--muted); }

.sidebar-caption {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #91a0b6;
    margin-bottom: 12px;
    padding-left: 12px;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    color: var(--muted);
    border-radius: 16px;
    padding: 9px 12px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    text-decoration: none;
    justify-content: flex-start;
    transition: background-color .18s ease, color .18s ease;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 12px;
    width: 100%;
}

.nav-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    background: #f7f9fc;
    color: #8090a4;
    border: 1px solid #edf1f5;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
    font-size: 13px;
}

.sidebar-bottom-link {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
}

.sidebar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    border-radius: 16px;
    font-weight: 700;
    margin: 0;
}

.app-sidebar .nav-link.active,
.app-sidebar .nav-link:hover {
    background: #f5f7fa;
    color: var(--ink);
}

.app-sidebar .nav-link.active .nav-icon,
.app-sidebar .nav-link:hover .nav-icon {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
    box-shadow: none;
}

.sidebar-footer {
    margin-top: 24px;
    padding: 16px;
    border-radius: 20px;
    background: #fafbfd;
    border: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.sidebar-footer strong {
    display: block;
    color: var(--ink);
    margin-bottom: 2px;
}

.sidebar-footer-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #f2f5f8;
    color: var(--ink);
    font-size: 18px;
}

.app-main {
    padding: 28px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.app-main > * {
    min-width: 0;
    max-width: 100%;
}

.topbar {
    background: rgba(255,255,255,.92);
    color: var(--ink);
    border-radius: 28px;
    padding: 26px 28px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    min-width: 0;
}

.topbar-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    background: #f7f9fc;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
}

.topbar p, .topbar-role {
    margin: 6px 0 0;
    color: var(--muted);
}

.topbar-user {
    min-width: 220px;
    padding: 16px;
    border-radius: 22px;
    background: #fbfcfe;
    border: 1px solid var(--border);
    text-align: right;
}

.topbar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    margin-left: auto;
    margin-bottom: 10px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: #fff;
    box-shadow: none;
}

.topbar-name { font-weight: 800; }

.content-card, .metric-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-tools {
    min-width: 220px;
}

.table-search {
    border-radius: 14px;
    border-color: var(--border);
}

.content-card-header {
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
}

.content-card .table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.content-card .table-responsive > .table {
    min-width: 760px;
}

.content-card-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
    min-width: 0;
}

.metric-card {
    padding: 20px;
    background: #fff;
}

.metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.metric-card strong {
    font-size: 30px;
    font-weight: 800;
}

.metric-card.warning {
    background: #fffdfa;
}

.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -28px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(23, 32, 45, .04);
}

.metric-card.warning::after {
    background: rgba(203, 106, 55, .05);
}

.metric-card-primary::after {
    background: rgba(203, 106, 55, .07);
}

.metric-card-accent::after {
    background: rgba(63, 122, 224, .06);
}

.metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    background: #f4f7fb;
    color: #fff;
    color: var(--ink);
    box-shadow: none;
    position: relative;
    z-index: 1;
}

.ops-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    min-width: 0;
}

.ops-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.ops-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 18px;
}

.ops-card-content span,
.ops-card-content small {
    display: block;
}

.ops-card-content span {
    color: var(--muted);
    margin-bottom: 6px;
}

.ops-card-content strong {
    display: block;
    font-size: 28px;
    line-height: 1;
    margin-bottom: 8px;
}

.ops-card-content small {
    color: var(--muted);
}

.ops-card-danger .ops-card-icon {
    background: rgba(232, 93, 117, 0.12);
    color: #d9485f;
}

.ops-card-warning .ops-card-icon {
    background: rgba(212, 106, 46, 0.12);
    color: #c3622d;
}

.ops-card-neutral .ops-card-icon {
    background: rgba(95, 111, 134, 0.12);
    color: #56657a;
}

.ops-card-primary .ops-card-icon {
    background: rgba(47, 128, 237, 0.12);
    color: #2f80ed;
}

.metric-card-primary .metric-icon {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.metric-card-accent .metric-icon {
    background: #eef4ff;
    color: var(--accent);
}

.metric-card span,
.metric-card strong,
.metric-card small {
    position: relative;
    z-index: 1;
}

.metric-card small {
    display: block;
    margin-top: 8px;
    color: #8b99ad;
}

.dashboard-subtitle {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.dashboard-hero-card {
    overflow: hidden;
}

.dashboard-hero-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-mini-stats {
    display: flex;
    gap: 12px;
}

.mini-stat {
    min-width: 128px;
    padding: 12px 14px;
    border-radius: 18px;
    background: #fbfcfe;
    border: 1px solid var(--border);
}

.mini-stat span {
    display: block;
    font-size: 12px;
    color: #8b99ad;
    margin-bottom: 6px;
}

.mini-stat strong {
    font-size: 18px;
    font-weight: 800;
}

.dashboard-chart-wrap {
    padding: 18px 22px 22px;
    height: 340px;
}

.dashboard-chart-wrap.compact {
    height: 300px;
}

.dashboard-chart-donut {
    padding: 22px;
    height: 290px;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 22px 22px;
}

.kpi-box {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fbfcfe;
}

.kpi-box span {
    display: block;
    color: #8b99ad;
    font-size: 12px;
    margin-bottom: 6px;
}

.kpi-box strong {
    font-size: 22px;
    font-weight: 800;
}

.kpi-box.danger {
    background: #fff8f8;
    border-color: #f2dfe3;
}

.ops-list {
    padding: 8px 18px 18px;
}

.ops-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}

.ops-list-item:last-child {
    border-bottom: 0;
}

.ops-list-item strong,
.ops-list-item span,
.ops-list-item small {
    display: block;
}

.ops-list-item span,
.ops-list-item small {
    color: var(--muted);
}

.ops-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
    margin-bottom: 6px;
}

.ops-bekliyor {
    background: #fff4e9;
    color: #c3622d;
}

.ops-onaylandi {
    background: #ecf4ff;
    color: #2f80ed;
}

.ops-hazirlaniyor {
    background: #eefaf4;
    color: #1f9d63;
}

.settings-section {
    padding: 0 0 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
    border-bottom: 0;
    margin-bottom: 20px;
}

.settings-section-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 18px;
    color: var(--ink);
}

.settings-section-title i {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #f4f7fb;
    color: var(--accent);
}

.settings-sql {
    padding: 16px 18px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.login-card-wide {
    max-width: 980px;
}

.login-tabs {
    gap: 10px;
}

.login-tabs .nav-link {
    border-radius: 14px;
    padding: 10px 18px;
    font-weight: 700;
    color: var(--muted);
    background: #f4f7fb;
}

.login-tabs .nav-link.active {
    color: #fff;
    background: var(--ink);
}

.quick-product-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-product {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 18px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all .18s ease;
}

.quick-product:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(24, 33, 47, .05);
}

.discount-box, .cart-totals, .detail-list {
    border-top: 1px solid var(--border);
}

.discount-box {
    padding-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-totals {
    padding: 22px;
    background: #fbfcfe;
}

.cart-totals div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cart-totals .grand {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
    font-size: 20px;
}

.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #edf2f7;
}

.detail-list strong {
    text-align: right;
    word-break: break-word;
}

.empty-state {
    min-height: 240px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
}

.empty-state i {
    font-size: 48px;
    color: var(--brand);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #fbfcfe, #f3f6fa);
}

.login-card {
    width: min(100%, 460px);
    padding: 16px;
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.login-brand h1 {
    margin: 0;
    font-size: 26px;
}

.login-brand p {
    margin: 4px 0 0;
    color: var(--muted);
}

.form-control,
.form-select,
.btn {
    border-radius: 16px;
}

.form-control,
.form-select {
    min-height: 48px;
    border-color: var(--border);
    background: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(63, 122, 224, .35);
    box-shadow: 0 0 0 .2rem rgba(63, 122, 224, .08);
}

.btn-primary {
    background: var(--ink);
    border-color: transparent;
    min-height: 48px;
    font-weight: 800;
    box-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #0f1722;
    border-color: transparent;
}

.btn-outline-light {
    border-color: var(--border);
    color: var(--ink);
    background: #fff;
}

.btn-outline-light:hover {
    background: #fff;
    color: var(--ink);
    border-color: #ccdbea;
}

.input-group-modern .input-group-text {
    border-radius: 16px 0 0 16px;
    border-color: var(--border);
    background: #f8fafc;
    color: #8b99ad;
}

.input-group-modern .form-control {
    border-left: 0;
    border-radius: 0 16px 16px 0;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(23, 32, 45, .025);
}

.table thead th {
    color: #8a98ab;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom-width: 1px;
}

.table tbody td {
    padding-top: 14px;
    padding-bottom: 14px;
    border-color: #eef2f6;
}

.order-row td {
    transition: background-color .18s ease;
}

.order-row-bekliyor td {
    background: rgba(255, 244, 233, .78);
}

.order-row-onaylandi td {
    background: rgba(236, 244, 255, .82);
}

.order-row-hazirlaniyor td {
    background: rgba(238, 250, 244, .86);
}

.order-row-teslim td {
    background: rgba(244, 247, 251, .9);
}

.order-row-iptal td {
    background: rgba(255, 238, 241, .86);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-badge-waiting {
    background: #fff4e9;
    color: #c3622d;
}

.status-badge-approved {
    background: #ecf4ff;
    color: #2f80ed;
}

.status-badge-preparing {
    background: #eefaf4;
    color: #1f9d63;
}

.status-badge-delivered {
    background: #f4f7fb;
    color: #55657b;
}

.status-badge-cancelled {
    background: #ffeff2;
    color: #d9485f;
}

.payment-queue-panel {
    border: 1px dashed #d7dfec;
    background: #f8fbff;
    border-radius: 18px;
    padding: 16px;
}

.payment-queue-empty {
    color: #6c7a92;
    font-size: 14px;
}

.payment-queue-list {
    display: grid;
    gap: 12px;
}

.payment-queue-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    border: 1px solid #e1e7f0;
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 16px;
}

.payment-queue-main {
    min-width: 0;
    flex: 1;
}

.payment-queue-title {
    font-size: 15px;
    font-weight: 700;
    color: #13233f;
    margin-bottom: 6px;
}

.payment-queue-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #71809a;
}

.payment-queue-side {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.payment-queue-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.payment-queue-status.status-waiting {
    background: #eef4ff;
    color: #4c6fa4;
}

.payment-queue-status.status-sending {
    background: #fff4df;
    color: #c28524;
}

.payment-queue-status.status-sent {
    background: #eaf8ef;
    color: #278055;
}

.payment-queue-status.status-error {
    background: #fff0f2;
    color: #cf445c;
}

@media (max-width: 991.98px) {
    body::before {
        display: none;
    }
    .app-shell {
        grid-template-columns: 1fr;
    }
    .app-backdrop { display: block; }
    body.sidebar-open .app-backdrop {
        opacity: 1;
        visibility: visible;
    }
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(86vw, 320px);
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .22s ease;
        overflow-y: auto;
        padding-top: 22px;
    }
    .sidebar-bottom {
        padding-bottom: 16px;
    }
    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }
    .sidebar-close-btn,
    .mobile-menu-toggle {
        display: inline-flex;
    }
    .sidebar-close-btn {
        margin-left: auto;
        margin-bottom: 12px;
    }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .ops-grid { grid-template-columns: repeat(2, 1fr); }
    .sidebar-footer { display: none; }
    .dashboard-hero-header { flex-direction: column; }
    .topbar {
        padding: 20px;
    }
    .topbar-user {
        min-width: 0;
    }
}

@media (max-width: 767.98px) {
    .app-main { padding: 16px; }
    .topbar { flex-direction: column; border-radius: 22px; padding: 18px; }
    .topbar-main { gap: 12px; }
    .topbar h1 { font-size: 24px; line-height: 1.2; }
    .topbar-chip { width: 100%; justify-content: center; }
    .content-card,
    .metric-card,
    .ops-card {
        border-radius: 20px;
    }
    .content-card-header {
        padding: 16px 16px 14px;
    }
    .content-card-header h3 {
        font-size: 17px;
    }
    .dashboard-grid, .ops-grid, .quick-product-list { grid-template-columns: 1fr; }
    .topbar-user { text-align: left; }
    .topbar-avatar { margin-left: 0; }
    .dashboard-mini-stats,
    .dashboard-kpi-grid { display: grid; grid-template-columns: 1fr; }
    .dashboard-chart-wrap,
    .dashboard-chart-wrap.compact,
    .dashboard-chart-donut { height: 280px; }
    #globalAlert {
        right: 16px;
        bottom: 16px;
        width: calc(100vw - 32px);
    }
    .row {
        --bs-gutter-x: 1rem;
    }
    .detail-list div,
    .discount-box,
    .cart-totals div {
        flex-direction: column;
        align-items: flex-start;
    }
    .detail-list strong {
        text-align: left;
    }
    .table-tools,
    .table-search,
    .mini-stat,
    .topbar-user,
    .btn,
    .form-control,
    .form-select {
        width: 100%;
    }
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }
    .content-card .table-responsive > .table {
        min-width: 680px;
    }
    .payment-queue-item,
    .payment-queue-side {
        flex-direction: column;
        align-items: flex-start;
    }
}
