/* Nakładka interfejsu; bez zmian danych i bez zmian publicznych stron firm. */
.content-shell, .main-content, .panel, .order-summary { min-width: 0; }
.main-content { overflow-anchor: none; }
.main-content img { max-width: 100%; }
.sidebar-close { display: none; }
.live-refresh-status {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
    gap: .35rem .8rem; min-height: 2.75rem; padding: .4rem clamp(1rem, 3vw, 2.5rem);
    color: var(--muted); font-size: .78rem; background: var(--paper, #f4f1ea);
}
.live-refresh-status button, .live-refresh-status a {
    border: 0; background: transparent; color: var(--green-700, #245b48);
    font: inherit; text-decoration: underline; cursor: pointer; padding: .3rem;
}
.live-refresh-status [hidden] { display: none; }
.order-material-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.order-material-card { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; }
.order-material-card > header { display: flex; align-items: center; gap: 1rem; }
.order-material-card > header > div { min-width: 0; overflow-wrap: anywhere; }
.order-material-card h3 { margin: .3rem 0; font-size: 1.05rem; }
.order-material-card > header > img, .order-material-image-link {
    display: block; flex: 0 0 100px; width: 100px; height: 125px; border-radius: 10px;
    background: #f3eee5; overflow: hidden;
}
.order-material-card > header img { width: 100%; height: 100%; object-fit: contain; }
.order-material-card > header > img { width: 100px; height: 125px; }
.order-material-card ul { list-style: none; padding: 0; margin: 1rem 0 0; }
.order-material-card li { display: flex; flex-wrap: wrap; gap: .3rem 1rem; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.order-material-card li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.order-material-card li > strong { white-space: nowrap; }
.order-material-card li > small { width: 100%; color: var(--muted); }

@media screen and (max-width: 860px) {
    html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body { margin: 0; }
    .app-shell { display: block; width: 100%; }
    .content-shell { width: 100%; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100dvh;
        overflow-y: auto; overscroll-behavior: contain; padding-bottom: max(1rem, env(safe-area-inset-bottom));
        z-index: 60;
    }
    body.menu-open { overflow: hidden; }
    body.menu-open::after { z-index: 50; }
    .main-nav .nav-link { min-height: 44px; display: flex; align-items: center; }
    .main-nav .nav-link-stacked { flex-direction: column; align-items: flex-start; }
    .topbar { padding: .65rem 1rem; min-height: 76px; gap: .7rem; }
    .topbar > div:not(.topbar-actions) { min-width: 0; flex: 1; }
    .topbar h1 { font-size: clamp(1.15rem, 5vw, 1.6rem); overflow-wrap: anywhere; }
    .topbar .eyebrow { font-size: .62rem; letter-spacing: .04em; }
    .menu-button { display: inline-flex; flex: 0 0 auto; width: auto; min-width: 78px; height: 44px; }
    .topbar-actions { gap: .2rem; }
    .topbar-actions .button { min-height: 44px; padding: .55rem .65rem; font-size: .78rem; }
    .main-content { padding: .8rem .85rem 2rem; width: 100%; }
    .main-content > * { min-width: 0; max-width: 100%; }
    .panel, .order-summary { padding: 1rem; border-radius: 16px; }
    .panel-heading { align-items: flex-start; gap: .7rem; flex-wrap: wrap; }
    .panel-heading h2, .order-detail-items .panel-heading h2 { font-size: 1.35rem; line-height: 1.2; }
    .hero-panel { padding: 1.25rem; min-height: 0; gap: 1rem; border-radius: 16px; flex-direction: column; align-items: flex-start; }
    .hero-panel h2 { font-size: clamp(1.5rem, 6vw, 2rem); }
    .hero-panel p { font-size: .9rem; }
    .stats-grid { gap: .7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card { padding: 1rem; border-radius: 14px; min-width: 0; }
    .stat-card > span { font-size: .78rem; }
    .stat-card > strong { font-size: clamp(1.35rem, 5.2vw, 1.85rem); overflow-wrap: anywhere; }
    .stat-card > small { font-size: .74rem; }
    .live-refresh-status { justify-content: space-between; padding: .4rem 1rem; min-height: 3.75rem; gap: .2rem .5rem; font-size: .72rem; }
    .live-refresh-status button, .live-refresh-status a { min-height: 36px; }
    .button, button, input, select { min-height: 44px; }
    input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; max-width: 100%; }
    input[type=checkbox], input[type=radio] { min-height: 20px; }
    .filters { flex-wrap: wrap; }
    .filters > *, .month-picker > * { max-width: 100%; min-width: 0; }
    .order-actions { flex-direction: column; align-items: stretch; gap: .65rem; }
    .order-actions > *, .order-actions .button { width: 100%; white-space: normal; text-align: center; }
    .details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-wide { grid-column: 1 / -1; }
    .detail-card { min-width: 0; overflow-wrap: anywhere; }
    .table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
    .mobile-orders-table, .mobile-orders-table tbody { display: block; width: 100%; }
    .mobile-orders-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .mobile-orders-table tbody { display: grid; gap: .85rem; }
    .mobile-orders-table tbody tr {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        border: 1px solid var(--line); border-radius: 12px; padding: .6rem; background: #fffdf9;
    }
    .mobile-orders-table tbody td {
        display: block; min-width: 0; max-width: none; padding: .55rem; border: 0;
        white-space: normal; overflow: visible; text-align: left; overflow-wrap: anywhere;
    }
    .mobile-orders-table tbody td:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); font-size: 1rem; }
    .mobile-orders-table tbody td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
    .mobile-orders-table .strong-link { display: inline-block; padding: .25rem 0; }
    .mobile-orders-table .truncate { max-width: none; }
    .mobile-orders-table .status { max-width: 100%; white-space: normal; }
    .order-items-detail-table tbody td { padding: .65rem .4rem; }
    .order-items-detail-table .item-type-description small { font-size: .9rem; }
    .order-website-product-image { float: none; display: block; width: min(100%, 280px); height: 260px; object-fit: contain; margin: .6rem auto 1rem; }
    .order-material-cards { grid-template-columns: 1fr; }
    .order-material-card { padding: .85rem; }
    .order-material-card > header { align-items: center; gap: .8rem; }
    .order-history-list { min-width: 0; }
    .order-history-item { grid-template-columns: 1fr; gap: .25rem; }
    .order-history-description { overflow-wrap: anywhere; }
}
@media screen and (max-width: 360px) {
    .main-content { padding-inline: .6rem; }
    .panel, .order-summary { padding: .8rem; }
    .stat-card { padding: .75rem; }
    .topbar { padding-inline: .6rem; }
}
/* Drawer also covers tablets and touch devices reporting a desktop-sized viewport. */
@media screen and (max-width: 1100px), screen and (hover: none) and (pointer: coarse) {
    .app-shell { display: block; width: 100%; }
    .content-shell { width: 100%; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(88vw, 680px);
        height: 100vh; height: 100dvh; z-index: 60;
        overflow-y: auto; overscroll-behavior: contain;
        padding: clamp(16px, 2.5vw, 28px); font-size: clamp(18px, 2.85vw, 28px);
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        transform: translateX(-105%); visibility: hidden;
        box-shadow: 20px 0 60px rgba(0, 0, 0, .25);
        transition: transform .2s ease, visibility .2s;
    }
    body.menu-open .sidebar { transform: translateX(0); visibility: visible; }
    body.menu-open { overflow: hidden; }
    body.menu-open::after {
        content: ""; position: fixed; inset: 0; z-index: 50;
        background: rgba(5, 17, 14, .42);
    }
    .menu-button {
        display: inline-flex; align-items: center; justify-content: center; gap: .65rem;
        flex: 0 0 auto; width: auto; min-width: clamp(132px, 20vw, 196px);
        height: clamp(64px, 10vw, 96px); padding: .75rem 1rem;
        color: #fff; background: var(--green-950); border: 2px solid var(--green-950);
        border-radius: 12px; font: inherit; font-size: clamp(20px, 3vw, 30px); font-weight: 800;
    }
    .menu-button > span { font-size: 1.4em; line-height: 1; }
    .sidebar-close {
        display: flex; align-items: center; justify-content: center; gap: .6rem;
        position: sticky; top: 0; z-index: 1; flex-shrink: 0;
        width: 100%; min-height: 3em; margin-bottom: 1rem;
        color: #fff; background: var(--green-950);
        border: 1px solid rgba(255, 255, 255, .3); border-radius: 10px;
        font: inherit; font-weight: 700; cursor: pointer;
    }
    .sidebar .brand { flex-shrink: 0; font-size: .85em; }
    .sidebar .brand-mark { width: 2em; height: 2em; flex-basis: 2em; font-size: 1.2em; }
    .sidebar .brand small { font-size: .8em; }
    .sidebar .main-nav { gap: .3em; }
    .sidebar .nav-link {
        display: flex; align-items: center; min-height: 3em;
        padding: .65em .75em; font-size: 1em; line-height: 1.3; color: #fff;
    }
    .sidebar .nav-link-stacked { flex-direction: column; align-items: flex-start; }
    .sidebar .nav-sub-link { padding-left: 1.2em; font-size: .9em; color: #f3d7a7; }
    .sidebar .nav-link-stacked small { font-size: .75em; color: rgba(255, 255, 255, .8); }
    .sidebar .nav-caption { font-size: .7em; color: rgba(255, 255, 255, .75); }
    .sidebar .sidebar-user { font-size: .8em; }
    .sidebar .sidebar-user strong, .sidebar .sidebar-account-link,
    .sidebar .install-app-button, .sidebar .link-button { font-size: inherit; }
    .sidebar .sidebar-user small { font-size: .85em; }
    .topbar-action { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
}
@media print {
    .sidebar-close, .menu-button { display: none !important; }
    .live-refresh-status { display: none !important; }
    .order-material-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-material-card { break-inside: avoid; }
}
