/* ONESHEET tab — detachable read-only module (Accounts-style layout) */

.onesheet-page {
    padding: 16px 20px 24px;
    max-width: 100%;
}

.onesheet-page-head h2,
.onesheet-page-title {
    margin: 0 0 6px;
    font-size: 1.35rem;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.onesheet-page-icon {
    display: inline-flex;
    flex-shrink: 0;
    line-height: 0;
    color: #1e40af;
}

.onesheet-page-icon-svg {
    width: 30px;
    height: 30px;
    display: block;
}

.onesheet-intro {
    margin: 0 0 14px;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.45;
    max-width: 900px;
}

.onesheet-callout {
    background: #ffffff;
    border: 1px solid #000000;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #000000;
}

.onesheet-page-toolbar {
    margin-bottom: 14px;
}

.onesheet-page-toolbar .onesheet-refresh-btn {
    background: #111111;
    border: 1px solid #1a1a1a;
    color: #ffffff;
    box-shadow:
        0 0 10px rgba(255, 255, 255, 0.35),
        0 0 18px rgba(255, 255, 255, 0.18);
}

.onesheet-page-toolbar .onesheet-refresh-btn:hover {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
    box-shadow:
        0 0 14px rgba(255, 255, 255, 0.45),
        0 0 24px rgba(255, 255, 255, 0.22);
}

.onesheet-global-filter {
    background: #f0f4f8;
    border: 1px solid #c8d4e0;
    border-radius: 10px;
    padding: 16px 18px 18px;
    margin-bottom: 22px;
}

.onesheet-global-filter-head {
    margin-bottom: 12px;
}

.onesheet-global-filter-title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
}

.onesheet-global-filter-desc {
    margin: 0;
    font-size: 0.84rem;
    color: #5a6572;
    line-height: 1.4;
}

.onesheet-global-filter-active {
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: #2563eb;
}

.onesheet-global-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
}

.onesheet-global-filter-row .onesheet-filter-field select,
.onesheet-global-filter-row .onesheet-filter-field input[type="date"],
.onesheet-global-filter-row .onesheet-filter-field input[type="text"] {
    font-size: 0.85rem;
    padding: 6px 8px;
    border: 1px solid #bcc5d0;
    border-radius: 4px;
    min-width: 140px;
    background: #fff;
}

.onesheet-global-search-field {
    flex: 1 1 220px;
    min-width: 200px;
}

.onesheet-global-search-field input {
    width: 100%;
    box-sizing: border-box;
}

.onesheet-global-year-field {
    display: none;
}

.onesheet-global-year-field.visible {
    display: flex;
}

.onesheet-global-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-bottom: 2px;
}

.onesheet-global-export {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #c8d4e0;
}

.onesheet-global-export-warn {
    margin: 0 0 10px;
    font-size: 0.82rem;
    color: #5c4a00;
    background: #fff8e6;
    border: 1px solid #f0d878;
    border-radius: 6px;
    padding: 10px 12px;
    line-height: 1.45;
}

.onesheet-global-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.onesheet-global-export-modal-warn {
    background: #fff8e6;
    border: 1px solid #f0d878;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    color: #5c4a00;
    line-height: 1.45;
}

.onesheet-global-export-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-bottom: 14px;
}

.onesheet-global-export-fieldset {
    margin: 0;
    padding: 10px 12px 12px;
    border: 1px solid #dde1e6;
    border-radius: 8px;
    background: #f8f9fa;
    min-width: 220px;
}

.onesheet-global-export-fieldset legend {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #666;
    padding: 0 4px;
}

.onesheet-global-export-radio,
.onesheet-global-export-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.84rem;
    color: #333;
    margin: 6px 0 0;
    cursor: pointer;
}

.onesheet-global-export-radio input,
.onesheet-global-export-check input {
    margin-top: 2px;
}

.onesheet-global-export-preview .onesheet-print-cover {
    border: 2px solid #1a1a1a;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 16px;
    background: #fff;
}

.onesheet-global-export-preview .onesheet-print-cover-brand {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2563eb;
    margin-bottom: 6px;
}

