﻿:root {
    --green: #285A42;
    --beige: #F2EAD7;
    --beige-hover: #E8DAC0;
    --icon-beige: #EAD6A7;
    --ink: #151515;
    --border: rgba(40, 90, 66, .7);
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

html,
body {
    margin: 0;
    height: 100%;
    overflow: hidden;
}

.app-shell {
    min-height: 100vh;
    background: #fff;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100dvh;
    z-index: 100;
    background: var(--beige);
    border-right: 1px solid #ddd3bc;
    display: flex;
    flex-direction: column;
    padding: clamp(8px, 1.4vh, 18px) 14px;
    box-sizing: border-box;
    overflow: hidden;
}

/* LOGO */
.sb-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 0 clamp(8px, 2.4vh, 34px);
    flex: 0 0 auto;
    text-decoration: none;
}

    .sb-logo img {
        width: auto;
        max-width: calc(var(--sidebar-width) - 28px);
        height: clamp(26px, 4.6vh, 50px);
        display: block;
        object-fit: contain;
    }

/* NAV — skaluje pozycje, żeby zawsze zmieściły się bez przewijania */
.sb-nav {
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.7vh, 10px);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding-right: 4px;
}

    .sb-nav::-webkit-scrollbar {
        width: 6px;
    }

    .sb-nav::-webkit-scrollbar-thumb {
        background: rgba(46, 97, 73, .25);
        border-radius: 999px;
    }

    .sb-nav::-webkit-scrollbar-track {
        background: transparent;
    }

.sb-bottom {
    margin-top: clamp(6px, 1vh, 12px);
    padding-top: clamp(6px, 1vh, 12px);
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.7vh, 8px);
}

/* Dyskretne linki prawne na dole menu */
.sb-legal {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: clamp(4px, 0.8vh, 10px);
    padding: clamp(6px, 1vh, 10px) 12px 2px;
    border-top: 1px solid rgba(46, 97, 73, .12);
}

.sb-legal a {
    font-size: clamp(10px, 1.4vh, 11.5px);
    line-height: 1.35;
    color: #9aa39c;
    text-decoration: none;
}

.sb-legal a:hover {
    color: #285A42;
    text-decoration: underline;
}

/* BUTTON */
.sb-item {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.2vh, 12px);
    width: 100%;
    flex: 0 0 auto;
    min-height: 0;
    height: clamp(28px, 4.6vh, 42px);
    max-height: 42px;
    padding: 0 14px;
    box-sizing: border-box;
    border-radius: 999px;
    border: 1px solid #151515;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    font-size: clamp(12.5px, 1.5vh, 16px);
    font-weight: 700;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

    .sb-item:hover {
        background: var(--beige-hover);
    }

    .sb-item.active {
        background: var(--green);
        border-color: var(--green);
        color: #fff;
    }

        .sb-item.active .sb-label {
            color: #fff;
        }

/* Wszystkie pozycje (górne i dolne) skalują się jednakowo i wypełniają menu,
   więc całość zawsze mieści się bez przewijania. Spacer dociska dolną grupę
   do dołu na wysokim ekranie, a na niskim niemal znika. */
.sb-nav .sb-item {
    flex: 8 1 0;
    height: auto;
    max-height: 42px;
    min-height: 0;
}

.sb-spacer {
    flex: 1 1 0;
    min-height: 0;
}

.sb-divider {
    flex: 0 0 auto;
    height: 1px;
    background: rgba(46, 97, 73, .14);
    margin: clamp(3px, 0.7vh, 8px) 6px;
}

/* ICON */
.sb-ico-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(22px, 3.2vh, 32px);
    height: clamp(22px, 3.2vh, 32px);
    min-width: clamp(22px, 3.2vh, 32px);
    flex: 0 0 auto;
}

.sb-ico {
    width: 100%;
    height: 100%;
    min-width: 0;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.sb-ico-svg {
    width: clamp(18px, 2.7vh, 22px);
    height: auto;
}

.sb-ico-text {
    width: clamp(20px, 3vh, 28px);
    height: clamp(20px, 3vh, 28px);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: clamp(12px, 1.7vh, 16px);
    border: 2px solid currentColor;
    line-height: 1;
}

.sb-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* TOPBAR */
.topbar {
    position: fixed !important;
    top: 0 !important;
    left: var(--sidebar-width) !important;
    right: 0 !important;
    height: var(--topbar-height) !important;
    z-index: 90 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0 28px !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, .92) !important;
    backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid #ece7da !important;
}

