:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #172033;
    --muted: #667085;
    --line: #dfe5ee;
    --navy: #14213d;
    --navy-2: #1f2f54;
    --teal: #0f766e;
    --teal-2: #14b8a6;
    --amber: #f59e0b;
    --rose: #dc2626;
    --shadow: 0 16px 40px rgba(20, 33, 61, .08);
    --shadow-soft: 0 8px 24px rgba(20, 33, 61, .06);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background:
        linear-gradient(180deg, #eef3f7 0, var(--bg) 260px),
        var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

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

.sidebar {
    width: 260px;
    flex-direction: column;
    gap: 14px;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 18px 14px;
    color: white;
    background: linear-gradient(180deg, var(--navy) 0%, #111827 100%);
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px 14px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand::before {
    content: "R";
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--teal), var(--teal-2));
    color: white;
    box-shadow: 0 10px 24px rgba(20, 184, 166, .22);
}

.sidebar .nav,
.offcanvas .nav {
    gap: 4px;
}

.sidebar .nav-link,
.offcanvas .nav-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    border-radius: 8px;
    padding: 10px 12px;
    font-weight: 650;
    color: rgba(255, 255, 255, .78);
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-link.text-danger {
    color: #fecaca !important;
    margin-top: auto;
}

.offcanvas {
    border: 0;
}

.offcanvas-header {
    border-bottom: 1px solid var(--line);
}

.offcanvas-title {
    font-weight: 800;
    color: var(--ink);
}

.offcanvas .nav-link {
    color: var(--ink);
}

.offcanvas .nav-link:hover,
.offcanvas .nav-link.active {
    background: #eef6f5;
    color: var(--teal);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px clamp(14px, 3vw, 28px);
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(223, 229, 238, .86);
    backdrop-filter: blur(14px);
}

.topbar h1 {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: clamp(18px, 2vw, 22px);
    font-weight: 800;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.topbar .btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-chip {
    max-width: 42vw;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-wrap {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: clamp(14px, 3vw, 28px);
}

.panel,
.stat {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(223, 229, 238, .92);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.panel {
    padding: clamp(14px, 2.4vw, 22px);
}

.stat {
    position: relative;
    min-height: 112px;
    padding: 16px;
    overflow: hidden;
}

.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--teal), var(--amber));
}

.stat .label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat .value {
    margin-top: 8px;
    color: var(--ink);
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 850;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.quick-action {
    min-height: 84px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: var(--ink);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.quick-action:hover {
    border-color: rgba(15, 118, 110, .38);
    color: var(--ink);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.quick-action span {
    font-size: 15px;
    font-weight: 850;
}

.quick-action small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.alert {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.form-label {
    margin-bottom: 6px;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.form-control,
.form-select {
    min-height: 42px;
    border-radius: 8px;
    border-color: #cfd8e3;
    color: var(--ink);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .14);
}

textarea.form-control {
    min-height: 96px;
}

.btn {
    min-height: 38px;
    border-radius: 8px;
    font-weight: 750;
    letter-spacing: 0;
}

.btn-sm {
    min-height: 32px;
    padding-inline: 10px;
    font-size: 12px;
}

.btn-primary {
    border-color: var(--teal);
    background: linear-gradient(135deg, var(--teal), #0d9488);
    box-shadow: 0 10px 22px rgba(15, 118, 110, .18);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: #0f766e;
    background: linear-gradient(135deg, #0f766e, #0f8f83);
}

.btn-outline-primary {
    color: var(--teal);
    border-color: rgba(15, 118, 110, .38);
}

.btn-outline-primary:hover {
    border-color: var(--teal);
    background: var(--teal);
}

.btn-outline-secondary {
    color: #475467;
    border-color: #cfd8e3;
}

.btn-outline-info {
    color: #0369a1;
    border-color: rgba(3, 105, 161, .34);
}

.btn-outline-danger {
    color: var(--rose);
    border-color: rgba(220, 38, 38, .34);
}

.badge {
    border-radius: 999px;
    padding: 6px 9px;
    font-weight: 800;
}

.table-responsive {
    border-radius: var(--radius);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #667085;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.table tbody td {
    border-color: #eef2f7;
}

.table-hover tbody tr:hover {
    background: #f6fbfa;
}

.fis-entry-table {
    table-layout: fixed;
}

.fis-entry-table th:nth-child(1) { width: 34%; }
.fis-entry-table th:nth-child(2) { width: 11%; }
.fis-entry-table th:nth-child(3) { width: 10%; }
.fis-entry-table th:nth-child(4) { width: 13%; }
.fis-entry-table th:nth-child(5) { width: 10%; }
.fis-entry-table th:nth-child(6) { width: 14%; }
.fis-entry-table th:nth-child(7) { width: 8%; }

.fis-entry-table .form-control-sm,
.fis-entry-table .form-select-sm {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 12px;
}

.fis-entry-table .satir {
    white-space: nowrap;
    font-weight: 800;
}

.table-danger {
    --bs-table-bg: #fff1f2;
    --bs-table-striped-bg: #ffe4e6;
    --bs-table-hover-bg: #ffe4e6;
}

.modal-content {
    border: 1px solid rgba(223, 229, 238, .95);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
    border-color: var(--line);
}

.print-sheet {
    background: white;
    max-width: 820px;
    margin: 0 auto;
    padding: 26px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.receipt-80 {
    width: 80mm;
    max-width: 80mm;
    font-size: 11px;
    line-height: 1.35;
}

.modern-receipt {
    padding: 6mm 4mm;
    color: #111827;
    font-family: Arial, "Segoe UI", sans-serif;
    font-weight: 900;
    letter-spacing: .01em;
}

.modern-receipt * {
    font-weight: 900 !important;
}

.receipt-brand {
    text-align: center;
    display: grid;
    justify-items: center;
    padding-bottom: 10px;
    border-bottom: 1px dashed #cbd5e1;
    margin-bottom: 10px;
}

.receipt-main-logo {
    display: block;
    width: min(60mm, 100%);
    max-height: 28mm;
    object-fit: contain;
    object-position: center;
}

.receipt-meta {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.receipt-meta div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid #eef2f7;
    padding: 3px 0 5px;
    font-size: 11.5px;
}

.receipt-meta span {
    color: #64748b;
}

.receipt-thanks {
    text-align: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
    font-weight: 800;
}

.modern-receipt .receipt-table-wrap {
    overflow: visible;
    border-radius: 0;
}

.modern-receipt .receipt-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 9.6px;
    line-height: 1.28;
}

.modern-receipt .receipt-table th,
.modern-receipt .receipt-table td {
    padding: 4px 1.5px;
    border-color: #cbd5e1;
    letter-spacing: .01em;
    vertical-align: middle;
    word-break: normal;
    hyphens: none;
}

.modern-receipt .receipt-table thead th {
    position: static;
    font-size: 7.4px;
    line-height: 1.18;
    background: transparent;
    white-space: nowrap;
    overflow-wrap: normal;
}

.modern-receipt .receipt-table th:nth-child(1),
.modern-receipt .receipt-table td:nth-child(1) {
    width: 28%;
    white-space: normal;
    overflow-wrap: break-word;
}

.modern-receipt .receipt-table th:nth-child(2),
.modern-receipt .receipt-table td:nth-child(2) {
    width: 13%;
}

.modern-receipt .receipt-table th:nth-child(3),
.modern-receipt .receipt-table td:nth-child(3) {
    width: 12%;
}

.modern-receipt .receipt-table th:nth-child(4),
.modern-receipt .receipt-table td:nth-child(4) {
    width: 14%;
}

.modern-receipt .receipt-table th:nth-child(5),
.modern-receipt .receipt-table td:nth-child(5) {
    width: 14%;
}

.modern-receipt .receipt-table th:nth-child(6),
.modern-receipt .receipt-table td:nth-child(6) {
    width: 19%;
}

.modern-receipt .receipt-table th:nth-child(n+2),
.modern-receipt .receipt-table td:nth-child(n+2) {
    white-space: nowrap;
    overflow-wrap: normal;
}

.modern-receipt .receipt-table tfoot th {
    font-size: 9.4px;
    white-space: nowrap;
    overflow-wrap: normal;
}

@media (max-width: 991px) {
    body {
        font-size: 13px;
    }

    .topbar {
        min-height: 62px;
    }

    .panel {
        box-shadow: none;
    }

    .table-responsive .table {
        min-width: 720px;
    }

    .dashboard-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fis-entry-wrap .fis-entry-table,
    .modern-receipt .receipt-table-wrap .receipt-table {
        min-width: 0;
    }

    .btn {
        min-height: 40px;
    }
}

@media (max-width: 575px) {
    .content-wrap {
        padding: 12px;
    }

    .topbar {
        padding: 10px 12px;
    }

    .user-chip {
        display: none;
    }

    .panel {
        padding: 12px;
    }

    .stat {
        min-height: 92px;
        padding: 14px;
    }

    .dashboard-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .quick-action {
        min-height: 72px;
        padding: 12px;
    }

    .row.g-3 {
        --bs-gutter-y: .75rem;
    }

    .panel form .d-flex.gap-2,
    .panel form .d-flex.gap-3 {
        width: 100%;
        flex-wrap: wrap;
    }

    .panel form .btn,
    .panel > .d-flex .btn {
        flex: 1 1 auto;
    }

    .table-responsive {
        margin-inline: -4px;
        border-radius: 6px;
    }

    .fis-entry-wrap {
        margin-inline: 0;
        overflow: visible;
    }

    .fis-entry-table {
        min-width: 0;
    }

    .fis-entry-table,
    .fis-entry-table thead,
    .fis-entry-table tbody,
    .fis-entry-table tr,
    .fis-entry-table td {
        display: block;
        width: 100%;
    }

    .fis-entry-table thead {
        display: none;
    }

    .fis-entry-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 10px;
        margin-bottom: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
    }

    .fis-entry-table tbody td {
        border: 0;
        padding: 0;
        min-width: 0;
    }

    .fis-entry-table tbody td::before {
        display: block;
        margin-bottom: 4px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .fis-entry-table tbody td:nth-child(1) {
        grid-column: 1 / -1;
    }

    .fis-entry-table tbody td:nth-child(1)::before { content: "Ürün"; }
    .fis-entry-table tbody td:nth-child(2)::before { content: "Miktar"; }
    .fis-entry-table tbody td:nth-child(3)::before { content: "Birim"; }
    .fis-entry-table tbody td:nth-child(4)::before { content: "Fiyat"; }
    .fis-entry-table tbody td:nth-child(5)::before { content: "KDV"; }
    .fis-entry-table tbody td:nth-child(6)::before { content: "Toplam"; }

    .fis-entry-table tbody td:nth-child(6) {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: end;
        min-height: 54px;
        font-size: 13px;
    }

    .fis-entry-table tbody td:nth-child(7) {
        display: flex;
        align-items: flex-end;
    }

    .fis-entry-table tbody td:nth-child(7) .btn {
        width: 100%;
    }

    .fis-entry-table .form-control-sm,
    .fis-entry-table .form-select-sm {
        width: 100%;
        min-height: 38px;
        font-size: 13px;
    }

    .modal-dialog {
        margin: 12px;
    }

    .receipt-80 {
        width: min(80mm, 100%);
        max-width: 100%;
    }

    .modern-receipt {
        padding: 4mm 3mm;
    }

    .modern-receipt .receipt-table {
        font-size: 9.2px;
        line-height: 1.26;
    }

    .modern-receipt .receipt-table thead th {
        font-size: 7.2px;
    }
}

@media print {
    @page {
        size: 80mm auto;
        margin: 0;
    }

    .sidebar,
    .topbar,
    .no-print,
    .alert,
    .modal {
        display: none !important;
    }

    body {
        background: white;
    }

    .app-shell,
    .app-main {
        display: block;
        min-height: 0;
    }

    .content-wrap {
        max-width: none;
        padding: 0;
    }

    .panel,
    .print-sheet {
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .print-sheet.receipt-80 {
        width: 80mm;
        max-width: 80mm;
        margin: 0;
        padding: 4mm 3mm;
        font-size: 11px;
    }

    .receipt-main-logo {
        width: 58mm;
        max-height: 26mm;
    }

    .modern-receipt .receipt-table {
        font-size: 8.8px;
        line-height: 1.22;
    }

    .modern-receipt .receipt-table th,
    .modern-receipt .receipt-table td {
        padding: 3px 1px;
    }

    .modern-receipt .receipt-table thead th {
        font-size: 7px;
    }
}
