﻿/* =========================================
   BASE / RESET
========================================= */

html {
    box-sizing: border-box;
    font-family: "Calibri", sans-serif;
    font-size: 16px;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    margin: 0;
    min-height: 100vh;
    font: inherit;
    overflow-x: hidden;
    overflow-y: scroll;
}

/* =========================================
   TYPOGRAPHY
========================================= */

h1:focus {
    outline: none;
}

a,
.btn-link {
    color: #0071c1;
}

code {
    color: #c02d76;
}

/* =========================================
   CONTENT
========================================= */

.content {
    padding-top: 1rem;
}

/* =========================================
   BUTTONS
========================================= */

.btn-primary {
    color: #fff;
    background-color: #00617f;
    border-color: #00617f;
}

    .btn-primary:hover {
        background-color: #004f66;
    }

button {
    cursor: pointer;
}

/* =========================================
   FORM / VALIDATION
========================================= */

.form-control:focus,
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 105, 255, 0.25);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #28a745;
}

.invalid {
    outline: 1px solid #dc3545;
}

.validation-message {
    color: #dc3545;
}

/* =========================================
   LOADING (DISABLED CLEAN)
========================================= */

/* Poistetaan loader glitch */
.loading-progress {
    display: none;
}

/* =========================================
   TABLES
========================================= */

.table {
    width: 100%;
}

    .table th {
        background: #e8e8e8;
        font-weight: 600;
    }

    .table td,
    .table th {
        padding: 10px;
    }

    .table tr:hover {
        background-color: #f5f5f5;
    }

.table-success {
    background-color: #d4edda !important;
}

/* =========================================
   TOPBAR / NAVBAR
========================================= */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 75px;
    padding: 0 20px;
    background: #00617f;
    color: white;
}

    .topbar a {
        color: white;
        text-decoration: none;
        margin-left: 12px;
    }

        .topbar a:hover {
            text-decoration: underline;
        }

    .topbar .user {
        font-weight: 500;
    }

.mobile-menu .userm {
    font-weight: 500;
    color: #00617f;
}

.topbar .logout {
    margin-left: 20px;
    color: #ffcc00;
}

/* =========================================
   CUSTOMER LIST
========================================= */



.customer-list {
    height: 420px; /* ✅ kiinteä korkeus desktopiin */
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    width: 100%;
}



.customer-item {
    padding: 8px;
    cursor: pointer;
}

    .customer-item:hover {
        background: #f0f0f0;
    }

    .customer-item.selected {
        background: #00617f;
        color: white;
    }
/* =========================================
   MANUAL INPUT
========================================= */

.manual-toggle {
    cursor: pointer;
    color: #00617f;
}
/* =========================================
   ALERTS
========================================= */

.alert {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}
/* =========================================
   TOAST
========================================= */

.toast-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #00816d;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    z-index: 9999;
}
/* =========================================
   LAST ADDED
========================================= */

.last-added {
    background: #e9f7ef;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 10px;
}
/* =========================================
   MINI CART (COLLAPSIBLE)
========================================= */


.mini-cart {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-top: 2px solid var(--primary);
    z-index: 1000;
}


