html,
body {
    height: 100%;
}

:root {
    --bg: #eef4fb;
    --panel: #0f172a;
    --panel-soft: #182338;
    --panel-border: rgba(255, 255, 255, 0.08);
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #12315e;
    --muted: #607594;
    --accent: #2d8cff;
    --accent-strong: #1d73da;
    --border: #d7e3f4;
    --danger-bg: #ffe9ec;
    --danger-text: #c43753;
    --warn-bg: #fff1da;
    --warn-text: #c97709;
    --info-bg: #e9efff;
    --info-text: #2d56c4;
    --soft-bg: #eef5ff;
    --soft-text: #5d7091;
    --shadow: 0 18px 40px rgba(18, 49, 94, 0.08);
    --sidebar-width: 238px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f4f8fd 0%, #edf3fa 100%);
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.sidebar {
    width: var(--sidebar-width);
    padding: 22px 16px;
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-soft) 100%);
    color: #f3f6fc;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--panel-border);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 0 0 var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.brand-kicker,
.topbar p {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.brand h1 {
    margin: 6px 0 0;
    font-size: 1.1rem;
    line-height: 1.2;
    font-weight: 700;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 18px;
    flex: 1;
}

.menu-link {
    padding: 12px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #9aa9c2;
    font-weight: 600;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.menu-link:hover,
.menu-link.active {
    color: #ffffff;
    background: #13314f;
    border-color: rgba(96, 165, 250, 0.16);
    transform: translateX(2px);
}

.sidebar-user-card {
    margin-top: 18px;
    padding: 14px 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(146, 178, 226, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar-user-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(160, 183, 221, 0.16);
}

.sidebar-user-head strong {
    color: #ffffff;
    font-size: 0.98rem;
    line-height: 1.2;
}

.sidebar-user-head span {
    color: #c5d0e2;
    font-size: 0.95rem;
    text-transform: lowercase;
}

.sidebar-user-head small {
    color: #9fb0cb;
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sidebar-user-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 0 14px;
}

.sidebar-user-link {
    padding: 11px 12px;
    border-radius: 12px;
    color: #aeb9cd;
    font-weight: 700;
    line-height: 1.15;
}

.sidebar-user-link:hover,
.sidebar-user-link.active {
    background: #184066;
    color: #ffffff;
}

.sidebar-logout-form {
    display: flex;
}

.sidebar-logout-btn {
    height: 42px;
    min-width: 84px;
    border-radius: 12px;
    background: #f3f7ff;
    color: #1c2b45;
    border-color: #f3f7ff;
    box-shadow: 0 6px 14px rgba(6, 18, 38, 0.16);
}

.content-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.topbar {
    padding: 18px 22px 0;
}

.topbar p {
    margin: 0;
    color: var(--muted);
}

.content {
    flex: 1;
    padding: 0 22px 24px;
    overflow-y: auto;
    overflow-x: hidden;
}

.footer {
    padding: 14px 22px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
}

.hero-panel {
    padding: 28px 22px;
    border: 1px solid var(--border);
    border-radius: 0 0 18px 18px;
    background: linear-gradient(180deg, #dcecff 0%, #cfe3fb 100%);
}

.hero-panel h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 800;
}

.hero-panel p {
    margin: 0;
    color: #5877a0;
    font-size: 0.98rem;
}

.filters-card,
.table-card {
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.summary-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
    gap: 14px;
}

.summary-card-total {
    grid-column: 1;
}

.summary-card-department {
    grid-column: 2;
}

.summary-card-cashier {
    grid-column: 1;
}

.summary-card-pos {
    grid-column: 2;
}

.summary-card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.summary-label {
    display: block;
    color: #647e9f;
    font-size: 0.82rem;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.summary-card strong {
    display: block;
    font-size: 1.6rem;
    color: #163762;
}

.summary-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.delta {
    font-weight: 700;
}

.delta-negative {
    color: #c43753;
}

.delta-positive {
    color: #1f8f57;
}

.delta-neutral {
    color: #5d7091;
}

.forecast-row-under {
    background: rgba(196, 55, 83, 0.06);
}

.forecast-row-over {
    background: rgba(31, 143, 87, 0.05);
}

.day-panels {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.page-shift-forecast .dashboard-summary {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.page-shift-forecast .dashboard-summary .summary-card {
    min-width: 0;
}

.day-panel {
    margin-top: 0;
}

.performance-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
}

.performance-up {
    background: #e8f8ef;
    color: #1f8f57;
}

.performance-down {
    background: #fff1f3;
    color: #c43753;
}

.performance-neutral {
    background: #eef4fb;
    color: #5d7091;
}

.mini-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
}

.mini-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid #ebf1fa;
    font-size: 0.92rem;
}

.mini-row-main {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.mini-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.35;
    color: #27476f;
    flex: 1;
}

.mini-row strong {
    font-size: 0.95rem;
    white-space: nowrap;
}

.mini-row small {
    color: #647e9f;
    font-size: 0.84rem;
}

.cashier-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cashier-code {
    display: inline-flex;
    width: fit-content;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #1d4f91;
    font-weight: 700;
    font-size: 0.78rem;
}

.cashier-name {
    font-weight: 600;
    color: #27476f;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay[hidden] {
    display: none !important;
}

.loading-card {
    min-width: 340px;
    padding: 26px 28px;
    border-radius: 20px;
    border: 1px solid #d6e3f5;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 60px rgba(18, 49, 94, 0.16);
    text-align: center;
}

.loading-card strong {
    display: block;
    margin-top: 12px;
    font-size: 1.1rem;
    color: #163762;
}

.loading-card p {
    margin: 8px 0 0;
    color: var(--muted);
}

.spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto;
    border: 4px solid #d9e6f7;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.filters-card {
    padding: 12px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    align-items: end;
}

.filters-grid input,
.filters-grid select,
.users-form textarea,
.login-form input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #cfdcf0;
    border-radius: 12px;
    background: #ffffff;
    color: #173860;
    font-size: 0.98rem;
    outline: none;
}

.filters-grid input:focus,
.filters-grid select:focus,
.users-form textarea:focus,
.login-form input:focus {
    border-color: #8ab8f4;
    box-shadow: 0 0 0 3px rgba(45, 140, 255, 0.12);
}

.users-form textarea {
    min-height: 92px;
    height: auto;
    padding: 12px 14px;
    resize: vertical;
}

.filter-field label {
    display: block;
    margin: 0 0 6px;
    color: #5f7697;
    font-size: 0.88rem;
    font-weight: 600;
}

.filters-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 44px;
}