.topbar-right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
}

/* TOPBAR USER AREA */
.top-user {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    height: 58px !important;
    padding: 6px 8px 6px 12px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(46, 97, 73, .22) !important;
    background: #F2EAD7 !important;
    box-shadow: 0 8px 24px rgba(46, 97, 73, .10) !important;
}

.top-user-avatar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: 999px !important;
    background: var(--green) !important;
    color: var(--icon-beige) !important;
    font-size: 19px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

.top-user-text {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-width: 0 !important;
    max-width: 280px !important;
    line-height: 1.1 !important;
}

.top-user-label {
    color: #8a8374 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}

.top-user-name {
    color: var(--green) !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.top-logout {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 20px !important;
    border-radius: 999px !important;
    border: 1px solid var(--green) !important;
    background: var(--green) !important;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease !important;
}

    .top-logout:hover {
        background: #244d3a !important;
        color: #fff !important;
        transform: translateY(-1px) !important;
        box-shadow: 0 8px 18px rgba(46, 97, 73, .18) !important;
    }

/* MAIN */
.main {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 26px 28px 48px;
    box-sizing: border-box;
    background: #fff;
}

/* PILLS */
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--green);
    color: var(--green);
    text-decoration: none;
    font-weight: 700;
}

.pill-primary {
    background: var(--green);
    color: #fff;
}

/* RESPONSIVE SIDEBAR */
@media (max-width: 1500px) {
    :root {
        --sidebar-width: 240px;
    }

    .sidebar {
        padding: 16px 12px;
    }

    .sb-logo {
        padding-bottom: 28px;
    }

    .sb-nav {
        gap: 10px;
    }

    .sb-item {
        min-height: 46px;
        padding: 0 14px;
        gap: 12px;
        font-size: 16px;
    }

    .sb-ico-wrap,
    .sb-ico {
        width: 30px;
        height: 30px;
        min-width: 30px;
        max-width: 30px;
    }
}

@media (max-width: 1280px) {
    :root {
        --sidebar-width: 220px;
    }

    .sidebar {
        padding: 14px 10px;
    }

    .sb-logo {
        padding-bottom: 22px;
    }

    .sb-nav {
        gap: 8px;
    }

    .sb-item {
        padding: 0 12px;
    }
}

/* Skalowanie wg wysokości okna obsługuje teraz clamp() na .sb-item/.sb-ico/.sb-nav —
   dawne media query (max-height 820/720) były zbędne i blokowały zwężanie. */

/* MOBILE */
@media (max-width: 980px) {
    :root {
        --sidebar-width: 86px;
        --topbar-height: 64px;
    }

    .sidebar {
        padding: 18px 10px;
    }

    .sb-logo {
        padding: 2px 0 24px;
    }

        .sb-logo img {
            width: 58px;
        }

    .sb-item {
        justify-content: center;
        padding: 0;
        min-height: 0;
        height: clamp(36px, 4.6vh, 48px);
        max-height: 48px;
    }

    .sb-label {
        display: none;
    }

    .topbar {
        padding: 0 14px !important;
    }

    .top-user-text {
        display: none !important;
    }

    .top-user {
        height: 46px !important;
        gap: 8px !important;
        padding: 4px 5px !important;
    }

    .top-user-avatar {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 15px !important;
    }

    .top-logout {
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 14px !important;
        font-size: 13px !important;
    }
}