.mini-cart-header {
    padding: 14px 16px;
    background: #00617f;
    color: white;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


@media (max-width: 768px) {
    .mini-cart-header {
        padding: 16px 16px;
        font-size: 16px;
        min-height: 56px; /* ✅ touch-friendly */
    }
}


.mini-cart-body {
    padding: 10px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* =========================================
   CART ROWS
========================================= */

.cart-row {
    display: grid;
    grid-template-columns: minmax(250px, 1fr) minmax(520px, auto);
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
    overflow: visible;
}

    .cart-row:not(:last-child) {
        margin-bottom: 6px;
    }

    .cart-row:hover {
        background: #f8fafc;
    }

/* LEFT SIDE */

.cart-name {
    min-width: 0;
}

.cart-title {
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* RIGHT SIDE CONTROLS */

.cart-controls {
    display: grid;
    grid-template-columns: 160px 160px 100px 50px;
    gap: 10px;
    align-items: center;
    min-width: 520px;
}

    .cart-controls input {
        width: 100%;
    }

    .cart-controls button {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 38px;
        padding: 0;
    }

/* SMALL FIELD OVERRIDES */

.qty {
    width: 60px;
}

.discount {
    width: 80px;
}






@media (max-width: 768px) {

    .cart-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 8px;
    }

    .cart-name {
        margin-bottom: 4px;
    }

    .cart-controls {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        min-width: 0;
    }

        /* start */
        .cart-controls input:nth-child(1) {
            grid-column: 1;
        }

        /* end */
        .cart-controls input:nth-child(2) {
            grid-column: 2;
        }

        /* discount */
        .cart-controls input:nth-child(3) {
            grid-column: 1;
        }

        /* remove */
        .cart-controls button {
            grid-column: 2;
            width: 100%;
        }
}


/* =========================================
   CART HEADER
========================================= */

.cart-header-row {
    display: grid;
    grid-template-columns: minmax(250px, 1fr) auto;
    font-size: 12px;
    font-weight: 600;
    color: #6c6c6c;
    border-bottom: 1px solid #d1d1d1;
    margin-bottom: 4px;
}

.cart-label {
    width: 70px;
    text-align: center;
}



@media (max-width: 768px) {

    .mini-cart {
        max-height: 70vh;
    }
}




/* =========================================
       CART FOOTER
    ========================================= */



.cart-footer {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 10;
}



@media (max-width: 768px) {
    .cart-footer {
        display: flex;
        flex-direction: row;
        justify-content: flex-end; /* ✅ siirtää oikealle */
        gap: 8px;
    }
}


@media (max-width: 768px) {
    .cart-footer .btn {
        min-width: 140px;
    }
}


/* =========================================
   CARD COMPONENT
========================================= */

.card {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    padding: 12px;
}
/* =========================================
   BLazor error UI (kept)
========================================= */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }
/* =========================================
   APP LAYOUT
========================================= */


.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* ✅ tärkeä! */
}

/* =========================================
   HEADER (NAVBAR)
========================================= */
/* Logo / brand */
.brand {
    font-size: 18px;
    font-weight: 600;
    color: white;
    text-decoration: none;
}
/* Nav groups */
.nav-left,
.nav-right {
    display: flex;
    align-items: center;
}
    /* Nav links */
    .nav-right a {
        color: white;
        text-decoration: none;
        margin-left: var(--space-md);
        font-size: 14px;
    }

        .nav-right a:hover {
            text-decoration: underline;
        }
/* User name */
.user {
    margin-left: var(--space-md);
    font-weight: 500;
}
/* Logout */
.logout {
    margin-left: var(--space-lg);
    color: #ffcc00;
}
/* =========================================
   MAIN CONTENT
========================================= */



.main-content {
    flex: 1;
    padding-top: 10px; /* ✅ stabiloi spacing */
}

/* =========================================
   CONTAINER (CENTERED CONTENT)
========================================= */




.container {
    margin-top: 10px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
    background: rgba(255,255,255,0.92); /* 👈 uusi */
    border-radius: 10px; /* 👈 uusi */
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); /* 👈 uusi */
}
/* =========================================
   SECTION SPACING
========================================= */

section {
    margin-bottom: var(--space-xl);
}
/* =========================================
   HEADINGS POLISH
========================================= */

h3 {
    margin-bottom: var(--space-md);
}

h4 {
    margin-bottom: var(--space-sm);
}
    /* =========================================
   PAGE RHYTHM
========================================= */

    h4 + * {
        margin-top: var(--space-xs);
    }

.table + * {
    margin-top: var(--space-md);
}


:root {
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 14px;
    --space-lg: 20px;
    --space-xl: 28px;
}
/* =========================================
   CHECKOUT LAYOUT
========================================= */