.btn {
    height: 40px;
    padding: 0 16px;
    border: 1px solid #d2dff1;
    border-radius: 12px;
    background: #eff4fa;
    color: #15345d;
    font-size: 0.98rem;
    font-weight: 700;
}

.btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.btn-danger {
    border-color: #f3c9cf;
    background: #fff0f2;
    color: #c43753;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.inline-form {
    display: inline-flex;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    height: 40px;
    border-radius: 999px;
    background: #edf5ff;
    color: #173b72;
    font-weight: 700;
    font-size: 0.88rem;
}

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.flash-message {
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 600;
}

.flash-success {
    background: #ecf9f0;
    border: 1px solid #b8e0c4;
    color: #1f8f57;
}

.flash-error {
    background: #fff2f4;
    border: 1px solid #efc9cf;
    color: #b53a4c;
}

.login-page {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0e1730 0%, #18345f 100%);
}

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

.login-card {
    padding: 30px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid #dce7f7;
    box-shadow: 0 28px 60px rgba(15, 29, 58, 0.24);
}

.login-brand h1 {
    margin: 8px 0 10px;
    color: #173b72;
}

.login-brand p {
    margin: 0 0 18px;
    color: #657ea0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.users-admin-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1fr) minmax(420px, 1fr);
    gap: 18px;
}

.section-head-nested {
    margin-top: 18px;
}

.single-column-grid {
    grid-template-columns: 1fr;
}

.users-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field-span-2 {
    grid-column: span 2;
}

.credentials-card {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid #d8e4f4;
    border-radius: 16px;
    background: #f9fbff;
}

.credentials-card h4 {
    margin: 0 0 14px;
    color: #173b72;
}

.users-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

@media (max-width: 1180px) {
    .users-admin-layout {
        grid-template-columns: 1fr;
    }
}

.table-card {
    padding: 14px 14px 10px;
    position: relative;
    overflow: visible;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 0 2px 14px;
}

.section-head h3 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
    color: #12315e;
    letter-spacing: 0.01em;
    text-transform: none;
}

.table-card > .section-head,
.line-chart-card > .section-head {
    padding-bottom: 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid #dbe6f5;
}

.summary-card .summary-label {
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #355887;
}

.section-head p,
.section-note {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.table-wrap {
    display: block;
    width: 100%;
    max-height: calc(100vh - 320px);
    min-height: 420px;
    overflow: auto;
    padding-bottom: 6px;
    border: 1px solid #dbe6f5;
    border-radius: 14px;
    scrollbar-gutter: stable both-edges;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
}

.table-wrap::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.table-wrap::-webkit-scrollbar-track {
    background: #dfe8f5;
    border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: #8ea9cc;
    border-radius: 999px;
    border: 3px solid #dfe8f5;
}

.table-error {
    padding: 16px;
    border: 1px solid #f1c7ce;
    border-radius: 12px;
    background: #fff5f6;
    color: #a83246;
    font-weight: 600;
}

.table-info {
    padding: 16px;
    border: 1px solid #cfe0f4;
    border-radius: 12px;
    background: #f5f9ff;
    color: #345a89;
    font-weight: 600;
}

.comparison-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    z-index: 1;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e4edf8;
    text-align: left;
}

.comparison-table th {
    color: #647e9f;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.page-shift-forecast .comparison-table-wrap {
    max-height: 68vh;
    overflow: auto;
}

.page-shift-forecast .comparison-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8fbff;
    box-shadow: 0 1px 0 #dbe7f5;
}

.totals-row td {
    background: #f6faff;
    border-top: 2px solid #d9e6f7;
    font-weight: 600;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px !important;
}

.sortable-th::after {
    content: "↕";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    color: #9ab0cd;
}

.sortable-th[data-sort-direction="asc"]::after {
    content: "↑";
    color: #2d8cff;
}

.sortable-th[data-sort-direction="desc"]::after {
    content: "↓";
    color: #2d8cff;
}

.sortable-th:hover {
    background: #f5f9ff;
}

.comparison-table td {
    color: #23456f;
    font-size: 0.95rem;
}

.comparison-table td strong,
.comparison-table td small {
    display: block;
}

.comparison-table td small {
    margin-top: 4px;
    color: #6d82a1;
}

.daily-comparison-table {
    width: max-content;
    min-width: 100%;
}

.daily-comparison-table th,
.daily-comparison-table td {
    white-space: nowrap;
    vertical-align: top;
}

.daily-comparison-table td strong,
.daily-comparison-table td small {
    display: block;
}

.daily-comparison-table td small {
    margin-top: 4px;
    color: #6d82a1;
}

.clickable-row {
    cursor: pointer;
}

.returns-table {
    width: max-content;
    min-width: 100%;
}

.returns-table th,
.returns-table td {
    vertical-align: top;
}

.returns-col-date,
.returns-col-guid,
.returns-col-item,
.returns-col-pos,
.returns-col-qty,
.returns-col-amount,
.returns-col-type {
    white-space: nowrap;
}

.returns-col-date {
    min-width: 126px;
}

.returns-col-guid {
    min-width: 280px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.86rem;
    word-break: break-all;
}

.returns-col-cashier {
    min-width: 170px;
}

.returns-col-pos {
    min-width: 110px;
}

.returns-col-dept {
    min-width: 140px;
}

.returns-col-item {
    min-width: 120px;
}

.returns-col-desc {
    min-width: 230px;
    max-width: 320px;
    white-space: normal;
    word-break: break-word;
}

.returns-col-qty,
.returns-col-amount {
    text-align: right;
    min-width: 90px;
}

.clickable-row:hover td {
    background: #f4f8ff;
}

.receipt-row-exception td {
    background: #fff3f0;
}

.receipt-row-exception:hover td {
    background: #ffe6df;
}