.onesheet-global-export-preview .onesheet-print-cover-title {
    margin: 0 0 4px;
    font-size: 1.25rem;
}

.onesheet-global-export-preview .onesheet-print-cover-sub {
    margin: 0 0 14px;
    color: #666;
    font-size: 0.85rem;
}

.onesheet-global-export-preview .onesheet-print-cover-meta {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-bottom: 14px;
}

.onesheet-global-export-preview .onesheet-print-cover-meta th,
.onesheet-global-export-preview .onesheet-print-cover-meta td {
    border: 1px solid #d1d5db;
    padding: 6px 10px;
    text-align: left;
}

.onesheet-global-export-preview .onesheet-print-cover-meta th {
    width: 130px;
    background: #f3f4f6;
}

.onesheet-global-export-preview .onesheet-print-cover-reports {
    margin: 0 0 6px;
    font-size: 0.95rem;
}

.onesheet-global-export-preview .onesheet-print-cover-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.82rem;
}

.onesheet-global-preview-section {
    margin-bottom: 16px;
}

.onesheet-global-preview-section h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.onesheet-order-jump-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#onesheetOrderJumpModal .onesheet-order-jump-header {
    padding: 10px 14px;
}

#onesheetOrderJumpModal .onesheet-order-jump-body {
    padding: 12px 14px 14px;
}

.onesheet-order-jump-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.onesheet-order-jump-title-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: #1e40af;
    line-height: 0;
}

.onesheet-order-jump-title-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.onesheet-order-jump-label {
    font-weight: 600;
    margin: 0 0 6px;
    font-size: 15px;
}