.card-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}
/* ✅ key-value summary */
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    border-bottom: 1px solid #eee;
}

    .summary-row:last-child {
        border-bottom: none;
    }
/* ✅ totals */
.row-total {
    font-weight: 600;
}

.order-total {
    text-align: right;
    margin-top: var(--space-md);
    font-size: 16px;
}
/* ✅ actions */
.checkout-actions {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-lg);
}
/* =========================================
   CUSTOMER VIEW POLISH
========================================= */
/* ✅ search input */
.large-input {
    font-size: 15px;
    padding: 8px;
}
/* ✅ empty state */
.empty-state {
    padding: var(--space-md);
    color: var(--muted);
    font-style: italic;
}
/* ✅ manual toggle */
.small-link {
    margin-top: var(--space-sm);
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
}

    .small-link:hover {
        text-decoration: underline;
    }
/* ✅ summary card */
.summary-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
}

.summary-header {
    font-size: 20px;
    color: var(--muted);
    margin-bottom: var(--space-xs);
}

.summary-content {
    font-size: 15px;
    margin-bottom: var(--space-sm);
}


.cart-summary {
    margin-left: auto;
    font-weight: 600;
}
/* ✅ address section */
.address-section {
    margin-top: var(--space-md);
}

.address-option {
    display: flex;
    gap: var(--space-sm);
    padding: 6px 0;
}
/* ✅ form group */
.form-group {
    margin-bottom: var(--space-md);
}
/* =========================================
   CONTENT PAGES (Terms, FAQ)
========================================= */

.content-page {
    display: flex;
    justify-content: center;
}

.content-card {
    max-width: 800px;
    width: 100%;
    background: white;
    padding: var(--space-xl);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
/* =========================================
   DASHBOARD
========================================= */

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
}

.dashboard-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

    .dashboard-card h5 {
        margin-bottom: var(--space-sm);
    }



.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-decoration: none;
}

.logo-mark {
    width: 12px;
    height: 12px;
    background: white;
    display: inline-block;
    border-radius: 2px;
}
/* =========================================
   FOOTER
========================================= */


.footer {
    background: transparent;
    border-top: none;
}


.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
}


.footer a {
    margin-left: var(--space-md);
    color: var(--primary);
    text-decoration: none;
}

    .footer a:hover {
        text-decoration: underline;
    }
/* =========================================
   HERO (light branding feel)
========================================= */

.hero {
    background: linear-gradient( 135deg, #00617f 0%, #00816d 100% );
    color: white;
    padding: var(--space-xl);
    border-radius: var(--radius);
    margin-bottom: var(--space-xl);
}

.hero-content h4 {
    margin-bottom: var(--space-sm);
}
/* =========================================
   DASHBOARD
========================================= */

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
}

.dashboard-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
/* =========================================
   LOGIN BOX
========================================= */

.login-box {
    padding: var(--space-md);
    background: #f8f9fa;
    border-radius: var(--radius);
}



.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
/* Logo */
.logo {
    height: 45px;
    width: auto;
}
/* Teksti */
.brand-text {
    color: white;
    font-weight: 600;
    font-size: 15px;
}
/* =========================================
   TOPBAR BUTTONS
========================================= */
/* Login */
.btn-primary.small {
    padding: 6px 10px;
    font-size: 16px;
    border-radius: var(--radius);
}
/* ✅ Logout ghost */
.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
}
    /* hover */
    .btn-ghost:hover {
        background: rgba(255,255,255,0.1);
    }
/* spacing */
.topbar .right a,
.topbar .right button {
    margin-left: var(--space-md);
}



.btn {
    display: inline-block;
    font-size: 14px;
    line-height: 1;
    border-radius: var(--radius);
    padding: 6px 10px;
}
/* Stock traffic light */
.stock-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid rgba(0,0,0,0.15);
}