/* ===== Toasts ===== */
.toast-host {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: max-content;
    max-width: min(560px, calc(100vw - 32px));
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 320px;
    max-width: 100%;
    padding: 15px 18px;
    border-radius: 14px;
    color: #fff;
    background: var(--green, #285A42);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .26);
    animation: toast-in .2s cubic-bezier(.2,.9,.3,1.2);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-14px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-ico {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    background: rgba(255, 255, 255, .22);
}

.toast-body { flex: 1 1 auto; min-width: 0; }
.toast-title { font-weight: 800; font-size: 15.5px; margin-bottom: 2px; }
.toast-text { font-size: 15px; line-height: 1.4; word-wrap: break-word; }

.toast-close {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .8);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.toast-close:hover { color: #fff; }

.toast-success { background: #285A42; }
.toast-error   { background: #C0392B; }
.toast-warning { background: #B8780A; }
.toast-info    { background: #2D6CDF; }

@media (max-width: 560px) {
    .toast-host { left: 16px; right: 16px; transform: none; top: 16px; width: auto; max-width: none; align-items: stretch; }
    .toast-item { min-width: 0; }
}

/* ===== Dialog input ===== */
.dialog-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(46, 97, 73, .35);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
}
.dialog-input:focus {
    border-color: var(--green, #285A42);
    box-shadow: 0 0 0 3px rgba(46, 97, 73, .12);
}

/* ===== App dialog (confirm / prompt / alert) ===== */
.app-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 32, 26, .42);
    backdrop-filter: blur(3px);
    animation: app-dialog-fade .15s ease-out;
}

.app-dialog {
    background: #fff;
    border-radius: 22px;
    width: 100%;
    max-width: 440px;
    padding: 28px 26px 22px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(20, 32, 26, .28);
    animation: app-dialog-pop .18s cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes app-dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes app-dialog-pop {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.app-dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    background: rgba(46, 97, 73, .12);
    color: var(--green, #285A42);
}
.app-dialog.is-danger .app-dialog-icon {
    background: rgba(192, 57, 43, .12);
    color: #C0392B;
}

.app-dialog-title {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 800;
    color: var(--ink, #151515);
}

.app-dialog-message {
    margin: 0 0 18px;
    font-size: 14.5px;
    line-height: 1.45;
    color: rgba(31, 31, 31, .68);
}

.app-dialog-input {
    width: 100%;
    padding: 11px 13px;
    margin: 2px 0 20px;
    border: 1px solid rgba(46, 97, 73, .35);
    border-radius: 12px;
    font-size: 14.5px;
    outline: none;
    box-sizing: border-box;
}
.app-dialog-input:focus {
    border-color: var(--green, #285A42);
    box-shadow: 0 0 0 3px rgba(46, 97, 73, .14);
}

.app-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.app-dialog-btn {
    flex: 1 1 0;
    max-width: 180px;
    padding: 11px 18px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: filter .12s ease, background .12s ease, transform .05s ease;
}
.app-dialog-btn:active { transform: translateY(1px); }

.app-dialog-btn.ghost {
    background: #fff;
    border-color: rgba(46, 97, 73, .35);
    color: var(--ink, #151515);
}
.app-dialog-btn.ghost:hover { background: #f4f8f6; }

.app-dialog-btn.primary {
    background: var(--green, #285A42);
    color: #fff;
}
.app-dialog-btn.primary:hover { filter: brightness(.95); }

.app-dialog-btn.danger {
    background: #C0392B;
    color: #fff;
}
.app-dialog-btn.danger:hover { filter: brightness(.95); }

@media (max-width: 480px) {
    .app-dialog { padding: 24px 18px 18px; border-radius: 18px; }
    .app-dialog-actions { flex-direction: column-reverse; }
    .app-dialog-btn { max-width: none; }
}

/* ===== Stock: historia ruchów ===== */
.stock-batch-toolbar { display: flex; justify-content: flex-end; gap: 10px; padding: 8px 4px 14px; }

.stock-history {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 760px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(20, 32, 26, .28);
    animation: app-dialog-pop .18s cubic-bezier(.2,.9,.3,1.2);
    overflow: hidden;
}
.stock-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 22px 14px;
    border-bottom: 1px solid rgba(46, 97, 73, .12);
}
.stock-history-head h3 { margin: 2px 0 0; font-size: 18px; font-weight: 800; }
.stock-history-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: rgba(46,97,73,.7); }
.stock-history-close { border: none; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: rgba(31,31,31,.45); }
.stock-history-close:hover { color: rgba(31,31,31,.8); }
.stock-history-body { padding: 8px 22px 20px; overflow-y: auto; }
.stock-history-table { width: 100%; }
.stock-history-table td { vertical-align: middle; }

.mv-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
}
.mv-badge.mv-in { background: rgba(46,97,73,.12); color: #285A42; }
.mv-badge.mv-out { background: rgba(192,57,43,.10); color: #C0392B; }

.mv-qty { font-weight: 700; white-space: nowrap; }
.mv-qty.mv-in { color: #285A42; }
.mv-qty.mv-out { color: #C0392B; }
.mv-ref { color: rgba(31,31,31,.65); }

@media (max-width: 560px) {
    .stock-history { max-width: none; }
}

/* ===== Stock: korekta / spis ===== */
.stock-adjust-form { text-align: left; display: flex; flex-direction: column; gap: 16px; margin: 6px 0 4px; }
.stock-count-input { max-width: 130px; }

.adjust-seg { display: flex; gap: 10px; }
.adjust-seg-btn {
    flex: 1;
    padding: 12px 10px;
    border-radius: 14px;
    border: 1.5px solid rgba(46, 97, 73, .18);
    background: #fff;
    font-weight: 700;
    font-size: 14.5px;
    color: rgba(31, 31, 31, .55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: border-color .12s, background .12s, color .12s, transform .05s;
}
.adjust-seg-btn:active { transform: translateY(1px); }
.adjust-seg-sign { font-size: 18px; line-height: 1; }
.adjust-seg-btn.out.active { border-color: #C0392B; background: rgba(192, 57, 43, .08); color: #C0392B; }
.adjust-seg-btn.in.active  { border-color: #285A42; background: rgba(46, 97, 73, .08); color: #285A42; }

.adjust-field { display: flex; flex-direction: column; gap: 6px; }
.adjust-field > label { font-size: 13px; font-weight: 600; color: rgba(31, 31, 31, .72); }
.adjust-opt { font-weight: 400; color: rgba(31, 31, 31, .42); }

/* pole liczbowe + jednostka jako etykieta OBOK (proste i pewne) */
.adjust-qty, .stocktake-count {
    display: flex;
    align-items: center;
    gap: 8px;
}
.adjust-qty .app-dialog-input,
.stocktake-count .app-dialog-input {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
}
.adjust-unit {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
    color: rgba(46, 97, 73, .7);
    min-width: 24px;
}

/* czyste pola liczbowe — bez strzałek spinnera */
.app-dialog-input[type="number"]::-webkit-outer-spin-button,
.app-dialog-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.app-dialog-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ===== Spis z natury (premium) ===== */
.stocktake-modal { max-width: 640px; }

.stocktake-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 22px;
    border-bottom: 1px solid rgba(46, 97, 73, .10);
}
.stocktake-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid rgba(46, 97, 73, .25);
    border-radius: 12px;
    background: #fff;
}
.stocktake-search input { border: none; outline: none; width: 100%; font-size: 14px; background: transparent; }
.stocktake-diffcount {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(31, 31, 31, .06);
    color: rgba(31, 31, 31, .5);
    white-space: nowrap;
}
.stocktake-diffcount.active { background: rgba(217, 164, 6, .14); color: #8a6d1a; }

.stocktake-body { flex: 1 1 auto; min-height: 0; }
.stocktake-list { display: flex; flex-direction: column; }

.stocktake-row {
    display: grid;
    grid-template-columns: 1fr 160px 90px;
    align-items: center;
    gap: 12px;
    padding: 11px 6px;
    border-bottom: 1px solid rgba(46, 97, 73, .08);
    border-radius: 10px;
}
.stocktake-row.changed { background: rgba(217, 164, 6, .07); }
.stocktake-row:not(.stocktake-row-head):hover { background: rgba(46, 97, 73, .04); }
.stocktake-row-head {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: rgba(31, 31, 31, .45);
    border-bottom: 1.5px solid rgba(46, 97, 73, .14);
}
.stocktake-row-head .stocktake-diff-col { text-align: right; }

.stocktake-name { font-weight: 700; font-size: 14.5px; }
.stocktake-theo { font-size: 12.5px; color: rgba(31, 31, 31, .5); margin-top: 2px; }

.stocktake-row.changed .stocktake-count .app-dialog-input {
    border-color: rgba(217, 164, 6, .7);
    box-shadow: 0 0 0 2px rgba(217, 164, 6, .15);
}

.stocktake-diff { text-align: right; font-weight: 800; font-size: 14.5px; }
.stocktake-diff.zero { color: rgba(31, 31, 31, .3); }
.stocktake-diff.pos { color: #285A42; }
.stocktake-diff.neg { color: #C0392B; }

.stocktake-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid rgba(46, 97, 73, .10);
    background: #fff;
}

@media (max-width: 560px) {
    .stocktake-row { grid-template-columns: 1fr 110px 70px; gap: 8px; }
    .stocktake-toolbar { flex-wrap: wrap; }
}

/* ===== Stock: kafelek wartości magazynu ===== */
.stock-kpi-value-main {
    border: 1px solid rgba(46, 97, 73, .25);
    background: linear-gradient(180deg, rgba(46, 97, 73, .06), rgba(46, 97, 73, .02));
}
.stock-kpi-value-main .stock-kpi-value { color: #285A42; }

/* ===== Stock: FEFO + sortowanie ===== */
.stock-sort { display: flex; align-items: center; gap: 8px; }
.stock-sort > label { font-size: 13px; font-weight: 600; color: rgba(31, 31, 31, .6); white-space: nowrap; }
.stock-sort .clients-select { min-width: 180px; }

.fefo-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    background: rgba(46, 97, 73, .12);
    color: #285A42;
    vertical-align: middle;
    white-space: nowrap;
}
.stock-row-next td { background: rgba(46, 97, 73, .045); }

/* ===== Stock: stan ujemny ===== */
.stock-neg { color: #C0392B; }

/* ===== Import sprzedaży (kreator) ===== */
.import-card { margin-bottom: 18px; }
.import-card h3 { margin: 0 0 6px; }
.import-muted { color: rgba(31,31,31,.6); font-size: 14px; margin: 0 0 14px; }
.import-ok { margin-top: 14px; color: #285A42; font-weight: 600; }
.import-warn { color: #C0392B; font-weight: 700; }

.import-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.import-grid .input label { display:block; font-size:13px; font-weight:600; margin-bottom:5px; color:rgba(31,31,31,.72); }

.import-preview-wrap { overflow-x: auto; border: 1px solid rgba(46,97,73,.12); border-radius: 12px; }
.import-preview { width: 100%; font-size: 13.5px; }
.import-col-on { background: rgba(46,97,73,.07); }
th.import-col-on { color: #285A42; }

/* ===== Import: nowy produkt w modalu receptury ===== */
.import-newprod {
    margin-top: 16px;
    padding: 14px;
    border: 1px dashed rgba(46, 97, 73, .3);
    border-radius: 12px;
    background: rgba(46, 97, 73, .03);
}
.import-newprod-label { font-size: 13px; font-weight: 600; color: rgba(31,31,31,.7); margin-bottom: 8px; }
.import-newprod-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.import-newprod-row .app-dialog-input { flex: 1 1 200px; }
.import-newprod-row .clients-select { flex: 0 0 180px; }

/* ===== Import: większe okno tworzenia receptury ===== */
.import-recipe-modal {
    max-width: 1000px;
    max-height: 92vh;
}

/* tabela składników w oknie tworzenia receptury */
.import-recipe-modal .clients-table { width: 100%; }
.import-recipe-modal .clients-table th,
.import-recipe-modal .clients-table td { padding: 6px 8px; vertical-align: middle; }

/* JEDNOLITY wygląd wszystkich kontrolek w oknie (te same ramki/kolory/wysokość) */
.import-recipe-modal .clients-table select,
.import-recipe-modal .clients-table input,
.import-recipe-modal .import-newprod input,
.import-recipe-modal .import-newprod select {
    height: 42px;
    margin: 0;
    border: 1px solid rgba(46, 97, 73, .35);
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    box-sizing: border-box;
}
.import-recipe-modal .clients-table select:focus,
.import-recipe-modal .clients-table input:focus,
.import-recipe-modal .import-newprod input:focus,
.import-recipe-modal .import-newprod select:focus {
    border-color: var(--green, #285A42);
    box-shadow: 0 0 0 3px rgba(46, 97, 73, .12);
    outline: none;
}

/* szerokości kolumn: Produkt rozciągnięty, Ilość/Jedn. wąskie */
.import-recipe-modal .clients-table td:nth-child(1) select { width: 100%; }
.import-recipe-modal .clients-table th:nth-child(2),
.import-recipe-modal .clients-table td:nth-child(2) { width: 120px; }
.import-recipe-modal .clients-table th:nth-child(3),
.import-recipe-modal .clients-table td:nth-child(3) { width: 110px; }
.import-recipe-modal .clients-table th:last-child,
.import-recipe-modal .clients-table td:last-child { width: 52px; }
.import-recipe-modal .clients-table td:nth-child(2) input,
.import-recipe-modal .clients-table td:nth-child(3) select { width: 100%; text-align: center; }

/* ===== Import: pasek szablonów ===== */
.import-templates {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px dashed rgba(46, 97, 73, .3);
    border-radius: 12px;
    background: rgba(46, 97, 73, .03);
}
.import-templates > label { font-size: 13px; font-weight: 700; color: rgba(31,31,31,.7); white-space: nowrap; }
.import-templates .clients-select { min-width: 220px; }

/* ===== Dashboard: insighty kosztowe ===== */
.cost-insights-card { margin-bottom: 18px; }
.cost-insights-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.cost-insight {
    padding: 12px 14px;
    border-radius: 12px;
    border-left: 4px solid #D9A406;
    background: rgba(217, 164, 6, .07);
}
.cost-insight.danger { border-left-color: #C0392B; background: rgba(192, 57, 43, .07); }
.cost-insight-main { display: flex; flex-direction: column; gap: 2px; }
.cost-insight-title { font-weight: 800; font-size: 14.5px; }
.cost-insight-msg { font-size: 13px; color: rgba(31,31,31,.7); }
.cost-insight-affected { margin-top: 8px; font-size: 12.5px; color: rgba(46,97,73,.85); font-weight: 600; }

/* ===== Dashboard: licznik alertów w nagłówku ===== */
.dashboard-v2-alert-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 8px;
    margin-left: 6px;
    border-radius: 999px;
    background: rgba(217, 164, 6, .16);
    color: #8a6d1a;
    font-size: 14px;
    font-weight: 800;
    vertical-align: middle;
}
.dashboard-v2-alert-crit { color: #C0392B; font-weight: 700; }

/* inline-SVG ikony w sidebarze (np. nawigacja admina) */
.sb-ico-svg { color: var(--green); }
.sb-item.active .sb-ico-svg { color: #fff; }

/* ===== Blokada do potwierdzenia e-maila (A2d) ===== */
.email-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 24px;
}
.email-gate-card {
    max-width: 480px;
    width: 100%;
    text-align: center;
    background: #fff;
    border: 1px solid #ece6d8;
    border-radius: 22px;
    padding: 40px 34px;
    box-shadow: 0 1px 2px rgba(31,31,31,.04), 0 18px 44px rgba(46,97,73,.07);
}
.email-gate-icon {
    width: 68px; height: 68px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--beige);
    color: var(--green);
}
.email-gate-card h2 { margin: 0 0 12px; font-size: 22px; font-weight: 800; color: #151515; }
.email-gate-card p { margin: 0 0 10px; color: #5a605a; line-height: 1.55; }
.email-gate-hint { font-size: 13.5px; color: #9aa39c; }
.email-gate-actions {
    display: flex; flex-direction: column; gap: 10px;
    margin: 24px 0 18px;
}
.email-gate-btn {
    height: 46px; padding: 0 22px; border-radius: 999px;
    border: 1px solid #ddd3bc; background: #fff; color: #2f3a33;
    font-weight: 700; font-size: 15px; cursor: pointer;
    transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.email-gate-btn:hover { background: #f6f2e9; transform: translateY(-1px); }
.email-gate-btn.primary {
    background: var(--green); border-color: var(--green); color: #fff;
    box-shadow: 0 6px 16px rgba(46,97,73,.18);
}
.email-gate-btn.primary:hover { background: #244d3a; }
.email-gate-btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.email-gate-logout {
    display: inline-block; color: #9aa39c; font-size: 14px;
    background: none; border: none; cursor: pointer; font-weight: 600;
    text-decoration: none;
}
.email-gate-logout:hover { color: var(--green); text-decoration: underline; }

/* ===== Walidacja formularzy (globalnie) ===== */
/* Komunikat pod polem */
.validation-message {
    display: block;
    margin-top: 5px;
    color: #C0392B;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

/* Podsumowanie błędów (ValidationSummary) */
.validation-errors {
    margin: 0 0 14px;
    padding: 12px 14px 12px 40px;
    list-style: none;
    border: 1px solid rgba(192, 57, 43, .35);
    border-left: 4px solid #C0392B;
    border-radius: 12px;
    background: rgba(192, 57, 43, .07);
    position: relative;
}
.validation-errors::before {
    content: "!";
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #C0392B;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    line-height: 18px;
    text-align: center;
}
.validation-errors li {
    color: #8a241a;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
}

/* Pole oznaczone jako błędne przez Blazor (klasa .invalid na inpucie) */
.cl-input.invalid,
input.invalid,
select.invalid,
textarea.invalid,
.app-dialog-input.invalid {
    border-color: #C0392B !important;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, .12) !important;
}
