body.sidebar-open .sidebar-overlay {
    display: block;
}

body.sidebar-open .app-sidebar {
    transform: translateX(0);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
}

main > * {
    min-width: 0;
}

.overflow-x-auto {
    max-width: 100%;
}

.tab-stack {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.tab-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tab-group--nested {
    padding: 1rem;
    border: 1px solid rgb(228 228 231);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(250, 250, 250, 0.95) 0%, rgba(244, 244, 245, 1) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tab-group__meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.tab-group__label {
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(113 113 122);
}

.tab-group__hint {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: rgb(82 82 91);
}

.tab-group__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.tab-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.7rem 1rem;
    border-radius: 0.8rem;
    border: 1px solid rgb(212 212 216);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.25;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.tab-pill:hover {
    transform: translateY(-1px);
}

.tab-pill--division {
    background: #ffffff;
    color: rgb(24 24 27);
}

.tab-pill--division:hover {
    background: rgb(244 244 245);
}

.tab-pill--division-active {
    border-color: rgb(220 38 38);
    background: rgb(220 38 38);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.2);
}

.tab-pill--nested {
    background: rgba(255, 255, 255, 0.72);
    color: rgb(39 39 42);
}

.tab-pill--nested:hover {
    background: #ffffff;
}

.tab-pill--nested-active {
    border-color: rgb(24 24 27);
    background: rgb(24 24 27);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(24, 24, 27, 0.18);
}

.dark .tab-group--nested {
    border-color: rgb(63 63 70);
    background: linear-gradient(180deg, rgba(39, 39, 42, 0.96) 0%, rgba(24, 24, 27, 1) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.dark .tab-group__label {
    color: rgb(161 161 170);
}

.dark .tab-group__hint {
    color: rgb(212 212 216);
}

.dark .tab-pill {
    border-color: rgb(63 63 70);
}

.dark .tab-pill--division {
    background: rgb(9 9 11);
    color: rgb(244 244 245);
}

.dark .tab-pill--division:hover {
    background: rgb(39 39 42);
}

.dark .tab-pill--nested {
    background: rgba(9, 9, 11, 0.65);
    color: rgb(244 244 245);
}

.dark .tab-pill--nested:hover {
    background: rgba(24, 24, 27, 0.92);
}

.dark .tab-pill--nested-active {
    border-color: rgb(244 244 245);
    background: rgb(244 244 245);
    color: rgb(24 24 27);
    box-shadow: 0 10px 24px rgba(244, 244, 245, 0.08);
}

.table-sticky-head thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fafafa;
}

.dark .table-sticky-head thead th {
    background: #09090b;
}

@media (max-width: 768px) {
    .tab-group--nested {
        padding: 0.85rem;
    }

    .tab-pill {
        width: 100%;
    }

    .responsive-table {
        min-width: 0 !important;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody,
    .responsive-table tfoot,
    .responsive-table tr,
    .responsive-table td,
    .responsive-table th {
        display: block;
        width: 100%;
    }

    .responsive-table tbody tr,
    .responsive-table tfoot tr {
        padding: 0.9rem 1rem;
        border-bottom: 1px solid rgb(228 228 231);
    }

    .dark .responsive-table tbody tr,
    .dark .responsive-table tfoot tr {
        border-bottom-color: rgb(39 39 42);
    }

    .responsive-table tbody tr:last-child,
    .responsive-table tfoot tr:last-child {
        border-bottom: 0;
    }

    .responsive-table tbody td,
    .responsive-table tfoot td {
        min-width: 0;
        padding: 0.4rem 0;
        border: 0 !important;
        display: grid;
        grid-template-columns: minmax(0, 116px) minmax(0, 1fr);
        gap: 0.75rem;
        align-items: start;
        text-align: left !important;
    }

    .responsive-table tbody td::before,
    .responsive-table tfoot td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        line-height: 1.2;
        font-weight: 800;
        text-transform: uppercase;
        color: rgb(113 113 122);
    }

    .dark .responsive-table tbody td::before,
    .dark .responsive-table tfoot td::before {
        color: rgb(161 161 170);
    }

    .responsive-table td[data-label=""],
    .responsive-table td[colspan] {
        display: block;
        text-align: center !important;
        padding: 1rem 0 !important;
    }

    .responsive-table td[data-label=""]::before,
    .responsive-table td[colspan]::before {
        content: none;
    }

    .responsive-table td .flex {
        justify-content: flex-start !important;
        flex-wrap: wrap;
    }

    .responsive-table td .rounded,
    .responsive-table td input,
    .responsive-table td select,
    .responsive-table td textarea,
    .responsive-table td button,
    .responsive-table td a {
        max-width: 100%;
    }

    .responsive-table td input.w-32 {
        width: 100%;
    }
}

.print-preview-shell {
    min-height: 100vh;
    background: #252525;
    color: #ffffff;
}

.print-preview-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #252525;
}

.print-preview-stage {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem;
    overflow: auto;
}

.print-paper {
    width: 210mm;
    max-width: 100%;
    background: #ffffff;
    color: #000000;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
    transform-origin: top center;
}

.print-document {
    padding: 10mm;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    line-height: 1.5;
}

.print-doc-title {
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.print-doc-subtitle {
    margin-top: 0.125rem;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.print-doc-muted {
    color: #525252;
}

.print-doc-divider {
    margin: 0.875rem 0;
    border-top: 2px dashed #111111;
}

.print-doc-meta,
.print-doc-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.print-doc-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.print-doc-row span {
    flex: 1 1 auto;
}

.print-doc-row strong {
    flex: 0 0 auto;
    text-align: right;
}

.print-doc-row--total {
    margin-top: 0.35rem;
    padding-top: 0.45rem;
    border-top: 1px dashed #111111;
    font-size: 14px;
    font-weight: 900;
}

.print-doc-section {
    margin-bottom: 0.5rem;
    font-weight: 900;
    text-transform: uppercase;
}

.print-doc-item {
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #a3a3a3;
}

.print-doc-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.print-doc-item__title {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-weight: 900;
}

.print-doc-item__body {
    margin-top: 0.2rem;
    color: #18181b;
}

.print-doc-footer {
    text-align: center;
    font-weight: 700;
}

.print-preview-shell[data-print-size="58mm"] .print-paper {
    width: 58mm;
    zoom: 2.15;
}

.print-preview-shell[data-print-size="80mm"] .print-paper {
    width: 80mm;
    zoom: 1.55;
}

.print-preview-shell[data-print-size="12x14"] .print-paper {
    width: 120mm;
    min-height: 140mm;
    zoom: 1.2;
}

.print-preview-shell[data-print-size="a4"] .print-paper {
    width: 210mm;
    min-height: 297mm;
    zoom: 0.95;
}

@media (max-width: 960px) {
    .print-preview-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .print-preview-toolbar > div:last-child {
        justify-content: space-between;
    }

    .print-preview-shell[data-print-size="58mm"] .print-paper {
        zoom: 1.85;
    }

    .print-preview-shell[data-print-size="80mm"] .print-paper {
        zoom: 1.3;
    }

    .print-preview-shell[data-print-size="12x14"] .print-paper {
        zoom: 1;
    }
}

@media (max-width: 640px) {
    .print-preview-stage {
        padding: 1rem 0.75rem 1.5rem;
    }

    .print-preview-toolbar {
        padding: 0.875rem 1rem;
    }

    .print-document {
        padding: 7mm;
        font-size: 10px;
    }

    .print-doc-title {
        font-size: 18px;
    }

    .print-preview-shell[data-print-size="58mm"] .print-paper {
        zoom: 1.4;
    }

    .print-preview-shell[data-print-size="80mm"] .print-paper {
        zoom: 1.1;
    }

    .print-preview-shell[data-print-size="12x14"] .print-paper,
    .print-preview-shell[data-print-size="a4"] .print-paper {
        width: min(100%, 210mm);
        zoom: 1;
    }
}

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

    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
        overflow: visible !important;
    }

    .app-sidebar,
    .sidebar-overlay,
    header,
    .print-hidden,
    .print-preview-toolbar {
        display: none !important;
    }

    .app-shell {
        padding-left: 0 !important;
    }

    main {
        padding: 0 !important;
    }

    .overflow-x-auto {
        overflow: visible !important;
    }

    table {
        width: 100% !important;
        min-width: 0 !important;
        font-size: 12px !important;
    }

    .table-sticky-head thead th {
        position: static !important;
    }

    .print-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }

    .print-shell[data-print-size="58mm"] {
        width: 58mm !important;
        max-width: 58mm !important;
    }

    .print-shell[data-print-size="80mm"] {
        width: 80mm !important;
        max-width: 80mm !important;
    }

    .print-shell[data-print-size="12x14"] {
        width: 12cm !important;
        max-width: 12cm !important;
        min-height: 14cm !important;
    }

    .print-shell[data-print-size="58mm"] .print-grid,
    .print-shell[data-print-size="80mm"] .print-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .print-shell[data-print-size="12x14"] .print-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .rounded,
    .shadow-sm {
        box-shadow: none !important;
    }

    .print-preview-shell,
    .print-preview-stage {
        background: #ffffff !important;
        color: #000000 !important;
        min-height: auto !important;
        overflow: visible !important;
    }

    .print-paper {
        box-shadow: none !important;
        max-width: none !important;
    }

    section,
    div {
        break-inside: avoid;
    }
}