.stock-red {
    background: #dc3545;
}
/* 0 */
.stock-green {
    background: #28a745;
}
/* 1 */
.stock-yellow {
    background: #ffc107;
}
/* 2 */

.address-option-unknown {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

    .address-option-unknown:hover {
        background: #f1f5f9;
    }

    .address-option-unknown input {
        margin-top: 3px;
    }

.address-unknown-label {
    display: flex;
    flex-direction: column;
}

.address-unknown-title {
    font-weight: 600;
}

.address-unknown-sub {
    font-size: 0.8rem;
    color: #64748b;
}


.customer-summary {
    margin-bottom: 1.5rem;
}

.customer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}


.customer-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.3rem;
}


.customer-name {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
}

.customer-change {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 0.8rem;
    padding: 0;
    cursor: pointer;
}

    .customer-change:hover {
        text-decoration: underline;
    }



.customer-change-inline {
    color: #64748b;
    font-weight: 500;
}

    .customer-change-inline:hover {
        color: #2563eb;
        text-decoration: underline;
    }



.customer-separator {
    color: #cbd5e1;
}



.customer-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}



body {
    background: linear-gradient(rgba(255,255,255,0.88), rgba(255,255,255,0.88)), url('/images/bg.jpg') no-repeat center center fixed;
    background-size: cover;
}


.qty-small {
    width: 70px;
}

.discount-small {
    width: 80px;
}


.stock-qty {
    margin-left: 6px;
    font-size: 13px;
    color: #374151;
}



.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}



.filter-chip {
    padding: 5px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    font-size: 13px;
    cursor: pointer;
    background: white;
    color: #374151;
    transition: all 0.15s ease;
}




    .filter-chip:hover {
        background: #e2e8f0;
    }



    .filter-chip.active {
        background: #00617f;
        color: white;
        border-color: #00617f;
    }

        .filter-chip.active:hover {
            background: #004f66;
        }




.clear-filters {
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    margin-bottom: 6px;
}



.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 12px;
    padding: 6px;
    background: #f1f5f9;
    border-radius: 6px;
}



.filter-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
    margin-bottom: 2px;
}


.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}



.filter-check {
    margin-left: 4px;
    font-size: 11px;
}

.contract-info {
    margin-top: 2px;
    font-size: 12px;
    color: #166534; /* greenish */
    display: flex;
    gap: 6px;
    align-items: center;
}

.contract-pill {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    padding: 1px 6px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 11px;
}


.tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 0;
    top: auto;
    min-width: 220px;
    max-width: 320px;
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
    z-index: 99999;
    pointer-events: none;
}


@media (max-width: 768px) {
    .tooltip-content {
        max-width: 260px;
        left: auto;
        right: 0;
        transform: translateY(-6px);
    }
}


.tooltip-wrap:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-content b {
    color: #e2e8f0;
}



.discount-hint {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}



.cart-title {
    font-size: 14px;
    font-weight: 600;
}