.receipt-row-ok td {
    background: #ffffff;
}

.adjustment-highlight {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 14px;
}

.adjustment-total {
    padding: 14px 16px;
    border: 1px solid #dbe6f5;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff8f8 0%, #fffdfd 100%);
}

.adjustment-total strong {
    display: block;
    margin-top: 6px;
    font-size: 1.4rem;
}

.adjustment-total p {
    margin: 8px 0 0;
    color: #607594;
    font-size: 0.92rem;
}

.table-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
    position: relative;
    z-index: 20;
}

.legend-chip,
.th-help {
    position: relative;
    z-index: 21;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border: 1px solid #dbe6f5;
    border-radius: 999px;
    background: #f8fbff;
    color: #33547e;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: help;
}

.th-help {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: help;
}

.floating-help-tooltip {
    position: fixed;
    z-index: 5000;
    min-width: 180px;
    max-width: 280px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fbff;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
    pointer-events: none;
}

.line-chart-card {
    margin-bottom: 16px;
    padding: 18px;
    border: 1px solid #dbe6f5;
    border-radius: 18px;
    background: linear-gradient(180deg, #fcfeff 0%, #f4f9ff 100%);
    box-shadow: 0 14px 30px rgba(35, 69, 111, 0.08);
}

.line-chart-wrap {
    overflow-x: auto;
    padding-bottom: 4px;
    position: relative;
}

.chart-tooltip {
    position: absolute;
    z-index: 5;
    min-width: 220px;
    max-width: 240px;
    padding: 12px 14px;
    border: 1px solid #d7e6f8;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.94);
    color: #f8fbff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.24);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.chart-tooltip-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.chart-tooltip-head strong {
    font-size: 0.9rem;
    line-height: 1.3;
}

.chart-tooltip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
}

.chart-tooltip-body {
    display: grid;
    gap: 4px;
    color: rgba(248, 251, 255, 0.9);
    font-size: 0.82rem;
}

.chart-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 0 0 14px;
}

.chart-kpi {
    padding: 12px 14px;
    border: 1px solid #d9e7f8;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
}

.chart-kpi span {
    display: block;
    color: #6882a5;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chart-kpi strong {
    display: block;
    margin-top: 6px;
    color: #173860;
    font-size: 1.02rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 12px;
}

.active-hours-strip {
    display: grid;
    grid-template-columns: repeat(12, minmax(64px, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}

.active-hour-item {
    padding: 8px 6px;
    border: 1px solid #dbe6f5;
    border-radius: 10px;
    background: #f8fbff;
    text-align: center;
}

.active-hour-label {
    display: block;
    color: #647e9f;
    font-size: 0.74rem;
}

.active-hour-item strong {
    display: block;
    margin-top: 4px;
    color: #173860;
    font-size: 1rem;
}

.active-hour-item small {
    color: #7a8da8;
    font-size: 0.72rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #27476f;
    font-size: 0.88rem;
    padding: 7px 10px;
    border: 1px solid #dbe6f5;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(45, 140, 255, 0.12);
}

.line-chart-svg {
    width: 100%;
    min-width: 1100px;
    height: auto;
}

.chart-plot-bg {
    fill: url(#chartPlotBg);
    stroke: #dbe6f5;
    stroke-width: 1;
}

.chart-axis {
    stroke: #b9cbe3;
    stroke-width: 1.2;
}

.chart-gridline {
    stroke: #deebfa;
    stroke-width: 1;
    stroke-dasharray: 4 6;
}

.chart-tick {
    stroke: #8aa6ca;
    stroke-width: 1;
}

.chart-label {
    fill: #59739a;
    font-size: 12px;
}

.chart-label-slot {
    font-size: 10px;
}

.chart-label-y {
    font-size: 11px;
    fill: #7a8faa;
}

.chart-line {
    fill: none;
    stroke: #2d8cff;
    stroke-width: 3.5;
    stroke-linejoin: round;
    stroke-linecap: round;
    filter: drop-shadow(0 6px 10px rgba(45, 140, 255, 0.14));
}

.chart-point {
    fill: #2d8cff;
    stroke: #ffffff;
    stroke-width: 2.5;
    filter: drop-shadow(0 3px 6px rgba(23, 56, 96, 0.18));
}

.productivity-wrap {
    overflow: auto;
    border: 1px solid #dbe6f5;
    border-radius: 14px;
}

.productivity-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

.productivity-table th,
.productivity-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e4edf8;
    border-right: 1px solid #eef4fb;
    text-align: left;
    vertical-align: top;
}

.productivity-table th {
    position: sticky;
    top: 0;
    background: #f7fbff;
    color: #647e9f;
    font-size: 0.78rem;
    text-transform: uppercase;
    z-index: 2;
}

.productivity-table th:nth-child(-n+4),
.productivity-table td:nth-child(-n+4) {
    position: sticky;
    background: #ffffff;
    z-index: 1;
}

.productivity-table th:first-child,
.productivity-table td:first-child {
    left: 0;
    min-width: 180px;
}

.productivity-table th:nth-child(2),
.productivity-table td:nth-child(2) {
    left: 180px;
    min-width: 120px;
}

.productivity-table th:nth-child(3),
.productivity-table td:nth-child(3) {
    left: 300px;
    min-width: 90px;
}

.productivity-table th:nth-child(4),
.productivity-table td:nth-child(4) {
    left: 390px;
    min-width: 100px;
}

.cashier-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hour-cell {
    min-width: 110px;
}

.hour-sales {
    display: block;
    font-weight: 700;
    color: #12315e;
}

.hour-meta {
    display: block;
    margin-top: 4px;
    color: #46658e;
    font-size: 0.78rem;
}

.data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    min-width: 1400px;
    table-layout: fixed;
}

.data-table th {
    padding: 12px 10px;
    text-align: left;
    color: #647e9f;
    font-size: 0.82rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f7fbff;
}

.data-table td {
    padding: 16px 10px;
    border-bottom: 1px solid #e4edf8;
    color: #23456f;
    vertical-align: top;
    font-size: 0.92rem;
    white-space: nowrap;
}

.data-table tbody tr {
    background: #fff7f8;
}

.data-table tbody tr:nth-child(even) {
    background: #fffafb;
}

.data-table th:first-child,
.data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 140px;
    max-width: 140px;
    background: inherit;
    box-shadow: 1px 0 0 #dfe8f5;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    position: sticky;
    left: 140px;
    z-index: 2;
    min-width: 130px;
    max-width: 130px;
    background: inherit;
    box-shadow: 1px 0 0 #dfe8f5;
}