.onesheet-order-jump-intro {
    margin: 0 0 12px;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

.onesheet-order-jump-actions .btn-primary,
.onesheet-order-jump-actions .btn-secondary {
    width: 100%;
    text-align: center;
    padding: 8px 14px;
    font-size: 0.95rem;
}

.onesheet-order-jump-actions .onesheet-jump-btn-sales {
    background: linear-gradient(180deg, #ffffff 0%, #ecfdf3 55%, #d4edda 100%);
    border: 1px solid #b1dfbb;
    color: #155724;
}

.onesheet-order-jump-actions .onesheet-jump-btn-sales:hover {
    background: linear-gradient(180deg, #ffffff 0%, #d4edda 55%, #b1dfbb 100%);
    border-color: #86c991;
    color: #0f5132;
}

.onesheet-order-jump-actions .onesheet-jump-btn-workshop {
    background: linear-gradient(180deg, #ffffff 0%, #fff0e3 55%, #ffd8b8 100%);
    border: 1px solid #fdba74;
    color: #7c2d12;
}

.onesheet-order-jump-actions .onesheet-jump-btn-workshop:hover {
    background: linear-gradient(180deg, #ffffff 0%, #ffd8b8 55%, #ffb366 100%);
    border-color: #fd7e14;
    color: #7c2d12;
}

.onesheet-order-jump-actions .onesheet-jump-btn-history {
    background: linear-gradient(180deg, #ffffff 0%, #f1f3f5 55%, #dee2e6 100%);
    border: 1px solid #ced4da;
    color: #495057;
}

.onesheet-order-jump-actions .onesheet-jump-btn-history:hover {
    background: linear-gradient(180deg, #ffffff 0%, #dee2e6 55%, #ced4da 100%);
    border-color: #adb5bd;
    color: #343a40;
}

.onesheet-order-jump-actions .onesheet-jump-btn-cancel {
    background: #fff;
    border: 1px solid #ced4da;
    color: #6c757d;
}

.onesheet-order-jump-actions .onesheet-jump-btn-cancel:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

.onesheet-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.onesheet-block-section {
    border: 1px solid #dde1e6;
    border-radius: 10px;
    padding: 18px 18px 20px;
}

.onesheet-block-section[data-section="salesIn"] {
    background: #ecf8f1;
    border-color: #b8e6cf;
}

.onesheet-block-section[data-section="salesIn"] .onesheet-section-icon {
    color: #198754;
}

.onesheet-block-section[data-section="stockOut"] {
    background: #fef8ec;
    border-color: #f0d9a8;
}

.onesheet-block-section[data-section="stockOut"] .onesheet-section-icon {
    color: #d97706;
}

.onesheet-block-section[data-section="stockIn"] {
    background: #fef8ec;
    border-color: #f0d9a8;
}

.onesheet-block-section[data-section="stockIn"] .onesheet-section-icon {
    color: #d97706;
}

.onesheet-block-section[data-section="poPay"] {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.onesheet-block-section[data-section="poPay"] .onesheet-section-icon {
    color: #6b7280;
}

.onesheet-section-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.onesheet-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.onesheet-section-head .onesheet-section-title {
    margin: 0;
}

.onesheet-section-head-meta {
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    margin-left: auto;
}

.onesheet-section-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    flex-shrink: 0;
}

.onesheet-section-toggle:hover {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.2);
}

.onesheet-section-chevron {
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid #374151;
    border-bottom: 2px solid #374151;
    transform: rotate(45deg);
    margin-top: -3px;
    transition: transform 0.15s ease;
}

.onesheet-block-section.collapsed .onesheet-section-chevron {
    transform: rotate(-45deg);
    margin-top: 3px;
}

.onesheet-block-section.collapsed .onesheet-section-body {
    display: none;
}

.onesheet-block-section.collapsed {
    padding-bottom: 14px;
}

.onesheet-section-icon {
    display: inline-flex;
    flex-shrink: 0;
    line-height: 0;
}

.onesheet-section-icon-svg {
    width: 22px;
    height: 22px;
    display: block;
}

.onesheet-block-section .onesheet-intro {
    color: #4a5568;
}

.onesheet-block-section .onesheet-kpi {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(0, 0, 0, 0.08);
}

.onesheet-block-section .onesheet-kpi-locked {
    background: rgba(255, 255, 255, 0.45);
}

.onesheet-block-section .onesheet-kpi-locked:hover {
    background: rgba(255, 255, 255, 0.72);
}

.onesheet-block-section .onesheet-kpi-masked {
    background: rgba(0, 0, 0, 0.06);
}

.onesheet-block-section .onesheet-toolbar {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(0, 0, 0, 0.08);
}

.onesheet-block-section .onesheet-section-filters {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(0, 0, 0, 0.08);
}

.onesheet-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.onesheet-kpi {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    padding: 10px 14px;
    background: #f5f6f8;
    border: 1px solid #dde1e6;
    border-radius: 8px;
}

.onesheet-kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #666;
    margin-bottom: 4px;
}

.onesheet-kpi-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a1a;
}

.onesheet-kpi-locked {
    cursor: pointer;
    background: transparent;
    border-style: dashed;
    border-color: #ced4da;
    justify-content: center;
    min-height: 44px;
}

.onesheet-kpi-locked .onesheet-kpi-masked {
    margin: 0;
}

.onesheet-kpi-locked:hover {
    border-color: #adb5bd;
    background: #fafbfc;
}

.onesheet-kpi-masked {
    display: block;
    min-height: 1.25rem;
    min-width: 80px;
    border-radius: 4px;
    background: #f0f2f5;
}

.onesheet-export-all-row {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 2px solid #dee2e6;
    text-align: center;
}

.onesheet-export-all-hint {
    margin: 10px 0 0;
    font-size: 0.82rem;
    color: #6c757d;
}

.onesheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px 20px;
    padding: 14px;
    background: #f5f6f8;
    border: 1px solid #dde1e6;
    border-radius: 8px;
    margin-bottom: 12px;
}

.onesheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.onesheet-toolbar-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    margin: 0;
}

.onesheet-toolbar .btn-secondary.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.onesheet-section-filters {
    display: none;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: flex-end;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #dde1e6;
    border-radius: 8px;
}

.onesheet-section-filters.open {
    display: flex;
}

.onesheet-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #666;
}

.onesheet-filter-field input {
    font-size: 0.85rem;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 140px;
}

.onesheet-filter-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
    padding-bottom: 6px;
}