.cart-sub {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.cart-line-total {
    font-weight: 700;
    color: #111827;
    margin-left: auto;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.cart-total {
    font-weight: 700;
}



.discount-adjusted {
    color: #2563eb;
    font-weight: 600;
}

.cart-label {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
}

.qty-col {
    text-align: center;
}

.discount-col {
    text-align: center;
}

.remove-col {
    width: 40px;
}


/* ===== LAYOUT SWITCH ===== */

.mobile-cards {
    display: none;
}

.desktop-table {
    display: block;
}

@media (max-width: 768px) {
    .desktop-table {
        display: none;
    }


    .mobile-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* ✅ estää overflow */
        gap: 8px;
        padding: 8px 6px; /* vähemmän sivupaddingia */
    }

    .product-card {
        min-width: 0; /* ✅ kriittinen gridissä */
    }
}

/* ===== CARD ===== */

.product-card {
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

/* header */
.card-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

/* title */
.card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

/* price */
.card-price {
    font-size: 16px;
    font-weight: 700;
    color: #047857;
    margin-top: 4px;
}

/* stock */
.card-stock {
    font-size: 11px;
    color: #6b7280;
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
}

/* controls */




.card-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

    .card-controls input {
        padding: 4px;
    }




.btn-add {
    background: #047857; /* sama kuin aiemmin */
    color: white;
    border: none;
    border-radius: 8px;
    min-width: 44px; /* ✅ ei liian kapea */
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.05s ease, background 0.1s ease;
}


    .btn-add:active {
        transform: scale(0.95);
        background: #065f46;
    }


/* 🔥 pää CTA-nappi */
.btn-add-full {
    margin-top: 10px;
    background: #047857;
    color: white;
    border: none;
    border-radius: 8px;
    height: 42px;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.05s ease, background 0.1s ease;
}

    .btn-add-full:active {
        transform: scale(0.97);
        background: #065f46;
    }


/* mobile boost */
@media (max-width: 768px) {
    .mini-cart-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .cart-summary {
        font-size: 12px;
        opacity: 0.9;
    }
}




/* =========================================
   TOPBAR (DESKTOP DEFAULT)
========================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 75px;
    padding: 0 20px;
    background: #00617f;
    color: white;
}

    /* left / right layout */
    .topbar .left,
    .topbar .right {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    /* brand */
    .topbar .brand {
        display: flex;
        align-items: center;
    }

    .topbar .logo {
        height: 40px;
        width: auto;
        display: block;
    }

    /* user + links */
    .topbar .user {
        font-weight: 500;
    }

    .topbar a,
    .topbar button {
        white-space: nowrap;
    }

/* desktop nav visible */
.desktop-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}


/* hamburger hidden default */
.hamburger {
    display: none;
}



/* =========================================
   MOBILE
========================================= */

@media (max-width: 768px) {

    .topbar {
        height: 65px; /* hieman matalampi mobileen */
        padding: 0 16px;
    }


    .desktop-nav {
        display: none; /* ✅ tämä PIILOTTAA linkit */
    }


    /* hamburger näkyviin */

    .hamburger {
        display: flex;
        width: 36px;
        height: 24px;
        padding: 0;
        background: none;
        border: none;
        flex-direction: column;
        justify-content: space-between;
    }

        .hamburger span {
            display: block;
            height: 3px;
            width: 100%;
            background: #ffffff;
            border-radius: 2px;
        }



    /* =========================================
   MOBILE MENU (DRAWER)
========================================= */


    .mobile-menu {
        position: fixed;
        top: 65px;
        right: 0;
        width: 260px;
        height: calc(100% - 65px); /* ✅ tämä varmistaa tilan */

        background: white;
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow-y: auto; /* ✅ tärkeä! */

        box-shadow: -4px 0 20px rgba(0,0,0,0.2);
        z-index: 3000;
    }


        /* menu items */
        .mobile-menu a {
            color: #00617f;
            text-decoration: none;
            font-weight: 500;
        }

    /* user section */
    .mobile-user {
        font-weight: 600;
        border-bottom: 1px solid #eee;
        padding-bottom: 8px;
    }



    /* mobile login hidden default */
    .mobile-login {
        display: none;
    }
}
/* mobile behavior */
@media (max-width: 768px) {

    .desktop-nav {
        display: none;
    }

    .mobile-login {
        display: block;
    }
}


.user-org {
    font-size: 12px;
    color: #6b7280;
}

.user-org-inline {
    font-size: 12px;
    color: #cbd5e1;
    margin-left: 6px;
}

.mobile-menu .user-org-inlinem {
    font-size: 12px;
    color: #00617f;
    margin-left: 6px;
}

.discount-builder-main,
.discount-builder-side {
    min-width: 0;
}



.builder-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

    .builder-toolbar > * {
        flex-shrink: 0;
    }


.results-meta {
    font-size: 12px;
    color: #64748b;
}


.customer-pick-row {
    display: flex; /* 🔥 tärkein muutos */
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}



    .customer-pick-row input {
        flex-shrink: 0;
        margin-top: 4px;
        display: inline-block; /* ✅ tärkeä fix */
    }



    .customer-pick-row:hover {
        background: #f8fafc;
    }



.customer-pick-content {
    flex: 1;
    min-width: 0;
    display: flex; /* ✅ tämä puuttui */
    flex-direction: column; /* ✅ tämä fixaa layoutin */
}




.customer-pick-name {
    font-weight: 600;
    white-space: normal; /* ✅ saa rivittyä */
    word-break: break-word; /* ✅ estää overflow */
}


.customer-pick-sub,
.customer-pick-searchhint {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.already-added {
    opacity: 0.75;
}


.picked-pill {
    flex-shrink: 0;
}


.selected-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selected-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.selected-item-name {
    font-weight: 600;
}

.selected-item-sub {
    font-size: 12px;
    color: #64748b;
}

@media (max-width: 900px) {
    .discount-builder-layout {
        grid-template-columns: 1fr;
    }
}

.discount-default-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.product-pick-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-pick-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.product-pick-main {
    min-width: 0;
    flex: 1;
}

.product-pick-name {
    font-weight: 600;
}

.product-pick-meta {
    font-size: 12px;
    color: #64748b;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.product-pick-price {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 700;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-list-item {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.summary-list-main {
    min-width: 0;
}

.summary-list-title {
    font-weight: 600;
}

.summary-list-sub {
    font-size: 12px;
    color: #64748b;
}

.summary-list-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.summary-product-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    padding: 12px;
}

.summary-product-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: start;
    margin-bottom: 10px;
}

.summary-product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
}