.data-table thead th:first-child,
.data-table thead th:nth-child(2) {
    z-index: 4;
    background: #f7fbff;
}

.data-table td {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-warn {
    background: var(--warn-bg);
    color: var(--warn-text);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge-soft {
    background: var(--soft-bg);
    color: var(--soft-text);
}

.footer {
    padding: 14px 22px 22px;
    color: var(--muted);
    font-size: 0.88rem;
}

@media (max-width: 960px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        position: static;
    }

    .filters-grid {
        grid-template-columns: 1fr 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .page-shift-forecast .dashboard-summary {
        grid-template-columns: 1fr;
    }

.summary-card-total,
.summary-card-department,
.summary-card-cashier,
.summary-card-pos {
        grid-column: auto;
    }

    .filters-actions {
        grid-column: span 2;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .topbar,
    .content,
    .footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .sidebar {
        padding: 18px 14px;
    }

    .hero-panel {
        padding: 22px 14px;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .mini-row-main {
        flex-direction: column;
    }

    .filters-wide,
    .filters-actions {
        grid-column: span 1;
    }

    .section-head {
        flex-direction: column;
    }

    .table-wrap {
        max-height: calc(100vh - 280px);
        min-height: 360px;
    }
}
 .topbar-actions {
     display: flex;
     align-items: center;
     gap: 0.75rem;
     margin-left: auto;
 }

 .btn-print {
     display: inline-flex;
     align-items: center;
     justify-content: center;
     min-width: 120px;
 }

 .print-only {
     display: none;
 }

/* ===== Previsione turni: lettura semplificata per il gestore ===== */
.forecast-guide .forecast-guide-lead {
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text-main);
    max-width: 70ch;
}
.forecast-highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.forecast-highlight {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--surface-soft);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.forecast-highlight .fh-num {
    font-size: 1.9rem;
    font-weight: 800;
    color: #0f2f63;
    line-height: 1.1;
}
.forecast-highlight .fh-num.fh-conf-high { color: #1f8a4c; }
.forecast-highlight .fh-num.fh-conf-mid { color: #c98a00; }
.forecast-highlight .fh-num.fh-conf-low { color: #c0392b; }
.forecast-highlight .fh-lbl { font-weight: 700; color: var(--text-main); }
.forecast-highlight .fh-note { font-size: .85rem; color: var(--text-muted); }

.shift-grid-wrap { overflow-x: auto; margin-top: 6px; }
.shift-grid { border-collapse: collapse; width: 100%; font-size: .9rem; }
.shift-grid th, .shift-grid td { text-align: center; padding: 0; }
.shift-grid thead th {
    font-weight: 700; color: var(--text-muted); padding: 4px 2px;
    font-size: .8rem; border-bottom: 2px solid var(--border);
}
.shift-grid th.sg-day {
    text-align: left; white-space: nowrap; padding: 6px 10px 6px 4px;
    color: var(--text-main); font-weight: 700; position: sticky; left: 0;
    background: var(--surface);
}
.shift-grid .sg-cell {
    width: 34px; height: 34px; border: 1px solid #ffffff;
    font-weight: 700; color: #0f2f63;
    background: rgba(31, 107, 200, calc(0.10 + var(--lvl, 0) * 0.55));
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.shift-grid .sg-cell.sg-reinforce { box-shadow: inset 0 4px 0 #e08a1e; }
.shift-grid .sg-cell.sg-light { box-shadow: inset 0 -4px 0 #1f8a4c; }
.shift-grid .sg-cell.sg-closed { background: #f0f3f8; color: #b3c0d4; font-weight: 400; }
.shift-grid .sg-tot {
    font-weight: 800; color: #0f2f63; background: var(--surface-soft);
    padding: 0 10px; white-space: nowrap;
}
.shift-grid tbody tr:hover .sg-cell { outline: 1px solid rgba(15,47,99,.25); }

.shift-legend {
    display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 14px;
    font-size: .85rem; color: var(--text-muted); align-items: center;
}
.shift-legend .sg-leg { display: inline-flex; align-items: center; gap: 6px; }
.sg-swatch {
    display: inline-block; width: 18px; height: 18px; border-radius: 4px;
    border: 1px solid var(--border); vertical-align: middle;
}
.sg-swatch.sg-s1 { background: rgba(31,107,200,.20); }
.sg-swatch.sg-s2 { background: rgba(31,107,200,.42); }
.sg-swatch.sg-s3 { background: rgba(31,107,200,.62); }
.sg-swatch.sg-reinforce-leg { background: #ffffff; box-shadow: inset 0 4px 0 #e08a1e; }
.sg-swatch.sg-light-leg { background: #ffffff; box-shadow: inset 0 -4px 0 #1f8a4c; }
.sg-swatch.sg-closed-leg { background: #f0f3f8; }

.shift-grid .sg-day.sg-day-holiday { color: #b9770e; }
.holiday-badge {
    display: inline-block; font-size: .62rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .3px; color: #b9770e; background: #fdf3e2; border: 1px solid #f0c98a;
    border-radius: 999px; padding: 0 6px; margin-left: 4px; vertical-align: middle;
}
.holiday-badge-closed { color: #8a8f98; background: #f0f3f8; border-color: #d4dbe6; }
.holiday-note {
    margin-top: 14px; border: 1px solid #f0c98a; background: #fdf8ef;
    border-left: 4px solid #e08a1e; border-radius: 10px; padding: 12px 16px;
    font-size: .9rem; color: var(--text-main);
}
.holiday-note p { margin: 0 0 6px; }
.holiday-list { margin: 0; padding-left: 18px; }
.holiday-list li { margin: 2px 0; }
.holiday-tag-closed { color: #8a8f98; font-weight: 700; }

/* Drill-down per negozio + breadcrumb ambito */
.store-scope-bar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin: 0 0 14px; padding: 8px 14px;
    background: var(--surface-soft); border: 1px solid var(--border);
    border-radius: 10px; font-size: 0.9rem;
}
.store-scope-bar .scope-label { color: var(--text-muted); font-weight: 700; }
.store-scope-bar .scope-current { color: var(--text-main); font-weight: 700; }
.store-scope-bar .scope-crumb { color: #163d77; font-weight: 700; text-decoration: none; }
.store-scope-bar .scope-crumb:hover { text-decoration: underline; }
.store-scope-bar .scope-sep { color: var(--text-muted); }
.store-scope-bar .scope-hint { color: var(--text-muted); font-size: 0.82rem; }
.store-drill-row { cursor: pointer; border-radius: 8px; transition: background 0.12s ease; }
.mini-table .store-drill-row:hover { background: var(--surface-soft); }
tr.store-drill-row { cursor: pointer; }
tr.store-drill-row:hover td { background: var(--surface-soft); }
.drill-hint { color: #163d77; font-weight: 700; }

/* Confronto negozi: grafici e matrice */
.store-bar-svg, .store-trend-svg { width: 100%; height: auto; }
.store-bar-svg .store-bar-label { font-size: 12px; fill: #173a70; font-weight: 700; }
.store-bar-svg .store-bar-val { font-size: 11px; fill: #5b7aa8; }
.store-trend-svg .store-axis { font-size: 11px; fill: #5b7aa8; }
.store-matrix .matrix-cell {
    text-align: right; font-variant-numeric: tabular-nums;
    background: rgba(31, 107, 200, calc(0.06 + var(--lvl, 0) * 0.5));
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.store-matrix th:first-child, .store-matrix td:first-child { text-align: left; }

.optional-tag {
    font-size: .65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 1px 8px; margin-left: 8px; vertical-align: middle;
}
.forecast-advanced { margin-top: 6px; }
.forecast-advanced > summary {
    cursor: pointer; font-weight: 700; color: #163d77;
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-soft); display: inline-block; list-style: none;
}
.forecast-advanced > summary::-webkit-details-marker { display: none; }
.forecast-advanced > summary::before { content: "▸ "; }
.forecast-advanced[open] > summary::before { content: "▾ "; }
.forecast-advanced[open] > summary { margin-bottom: 12px; }

 @page {
     size: A4 landscape;
     margin: 12mm;
 }

/* Print frame = plain blocks on screen (no table layout) */
.print-frame,
.print-frame > tbody,
.print-frame > tbody > tr,
.print-frame > tbody > tr > td {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
}

/* ===== Brand print framework (DF Sistemi) ===== */
@media print {
    /* Repeating header/footer via native table header/footer groups */
    .print-frame {
        display: table !important;
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .print-frame > thead.print-frame-head {
        display: table-header-group !important;
    }

    .print-frame > tfoot.print-frame-foot {
        display: table-footer-group !important;
    }

    .print-frame > tbody.print-frame-body {
        display: table-row-group !important;
    }

    .print-frame > thead > tr,
    .print-frame > tfoot > tr,
    .print-frame > tbody > tr {
        display: table-row !important;
    }

    .print-frame > thead > tr > td,
    .print-frame > tfoot > tr > td,
    .print-frame > tbody > tr > td {
        display: table-cell !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .print-frame-head > tr > td {
        padding-bottom: 4mm !important;
    }

    .print-frame-foot > tr > td {
        padding-top: 4mm !important;
    }

    .print-running-header,
    .print-running-footer {
        display: flex;
        align-items: center;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-running-header {
        gap: 10px;
        padding-bottom: 3mm;
        border-bottom: 2px solid #163d77;
    }

    .print-running-footer {
        justify-content: center;
        padding-top: 2.5mm;
        border-top: 1px solid #cfd8e6;
        font-size: 8pt;
        color: #5b7aa8;
        text-align: center;
    }

    .print-running-header .brand-mark {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .print-running-header .brand-logo {
        width: 11mm;
        height: 11mm;
        border-radius: 2.2mm;
        background: #163d77 !important;
        color: #ffffff !important;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        font-size: 13pt;
        letter-spacing: .5px;
    }

    .print-running-header .brand-text {
        display: flex;
        flex-direction: column;
        line-height: 1.15;
    }

    .print-running-header .brand-text .app {
        font-size: 13pt;
        font-weight: 800;
        color: #0f2f63 !important;
    }

    .print-running-header .brand-text .sub {
        font-size: 7pt;
        text-transform: uppercase;
        letter-spacing: 1.1px;
        color: #5b7aa8 !important;
    }

    .print-running-header .header-context {
        margin-left: auto;
        display: flex;
        flex-direction: column;
        text-align: right;
        font-size: 8.5pt;
        color: #5b7aa8 !important;
        line-height: 1.5;
    }

    .print-running-header .header-context strong {
        color: #173a70 !important;
        font-weight: 700;
    }

    /* First-page title band */
    .print-title {
        display: block !important;
        background: #eef4fb !important;
        border: 1px solid #cfd8e6 !important;
        border-left: 5px solid #163d77 !important;
        border-radius: 2mm;
        padding: 4mm 5mm;
        margin: 0 0 6mm;
        break-inside: avoid;
    }

    .print-title h2 {
        margin: 0 0 2mm;
        font-size: 17pt;
        font-weight: 800;
        color: #0f2f63 !important;
    }

    .print-title-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 2.5mm 8mm;
        font-size: 9pt;
        color: #173a70 !important;
    }

    .print-title-meta b {
        color: #5b7aa8 !important;
        font-weight: 600;
    }

    /* Topbar e footer a video sono ridondanti in stampa: header/footer
       ripetuti li sostituiscono. Nasconderli evita anche una prima pagina vuota. */
    .topbar,
    .footer {
        display: none !important;
    }

    /* Polished print-report tables */
    .print-report-section {
        margin-bottom: 6mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-report-section h3 {
        font-size: 11pt;
        font-weight: 800;
        color: #0f2f63 !important;
        margin: 0 0 2.5mm;
        padding-left: 3mm;
        border-left: 4px solid #163d77;
    }

    .print-report-table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8.8pt !important;
    }

    .print-report-table thead th {
        background: #163d77 !important;
        color: #ffffff !important;
        border: 1px solid #163d77 !important;
        font-weight: 700 !important;
        text-align: left;
        padding: 2.3mm 2.4mm !important;
    }

    .print-report-table tbody td,
    .print-report-table tbody th {
        border: 1px solid #cfd8e6 !important;
        padding: 2mm 2.4mm !important;
        color: #173a70 !important;
        vertical-align: top;
    }

    .print-report-table tbody tr:nth-child(even) td {
        background: #f5f8fc !important;
    }

    .print-report-table tbody tr.total-row td,
    .print-report-table tfoot td {
        background: #0f2f63 !important;
        color: #ffffff !important;
        font-weight: 800 !important;
        border-color: #0f2f63 !important;
    }

    .print-report-table .num,
    .print-report-table td.num,
    .print-report-table th.num {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    .print-report-note {
        font-size: 9pt;
        color: #5b7aa8 !important;
        margin: 0;
    }

    /* Chart card inside print-report */
    .print-report .print-report-chart {
        border: 1px solid #cfd8e6 !important;
        border-radius: 2mm;
        padding: 3mm;
        margin-bottom: 6mm;
        break-inside: avoid;
    }

    .print-report .print-report-chart svg {
        width: 100% !important;
        height: auto !important;
        max-height: 95mm;
    }

    .print-chart-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 2mm 6mm;
        margin-top: 2.5mm;
        font-size: 8pt;
        color: #5b7aa8 !important;
    }

    .print-chart-legend i {
        display: inline-block;
        width: 3mm;
        height: 3mm;
        border-radius: 1mm;
        margin-right: 1.5mm;
        vertical-align: -0.5mm;
    }

    /* Griglia "Piano casse" in stampa */
    .print-report .print-shift-grid {
        width: 100% !important;
        border-collapse: collapse !important;
        table-layout: fixed;
    }
    .print-report .print-shift-grid th,
    .print-report .print-shift-grid td {
        border: 1px solid #ffffff !important;
        padding: 1.4mm 0 !important;
        text-align: center;
        font-size: 8pt !important;
        color: #0f2f63 !important;
        vertical-align: middle;
    }
    .print-report .print-shift-grid thead th {
        background: #ffffff !important;
        color: #5b7aa8 !important;
        border: 0 !important;
        border-bottom: 1px solid #cfd8e6 !important;
        font-weight: 700 !important;
    }
    .print-report .print-shift-grid th.sg-day {
        text-align: left;
        white-space: nowrap;
        padding: 1.4mm 2mm 1.4mm 0 !important;
        background: #ffffff !important;
        color: #173a70 !important;
        border: 0 !important;
        font-weight: 700 !important;
    }
    .print-report .print-shift-grid .sg-cell {
        background: rgba(31, 107, 200, calc(0.12 + var(--lvl, 0) * 0.55)) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .print-report .print-shift-grid .sg-cell.sg-reinforce { border-top: 2px solid #e08a1e !important; }
    .print-report .print-shift-grid .sg-cell.sg-light { border-bottom: 2px solid #1f8a4c !important; }
    .print-report .print-shift-grid .sg-cell.sg-closed { background: #f0f3f8 !important; color: #b3c0d4 !important; }
    .print-report .print-shift-grid .holiday-badge {
        font-size: 6pt; color: #b9770e; border: 1px solid #f0c98a; border-radius: 1mm;
        padding: 0 1mm; margin-left: 1mm;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .print-report .print-shift-grid .holiday-badge-closed { color: #777; border-color: #ccc; }
    .print-report .print-shift-grid .sg-tot {
        background: #eef4fb !important;
        font-weight: 800 !important;
        padding: 0 2mm !important;
        white-space: nowrap;
    }
    .print-shift-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 3mm 6mm;
        margin-top: 2.5mm;
        font-size: 8pt;
        color: #5b7aa8;
    }
    .print-shift-legend i {
        display: inline-block;
        width: 4mm;
        height: 3mm;
        border: 1px solid #cfd8e6;
        margin-right: 1mm;
        vertical-align: -0.4mm;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

@media print {
     :root {
         --bg-main: #ffffff;
         --surface: #ffffff;
         --surface-soft: #ffffff;
         --surface-strong: #ffffff;
         --border: #c9d6ea;
         --text-main: #0f2f63;
         --text-muted: #36598f;
     }

     html,
     body {
         background: #ffffff !important;
         color: #173a70 !important;
         font-size: 10pt;
         overflow: visible !important;
     }

     body * {
         box-shadow: none !important;
         text-shadow: none !important;
     }

     .app-shell {
         display: block !important;
         min-height: auto !important;
         background: #ffffff !important;
     }

     .sidebar,
     .topbar-actions,
     .loading-overlay,
     .page-actions,
     .no-print,
     button,
     .btn,
     .filters-card .filters-actions,
     .legend-pill::after {
         display: none !important;
     }

     .content {
         margin: 0 !important;
         padding: 0 !important;
         width: 100% !important;
         max-width: none !important;
     }

     .topbar {
         padding: 0 !important;
         margin: 0 0 6mm !important;
         border: 0 !important;
         background: transparent !important;
         min-height: auto !important;
     }

     .page-body {
         padding: 0 !important;
         gap: 5mm !important;
         background: #ffffff !important;
     }

     .print-only {
         display: block !important;
     }

     .hero-panel,
     .filters-card,
     .summary-card,
     .table-card,
     .stat-card,
     .chart-card,
     .detail-card,
     .panel,
     .receipt-summary-card,
     .receipt-detail-card {
         background: #ffffff !important;
         border: 1px solid #cfd8e6 !important;
         box-shadow: none !important;
         break-inside: avoid;
         page-break-inside: avoid;
     }

     .hero-panel {
         padding: 5mm !important;
     }

     .hero-panel::before,
     .table-card::before,
     .summary-card::before {
         display: none !important;
     }

     .summary-grid,
     .dashboard-grid,
     .two-column-grid,
     .report-grid {
         gap: 4mm !important;
     }

     .summary-grid > *,
     .dashboard-grid > *,
     .two-column-grid > *,
     .report-grid > * {
         min-width: 0 !important;
     }

     table {
         width: 100% !important;
         border-collapse: collapse !important;
         table-layout: auto !important;
         font-size: 8.8pt !important;
     }

     thead {
         display: table-header-group;
     }

     tfoot {
         display: table-footer-group;
     }

     tr,
     td,
     th {
         break-inside: avoid;
         page-break-inside: avoid;
     }

     th,
     td {
         padding: 2.2mm 2mm !important;
         border: 1px solid #d8e2f0 !important;
         background: #ffffff !important;
         color: #173a70 !important;
         vertical-align: top;
     }

     th {
         background: #eef4fb !important;
         font-weight: 800 !important;
     }

     .table-scroll,
     .table-wrapper,
     .grid-scroll,
     .comparison-table-wrapper,
     .receipt-table-wrapper {
         overflow: visible !important;
         max-height: none !important;
     }

     .productivity-table,
     .comparison-table,
     .receipt-detail-table,
     .sortable-table {
         overflow: visible !important;
     }

     canvas,
     svg,
     img {
         max-width: 100% !important;
         break-inside: avoid;
         page-break-inside: avoid;
     }

     .chart-card canvas,
     .chart-card svg {
         max-height: 130mm !important;
     }

     .footer {
         position: static !important;
         padding: 4mm 0 0 !important;
         margin-top: 5mm !important;
         border-top: 1px solid #cfd8e6 !important;
         background: #ffffff !important;
         color: #4f6f9f !important;
         text-align: center !important;
     }

     a,
     a:visited {
         color: #173a70 !important;
         text-decoration: none !important;
     }

     .pill,
     .badge,
     .legend-pill,
     .status-chip,
     .metric-chip {
         border: 1px solid #d8e2f0 !important;
         background: #ffffff !important;
         color: #173a70 !important;
     }
 }

@media print {
    .print-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        align-items: stretch !important;
    }

    .print-avoid-break {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .print-page-break-before {
        break-before: page;
        page-break-before: always;
    }

    .print-wide-table {
        width: 100% !important;
        overflow: visible !important;
    }

    .print-chart-card,
    .line-chart-card {
        padding: 4mm !important;
        background: #ffffff !important;
    }

    .print-chart-card .chart-kpis,
    .line-chart-card .chart-kpis {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 2.5mm !important;
        margin-bottom: 4mm !important;
    }

    .print-chart-card .chart-kpi,
    .line-chart-card .chart-kpi {
        border: 1px solid #d8e2f0 !important;
        background: #ffffff !important;
        padding: 2.5mm !important;
    }

    .print-chart-card .active-hours-strip,
    .line-chart-card .active-hours-strip {
        display: grid !important;
        grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
        gap: 2mm !important;
        margin: 4mm 0 !important;
    }

    .print-chart-card .active-hour-item,
    .line-chart-card .active-hour-item {
        border: 1px solid #d8e2f0 !important;
        background: #ffffff !important;
        min-height: auto !important;
        padding: 2mm 1.5mm !important;
    }

    .print-chart-card .chart-legend,
    .line-chart-card .chart-legend {
        gap: 2mm 4mm !important;
        margin: 3mm 0 4mm !important;
        padding: 0 !important;
    }

    .print-chart-card .legend-item,
    .line-chart-card .legend-item {
        font-size: 8pt !important;
    }

    .print-chart-card .line-chart-wrap,
    .line-chart-card .line-chart-wrap {
        padding: 0 !important;
        overflow: visible !important;
        background: #ffffff !important;
    }

    .print-chart-card .line-chart-svg,
    .line-chart-card .line-chart-svg {
        width: 100% !important;
        height: auto !important;
        max-height: 110mm !important;
    }

    .print-chart-card .chart-tooltip,
    .line-chart-card .chart-tooltip {
        display: none !important;
    }

    .page-home .dashboard-summary-card .comparison-table,
    .page-home .dashboard-daily-card .comparison-table,
    .page-payments-analysis .comparison-table,
    .page-payment-anomalies-page .comparison-table,
    .page-receipts-view .comparison-table,
    .page-reports .productivity-table,
    .page-reports-pos .productivity-table,
    .page-returns-control .comparison-table,
    .page-operations-control .comparison-table,
    .page-operations-control-detail .comparison-table {
        font-size: 8pt !important;
    }

    .page-home .dashboard-daily-card th,
    .page-home .dashboard-daily-card td,
    .page-payments-analysis .daily-comparison-table th,
    .page-payments-analysis .daily-comparison-table td,
    .page-receipts-view .daily-comparison-table th,
    .page-receipts-view .daily-comparison-table td {
        padding: 1.8mm 1.6mm !important;
    }

    .page-home .dashboard-daily-card small,
    .page-payments-analysis small,
    .page-reports small,
    .page-reports-pos small,
    .page-receipts-view small {
        font-size: 7.2pt !important;
        line-height: 1.25 !important;
    }

    .page-reports .productivity-table th,
    .page-reports .productivity-table td,
    .page-reports-pos .productivity-table th,
    .page-reports-pos .productivity-table td {
        padding: 1.6mm 1.4mm !important;
        font-size: 7.8pt !important;
    }

    .page-reports .hour-cell,
    .page-reports-pos .hour-cell {
        min-width: 18mm !important;
        background-image: none !important;
        color: #173a70 !important;
    }

    .page-reports .hour-sales,
    .page-reports-pos .hour-sales {
        font-size: 7.6pt !important;
        font-weight: 700 !important;
    }

    .page-reports .hour-meta,
    .page-reports-pos .hour-meta {
        font-size: 6.8pt !important;
    }

    .page-home .legend-chip,
    .page-payments-analysis .legend-chip {
        padding: 1.5mm 2.2mm !important;
        font-size: 7.4pt !important;
    }

    .page-home .section-head h3,
    .page-payments-analysis .section-head h3,
    .page-reports .section-head h3,
    .page-reports-pos .section-head h3,
    .page-operations-control .section-head h3,
    .page-returns-control .section-head h3,
    .page-receipts-view .section-head h3,
    .page-operations-control-detail .section-head h3 {
        font-size: 12pt !important;
        color: #12386f !important;
    }

    .page-home .section-note,
    .page-payments-analysis .section-note,
    .page-reports .section-note,
    .page-reports-pos .section-note,
    .page-operations-control .section-note,
    .page-returns-control .section-note,
    .page-receipts-view .section-note,
    .page-operations-control-detail .section-note {
        color: #4f6f9f !important;
        font-size: 7.4pt !important;
    }
}

.print-report {
    display: none;
}

.print-report-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.print-report-section {
    margin: 0 0 18px;
}

.print-report-section h3,
.print-report-section h4 {
    margin: 0 0 8px;
    color: #163d77;
}

.print-report-note {
    margin: 0;
    color: #173a70;
}

.print-report-table {
    width: 100%;
    border-collapse: collapse;
}

.print-report-table th,
.print-report-table td {
    border: 1px solid #d8e2f0;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.print-report-table th {
    background: #eef4fb;
    color: #163d77;
    font-weight: 700;
}

.page-home-mobile .content {
    padding: 18px 16px 28px;
}

.page-home-mobile .app-shell {
    grid-template-columns: 1fr;
}

.page-home-mobile .content-shell {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-home-mobile .mobile-hero {
    padding: 20px 18px;
    border-radius: 20px;
}

.page-home-mobile .footer {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 14px 16px 18px;
    margin-top: auto;
    font-size: 0.84rem;
    line-height: 1.35;
}

.page-home-mobile .mobile-quick-range {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.page-home-mobile .quick-range-btn {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f4f8fd;
}

.filter-field-checkbox {
    display: flex;
    align-items: end;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    font-weight: 600;
    color: #173a70;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2f80ed;
}

.page-home-mobile .mobile-filters-card {
    padding: 16px;
}

.page-home-mobile .mobile-filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.page-home-mobile .mobile-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.page-home-mobile .mobile-kpi-card {
    min-height: 0;
    padding: 16px;
    border-radius: 18px;
}

.page-home-mobile .mobile-kpi-card strong {
    font-size: 1.55rem;
}

.page-home-mobile .mobile-kpi-card small {
    color: #5f7ca8;
    font-size: 0.78rem;
}

.page-home-mobile .mobile-panels {
    display: grid;
    gap: 14px;
}

.page-home-mobile .mobile-panel {
    padding: 16px;
    border-radius: 20px;
}

.page-home-mobile .mobile-ranking {
    display: grid;
    gap: 10px;
}

.page-home-mobile .mobile-ranking.compact {
    gap: 8px;
}

.page-home-mobile .mobile-ranking-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e3edf8;
}

.page-home-mobile .mobile-ranking-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.page-home-mobile .mobile-ranking-row strong {
    display: block;
}

.page-home-mobile .mobile-ranking-row small {
    display: block;
    margin-top: 4px;
    color: #6883ab;
    line-height: 1.35;
}

.page-home-mobile .mobile-ranking-metrics {
    text-align: right;
    white-space: nowrap;
}

.page-home-mobile .mobile-ranking-alert strong:first-child,
.page-home-mobile .mobile-ranking-alert .delta {
    color: #cc3e58;
}

.page-home-mobile .mobile-ranking-positive .delta {
    color: #0f8e58;
}

.page-home-mobile .mobile-highlight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.page-home-mobile .mobile-highlight-card {
    padding: 14px;
    border: 1px solid #dce8f6;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.page-home-mobile .mobile-highlight-card strong {
    display: block;
    margin: 6px 0;
}

@media (max-width: 920px) {
    .page-home-mobile .app-shell {
        grid-template-columns: 1fr;
    }

    .page-home-mobile .content-shell {
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .page-home-mobile .content {
        padding: 14px 12px 24px;
    }

    .page-home-mobile .mobile-filters-grid,
    .page-home-mobile .mobile-kpis,
    .page-home-mobile .mobile-highlight-grid {
        grid-template-columns: 1fr;
    }

    .page-home-mobile .mobile-kpi-card strong {
        font-size: 1.45rem;
    }

    .page-home-mobile .mobile-ranking-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-home-mobile .mobile-ranking-metrics {
        text-align: left;
        white-space: normal;
    }
}

.print-report-table.compact th,
.print-report-table.compact td {
    padding: 6px 8px;
}

@media print {
    html,
    body,
    .app-shell,
    .content-shell,
    .content {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .screen-only {
        display: none !important;
    }

    .print-report {
        display: block !important;
    }

    .print-report-columns {
        grid-template-columns: 1fr !important;
        gap: 4mm !important;
    }

    .print-report-section {
        margin: 0 0 5mm !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-break-section {
        break-before: page;
        page-break-before: always;
    }

    .print-report-section h3 {
        font-size: 12pt !important;
        margin-bottom: 2.5mm !important;
    }

    .print-report-section h4 {
        font-size: 9pt !important;
        margin-bottom: 2mm !important;
    }

    .print-report-table {
        width: 100% !important;
        border-collapse: collapse !important;
        table-layout: auto !important;
        font-size: 7.8pt !important;
    }

    .print-report-table thead {
        display: table-header-group !important;
    }

    .print-report-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-report-table th,
    .print-report-table td {
        border: 1px solid #ccd8ea !important;
        padding: 1.6mm 1.8mm !important;
        background: #ffffff !important;
        color: #173a70 !important;
        line-height: 1.25 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
    }

    .print-report-table th {
        background: #eef4fb !important;
        font-weight: 800 !important;
    }

.print-report-table.compact {
    font-size: 6.8pt !important;
}

    .print-report-table.dense {
        font-size: 6.2pt !important;
    }

    .print-report-table.dense th,
    .print-report-table.dense td {
        padding: 1.2mm 1.3mm !important;
        line-height: 1.18 !important;
    }

    .page-home .print-report-table.compact th:first-child,
    .page-home .print-report-table.compact td:first-child {
        min-width: 42mm !important;
    }

    .page-home .print-report-table.compact th:not(:first-child),
    .page-home .print-report-table.compact td:not(:first-child) {
        min-width: 18mm !important;
    }
}