.onesheet-table-wrap {
    overflow-x: auto;
    border: 1px solid #dde1e6;
    border-radius: 8px;
    background: #fff;
}

.onesheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.onesheet-orders-table th,
.onesheet-orders-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.onesheet-orders-table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #495057;
    white-space: nowrap;
}

.onesheet-orders-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.onesheet-orders-table th.sortable:hover {
    background: #eef2f7;
}

.onesheet-orders-table th .sort-ind {
    font-size: 10px;
    color: #adb5bd;
    margin-left: 3px;
}

.onesheet-orders-table tbody tr:hover {
    background: #f8f9fa;
}

.onesheet-orders-table tbody tr.onesheet-expandable {
    cursor: pointer;
}

.onesheet-orders-table tbody tr.onesheet-order-nav-row {
    cursor: pointer;
}

.onesheet-orders-table tbody tr.onesheet-order-nav-row:hover td {
    background: rgba(37, 99, 235, 0.07);
}

.onesheet-row-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 4px;
    padding: 0;
    border: 1px solid #c8d4e0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
}

.onesheet-row-expand-btn::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 2px solid #374151;
    border-bottom: 2px solid #374151;
    transform: rotate(-45deg);
    margin-top: -2px;
    transition: transform 0.15s ease;
}

.onesheet-row-expand-btn.expanded::before {
    transform: rotate(45deg);
    margin-top: 2px;
}

.onesheet-row-expand-btn:hover {
    background: #fff;
    border-color: #94a3b8;
}

.onesheet-orders-table tbody tr.onesheet-expanded {
    background: #e7f1ff;
}

.onesheet-orders-table tbody tr.onesheet-detail-row td {
    background: #f8f9fa;
    font-size: 0.78rem;
}

.onesheet-orders-table .num {
    text-align: right;
    white-space: nowrap;
}

.onesheet-sub {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

.onesheet-empty {
    padding: 24px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.onesheet-loading,
.onesheet-error {
    text-align: center;
    padding: 28px;
    color: #6c757d;
}

.onesheet-error {
    color: #dc3545;
}

.onesheet-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    background: #e9ecef;
    color: #495057;
}

.onesheet-badge-dispatched {
    background: #d1e7dd;
    color: #0f5132;
}

.onesheet-badge-legacy {
    background: #e2e3e5;
    color: #41464b;
}

.onesheet-badge-cancelled {
    background: #f8d7da;
    color: #842029;
}

.onesheet-preview-scroll {
    max-height: 320px;
    overflow: auto;
    border: 1px solid #dde1e6;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

.onesheet-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.onesheet-preview-table th,
.onesheet-preview-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.onesheet-preview-table th {
    background: #f8f9fa;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 1;
}

.onesheet-preview-empty {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    margin: 0;
}

.onesheet-preview-note {
    margin: 0 0 8px;
    font-size: 0.8rem;
    color: #856404;
    background: #fff8e6;
    padding: 8px 10px;
    border-radius: 4px;
}

.onesheet-preview-panel-focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 8px;
}

@media print {
    body * {
        visibility: hidden;
    }
    #onesheetTabContent,
    #onesheetTabContent * {
        visibility: visible;
    }
    #onesheetTabContent {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .onesheet-page-toolbar,
    .onesheet-toolbar,
    .onesheet-section-filters,
    .tab-bar,
    .section-header,
    .content-box:last-child {
        display: none !important;
    }
    body[data-onesheet-print] .onesheet-block-section {
        display: none !important;
    }
    body[data-onesheet-print] .onesheet-block-section[data-section] {
        display: none !important;
    }
    body[data-onesheet-print="salesIn"] #onesheet-section-salesIn,
    body[data-onesheet-print="stockIn"] #onesheet-section-stockIn,
    body[data-onesheet-print="poPay"] #onesheet-section-poPay,
    body[data-onesheet-print="stockOut"] #onesheet-section-stockOut {
        display: block !important;
        border: none;
        padding-top: 0;
    }
}