.summary-mini-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}

.summary-mini-label {
    color: #64748b;
}

.summary-extra-text {
    margin-top: 10px;
    font-size: 12px;
    color: #475569;
}

.picked-pill-alt {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

@media (max-width: 900px) {
    .summary-product-grid {
        grid-template-columns: 1fr;
    }
}


.stepper {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.step {
    padding: 8px 12px;
    background: #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

    .step.active {
        background: #00617f;
        color: white;
    }

}
/* =========================================
   DISCOUNT BUILDER - DESKTOP + MOBILE BASE
   IMPORTANT: this block must be OUTSIDE any @media
========================================= */

.discount-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.discount-builder-main,
.discount-builder-side {
    min-width: 0;
}

.builder-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 0;
}

    .builder-toolbar > * {
        flex-shrink: 0;
    }

.results-meta {
    font-size: 12px;
    color: #64748b;
}

.customer-list {
    margin-top: 0;
    height: 460px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #dbe3ea;
    border-radius: 10px;
    background: #fff;
    width: 100%;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.customer-pick-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    transition: background-color 0.12s ease;
}

    .customer-pick-row:last-child {
        border-bottom: none;
    }

    .customer-pick-row:hover {
        background: #f8fafc;
    }

    .customer-pick-row input[type="checkbox"] {
        flex: 0 0 auto;
        margin-top: 3px;
        width: 16px;
        height: 16px;
    }

.customer-pick-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-pick-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.25;
    color: #0f172a;
    white-space: normal;
    word-break: break-word;
}

.customer-pick-sub {
    font-size: 13px;
    line-height: 1.3;
    color: #475569;
    white-space: normal;
    word-break: break-word;
}

.customer-pick-searchhint {
    font-size: 12px;
    line-height: 1.35;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.already-added {
    opacity: 0.72;
}

.picked-pill {
    flex: 0 0 auto;
    align-self: center;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.summary-card {
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.summary-header {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.summary-content {
    font-size: 14px;
    color: #475569;
    margin-bottom: 12px;
}

.selected-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 420px;
    overflow-y: auto;
}

.selected-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f7;
}

    .selected-item:last-child {
        border-bottom: none;
    }

.selected-item-main {
    min-width: 0;
    flex: 1;
}

.selected-item-name {
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

.selected-item-sub {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
    word-break: break-word;
}

.checkout-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Desktop polish */
@media (min-width: 901px) {
    .discount-builder-main .large-input {
        margin-bottom: 10px;
    }

    .builder-toolbar .btn {
        min-width: 170px;
    }
}

/* Tablet / mobile */
@media (max-width: 900px) {
    .discount-builder-layout {
        grid-template-columns: 1fr;
    }

    .discount-builder-side {
        order: 2;
    }

    .discount-builder-main {
        order: 1;
    }
}

@media (max-width: 768px) {
    .builder-toolbar {
        gap: 0;
        margin-top: 0;
    }

    .results-meta {
        padding: 6px 0 8px;
    }

    .builder-toolbar .btn {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 0;
    }

    .customer-list {
        height: 460px;
        border-radius: 0 0 10px 10px;
    }

    .customer-pick-row {
        padding: 12px 10px;
    }

    .customer-pick-name {
        font-size: 14px;
    }

    .customer-pick-sub,
    .customer-pick-searchhint {
        font-size: 12px;
    }
}


.summary-scroll {
    max-height: 350px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .summary-scroll {
        max-height: 220px;
    }
}



.summary-scroll {
    scrollbar-width: thin;
}


    .summary-scroll::after {
        content: "";
        position: sticky;
        bottom: 0;
        height: 8px;
        display: block;
        background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.1));
    }


.discount-builder-main {
    padding-bottom: 220px; /* cart height */
}


.mini-cart-body {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
}


.mini-cart {
    box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
}



.small-hint {
    font-size: 13px;
    color: #64748b; /* harmaa sinertävä (Tailwind slate-500) */
    background: #f8fafc; /* erittäin kevyt tausta */
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}


@media (max-width: 768px) {
    .order-table {
        display: none;
    }
}

/* Checkout mobiili näkymä */

/* ✅ desktop */
.order-cards {
    display: none;
}

/* ✅ mobile */
@media (max-width: 768px) {

    .order-table {
        display: none;
    }

    .order-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .order-card {
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 12px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    }

    .card-header {
        font-weight: 600;
        font-size: 14px;
        word-break: break-word;
    }

    .card-sub {
        font-size: 14px;
        color: #64748b;
        margin-bottom: 6px;
    }

    .card-row {
        display: flex;
        justify-content: space-between;
        font-size: 13px;
        padding: 2px 0;
    }

    .row-total {
        font-weight: 600;
    }

    .stock-row {
        margin-top: 6px;
    }
}



/* ✅ force desktop */
@media (min-width: 769px) {
    .order-cards {
        display: none !important;
    }
}

/* =========================
   PRODUCTS VIEW (DESKTOP)
========================= */

.products-table td {
    vertical-align: middle;
}

.stock-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* =========================
   MOBILE VIEW
========================= */

/* default: mobile cards piilossa */
.products-mobile-cards {
    display: none;
}

/* mobile layout */
@media (max-width: 768px) {

    /* piilota table */
    .products-table {
        display: none !important;
    }

    /* näytä cardit */
    .products-mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* card */
    .product-card {
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 12px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        max-width: 100%;
        overflow: hidden;
    }

    /* header */
    .card-name {
        margin-bottom: 8px;
    }

    .card-title {
        font-weight: 600;
        font-size: 14px;
        word-break: break-word;
    }

    .card-sub {
        font-size: 12px;
        color: #64748b;
    }

    /* rows */
    .card-row {
        display: flex;
        justify-content: space-between;
        font-size: 13px;
        padding: 2px 0;
    }

        /* labels vaaleammaksi */
        .card-row span:first-child {
            color: #64748b;
        }

    /* stock spacing */
    .stock-row {
        margin-top: 6px;
    }

    /* button full width mobile */
    .product-card .btn {
        width: 100%;
    }
}

/* =========================
   DESKTOP OVERRIDE (IMPORTANT)
========================= */

/* varmistaa ettei cardit näy desktopilla */
@media (min-width: 769px) {
    .products-mobile-cards {
        display: none !important;
    }
}


.product-header {
    margin-bottom: 12px;
}

.product-title {
    font-weight: 600;
    font-size: 16px;
}

.product-sub {
    font-size: 13px;
    color: #64748b;
}



.customer-name {
    font-weight: 600;
    font-size: 16px;
}

.customer-id {
    font-size: 13px;
    color: #64748b;
}


.cart-controls input[type="date"] {
    width: 100% !important;
    min-width: 140px;
}

.form-group input[type="date"] {
    width: 100% !important;
    min-width: 140px;
}


@media (max-width: 768px) {
    .discount-default-grid {
        grid-template-columns: 1fr;
    }
}



.cart-bar {
    position: sticky;
    bottom: 0;
    background: #00617f;
    color: white;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

/* ACTIONS */

.cart-bar-actions {
    display: flex;
    gap: 10px;
}

/* BASE BUTTON */

.cart-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

    /* VARIANTS */

    /* primary = checkout */

    .cart-btn.primary {
        background: #00617f;
        color: white;
        border: 1px solid #00617f;
    }


        .cart-btn.primary:hover {
            background: #004f66;
        }

    .cart-btn.primary2 {
        background: white;
        color: #00617f;
        border: 1px solid #00617f;
    }


    /* secondary = change */

    .cart-btn.secondary {
        background: #e2e8f0;
        color: #334155;
        border: 1px solid #cbd5e1;
    }


    /* ghost = check cart */

    .cart-btn.ghost {
        background: transparent;
        color: white;
        border: 1px solid rgba(255,255,255,0.4);
    }


@media (max-width: 768px) {
    .cart-btn.ghost {
        color: white;
        border: 1px solid #cbd5e1;
    }
}



/* spacing feel */

.cart-btn:hover {
    opacity: 0.9;
}




@media (max-width: 768px) {
    .mini-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
    }
}


@media (max-width: 768px) {
    .mini-cart-body,
    .cart-bar {
        padding-left: 12px;
        padding-right: 12px;
    }
}



.cart-controls .btn-danger {
    width: 44px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}


@media (max-width: 768px) {
    .cart-row > .btn-danger {
        width: 44px;
        justify-self: end;
    }
}


.stock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stock-value {
    display: flex;
    align-items: center;
    gap: 6px;
}


.stock-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}


.stock-value span:first-child {
    min-width: 32px;
    text-align: right;
}





.notif-card {
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}

    .notif-card:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }


.notif-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}


.notif-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-title {
    font-weight: 600;
    font-size: 15px;
}

.notif-meta {
    font-size: 12px;
    color: #64748b;
}

.notif-body {
    margin-top: 10px;
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
}

.notif-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}

/* Severityt */

.notif-info {
    background: #f8fafc;
}

.notif-warning {
    background: #fff7ed;
    border-color: #fed7aa;
}

.notif-critical {
    background: #fef2f2;
    border-color: #fecaca;
}



.missing-product {
    color: #dc2626;
    font-size: 12px;
}



.stock-expiry {
    margin-left: 6px;
    font-size: 0.8em;
    opacity: 0.8;
}

.expiry-expired {
    color: #dc3545;
    font-weight: 600;
}

.expiry-soon {
    color: #fd7e14;
    font-weight: 600;
}

.expiry-mid {
    color: #ffc107;
}

.expiry-ok {
    color: #6c757d;
}


.card-stock {
    display: flex;
    align-items: center;
    gap: 6px;
}


.card-name {
    flex: 0 0 auto;
    min-height: 32px;
}

.card-title {
    display: block;
    word-break: break-word;
}
