:root {
    --primary-color: #008C95;
    --primary-dark: #006C73;
    --secondary-color: #F5A623;
    --background-color: #F4F6F8;
    --surface-color: #FFFFFF;
    --text-color: #333333;
    --text-light: #888888;
    --border-color: #EAEAEA;
    --danger-color: #D0021B;
    --warning-color: #f0ad4e;
    --info-color: #5bc0de;
    --success-color: #28a745;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Toast Notification === */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}
.toast.show {
    visibility: visible;
    opacity: 1;
}


/* === Loader === */
.loader-container { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; background-color: var(--surface-color); transition: opacity 0.5s ease; }
/* NEW SPIRAL LOADING */
.spinner { 
    width: 50px; 
    height: 50px; 
    border-radius: 50%; 
    background: conic-gradient(#0000 10%, var(--primary-color)); 
    -webkit-mask: radial-gradient(farthest-side,#0000 calc(100% - 8px),#000 0); 
    mask: radial-gradient(farthest-side,#0000 calc(100% - 8px),#000 0); 
    animation: spin 1s infinite linear; 
}
.loader-container p { font-size: 1.5rem; font-weight: 600; color: var(--primary-color); margin-top: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === App Structure === */
.app-container { display: flex; flex-direction: column; height: 100%; width: 100%; max-width: 600px; margin: 0 auto; background-color: var(--surface-color); position: relative; }
.view { display: none; flex-direction: column; width: 100%; height: 100%; overflow-y: auto; }
.view.active { display: flex; }
.page { padding-bottom: 80px; }
.main-content { flex-grow: 1; overflow-y: auto; background-color: var(--background-color); }

/* === Header === */
/* (20% slimmer than it was, 59 → 47 px on a phone, so everything under it sits higher; the menu and back buttons keep their 44 px tap area.
   Wide screens, where the shop stays open on the left, keep their own 60 px bar: see "min-width: 900px") */
.app-header {
    background-color: var(--surface-color);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}
/* The top bar's words cannot be selected (a long press or a double tap never highlights "My shop", "My products", "All sales"...) */
.app-header { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.app-container[data-view="home-view"] .app-header { cursor: pointer; } /* (on Home a tap on it opens the menu) */
#all-sales-time-filter { margin-block: -7px; } /* (All sales: its 40 px period picker beside the title keeps its tap area without making the bar taller) */
/* What sits in the slimmer bar is a little smaller too (phones; wide screens keep theirs): the title 19.5 → 17.6 px on a 375 px phone,
   the menu and back icons 24 → 21 px (their 44 px tap areas stay), and the unread dot moved so it still sits on the menu icon's corner */
@media (max-width: 899px), (max-height: 559px) {
    .app-header #header-title { font-size: clamp(0.95rem, 4.7vw, 1.22rem); }
    .app-header { padding-top: 11.5px; padding-bottom: 11.5px; } /* (the smaller title is 3 px shorter: the bar stays 47 px) */
    #all-sales-time-filter { margin-block: -9px; } /* (All sales: the picker no taller than the smaller title, so its bar is 47 px too) */
    .app-header .menu-btn svg, .app-header .back-btn svg { width: 21px; height: 21px; }
    .app-header .menu-btn.has-nudge::after { top: 2px; right: 1px; } /* (written with .app-header so it wins over the dot's own rule further down) */
}
/* The Money tank (app.js: PikaTank): on a phone's Home, a strip at the top of the teal band whose top edge is a wavy water surface. Above
   the surface it paints the bar's white, so the white bar stays clean and the water never rises into it; no line between the two */
.pika-tank { display: none; position: absolute; left: 0; top: 0; width: 100%; height: 48px; pointer-events: none; z-index: 0; } /* (phones only: see below) */
.pika-splash { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; } /* (drops that land on the white bar, over its title, on a phone's Home) */
#home-view .home-header { position: relative; z-index: 1; }
@media (max-width: 899px), (max-height: 559px) {
    #home-view.page { position: relative; }
    .app-container[data-view="home-view"] .app-header { border-bottom-color: transparent; }
    .app-container[data-view="home-view"] .pika-splash { display: block; }
    .pika-tank { display: block; }
}
@media (min-width: 900px) and (min-height: 560px) {
}
.app-header h1 {
    font-size: clamp(1.2rem, 4vw, 1.4rem);
    font-weight: 600;
    text-align: center;
    margin: 0 45px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.add-to-homescreen-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}
.menu-btn, .back-btn {
    background: none;
    border: none;
    padding: 4px;
    color: var(--text-color);
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.page-actions-header {
    padding: 12px 20px;
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}
.btn-icon-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-icon-link:active {
    color: var(--primary-dark);
}

/* === Onboarding & Permissions === */
.onboarding-content { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 30px; text-align: center; height: 100%; }
.onboarding-content h1, .onboarding-content h2 { font-size: clamp(1.5rem, 6vw, 1.8rem); font-weight: 700; margin-bottom: 12px; }
.onboarding-content p { font-size: clamp(0.9rem, 2.5vw, 1rem); color: var(--text-light); margin-bottom: 24px; max-width: 320px; line-height: 1.5; }
.permission-icon { margin-bottom: 20px; color: var(--primary-color); }
.privacy-policy-link {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 20px;
}
.privacy-policy-link a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 600;
}


/* === Forms === */
.form-group { width: 100%; margin-bottom: 20px; text-align: left; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; font-size: clamp(0.85rem, 2.5vw, 0.9rem); }
.form-group input, .form-group select { width: 100%; padding: 14px; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 1rem; background-color: #fafafa; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(0, 140, 149, 0.2); }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-row .form-group { flex: 1; }

/* === Create Account screen: the whole form fits on one phone screen, no scrolling === */
.onboarding-form { flex-shrink: 0; justify-content: center; align-items: stretch; text-align: left; height: auto; min-height: 100%; padding: 22px 20px max(16px, env(safe-area-inset-bottom)); }
.reg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.reg-back { flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: #f3f5f7; color: var(--text-color); cursor: pointer; }
.reg-back:active { background: #e6e9ec; }
.onboarding-form h1 { margin: 0; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.02em; }
.onboarding-form .reg-head p { max-width: none; margin: 2px 0 0; font-size: 0.85rem; line-height: 1.3; text-align: left; }
.reg-fields { display: flex; flex-direction: column; gap: 16px; }
.onboarding-form .form-row { gap: 10px; align-items: stretch; }
.onboarding-form .form-group { position: relative; margin-bottom: 0; min-width: 0; }

/* every field has a visible outline with its title sitting on the top border line */
.onboarding-form .form-group > label, .onboarding-form .form-group > .field-title {
    position: absolute; z-index: 1; top: -8px; left: 11px; max-width: calc(100% - 22px); margin: 0; padding: 0 5px;
    background: #fff; color: #5b6670; font-size: 0.72rem; font-weight: 600; line-height: 1.1; letter-spacing: 0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: color 0.15s;
}
.onboarding-form .form-group:focus-within > label, .onboarding-form .form-group:focus-within > .field-title { color: var(--primary-color); }
.onboarding-form .form-group input, .onboarding-form .form-group select { height: 48px; padding: 0 14px; border: 1.5px solid #b4bec7; border-radius: 12px; background-color: #fff; color: #1d1d1d; font-size: 1rem; }
.onboarding-form .form-group input::placeholder { color: #a6adb4; }
.onboarding-form .form-group input:focus, .onboarding-form .form-group select:focus { background-color: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.onboarding-form .form-group select { appearance: none; -webkit-appearance: none; padding: 0 28px 0 12px; font-size: 0.95rem; text-overflow: ellipsis; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23556' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat; background-position: right 10px center; }
.onboarding-form .form-group select:required:invalid { color: #a6adb4; } /* "Select" reads as a placeholder until something is picked */
.onboarding-form .form-group select option { color: #1d1d1d; }
.onboarding-form .input-wrapper input { padding-right: 84px; letter-spacing: 0.3em; font-weight: 600; }
.onboarding-form .input-wrapper input::placeholder { letter-spacing: 0.3em; font-weight: 400; }

/* business type: three buttons in the same outline; until one is picked they light up in turn to show they can be tapped */
.reg-segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 4px; border: 1.5px solid #b4bec7; border-radius: 12px; background: #fff; }
.reg-segment button { min-width: 0; height: 38px; border: none; border-radius: 8px; background: #eef1f4; color: #4a555f; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: background-color 0.15s, color 0.15s, box-shadow 0.15s; }
.reg-segment button:active { transform: scale(0.97); }
.reg-segment button:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.reg-segment button.selected { background: var(--primary-color); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.reg-segment:not(.chosen) button { animation: reg-hint 3.4s ease-in-out infinite; }
.reg-segment:not(.chosen) button:nth-child(2) { animation-delay: 0.3s; }
.reg-segment:not(.chosen) button:nth-child(3) { animation-delay: 0.6s; }
@keyframes reg-hint {
    0%, 45%, 100% { background-color: #eef1f4; color: #4a555f; box-shadow: inset 0 0 0 0 var(--primary-color); transform: none; }
    15%, 30% { background-color: #d8eeef; color: var(--primary-dark); box-shadow: inset 0 0 0 1.5px var(--primary-color); transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
    .reg-segment:not(.chosen) button { animation: none; }
}

.onboarding-form .reg-submit { margin-top: 22px; min-height: 50px; border-radius: 14px; font-size: 1rem; }
.onboarding-form .privacy-policy-link { max-width: none; margin: 12px 0 0; font-size: 0.75rem; text-align: center; }
@media (max-height: 640px) {
    .onboarding-form { padding-top: 14px; }
    .reg-head { margin-bottom: 18px; }
    .reg-fields { gap: 14px; }
    .onboarding-form .form-group input, .onboarding-form .form-group select { height: 44px; }
    .reg-segment button { height: 34px; }
    .onboarding-form .reg-submit { margin-top: 16px; min-height: 46px; }
    .onboarding-form .privacy-policy-link { margin-top: 8px; }
}
.source-info {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-light);
    text-align: center;
    margin-top: -8px;
    margin-bottom: 16px;
    background-color: var(--background-color);
    padding: 8px;
    border-radius: 8px;
}
.barcode-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 16px;
    background-color: var(--background-color);
    padding: 12px;
    border-radius: 8px;
    word-break: break-all;
}
.barcode-display.large {
    font-size: 1.5rem;
    padding: 16px;
    font-weight: 700;
}
.wholesaler-only {
    display: none; /* Hidden by default */
}
.price-group {
    flex: 1.7;
}
.unit-group {
    flex: 1.3;
}

/* The PIN screens are forms that take no room of their own; the phone number rides along, unseen, as the username a browser pairs the PIN with */
.cred-form { display: contents; }
.cred-username { position: absolute !important; left: 0 !important; top: 0 !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; opacity: 0 !important; pointer-events: none !important; }
/* A PIN box that is not a login (asked before something is deleted): hidden digits, without being a password box */
.masked-pin { -webkit-text-security: disc; }

/* Unit: a button that shows the chosen unit with a small picture, and a list of every unit with its picture (the hidden <select> is the real field) */
.unit-btn {
    display: flex; align-items: center; gap: 8px; width: 100%; height: 50px; padding: 0 10px 0 10px; border: 1.5px solid #b4bec7; border-radius: 12px;
    background: #fff; color: #1d1d1d; font: inherit; font-size: 1rem; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.unit-btn:focus-visible, .unit-btn[aria-expanded="true"] { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.unit-btn:disabled { background: #f3f5f7; color: #7a848c; cursor: default; }
.unit-btn .unit-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-btn .unit-chev { flex: none; color: #556; transition: transform 0.18s ease; }
.unit-btn[aria-expanded="true"] .unit-chev { transform: rotate(180deg); }
.unit-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--primary-color); }
.unit-btn:disabled .unit-ico { color: #8a949b; }
.unit-svg { width: 100%; height: 100%; display: block; }
/* The list: one vertical list that floats above the product box (it sits in the modal layer, outside the form, so the box never grows, scrolls or moves
   when it opens). Under the Unit field, left edges together; only as wide as its units want (never narrower than the field), and it opens upwards
   when there is no room below. Its place, width and height are set by _placeUnitMenu in app.js. */
.unit-menu {
    position: absolute; z-index: 5; margin: 0; padding: 4px; list-style: none; width: max-content; max-width: calc(100% - 16px); overflow-y: auto; overscroll-behavior: contain;
    background: #fff; border: 1px solid #dfe5ea; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform-origin: 24px 0; animation: unit-pop 0.14s ease-out;
}
.unit-menu[hidden] { display: none; }
.unit-menu.up { transform-origin: 24px 100%; animation-name: unit-pop-up; }
.unit-menu.out { animation: unit-out 0.1s ease-in forwards; pointer-events: none; }
.unit-menu li { position: relative; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 28px 0 8px; border-radius: 8px; font-size: 0.92rem; color: #1d1d1d; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.unit-menu li + li { margin-top: 1px; }
.unit-menu li .unit-ico { width: 20px; height: 20px; }
.unit-opt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-menu li:hover, .unit-menu li:focus { background: #eef6f7; outline: none; }
.unit-menu li:active { background: #dcecee; }
.unit-menu li[aria-selected="true"] { background: rgba(0, 140, 149, 0.1); font-weight: 600; }
.unit-menu li[aria-selected="true"]::after { content: ''; position: absolute; right: 11px; top: 50%; width: 5px; height: 10px; margin-top: -7px; border: solid var(--primary-color); border-width: 0 2px 2px 0; transform: rotate(45deg); }
@keyframes unit-pop { from { opacity: 0; transform: translateY(-4px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes unit-pop-up { from { opacity: 0; transform: translateY(4px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes unit-out { to { opacity: 0; transform: scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .unit-menu, .unit-menu.up, .unit-menu.out { animation: none; } }

/* "Bottle or Sachet?": a small floating question under the unit field, pointing up at it; the field glows until it is answered */
.unit-ask {
    position: absolute; z-index: 45; top: calc(100% + 12px); left: -2px; width: max-content; max-width: calc(100vw - 56px); padding: 8px 10px;
    background: #fff; border: 1.5px solid var(--primary-color); border-radius: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    transform-origin: 26px -8px; animation: unit-ask-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.unit-ask[hidden] { display: none; }
.unit-ask-arrow { position: absolute; top: -7px; left: 24px; width: 12px; height: 12px; background: #fff; border-left: 1.5px solid var(--primary-color); border-top: 1.5px solid var(--primary-color); transform: rotate(45deg); border-top-left-radius: 3px; }
.unit-ask-row { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; color: #1d1d1d; white-space: nowrap; }
.unit-ask-btn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px 0 8px; border: 1.5px solid var(--primary-color); border-radius: 999px; background: #fff; color: var(--primary-color); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color 0.15s, color 0.15s, transform 0.1s; }
.unit-ask-btn .unit-ico { width: 18px; height: 18px; }
.unit-ask-btn:active { background: var(--primary-color); color: #fff; transform: scale(0.96); }
.unit-ask-or, .unit-ask-q { color: #5b6670; font-weight: 600; }
.unit-ask-q { margin-left: -4px; }
.unit-btn.needs-answer { border-color: var(--primary-color); animation: unit-glow 1.6s ease-in-out infinite; }
@keyframes unit-ask-in { from { opacity: 0; transform: translateY(-8px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes unit-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 140, 149, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(0, 140, 149, 0.12); } }
@media (prefers-reduced-motion: reduce) { .unit-ask { animation: none; } .unit-btn.needs-answer { animation: none; box-shadow: 0 0 0 3px rgba(0, 140, 149, 0.25); } }
#product-form .btn-icon {
    flex: 1;
    margin-bottom: 20px;
}
.stock-group {
    flex: 2;
}

/* NEW STYLES FOR INPUT ICONS (REPLACED EMOJIS) */
.input-wrapper {
    position: relative;
    width: 100%;
}
.input-wrapper input {
    padding-right: 85px; /* Make space for icons */
    letter-spacing: 2px;
    font-weight: 600;
}
.input-icons {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}
.icon-btn:hover {
    background-color: rgba(0,0,0,0.05);
}
.icon-btn:active {
    background-color: rgba(0,0,0,0.1);
}
/* Specific copy color */
#copy-login-pin, #copy-create-pin {
    color: var(--primary-color);
}

/* NEW TRIPLE TOGGLE STYLES */
.sale-type-section {
    margin-bottom: 38px; /* room for the "How many?" title that sits on the box below */
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}
.triple-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}
/* Both labels are as light as the "Total" caption; only the one that is switched on gets heavier */
.toggle-label {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-light);
    transition: color 0.3s;
}
.toggle-label.active {
    color: var(--text-color); /* Not text-muted */
    font-weight: 600;
}
.text-muted {
    color: var(--text-light);
}

.triple-toggle {
    position: relative;
    display: flex;
    width: 108px;
    height: 32px;
    background-color: rgba(0, 0, 0, 0.08); /* slightly darker background to show track */
    border-radius: 16px;
    border: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.triple-toggle input[type="radio"] {
    flex: 1;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
    margin: 0;
    height: 100%;
}
.triple-toggle::before, .triple-toggle::after {
    content: '';
    position: absolute;
    top: 25%;
    bottom: 25%;
    width: 2px;
    background-color: rgba(0, 0, 0, 0.15); /* Obvious demarcations */
    border-radius: 1px;
    z-index: 1;
    pointer-events: none;
}
.triple-toggle::before {
    left: 35px;
}
.triple-toggle::after {
    right: 35px;
}
.triple-slider {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 32px;
    background-color: #adb5bd; /* Default middle */
    border-radius: 14px;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.5, 1), background-color 0.3s;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Positions based on which radio is checked */
/* (Credit on the left, Discount on the right) */
.triple-toggle input[value="discount"]:checked ~ .triple-slider {
    transform: translateX(74px); /* right */
    background-color: var(--primary-color);
}
.triple-toggle input[value="default"]:checked ~ .triple-slider {
    transform: translateX(38px); /* middle */
    background-color: #adb5bd;
}
.triple-toggle input[value="credit"]:checked ~ .triple-slider {
    transform: translateX(2px); /* left */
    background-color: #ef4444;
}

.discount-input-container {
    margin-top: 12px;
    animation: slideDown 0.3s ease-out;
}
.discount-input-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Input layout changes */
.input-with-contact-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}
.input-with-contact-wrapper .input-with-prefix {
    flex: 1; /* By default takes all space */
    transition: width 0.3s;
}
.input-with-contact-wrapper.credit-mode .input-with-prefix {
    width: 70%;
    flex: none;
}
.input-with-contact-wrapper.credit-mode #select-contact-btn {
    display: flex !important;
    width: 30%;
    height: 44px; /* match input height */
    justify-content: center;
    align-items: center;
    background-color: rgba(0,0,0,0.02);
    border-radius: var(--border-radius);
    border: 1px dashed var(--border-color);
    transition: background-color 0.2s;
}
.input-with-contact-wrapper.credit-mode #select-contact-btn:hover {
    background-color: rgba(0,0,0,0.06);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Modern input with prefix */
.input-with-prefix {
    position: relative;
    width: 100%;
}
.currency-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--text-light);
    pointer-events: none;
}
/* UPDATED: Modern input styling for discount box */
.input-with-prefix input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: #fafafa;
    
    padding-left: 32px !important; /* Space for prefix */
    transition: all 0.2s;
}
.input-with-prefix input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 140, 149, 0.2);
}

.discount-mark {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.8em;
    margin-left: 2px;
    vertical-align: super;
}


/* === Buttons === */
button:focus { outline: none; }
.btn { padding: 14px 20px; border: none; border-radius: var(--border-radius); font-size: clamp(0.9rem, 2.5vw, 1rem); font-weight: 600; cursor: pointer; width: 100%; transition: background-color 0.2s; min-height: 48px; }
.btn:disabled { background-color: #ccc; cursor: not-allowed; }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:active { background-color: var(--primary-dark); }
/* A button with a small line of explanation under its label: small and light so it never competes with the label, but still plain to read */
.btn-stack { padding-top: 9px; padding-bottom: 9px; line-height: 1.2; }
.btn-stack .btn-main { display: block; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.01em; } /* a little bigger than a plain button's label, so it holds its own against the small line */
.btn-stack .btn-sub { display: block; margin-top: 3px; font-size: 0.76rem; font-weight: 500; letter-spacing: 0.01em; color: rgba(255, 255, 255, 0.94); }
.btn-secondary { background-color: var(--border-color); color: var(--text-color); }
.btn-secondary:active { background-color: #ddd; }
/* Every Cancel and Close button: a red line and red text, like Logout (and a white fill over the camera, so it can be read) */
.btn.btn-cancel { background: transparent; color: var(--danger-color); border: 1.5px solid rgba(208, 2, 27, 0.35); }
.btn.btn-cancel:active { background: #ffebee; }
.camera-actions .btn.btn-cancel { background: rgba(255, 255, 255, 0.94); }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--border-color);
    color: var(--text-color);
    min-height: 48px;
    padding: 8px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.btn-icon.success {
    background-color: #eaf6ec;
    color: var(--success-color);
}
.fab { position: fixed; bottom: 90px; right: 20px; width: 60px; height: 60px; border-radius: 50%; background-color: #000; color: white; display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 15px rgba(0,0,0,0.2); border: none; z-index: 100; transition: opacity 0.3s, transform 0.3s; }
.disabled { opacity: 0.6; pointer-events: none; cursor: not-allowed; transform: scale(0.95); }
.input-error-shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
#product-form button.input-error-shake {
    border: 1px solid var(--danger-color) !important;
    box-shadow: 0 0 5px rgba(208, 2, 27, 0.5);
}
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}


/* === Bottom Navigation & Global Actions === */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; max-width: 600px; margin: 0 auto; height: 70px; display: flex; justify-content: space-around; align-items: center; background-color: var(--surface-color); border-top: 1px solid var(--border-color); box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 200; }
.nav-btn { background: none; border: none; color: var(--text-light); display: flex; flex-direction: column; align-items: center; font-size: 0.75rem; padding: 8px; transition: color 0.2s; }
.nav-btn svg { margin-bottom: 4px; }
.nav-btn.active { color: var(--primary-color); }
/* The page you are on (Shop or Products): its icon filled solid teal with the details in white (a solid house with a white door, a solid
   bag with a white top and handle), and its word bolder; the other one stays an outline */
.nav-btn svg > * { transition: fill 0.2s, stroke 0.2s; }
.nav-btn.active svg > :first-child { fill: currentColor; }
.nav-btn.active svg > :not(:first-child) { stroke: #fff; }
.nav-btn.active span { font-weight: 700; }
.nav-btn-main { background-color: var(--primary-color); border: none; border-radius: 50%; width: 74px; height: 74px; padding-bottom: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; box-shadow: 0 4px 15px rgba(0, 140, 149, 0.4); transform: translateY(-20px); transition: opacity 0.3s, transform 0.3s; position: relative; }
.nav-btn-main span { font-size: 0.7rem; margin-top: 2px; }
.nav-btn span { font-size: 0.75rem; margin-top: 4px; font-weight: 500; }

.onboarding-tooltip {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: bounce 2s infinite;
    z-index: 1001;
    max-width: 140px;
    text-align: center;
}
.onboarding-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 30px;
    margin-left: -8px;
    border-width: 14px 8px 0 8px;
    border-style: solid;
    border-color: var(--primary-color) transparent transparent transparent;
}
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}.nav-btn-icon { transition: opacity 0.2s ease-in-out; }
.nav-btn-loader {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}
.nav-btn-main.loading .nav-btn-loader { opacity: 1; }
.nav-btn-main.loading .nav-btn-icon { opacity: 0; }
.receipt-actions { position: fixed; bottom: 0; left: 0; right: 0; max-width: 600px; margin: 0 auto; padding: 16px; background: var(--surface-color); box-shadow: 0 -4px 12px rgba(0,0,0,0.1); display: none; gap: 12px; z-index: 201; transform: translateY(100%); transition: transform 0.3s ease-in-out; }
.receipt-actions.visible { display: flex; transform: translateY(0); }
.receipt-actions .btn { min-width: 0; }
/* Edit button: collapses (and fades) out of the flex row smoothly when hidden */
.receipt-actions .btn-edit-sale {
    flex: 0 0 auto; width: auto; max-width: 0; margin-left: -12px; padding-left: 0; padding-right: 0;
    opacity: 0; overflow: hidden; white-space: nowrap; pointer-events: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: max-width 0.3s ease, margin-left 0.3s ease, padding 0.3s ease, opacity 0.25s ease, background-color 0.2s;
}
.receipt-actions .btn-edit-sale.visible { max-width: 110px; margin-left: 0; padding-left: 16px; padding-right: 16px; opacity: 1; pointer-events: auto; }
.receipt-actions .btn-edit-sale svg { flex-shrink: 0; }

/* Home View / Dashboard Styles */
#home-view, #all-sales-view { user-select: none; -webkit-user-select: none; }
#home-view.page { padding-bottom: 80px; background: linear-gradient(180deg, var(--primary-color) 200px, var(--background-color) 200px); background-attachment: local; } /* (local: the teal scrolls away with the page; 6 px of its top is under the water's surface, see .pika-tank. Phones: their own, further down) */

/* Offline banner: it only floats over the top of the page (Home, My Products, Customers & Salespeople, All Sales). It takes no room (nothing moves when it appears) and stays put while the page scrolls under it. */
.offline-banner { position: sticky; top: 0; z-index: 8; height: 0; }
.offline-banner[hidden], .offline-banner.not-here { display: none; }
.offline-banner-inner { position: absolute; top: 10px; left: 14px; right: 14px; display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 14px; color: #fff; background: rgba(0, 108, 115, 0.97); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); pointer-events: none; animation: offline-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.offline-icon { flex-shrink: 0; box-sizing: border-box; width: 34px; height: 34px; padding: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.offline-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.offline-text strong { font-size: 0.95rem; font-weight: 700; }
.offline-text span { font-size: 0.78rem; line-height: 1.3; opacity: 0.88; }
.offline-banner.is-back .offline-banner-inner { background: rgba(255, 255, 255, 0.97); color: var(--primary-dark); }
.offline-banner.is-back .offline-icon { background: rgba(0, 140, 149, 0.12); }
@keyframes offline-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: none; } }
.home-header { padding: 24px 20px; color: white; display: flex; justify-content: space-between; align-items: flex-start; }
.home-header p { font-size: clamp(0.85rem, 2.5vw, 0.9rem); opacity: 0.8; }
.home-header h2 { font-size: clamp(1.5rem, 5vw, 1.75rem); font-weight: 700; margin-top: 4px; }
/* The date on the left; the shop's place at the other end of the same line, right-aligned: the date's look, a little smaller, with a small round dot before it */
.home-header-main { flex: 1 1 auto; min-width: 0; }
.home-header-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.home-header p.welcome-place { flex: 0 1 auto; min-width: 0; max-width: 55%; font-size: clamp(0.78rem, 2.3vw, 0.84rem); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-header p.welcome-place[hidden] { display: none; }
.welcome-place::before { content: ''; display: inline-block; width: 4px; height: 4px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: middle; position: relative; top: -1px; }

/* A message you have not read yet: a warm dot on the menu button. It springs in, gives off a soft ring and the three lines ripple
   for 30 seconds; after that it stays as a quiet dot until the Profile is opened. */
.menu-btn svg line { transform-box: fill-box; transform-origin: left center; }
.menu-btn.has-nudge::after {
    content: ''; position: absolute; top: 0; right: -1px; box-sizing: content-box; width: 9px; height: 9px;
    border: 2px solid var(--surface-color); border-radius: 50%; background: linear-gradient(135deg, #ffb347, #ff5f4e);
    animation: nudge-dot-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.menu-btn.has-nudge.nudge-live::after { animation: nudge-dot-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both, nudge-ring 2.4s ease-out 0.7s infinite; }
.menu-btn.nudge-live svg line:nth-child(2) { animation: nudge-wave 2.6s ease-in-out infinite; }
.menu-btn.nudge-live svg line:nth-child(1) { animation: nudge-wave 2.6s ease-in-out 0.12s infinite; }
.menu-btn.nudge-live svg line:nth-child(3) { animation: nudge-wave 2.6s ease-in-out 0.24s infinite; }
@keyframes nudge-dot-in { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes nudge-ring { 0% { box-shadow: 0 0 0 0 rgba(255, 95, 78, 0.55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(255, 95, 78, 0); } }
@keyframes nudge-wave { 0%, 34%, 100% { transform: scaleX(1); } 10% { transform: scaleX(0.55); } 22% { transform: scaleX(1.04); } }
@media (prefers-reduced-motion: reduce) {
    .menu-btn.has-nudge::after, .menu-btn.has-nudge.nudge-live::after { animation: none; }
    .menu-btn.nudge-live svg line { animation: none; }
}

/* The customer or product a message took you to */
.focus-flash { animation: focus-flash 2.4s ease-out 1; border-radius: var(--border-radius); }
@keyframes focus-flash { 0%, 50% { outline: 3px solid rgba(0, 140, 149, 0.9); outline-offset: 3px; } 100% { outline: 3px solid rgba(0, 140, 149, 0); outline-offset: 7px; } }

.home-content { padding: 0 20px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background-color: var(--surface-color); border-radius: var(--border-radius); box-shadow: var(--box-shadow); }
.stat-card { padding: 16px; display: flex; flex-direction: column; }
.stat-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; color: white; }
.stat-icon.sales { background-color: var(--primary-color); }
.stat-icon.items { background-color: var(--primary-color); }
.stat-card p { font-size: clamp(0.8rem, 2.5vw, 0.9rem); color: var(--text-light); }
.stat-card .stat-label { display: flex; align-items: center; gap: 6px; }
.figures-toggle { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: -4px 0; border: none; background: transparent; color: var(--text-light); border-radius: 50%; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.figures-toggle:active { background: var(--border-color); color: var(--primary-color); }
.figures-toggle[aria-pressed="true"] { color: var(--primary-color); }
.stat-card h3 { font-size: clamp(1.4rem, 5vw, 1.75rem); font-weight: 700; color: var(--text-color); margin-top: 4px; }

/* Recent & All Sales Styles */
.recent-sales-container { margin-top: 24px; }
.recent-sales-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.recent-sales-header h4 { font-size: clamp(1rem, 3vw, 1.1rem); font-weight: 600; }
.selection-hint { font-size: 0.8rem; color: var(--text-light); }
/* Customers & Salespeople: a half capsule on the right, its flat end against the edge of the screen. Light and small, but easy to see. */
.stock-link-row { margin: 14px -20px 0 0; text-align: right; } /* (the page has 20px at the sides: this goes out to the edge) */
.stock-link-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 16px 6px 20px; border: 1px solid rgba(0, 140, 149, 0.22); border-right: 0; border-radius: 999px 0 0 999px; background: rgba(0, 140, 149, 0.08); color: var(--primary-dark); font: inherit; font-size: 0.82rem; font-weight: 500; line-height: 1.2; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color 0.2s; }
.stock-link-btn::after { content: ''; position: absolute; inset: -5px 0 -5px -6px; } /* (a bigger area to tap) */
.stock-link-btn:active { background: rgba(0, 140, 149, 0.17); }
.stock-link-btn .arrow-icon { flex: none; width: 14px; height: 14px; opacity: 0.75; }
/* The button names one thing at a time and now and then rolls over to the other. Both words sit in the same spot, so the capsule never changes size. */
.stock-link-words { display: inline-grid; overflow: hidden; padding: 2px 0; margin: -2px 0; }
.stock-link-word { grid-area: 1 / 1; text-align: center; white-space: nowrap; opacity: 0; }
.stock-link-word.is-on { opacity: 1; }
.stock-link-word.is-out { animation: stock-word-out 0.45s cubic-bezier(0.4, 0, 0.8, 0.4) both; }
.stock-link-word.is-in { animation: stock-word-in 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.2s both; }
@keyframes stock-word-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-60%); } }
@keyframes stock-word-in { from { opacity: 0; transform: translateY(60%); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .stock-link-word.is-out, .stock-link-word.is-in { animation-duration: 0.01s; animation-delay: 0s; } }
.see-all-container { text-align: center; margin-top: 16px; margin-bottom: 120px; }
.see-all-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    cursor: pointer;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.arrow-icon {
    display: inline-block;
    vertical-align: middle;
}
.sale-item { display: flex; align-items: center; background: var(--surface-color); padding: 12px; border-radius: var(--border-radius); margin-bottom: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); transition: background-color 0.2s, transform 0.2s; position: relative; overflow: hidden; cursor: pointer; }
.sale-item.selectable { cursor: pointer; }
.sale-item.selected { background-color: #E0F3F4; transform: scale(1.02); box-shadow: 0 4px 8px rgba(0, 140, 149, 0.3); }
.sale-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.6);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.sale-item.shake-and-show-overlay {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
.sale-item.shake-and-show-overlay .sale-item-overlay {
    opacity: 1;
}
.sale-item.shake-restricted {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    border: 1px solid var(--danger-color); 
}
/* Edit window timer: thin teal line receding right-to-left (duration set per element: 45 min on both sales and edited products) */
.sale-edit-timer, .product-edit-timer {
    position: absolute; left: 0; bottom: 0; width: 100%; height: 2px;
    background: var(--primary-color); transform-origin: left center;
    animation: edit-window-recede 1200s linear forwards; pointer-events: none;
}
.product-edit-timer { z-index: 5; }
@keyframes edit-window-recede { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.sale-row { position: relative; margin-bottom: 10px; }
.sale-row > .sale-item { margin-bottom: 0; }
.sale-tag {
    position: absolute; top: 50%;
    writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg);
    font-size: 0.56rem; font-weight: 600; letter-spacing: 0.04em; line-height: 1;
    pointer-events: none; white-space: nowrap;
}
.sale-tag.right { left: calc(100% + 6px); }
.sale-tag.left { right: calc(100% + 6px); }
.sale-tag.edited, .sale-tag.credit { color: rgba(208, 2, 27, 0.5); }
.sale-tag.discounted, .sale-tag.transferred { color: rgba(0, 140, 149, 0.7); }
.sale-item img { width: 40px; height: 40px; border-radius: 8px; margin-right: 12px; object-fit: cover; flex-shrink: 0; }
.sale-info { flex-grow: 1; overflow: hidden; }
.sale-info p { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(0.9rem, 2.5vw, 1rem); }
.sale-info span { font-size: clamp(0.75rem, 2vw, 0.8rem); color: var(--text-light); }
.sale-price { font-weight: 700; font-size: clamp(1rem, 3vw, 1.1rem); margin-left: 8px; }
.all-sales-container { padding: 20px; }
#stock-levels-view .all-sales-container {
    padding: 16px 20px 20px;
}
.sales-group-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 8px;
    margin-bottom: 12px;
    margin-top: 24px;
    border-bottom: 1px solid var(--border-color);
}
.sales-group:first-child .sales-group-header {
    margin-top: 0;
}
.sales-group-header h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin: 0;
}
.sales-group-total {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sales-group-total.acknowledged {
    color: var(--success-color);
}
.sales-group-total .checkmark-icon {
    stroke: var(--success-color);
}
.sales-legend {
    padding: 10px 20px;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    background-color: #f9f9f9;
    border-top: 1px solid var(--border-color);
}
.acknowledgement-text {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--success-color);
    background-color: #eaf6ec;
    padding: 8px 12px;
    border-radius: 8px;
    margin: -8px 0 12px;
    text-align: center;
}

/* === Products View === */
.product-header { padding: 16px 20px 0; display: flex; justify-content: space-between; align-items: center; }
.sku-count { text-align: left; font-size: 0.9rem; font-weight: 500; color: var(--text-light); margin: 0; }
.total-value { text-align: right; font-size: 0.9rem; font-weight: 500; color: var(--text-light); margin: 0; }
.total-value-wrap { display: flex; align-items: center; gap: 4px; }
.total-value-wrap .figures-toggle { margin: -4px -4px -4px 0; }

/* This new wrapper makes the search and filter controls stick together at the top */
.product-controls-sticky-header {
    background-color: var(--background-color);
    position: sticky;
    top: 0;
    z-index: 6;
    border-bottom: 1px solid var(--border-color);
}

/* Container for the search bar, padding adjusted for the new layout */
#product-search-container {
    padding: 8px 20px 0;
}

/* Search input now has a bottom margin to space it from the filters */
#product-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    background-color: var(--surface-color);
    margin-bottom: 12px;
}
#product-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 140, 149, 0.2);
}

/* Filters are no longer sticky on their own and have adjusted padding */
.product-filter-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 0 20px 12px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.product-filter-tabs::-webkit-scrollbar {
    display: none;
}
.filter-tab-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    background-color: var(--surface-color);
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.filter-tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.filter-tab-btn:not(.active):hover {
    background-color: #f0f0f0;
}
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; padding: 20px; }
.product-card { background-color: var(--surface-color); border-radius: var(--border-radius); box-shadow: var(--box-shadow); display: flex; flex-direction: column; position: relative; aspect-ratio: 3 / 4; overflow: hidden; }
.product-card-image-wrapper { height: 70%; width: 100%; }
.product-card-image-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.out-of-stock-badge, .restock-badge, .setup-badge { position: absolute; top: 8px; right: 8px; max-width: calc(100% - 50px); color: white; padding: 4px 8px; font-size: 0.7rem; font-weight: 600; border-radius: 6px; z-index: 4; line-height: 1.2; text-align: center; }
.out-of-stock-badge { background-color: var(--danger-color); }
.restock-badge { background-color: var(--warning-color); }
.setup-badge { background-color: var(--info-color); }
.product-card-info { flex-grow: 1; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; min-height: 30%; }
.product-card-info h4 {
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 2px;
    white-space: normal;
    overflow-wrap: break-word;
    min-height: 1.2em;
}
.product-price { font-size: clamp(0.9rem, 3vw, 1rem); font-weight: 700; color: var(--primary-color); }
.product-stock { font-size: clamp(0.7rem, 2vw, 0.75rem); color: var(--text-light); margin-top: auto; padding-top: 4px; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-light); grid-column: 1 / -1; }
.edit-btn-icon { position: absolute; top: 6px; left: 6px; z-index: 3; background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(2px); border: none; border-radius: 50%; width: 30px; height: 30px; padding: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; }
.edit-btn-icon:hover { background: rgba(255, 255, 255, 0.8); }
.edit-btn-icon svg { width: 100%; height: 100%; stroke: var(--text-color); }

/* Choosing a product to sell ("Select a Product"): the count, the worth and the settings are not needed here, and each card has a teal line that keeps moving around its edge.
   The line is a bright arc on a spinning layer behind the card (only that layer turns, so it stays light even with many cards); a plain card-coloured layer covers all but the edge. */
.selection-mode .product-header { display: none; }
.selection-mode .search-settings-btn { display: none !important; }
.selection-mode .search-field #product-search-input { padding-right: 14px; }
.selection-mode .product-card { cursor: pointer; padding: 2px; isolation: isolate; }
.selection-mode .product-card::before { content: ''; position: absolute; z-index: 0; left: -50%; top: -50%; width: 200%; height: 200%; pointer-events: none; will-change: transform;
    background: conic-gradient(from 0deg, rgba(0, 140, 149, 0.16) 0deg, rgba(0, 140, 149, 0.16) 140deg, var(--primary-color) 345deg, rgba(0, 140, 149, 0.16) 360deg);
    animation: card-line-spin 3.2s linear infinite; }
.selection-mode .product-card::after { content: ''; position: absolute; z-index: 1; inset: 2px; border-radius: calc(var(--border-radius) - 2px); background: var(--surface-color); pointer-events: none; }
.selection-mode .product-card-image-wrapper, .selection-mode .product-card-info { position: relative; z-index: 2; }
@keyframes card-line-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .selection-mode .product-card::before { animation: none; background: var(--primary-color); } }
.selection-mode .product-card:hover { transform: scale(1.03); box-shadow: 0 6px 15px rgba(0,0,0,0.12); }
.selection-mode .edit-btn-icon { display: none !important; }

/* === Wholesaler View Styles === */
#stock-levels-view .page-actions-header {
    justify-content: space-between;
}
#stock-levels-view .product-filter-tabs {
    padding: 0;
    flex-grow: 1;
    justify-content: flex-start;
}
#retailer-stock-view .card, #salespeople-view .card {
    margin-bottom: 16px;
    box-shadow: var(--box-shadow);
}
.retailer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    background-color: #f9f9f9;
}
.retailer-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.retailer-call-btn, .info-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 4px;
    cursor: pointer;
    line-height: 0;
    margin-left: 8px;
    flex-shrink: 0;
}
.delete-retailer-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    padding: 4px;
    cursor: pointer;
    margin-left: 8px;
}
.delete-retailer-btn svg {
    width: 20px;
    height: 20px;
}
#retailer-stock-view .retailer-product-list {
    padding: 8px 16px;
}
.retailer-product-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 4px 0;
}
.retailer-product-item:last-child {
    border-bottom: none;
}
.retailer-product-item.out-of-stock {
    background-color: #ffebee;
}
.retailer-product-item.restock-now {
    background-color: #fff8e1;
}
/* === Credit card (Customers tab): who, what, how much is still owed, and one clear action === */
#retailer-stock-view .credit-card, #retailer-stock-view .stock-card { padding: 14px 16px 14px; overflow: hidden; }
#retailer-stock-view .credit-card { border-left: 4px solid var(--danger-color); }
#retailer-stock-view .stock-card { border-left: 4px solid var(--primary-color); }
.credit-top { display: flex; align-items: center; gap: 10px; }
.credit-who { flex: 1; min-width: 0; }
.credit-who h4 { display: flex; flex-wrap: nowrap; align-items: center; column-gap: 8px; row-gap: 3px; margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.credit-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* a long name ends in "…" on its line */
.credit-pill { flex: none; padding: 2px 8px; border-radius: 999px; background: rgba(208, 2, 27, 0.1); color: var(--danger-color); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.credit-when { margin: 2px 0 0; font-size: 0.78rem; color: var(--text-light); }
.credit-when .retailer-status { margin: 0; font-size: inherit; }
.stock-pill { background: rgba(0, 140, 149, 0.1); color: var(--primary-color); }
.stock-card .credit-stock { margin-top: 12px; padding-top: 6px; }
.credit-card .retailer-call-btn, .stock-card .retailer-call-btn { flex: none; margin: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #e6f4f5; }
.credit-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 14px; font-size: 0.9rem; }
.credit-item-name { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.credit-item-qty { flex: none; color: var(--text-light); font-size: 0.82rem; }
.credit-owes { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.credit-owes span { font-size: 0.82rem; color: var(--text-light); }
.credit-owes strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; color: var(--danger-color); font-variant-numeric: tabular-nums; }
.credit-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: rgba(208, 2, 27, 0.12); overflow: hidden; }
.credit-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--primary-color); }
.credit-paid { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 0.76rem; color: var(--text-light); font-variant-numeric: tabular-nums; }
.credit-stock { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border-color); }
.credit-stock-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.credit-stock-head h5 { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-light); }
.credit-stock-head .retailer-status { margin: 0; font-size: 0.72rem; }
.credit-stock .retailer-product-item { padding: 6px 8px; font-size: 0.85rem; }
.delete-credit-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; margin-top: 14px; border: 1.5px solid var(--primary-color); border-radius: 10px; background: transparent; color: var(--primary-color); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.delete-credit-btn:active { background: #e6f4f5; }
.stock-card .delete-retailer-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; margin: 12px 0 0; padding: 0; border: 1.5px solid var(--border-color); border-radius: 10px; background: transparent; color: var(--danger-color); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.stock-card .delete-retailer-btn svg { width: 16px; height: 16px; }
.stock-card .delete-retailer-btn:active { background: #ffebee; }

.card-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Internet Notice on Stock Levels Screen. The offline banner now says it, so this is kept only for its room (it keeps the tabs from sitting under the banner). */
.internet-notice {
    visibility: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 0 20px 16px;
    background-color: #fffbe6; /* Light yellow */
    color: #8a6d3b; /* Dark yellow text */
    border: 1px solid #ffeeba; /* Yellow border */
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
}
.internet-notice svg {
    flex-shrink: 0;
    stroke: #8a6d3b;
}

/* Online Status on Retailer Cards */
.retailer-status {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 2px;
}
.retailer-status.online { color: #28a745; } /* Green */
.retailer-status.away { color: #fd7e14; } /* Orange */
.retailer-status.offline { color: var(--text-light); } /* Grey */


/* === Camera View === */
.camera-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; z-index: 200; justify-content: center; align-items: center; }
#camera-feed { width: 100%; height: 100%; object-fit: cover; }
.camera-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; }
.scan-box { width: 80vw; height: 40vw; max-width: 400px; max-height: 200px; border: 3px solid rgba(255, 255, 255, 0.8); border-radius: var(--border-radius); box-shadow: 0 0 0 2000px rgba(0,0,0,0.5); position: relative; overflow: hidden; }
.scan-box::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--danger-color), transparent); animation: scan 1.5s infinite ease-in-out; }
.scan-box::before { content: ''; position: absolute; bottom: 0; left: 0; height: 5px; width: 0; background-color: var(--primary-color); animation: scan-timer 3s linear forwards; }
@keyframes scan { 0% { top: 0; } 50% { top: calc(100% - 3px); } 100% { top: 0; } }
@keyframes scan-timer { from { width: 0%; } to { width: 100%; } }
#scan-feedback { margin-top: 24px; font-size: 1.2rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.scan-timer-display { font-size: 2.5rem; font-weight: bold; margin-top: 20px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.cancel-scan-btn { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); width: auto; padding: 12px 24px; }

/* === Modals === */
.modal-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 300; padding: 20px; }
.modal-content { position: relative; background-color: var(--surface-color); padding: 24px; border-radius: 16px; width: 100%; max-width: 400px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); animation: modal-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; }
/* Text on modals and popups can't be selected or long-press copied; fields people type into stay editable */
.modal-container, .celebration-overlay { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.modal-container input, .modal-container textarea { user-select: text; -webkit-user-select: text; }
.modal-content h2 { text-align: center; margin-bottom: 16px; font-size: clamp(1.2rem, 4vw, 1.4rem); }
.modal-content p { text-align: center; margin-bottom: 20px; color: var(--text-light); line-height: 1.5; }
.modal-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.modal-actions-inline { display: flex; flex-direction: row; gap: 12px; }
.modal-actions .btn { flex-grow: 1; }
.modal-actions-inline .btn-secondary { flex-basis: 33.33%; }
.modal-actions-inline .btn-primary { flex-basis: 66.67%; }

#confirm-picture-modal img { width: 100%; max-height: 250px; object-fit: contain; border-radius: var(--border-radius); margin-bottom: 10px; }

#confirm-sale-modal {
    padding-bottom: 0;
    justify-content: flex-end;
}

#confirm-sale-modal .modal-scroll-content {
    overflow-y: auto;
    padding: 0 24px;
    margin: 0 -24px;
}

.quantity-stepper { display: grid; grid-template-columns: 2fr 6fr 2fr; gap: 10px; width: 100%; align-items: stretch; }
.quantity-stepper .btn { width: 100%; padding: 0; font-size: 1.4rem; line-height: 1; }
/* + / - can be held down to repeat, so no scrolling, text selection or long-press menu may start from them */
.quantity-stepper .btn { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.quantity-stepper input { width: 100%; min-width: 0; text-align: center; font-weight: 600; }
#confirm-sale-modal .sale-item-details { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
#confirm-sale-modal img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
#confirm-sale-modal h3 { font-size: clamp(1.1rem, 3.5vw, 1.2rem); margin: 0; }
#confirm-sale-modal p { color: var(--text-light); margin: 0; }
.sale-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.sale-total p { font-size: clamp(0.9rem, 2.5vw, 1rem); color: var(--text-light); }
.sale-total h2 { margin: 0; color: var(--primary-color); font-size: clamp(1.4rem, 4vw, 1.6rem); }

#confirm-sale-modal .modal-actions {
    margin-top: auto;
    padding: 24px;
    margin: 0 -24px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}
.salesperson-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 16px;
}

.salesperson-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

#salesperson-label.checked {
    color: var(--danger-color);
    font-size: 0.9rem;
    font-weight: 600;
}

/* --- FIX: Make confirm-log-modal content scrollable --- */
#confirm-log-modal h2 {
    flex-shrink: 0; /* Keep title at top */
}

#confirm-log-content {
    flex-grow: 1; /* Allow content to fill space */
    overflow-y: auto; /* Add scrollbar if content overflows */
    min-height: 0; /* Allow shrinking */
}

#confirm-log-modal .modal-actions {
    margin-top: 16px;
    flex-shrink: 0; /* Keep actions at bottom */
}
/* --- END FIX --- */

.delete-btn-icon { position: absolute; top: 16px; right: 16px; z-index: 5; background: #fee; border: 1px solid var(--danger-color); border-radius: 50%; width: 32px; height: 32px; padding: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.delete-btn-icon:hover { background: var(--danger-color); }
.delete-btn-icon svg { stroke: var(--danger-color); transition: stroke 0.2s; }
.delete-btn-icon:hover svg { stroke: white; }
@keyframes modal-pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }


@keyframes modal-pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Offline notice for modals */
.offline-notice {
    display: none; /* Hidden by default */
    padding: 10px 16px;
    margin-bottom: 16px;
    background-color: #fffbe6; /* Light yellow */
    color: #8a6d3b; /* Dark yellow text */
    border: 1px solid #ffeeba; /* Yellow border */
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}



/* Profile Modal: a title, the airtime card, a plain list of details, two buttons. Small text stays light. */
.profile-modal { padding: 10px 20px 20px; }
/* Nothing in the profile shrinks to fit a short screen (the open Profile used to be squashed, its Logout cut off inside it): the profile scrolls instead */
.profile-modal > * { flex-shrink: 0; }
.profile-bar { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; margin: 0 -10px 16px; }
.profile-bar-gap { width: 36px; }
.profile-icon-btn { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #9aa2a9; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.profile-icon-btn:active { background: #f0f0f0; color: var(--primary-color); }
.modal-content h2.profile-title { margin: 0; text-align: center; font-size: 1.1rem; font-weight: 700; color: var(--text-color); }

.scan-tracker-container { padding: 20px 18px 18px; border-radius: 16px; background: #f5f8f8; text-align: left; }
.airtime-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.airtime-title { font-size: 0.95rem; font-weight: 700; color: var(--text-color); }
.scan-progress-bar { width: 100%; height: 8px; background-color: #e2eaea; border-radius: 4px; overflow: hidden; }
.scan-progress { width: 0%; height: 100%; background: var(--primary-color); border-radius: 4px; transition: width 0.5s ease-out; }
.scan-reward.is-link { cursor: pointer; justify-content: space-between; }
/* A message that goes somewhere when tapped: a round teal arrow that nudges to the right (twice, then a pause) so it is plain that it can be tapped */
.scan-reward.is-link::after {
    content: ""; flex: none; width: 28px; height: 28px; margin-left: 10px; border-radius: 50%;
    background: var(--primary-color) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>") 55% center / 15px no-repeat;
    box-shadow: 0 2px 8px rgba(0, 140, 149, 0.35); animation: nudge-arrow 1.8s ease-in-out 0.5s infinite;
}
.scan-reward.is-link:active::after { transform: scale(0.9); animation: none; }
@keyframes nudge-arrow { 0%, 44%, 100% { transform: none; } 12% { transform: translateX(6px); } 24% { transform: none; } 34% { transform: translateX(4px); } }
.scan-reward { display: flex; align-items: center; min-height: 2.8em; margin-top: 18px; font-size: 1rem; font-weight: 700; line-height: 1.4; color: var(--primary-color); animation: reward-in 0.45s ease-out; }
@keyframes reward-in {
    0% { transform: translateY(6px) scale(0.96); opacity: 0; }
    100% { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .scan-reward, .scan-reward.is-link::after { animation: none; } }

/* Phone alerts: a quiet line, small grey words and a small switch, no box (only where the phone can show alerts), so the Assistant and the
   Profile keep the room. The whole line can be tapped. A second tiny line only when alerts are blocked in the phone's settings. */
.profile-alerts { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 5px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.profile-alerts[hidden] { display: none; }
.profile-alerts:not([hidden]) + .profile-account { margin-top: 6px; } /* (the two sit as a pair) */
.profile-alerts-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.profile-alerts-title { font-size: 0.76rem; font-weight: 500; color: #9aa2a9; }
.profile-alerts-note { font-size: 0.68rem; line-height: 1.3; color: #b0603a; }
.profile-alerts-note[hidden] { display: none; }
.pf-switch { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 22px; height: 13px; margin: 0; border-radius: 7px; background: #d5dddf; cursor: pointer; transition: background-color 0.2s; }
.pf-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.pf-switch:checked { background: var(--primary-color); }
.pf-switch:checked::after { transform: translateX(9px); }
.pf-switch:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .pf-switch, .pf-switch::after { transition: none; } }

/* The account details fold away (closed each time the profile opens); Logout lives inside */
.profile-account { margin-top: 16px; border: 1px solid #e8edee; border-radius: 14px; overflow: hidden; }
.profile-account-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 0; background: transparent; font: inherit; text-align: left; color: var(--text-color); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.profile-account-toggle:active { background: #f5f8f8; }
.profile-account-title { flex: none; font-size: 0.92rem; font-weight: 600; }
.profile-account-name { flex: 1; min-width: 0; margin-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; color: #8c9399; text-align: right; }
.profile-chevron { flex: none; color: #9aa2a9; transition: transform 0.25s ease; }
.profile-account.open .profile-chevron { transform: rotate(180deg); }
.profile-account-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s ease; }
.profile-account.open .profile-account-panel { grid-template-rows: 1fr; }
.profile-account-body { min-height: 0; overflow: hidden; padding: 0 16px; }
/* (open, it stays short: tight rows and a slimmer Logout) */
.profile-account.open .profile-account-body { padding-bottom: 12px; }
.profile-details { display: flex; flex-direction: column; margin: 0 0 10px; border-top: 1px solid #eef0f1; }
.profile-item { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 6px 0; border-top: 1px solid #eef0f1; }
.profile-item:first-child { border-top: 0; }
.profile-label { flex: none; font-size: 0.8rem; font-weight: 400; color: #8c9399; }
.profile-value { min-width: 0; font-size: 0.88rem; font-weight: 600; color: var(--text-color); text-align: right; overflow-wrap: anywhere; }
#logout-btn { width: 100%; min-height: 38px; padding: 7px 12px; font-size: 0.9rem; font-weight: 600; background: transparent; border: 1.5px solid rgba(208, 2, 27, 0.35); color: var(--danger-color); }
#logout-btn:active { background: #ffebee; }
@media (prefers-reduced-motion: reduce) { .profile-account-panel, .profile-chevron, .profile-actions { transition: none; } }

/* Cancel and Get help sit lower while the account section is folded, so the card does not feel cramped */
.profile-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 32px; transition: margin-top 0.28s ease; }
.profile-modal.account-open .profile-actions { margin-top: 14px; }
.profile-actions .btn { flex: none; min-height: 44px; padding: 10px 14px; font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; justify-content: center; text-decoration: none; }
#get-help-btn { background: var(--primary-color); color: #fff; }
#get-help-btn:active { background: var(--primary-dark); }

/* Receipt & Log Modals */
.receipt-modal {
    padding: 0;
    max-width: 480px;
    max-height: min(90vh, 90dvh);
    overflow: hidden;           /* only the paper area scrolls, never the buttons */
    background: #eef1f3;
}
.receipt-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 20px 10px; flex-shrink: 0; }
.receipt-modal-head h2 { margin: 0; text-align: left; font-size: 1.1rem; }
.receipt-count-chip { font-size: 0.72rem; font-weight: 600; color: var(--primary-dark); background: #dcefef; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.receipt-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 16px 8px 20px;
    /* soft fades appear only while there is more to scroll */
    background:
        linear-gradient(#eef1f3 30%, rgba(238,241,243,0)) center top,
        linear-gradient(rgba(238,241,243,0), #eef1f3 70%) center bottom,
        radial-gradient(farthest-side at 50% 0, rgba(0,0,0,0.16), rgba(0,0,0,0)) center top,
        radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,0.16), rgba(0,0,0,0)) center bottom;
    background-repeat: no-repeat;
    background-size: 100% 28px, 100% 28px, 100% 10px, 100% 10px;
    background-attachment: local, local, scroll, scroll;
}
.receipt-paper {
    position: relative;
    background: #fff;
    padding: 22px 16px 20px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    line-height: 1.4;
    color: #1d1d1d;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    font-variant-numeric: tabular-nums;
}
/* torn paper edges (outside the paper box, so they are not part of the shared image) */
.receipt-paper::before, .receipt-paper::after {
    content: ''; position: absolute; left: 0; right: 0; height: 8px;
    background-repeat: repeat-x; background-size: 12px 8px;
}
.receipt-paper::before { top: -7px; background-image: linear-gradient(135deg, transparent 50%, #fff 50%), linear-gradient(225deg, transparent 50%, #fff 50%); background-size: 6px 8px; background-position: 0 0, 6px 0; }
.receipt-paper::after { bottom: -7px; background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(315deg, transparent 50%, #fff 50%); background-size: 6px 8px; background-position: 0 0, 6px 0; }

/* Type scale: store name > amounts > item names > everything else (small and grey) */
.receipt-header { text-align: center; padding-bottom: 14px; }
.receipt-header .rc-store { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.25; overflow-wrap: anywhere; }
.receipt-header .rc-meta { font-size: 0.72rem; color: #777; margin-top: 4px; overflow-wrap: anywhere; }
.rc-info { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-top: 1px dashed #bbb; border-bottom: 1px dashed #bbb; }
.rc-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 0.74rem; color: #888; }
.rc-kv span:last-child { min-width: 0; text-align: right; color: #333; font-weight: 500; overflow-wrap: anywhere; }
.rc-cols { display: flex; justify-content: space-between; margin-top: 14px; padding-bottom: 5px; border-bottom: 1.5px solid #1d1d1d; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #888; }
/* every line item is a block of its own, divided by a hairline */
.rc-item { padding: 10px 0; }
.rc-item + .rc-item { border-top: 1px solid #ececec; }
.rc-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rc-item-name { flex: 1 1 auto; min-width: 0; font-size: 0.92rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto; }
.rc-amt { flex: none; font-size: 0.92rem; font-weight: 600; white-space: nowrap; }
.rc-calc { color: #777; font-size: 0.76rem; margin-top: 2px; }
.rc-sub { display: flex; justify-content: space-between; gap: 12px; font-size: 0.74rem; color: #777; margin-top: 2px; }
.rc-sub.credit { color: #b3261e; }
.rc-summary { padding-top: 10px; border-top: 1.5px solid #1d1d1d; }
.rc-sum { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; font-size: 0.8rem; }
.rc-sum.muted { color: #666; }
.rc-sum.discount { color: #1c7c54; }
.rc-sum.credit { color: #b3261e; }
.rc-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 8px; font-size: 1.25rem; font-weight: 700; }
.rc-total span:first-child { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #555; }
.rc-balance { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 12px; padding: 8px 10px; border: 1px dashed #b3261e; border-radius: 6px; color: #b3261e; font-size: 0.9rem; font-weight: 700; }
.rc-balance span:first-child { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }
.receipt-footer { margin-top: 16px; padding-top: 14px; border-top: 1px dashed #bbb; text-align: center; color: #777; font-size: 0.76rem; }
.receipt-footer p { margin: 0; text-align: center; color: inherit; line-height: 1.5; }
.receipt-footer .rc-thanks { font-size: 0.82rem; font-weight: 600; color: #333; }
.receipt-footer .rc-stamp { margin-top: 6px; font-size: 0.66rem; color: #999; white-space: nowrap; }
.receipt-footer .rc-brand { font-size: 0.6rem; color: #aaa; margin-top: 10px; letter-spacing: 0.12em; text-transform: uppercase; }

/* Phones: let the receipt use nearly the full screen width */
@media (max-width: 520px) {
    #receipt-modal, #incoming-transfer-modal { width: calc(100% + 16px); margin: 0 -8px; }
}

.receipt-modal-actions { flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 16px; background: var(--surface-color); box-shadow: 0 -4px 12px rgba(0,0,0,0.08); }
.receipt-modal-row { display: flex; gap: 10px; }
.receipt-modal-row .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }
.receipt-modal-actions .btn-primary { width: 100%; }
/* On the receipt, Close / Print / Share are slimmer, to make room for the bigger Transfer items label above them */
#receipt-modal .receipt-modal-row .btn { min-height: 40px; padding-top: 9px; padding-bottom: 9px; font-size: clamp(0.8rem, 2.3vw, 0.9rem); }

/* === Transfer modal === */
/* max-height follows the modal layer, which app.js shrinks to the area above the on-screen keyboard */
.transfer-modal { max-height: 100%; padding: 20px; }
.transfer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.transfer-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #e6f4f5; color: var(--primary-color); display: flex; align-items: center; justify-content: center; }
.transfer-head h2 { margin: 0; text-align: left; font-size: 1.15rem; }
.transfer-head .transfer-summary { margin: 2px 0 0; text-align: left; font-size: 0.8rem; line-height: 1.3; color: var(--text-light); }
.transfer-label { margin-bottom: 8px; font-size: 0.8rem; font-weight: 600; color: var(--text-light); }
.transfer-input-wrap { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px; border: 1.5px solid var(--border-color); border-radius: 14px; background: #fafafa; color: var(--text-light); transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s; }
.transfer-input-wrap:focus-within { border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 3px rgba(0, 140, 149, 0.15); }
.transfer-input-wrap svg { flex: none; }
.transfer-input-wrap input { flex: 1; min-width: 0; height: 100%; padding: 0; border: none; outline: none; background: transparent; font-size: 1.25rem; font-weight: 600; letter-spacing: 0.04em; color: var(--text-color); font-variant-numeric: tabular-nums; }
.transfer-input-wrap input::placeholder { color: #c8c8c8; font-weight: 500; }
.transfer-digit-count { flex: none; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.transfer-input-wrap.complete .transfer-digit-count { color: var(--primary-color); font-weight: 600; }
.transfer-message { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.85rem; line-height: 1.35; color: var(--text-light); }
.transfer-message.error { color: var(--danger-color); cursor: pointer; }
.transfer-spinner { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #d9dde0; border-top-color: var(--primary-color); animation: spin 0.8s linear infinite; }
.transfer-message.error .transfer-spinner { display: none; }
.transfer-recipient { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border: 1px solid #cfe9ea; border-radius: 14px; background: #f1f9f9; animation: slideDown 0.25s ease-out; }
.transfer-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-color); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.transfer-recipient-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.transfer-recipient-text strong { font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; }
.transfer-recipient-text span { font-size: 0.8rem; color: var(--text-light); overflow-wrap: anywhere; }
.transfer-check { flex: none; color: var(--primary-color); }
.transfer-modal .modal-actions { margin-top: 22px; }

/* === PIN check === */
.pin-modal { max-width: 340px; text-align: center; }
.pin-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: #e6f4f5; color: var(--primary-color); display: flex; align-items: center; justify-content: center; }
.pin-modal h2 { margin-bottom: 6px; overflow-wrap: anywhere; }
.pin-modal #pin-confirm-text { margin-bottom: 16px; font-size: 0.9rem; }
.pin-input-wrap input { width: 100%; height: 54px; padding: 0 0 0 0.5em; border: 1.5px solid #b4bec7; border-radius: 12px; background: #fff; color: #1d1d1d; text-align: center; font-size: 1.5rem; font-weight: 700; letter-spacing: 0.5em; }
.pin-input-wrap input::placeholder { color: #c5cbd1; font-weight: 400; }
.pin-input-wrap input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.pin-modal .pin-error { min-height: 1.3em; margin: 8px 0 0; font-size: 0.82rem; line-height: 1.3; color: var(--danger-color); }
.pin-modal .modal-actions { margin-top: 12px; }

#qr-code-modal { text-align: center; }
#qr-canvas { width: 90% !important; height: auto !important; max-width: 300px; margin: 0 auto; }
.qr-help-text { font-size: 0.9rem; color: var(--text-light); margin-top: 16px; }
/* Accept-transfer popup: the sender's receipt, with a small picture beside each product */
/* Incoming transfer: when it was sent, a small pill under the sender ("Sent today · 10:21 AM"): seen, but quiet */
.receipt-header .rc-sent { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 3px 10px; border-radius: 999px; background: #eef6f7; color: var(--primary-dark, #00727a); font-size: 0.72rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.receipt-header .rc-sent svg { flex: none; }
#incoming-transfer-content .receipt-header { border-bottom: 1px dashed #bbb; }
.rc-from { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #888; margin-bottom: 3px; }
/* "FROM" and when it was sent, on one line above the sender's name */
.receipt-header .rc-from-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 4px; }
.receipt-header .rc-from-row .rc-from { margin-bottom: 0; }
.receipt-header .rc-from-row .rc-sent { margin-top: 0; padding: 2px 9px; }
.rc-item.has-thumb { display: flex; align-items: flex-start; gap: 10px; }
.rc-item-main { flex: 1 1 auto; min-width: 0; }
.rc-thumb { flex: none; width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #eef1f3; }
.receipt-paper .rc-note { margin: 14px 0 0; font-size: 0.74rem; line-height: 1.4; color: #888; text-align: center; }
.receipt-modal-row .btn-primary { flex-grow: 2; }

/* Print Styles */
@media print {
    body > *:not(#modal-container) {
        display: none !important;
    }
    .modal-container, #receipt-modal {
        display: block !important;
        position: static;
        background: white;
        width: 100%;
        height: auto;
        padding: 0;
        overflow: visible;
    }
    #receipt-modal {
        max-width: 100%;
        max-height: none;
        box-shadow: none;
        border: none;
        padding: 0;
    }
    .modal-actions, .receipt-modal-actions, .receipt-modal-head {
        display: none !important;
    }
    .receipt-modal, .receipt-scroll {
        overflow: visible !important;
        max-height: none !important;
        background: white !important;
    }
    .receipt-scroll { padding: 0 !important; }
    .receipt-paper::before, .receipt-paper::after { display: none; }
    .receipt-paper {
        border: none;
        box-shadow: none;
        font-size: 11pt;
        color: black;
        max-width: 80mm;
    }
    .receipt-paper * {
        color: black;
    }
}


/* Responsiveness Tweaks */
@media (max-width: 360px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 12px; padding: 12px; }
    .page { padding-bottom: 75px; }
    .modal-content:not(.receipt-modal) { padding: 16px; }
}

/* Celebration popup (transfer accepted / products received) */
.celebration-overlay {
    position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.25s ease;
}
.celebration-overlay.show { opacity: 1; }
.celebration-card {
    position: relative; z-index: 1; width: 100%; max-width: 340px; text-align: center;
    background: var(--surface-color); border-radius: 20px; padding: 28px 22px 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.85); transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.celebration-overlay.show .celebration-card { transform: scale(1); }
.celebration-icon { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.celebration-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--primary-color); }
.celebration-name { font-size: 1.25rem; font-weight: 700; color: var(--text-color); margin-top: 6px; word-break: break-word; }
.celebration-sub { font-size: 0.9rem; color: var(--text-light); margin-top: 2px; word-break: break-word; }
.celebration-card p.celebration-msg { font-size: 0.88rem; line-height: 1.5; color: var(--text-color); margin: 14px 0 0; }
.celebration-card .btn { margin-top: 20px; }
#confetti-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; } /* (in front of the card; taps go through to its buttons) */
#torch-btn.torch-on { background: rgba(255, 214, 10, 0.9) !important; color: #222 !important; }

/* Stock visibility switch (products received by transfer) */
.stock-visibility-row { display: flex; align-items: center; justify-content: flex-start; gap: 7px; margin: 16px 0 0; font-size: 0.66rem; line-height: 1.35; color: var(--text-light); }
#product-name-group { margin-top: 22px; } /* the gap above Product name that the (removed) hidden Scan Barcode block used to give: same as before, with or without the lines above it */
.stock-visibility-row > span { flex: 1; min-width: 0; text-wrap: balance; } /* (on a narrow phone the line breaks evenly, not with "on/off" left alone) */
.mini-switch { position: relative; display: inline-block; width: 28px; height: 15px; flex-shrink: 0; }
.mini-switch::after { content: ''; position: absolute; inset: -9px -6px; } /* (a short switch, but still easy to tap: the area around it takes the tap too) */
.mini-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.mini-switch-slider { position: absolute; inset: 0; background: #ccc; border-radius: 999px; cursor: pointer; transition: background-color 0.2s; }
.mini-switch-slider::before { content: ''; position: absolute; width: 11px; height: 11px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.2s; }
.mini-switch input:checked + .mini-switch-slider { background: var(--primary-color); }
.mini-switch input:checked + .mini-switch-slider::before { transform: translateX(13px); }
.mini-switch input:focus-visible + .mini-switch-slider { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* Gentle nudge towards the "+" button */
@keyframes attention-pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 140, 149, 0.55); transform: scale(1); }
    60% { box-shadow: 0 0 0 16px rgba(0, 140, 149, 0); transform: scale(1.08); }
    100% { box-shadow: 0 0 0 0 rgba(0, 140, 149, 0); transform: scale(1); }
}
.attention-pulse { animation: attention-pulse 1.1s ease-out 3; }

/* === Sign-up: WhatsApp number check === */
#onboarding-step-1 { position: relative; }
#phone-entry, .wa-verify { width: 100%; max-width: 340px; }
#phone-entry[hidden], #signup-intro[hidden], #signup-privacy[hidden], .wa-verify[hidden], .wa-verify [hidden], .signup-install[hidden] { display: none !important; }
.wa-verify { display: flex; flex-direction: column; align-items: stretch; gap: 14px; text-align: center; }
.onboarding-content .wa-verify h2 { margin: 0; }
.onboarding-content .wa-text { margin: 0 auto; max-width: 300px; }
.onboarding-content .wa-text b { color: var(--text-color); white-space: nowrap; }
.btn-whatsapp { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; background: #25D366; color: #fff; text-decoration: none; }
.btn-whatsapp:active { background: #1ebe5a; }
.btn-whatsapp.disabled { opacity: 0.4; pointer-events: none; }
.onboarding-content .wa-status { margin: 0; max-width: none; font-size: 0.85rem; }
.wa-status.ok { color: #138a5e; font-weight: 600; }
.wa-link-btn { align-self: center; background: none; border: 0; padding: 6px; color: var(--primary-color); font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.signup-install { top: 16px; transform: none; z-index: 2; }

/* === Sign-up and login fields: the title sits on the border line, like Create Account === */
.onboarding-content .form-group.outlined { position: relative; margin-bottom: 18px; }
.form-group.outlined > label {
    position: absolute; z-index: 1; top: -8px; left: 11px; max-width: calc(100% - 22px); margin: 0; padding: 0 5px;
    background: #fff; color: #5b6670; font-size: 0.72rem; font-weight: 600; line-height: 1.1; letter-spacing: 0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: color 0.15s;
}
.form-group.outlined:focus-within > label { color: var(--primary-color); }
.form-group.outlined input { height: 52px; padding: 0 14px; border: 1.5px solid #b4bec7; border-radius: 12px; background-color: #fff; color: #1d1d1d; font-size: 1.05rem; }
.form-group.outlined input::placeholder { color: #a6adb4; }
.form-group.outlined input:focus { outline: none; background-color: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.form-group.outlined .input-wrapper input { padding-right: 84px; letter-spacing: 0.3em; font-weight: 600; }
.form-group.outlined .input-wrapper input::placeholder { letter-spacing: 0.3em; font-weight: 400; }
.login-links { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 14px; }
.wa-link-btn.muted-link { color: var(--text-light); font-weight: 500; }
.onboarding-content .newpin-note { margin: 14px 0 0; font-size: 0.82rem; }
.onboarding-content p.newpin-match { margin: 6px 2px 0; font-size: 0.82rem; line-height: 1.3; font-weight: 600; text-align: left; color: var(--danger-color); }
.onboarding-content p.newpin-match[hidden] { display: none; }
.onboarding-content p b { color: var(--text-color); white-space: nowrap; }

/* === One look for every field (search boxes excepted): the title sits on the border line === */
.modal-content .form-group { position: relative; margin-bottom: 22px; }
.modal-content .form-group > label,
.discount-input-container > label,
.transfer-input-wrap .transfer-label,
.pin-input-wrap label {
    position: absolute; z-index: 1; top: -8px; left: 11px; max-width: calc(100% - 22px); margin: 0; padding: 0 5px;
    background: #fff; color: #5b6670; font-size: 0.72rem; font-weight: 600; line-height: 1.1; letter-spacing: 0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: color 0.15s;
}
.modal-content .form-group:focus-within > label,
.discount-input-container:focus-within > label,
.transfer-input-wrap:focus-within .transfer-label,
.pin-input-wrap:focus-within label { color: var(--primary-color); }

.modal-content .form-group input,
.modal-content .form-group select,
.input-with-prefix input {
    height: 50px; padding: 0 14px; border: 1.5px solid #b4bec7; border-radius: 12px;
    background-color: #fff; color: #1d1d1d; font-size: 1rem;
}
.modal-content .form-group input::placeholder, .input-with-prefix input::placeholder { color: #a6adb4; }
.modal-content .form-group input:focus,
.modal-content .form-group select:focus,
.input-with-prefix input:focus { outline: none; background-color: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.modal-content .form-group select {
    appearance: none; -webkit-appearance: none; padding: 0 30px 0 12px; cursor: pointer; text-overflow: ellipsis;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23556' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
}
.modal-content .form-row { align-items: flex-start; }
#product-form .btn-icon { min-height: 50px; margin-bottom: 22px; border-radius: 12px; }

/* The product box: a scrolling top (title, barcode, fields) and a footer (Cancel, Save) that never scrolls, so with the phone's keypad up the title and the
   barcode scroll out of the way and both buttons stay in view. Without the keypad the box looks exactly as it did: the same space all round (24 px, 16 px on a
   very short screen), and 46 px between the last field and the buttons (22 of the field's own + 12 + 12 here). A soft edge shows above the footer while
   something is hidden beneath it (the `more` class, set by _watchProductScroll in app.js). */
#product-form-modal.pf-modal { padding: 0; overflow: hidden; }
#product-form-modal .pf-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: 100%; }
#product-form-modal .pf-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 24px 12px; }
#product-form-modal .pf-body { display: flow-root; }
#product-form-modal .pf-footer { flex: none; margin: 0; padding: 12px 24px 24px; background: var(--surface-color); transition: box-shadow 0.15s ease; }
#product-form-modal .pf-footer.more { box-shadow: 0 -6px 12px -8px rgba(0, 0, 0, 0.18); }
@media (max-width: 360px) { /* narrow phones: 16 px all round, as every box has */
    #product-form-modal .pf-scroll { padding: 16px 16px 12px; }
    #product-form-modal .pf-footer { padding: 12px 16px 16px; }
}
@media (max-height: 520px) {
    #product-form-modal .pf-scroll { padding-top: 16px; }
    #product-form-modal .pf-footer { padding-bottom: 16px; }
}

/* quantity: one box with − and + inside, title centred on its border */
.modal-content .quantity-stepper {
    gap: 0; height: 56px; border: 1.5px solid #b4bec7; border-radius: 12px; overflow: hidden; background: #fff;
}
.modal-content .quantity-stepper:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.modal-content .quantity-stepper .btn { height: 100%; min-height: 0; border-radius: 0; background: #f2f4f6; color: var(--text-color); }
.modal-content .quantity-stepper .btn:active { background: #e3e7eb; }
.modal-content .form-group .quantity-stepper input {
    height: 100%; border: 0; border-radius: 0; box-shadow: none; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.modal-content .form-group > #sale-quantity-label { left: 50%; transform: translateX(-50%); }

/* discount / part payment */
.discount-input-container { position: relative; margin-top: 18px; }
.input-with-prefix input { padding-left: 32px !important; }
.input-with-contact-wrapper.credit-mode #select-contact-btn { height: 50px; border-radius: 12px; }

/* who a transfer goes to */
.transfer-input-wrap { position: relative; margin-top: 8px; border-color: #b4bec7; background: #fff; }
.transfer-input-wrap:focus-within { box-shadow: 0 0 0 1px var(--primary-color); }
/* the number's box, with a small "add customer" button beside it that opens the phone's contacts (shown only where the browser can) */
.transfer-phone-row { display: flex; align-items: flex-end; gap: 10px; }
.transfer-phone-row .transfer-input-wrap { flex: 1; min-width: 0; }
.transfer-contact-btn { flex: none; display: flex; align-items: center; justify-content: center; width: 48px; height: 56px; padding: 0; border: 1.5px solid #b4bec7; border-radius: 14px; background: #fff; color: var(--primary-color); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color 0.15s, border-color 0.15s; }
.transfer-phone-row.has-contacts .transfer-input-wrap > svg { display: none; } /* the button beside the box says "phone book": the box needs the room for all 11 digits */
@media (max-width: 359px) { .transfer-input-wrap input { font-size: 1.05rem; letter-spacing: 0.02em; } }
.transfer-contact-btn[hidden] { display: none; }
.transfer-contact-btn:active { background: rgba(0, 140, 149, 0.1); border-color: var(--primary-color); }

/* PIN check */
.pin-input-wrap { position: relative; margin-top: 6px; }

/* === Modals: one shape, and always above the keyboard (the layer is sized to the visible screen) === */
.modal-content { max-height: 100%; }
.modal-content h2 { font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.modal-content > p, .modal-scroll-content > p { font-size: 0.95rem; }
.modal-actions-inline .btn { min-width: 0; }

/* === Messages and questions: our own pop-up instead of the browser's, above any open modal === */
.dialog-layer { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,0.6); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.update-layer { z-index: 1300; } /* above every other message: it is the one thing that must be answered */
.dialog-card { max-width: 340px; }
.dialog-card h2[hidden], .dialog-card .btn[hidden] { display: none; }
.dialog-card h2 { margin-bottom: 10px; }
.dialog-card p { margin-bottom: 0; font-size: 1rem; color: var(--text-color); overflow-wrap: anywhere; }
.dialog-card .modal-actions { margin-top: 22px; }
.dialog-card .btn-danger { flex-basis: 66.67%; }
.dialog-card #dialog-cancel[hidden] + #dialog-ok { flex-basis: 100%; }

/* === Credit sale: what is still owed, and the customer's name, under the part payment box === */
.credit-notes { display: flex; align-items: baseline; justify-content: space-between; column-gap: 10px; } /* one line: the name gives way, what is owing never does */
.credit-notes > * { margin-top: 6px; }
.amount-owing { flex: 0 0 auto; font-size: clamp(0.72rem, 3.4vw, 0.85rem); color: var(--text-light); white-space: nowrap; }
.amount-owing strong { color: var(--danger-color); font-weight: 700; font-variant-numeric: tabular-nums; }
.contact-name-display { flex: 0 1 auto; min-width: 0; margin-left: auto; font-size: clamp(0.68rem, 3vw, 0.75rem); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === Salespeople === */
/* A sale slides to the left to show who recorded it */
.sale-item { touch-action: pan-y; transform: translateX(var(--swipe, 0px)); z-index: 1; }
.sale-item.selected { transform: translateX(var(--swipe, 0px)) scale(1.02); }
.sale-item.swiping { transition: background-color 0.2s; }
.sale-by {
    position: absolute; top: 0; right: 0; bottom: 0; width: 124px; box-sizing: border-box; padding-right: 14px;
    display: flex; align-items: center; justify-content: flex-end; text-align: right;
    font-size: 0.72rem; font-weight: 600; line-height: 1.3; color: var(--text-light);
    opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.sale-by span { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.sale-row.peek .sale-by { opacity: 1; }
/* A transferred sale slides to the right to show who accepted it ("Accepted by John Doe"), in the teal of "Transfd." */
.sale-acc {
    position: absolute; top: 0; left: 0; bottom: 0; width: 118px; box-sizing: border-box; padding-left: 12px; /* (inside the 124px the sale opens: a long name goes to a second line, never under the sale) */
    display: flex; align-items: center; justify-content: flex-start; text-align: left;
    font-size: 0.72rem; font-weight: 600; line-height: 1.3; color: rgba(0, 140, 149, 0.85);
    opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.sale-acc span { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.sale-row.peek .sale-acc { opacity: 1; }
.credit-by { margin: 2px 0 0; font-size: 0.78rem; font-weight: 600; color: var(--primary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The salesperson's waiting screen and the admin's "add a salesperson" screen */
.modal-content .form-group input.sp-code-input { text-align: center; padding-left: 0.5em; font-size: 1.6rem; font-weight: 700; letter-spacing: 0.5em; }
.modal-content p.sp-error { min-height: 1.3em; margin: -8px 0 12px; font-size: 0.85rem; line-height: 1.35; color: var(--danger-color); }
.sp-link { padding: 10px; border: 0; background: none; font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text-light); text-decoration: underline; cursor: pointer; }
.sp-rules { margin: 4px 0 20px; padding: 12px 14px; border-radius: 12px; background: #f6f8f9; text-align: left; }
.modal-content .sp-rules p { margin: 0 0 6px; text-align: left; font-size: 0.85rem; line-height: 1.4; color: var(--text-color); }
.modal-content .sp-rules p.sp-rules-lead { font-weight: 700; }
.sp-rules ul { margin: 0; padding-left: 18px; font-size: 0.84rem; line-height: 1.55; color: var(--text-light); }
/* The box is a scrolling top and a footer that never moves, so Cancel and Get code stay in view above the phone's keypad. The "what they can do"
   panel stays put above the number: it is read first, with no keypad open; once the keypad is up it simply scrolls up out of the way (and back). */
#add-salesperson-modal.sp-modal { padding: 0; overflow: hidden; }
#add-salesperson-modal .sp-pane { display: flex; flex-direction: column; min-height: 0; max-height: 100%; flex: 1 1 auto; }
#add-salesperson-modal .sp-pane[hidden] { display: none; }
#add-salesperson-modal .sp-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 24px 24px 6px; }
#add-salesperson-modal .sp-footer { flex: none; margin: 0; padding: 12px 24px 20px; background: var(--surface-color); box-shadow: 0 -6px 12px -8px rgba(0, 0, 0, 0.18); }
#add-salesperson-modal .sp-rules { margin: 4px 0 22px; }
.sp-code-box { margin: 4px 0; padding: 16px; border-radius: 14px; background: #e6f4f5; text-align: center; }
.sp-code-box strong { padding-left: 0.3em; font-size: 2.6rem; font-weight: 800; letter-spacing: 0.3em; color: var(--primary-color); font-variant-numeric: tabular-nums; }
.sp-code-box.expired { background: #f3f3f3; }
.sp-code-box.expired strong { color: #b5b5b5; text-decoration: line-through; }
.modal-content p.sp-timer { margin: 6px 0 0; text-align: center; font-size: 0.88rem; color: var(--text-light); }

/* The Salespeople tab: a card per salesperson, a summary card per day that still needs their money confirmed */
.sp-card { overflow: hidden; }
.sp-head { display: flex; align-items: center; gap: 12px; padding: 14px 8px 14px 16px; }
.sp-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #e6f4f5; color: var(--primary-color); font-weight: 800; }
.sp-id { flex: 1; min-width: 0; }
.sp-id h4 { margin: 0; font-size: 1.02rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-id p { margin: 1px 0 0; font-size: 0.78rem; color: var(--text-light); }
.sp-remove { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--danger-color); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sp-remove svg { width: 20px; height: 20px; }
.sp-empty { margin: 0; padding: 14px 16px 16px; border-top: 1px solid var(--border-color); font-size: 0.88rem; color: var(--text-light); }
.sp-day { padding: 14px 16px 16px; border-top: 1px solid var(--border-color); }
.sp-day-top { display: flex; justify-content: space-between; gap: 12px; font-size: 0.78rem; font-weight: 600; color: var(--text-light); }
.sp-day-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 6px; }
.sp-day-total span { font-size: 0.85rem; color: var(--text-light); }
.sp-day-total strong { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; color: var(--primary-color); font-variant-numeric: tabular-nums; }
.sp-rows { margin-top: 10px; padding: 2px 12px; border-radius: 10px; background: #f6f8f9; }
.sp-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 9px 0; border: 0; background: none; font: inherit; font-size: 0.88rem; text-align: left; color: inherit; }
.sp-row + .sp-row { border-top: 1px solid #e8ecee; }
.sp-row span { color: var(--text-light); }
.sp-row strong { font-weight: 700; color: var(--text-color); text-align: right; font-variant-numeric: tabular-nums; }
.sp-row-link { cursor: pointer; }
.sp-row-link strong { color: var(--danger-color); }
.sp-row-link i { margin-left: 2px; font-style: normal; font-size: 1.1rem; }
.sp-row strong.sp-none { color: #b5bcc2; font-weight: 600; }
.sp-received { margin-top: 12px; min-height: 46px; }

/* Room for the + button under the last salesperson, and tabs that fit the narrowest phones */
#salespeople-view.all-sales-container { padding-bottom: 110px; }
#stock-levels-view .product-filter-tabs { min-width: 0; }
@media (max-width: 360px) {
    #stock-levels-view .page-actions-header { gap: 8px; padding-left: 12px; padding-right: 12px; }
    #stock-levels-view .product-filter-tabs { gap: 6px; }
    #stock-levels-view .filter-tab-btn { padding: 6px 10px; font-size: 0.8rem; }
    #refresh-stocks-btn span { display: none; }
}

/* A field that needs attention: it shakes, and its box and title turn red for a moment */
.form-group.input-error-shake input, .form-group.input-error-shake select, .quantity-stepper.input-error-shake,
.input-with-prefix.input-error-shake input, .pin-input-wrap.input-error-shake input { border-color: var(--danger-color); }
.form-group.input-error-shake > label { color: var(--danger-color); }

/* === Every phone size: tap areas, text that wraps instead of being cut off, and fluid type === */
.loader-container { height: 100vh; height: 100dvh; }

/* Buttons and icons: at least a thumb-sized area, the look stays the same */
.menu-btn, .back-btn { left: 10px; display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px; }
.app-header h1 { margin: 0 54px; font-size: clamp(1rem, 5.2vw, 1.4rem); }
.figures-toggle { position: relative; }
.figures-toggle::after { content: ''; position: absolute; inset: -10px; }
.edit-btn-icon::after { content: ''; position: absolute; inset: -7px; }
/* The trash icon of the product box: a small circle (30 px, the size of the pencil on the product cards). The thumb-sized area around it (44 px) cannot be seen. */
.delete-btn-icon { top: 17px; right: 16px; width: 30px; height: 30px; padding: 6px; }
.delete-btn-icon::after { content: ''; position: absolute; inset: -8px; }
.filter-tab-btn { min-height: 38px; }
.btn-icon-link { min-height: 40px; padding: 0 6px; }
.see-all-btn { min-height: 44px; }

/* Long names use two lines before they are cut */
.sale-by { width: 132px; }
.sp-day-total strong { font-size: clamp(1.35rem, 6.2vw, 1.6rem); }
.credit-owes strong { font-size: clamp(1.3rem, 6vw, 1.5rem); }

/* Short screens (small phones, or a phone turned sideways) */
@media (max-height: 520px) {
    .page { padding-bottom: 72px; }
    .modal-container { padding: 10px; }
    .modal-content { padding-top: 16px; padding-bottom: 16px; }
    .dialog-layer { padding: 10px; }
    .app-header { padding-top: 8px; padding-bottom: 8px; }
}

/* The bar under a selected sale: its buttons stay on one line, whatever the width */
.btn-icon-link { min-width: 44px; justify-content: center; }
.receipt-actions .btn { white-space: nowrap; padding-left: 12px; padding-right: 12px; font-size: clamp(0.85rem, 3.8vw, 1rem); }
.receipt-actions .btn-secondary:not(.btn-edit-sale) { flex: 0 0 auto; width: auto; }
.receipt-actions .btn-primary { flex: 1 1 0; }
@media (max-width: 360px) {
    .receipt-actions { padding: 12px; gap: 10px; }
}
@media (max-width: 340px) { /* the narrowest phones, with Cancel and Edit beside it: "Receipt & transfer" still sits inside its button */
    .receipt-actions .btn-primary { padding-left: 8px; padding-right: 8px; font-size: 0.8rem; }
}

/* The sale screen on small phones: a long product name takes two lines, and the spacing tightens so more of the form shows */
#confirm-sale-modal #sale-product-name { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; line-height: 1.25; font-size: clamp(1rem, 4.6vw, 1.2rem); }
@media (max-height: 640px) {
    #confirm-sale-modal .sale-item-details { gap: 12px; margin-bottom: 8px; }
    #confirm-sale-modal .sale-total { margin-bottom: 8px; padding-top: 10px; }
    #confirm-sale-modal .sale-type-section { margin-bottom: 30px; }
    #confirm-sale-modal .modal-actions { padding-top: 14px; padding-bottom: 14px; }
}

/* Sign-up and login: links, icons and choices big enough for a thumb */
.wa-link-btn { min-height: 44px; padding: 6px 10px; }
.icon-btn { width: 40px; height: 40px; padding: 0; }
.input-icons { right: 6px; gap: 0; }
.input-wrapper input, .onboarding-form .input-wrapper input, .form-group.outlined .input-wrapper input { padding-right: 92px; }
.reg-segment button { min-height: 40px; }
a.privacy-link-trigger { display: inline-block; padding: 8px 2px; margin: -8px 0; }

/* Products: the low stock setting sits quietly inside the search bar; the filter tabs keep their centred row, with counts and colours */
.search-field { position: relative; margin-bottom: 12px; }
.search-field #product-search-input { margin-bottom: 0; padding-right: 46px; }
.search-settings-btn { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: #8d969e; cursor: pointer; transition: color 0.2s; -webkit-tap-highlight-color: transparent; }
.search-settings-btn:hover, .search-settings-btn:active, .search-settings-btn:focus-visible { color: var(--primary-color); outline: none; }
.tab-count { display: inline-block; min-width: 1.4em; margin-left: 2px; padding: 0 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.07); font-size: 0.72rem; font-weight: 700; line-height: 1.5; text-align: center; font-variant-numeric: tabular-nums; }
.filter-tab-btn[data-filter="restock"] .tab-count { background: rgba(240, 173, 78, 0.22); color: #9a6100; }
.filter-tab-btn[data-filter="outofstock"] .tab-count { background: rgba(208, 2, 27, 0.1); color: var(--danger-color); }
.filter-tab-btn[data-filter="restock"].active { background-color: var(--warning-color); border-color: var(--warning-color); color: #fff; }
.filter-tab-btn[data-filter="outofstock"].active { background-color: var(--danger-color); border-color: var(--danger-color); color: #fff; }
.filter-tab-btn.active .tab-count { background: rgba(255, 255, 255, 0.3); color: #fff; }
#product-filter-tabs { gap: 8px; }
/* Centred when the tabs fit, and scrolled from the very first tab when they do not (plain centring pushed "All" off the left edge, out of reach) */
#product-filter-tabs { justify-content: flex-start; }
#product-filter-tabs::before { content: ''; margin-left: auto; }
#product-filter-tabs::after { content: ''; margin-right: auto; } /* (spacers of the row itself, not of its first and last tab: a salesperson's hidden Check tab took the right one with it and pushed All, Low, Out to the right) */
#product-filter-tabs .filter-tab-btn { flex: 0 0 auto; min-height: 34px; padding: 5px 12px; border-radius: 999px; font-size: 0.82rem; }
#product-filter-tabs .filter-tab-btn[data-filter="all"] { min-width: 52px; } /* wide enough to be a capsule, not a ball */
@media (max-width: 420px) { #product-filter-tabs { gap: 6px; padding-left: 12px; padding-right: 12px; } #product-filter-tabs .filter-tab-btn { padding-left: 9px; padding-right: 9px; } #product-filter-tabs .filter-tab-btn[data-filter="all"] { min-width: 48px; } } /* (four tabs, with their counts, fit on most phones) */
@media (max-width: 360px) {
    #product-filter-tabs { gap: 6px; padding: 0 10px 12px; }
    #product-filter-tabs .filter-tab-btn { padding: 5px 8px; font-size: 0.8rem; }
    #product-filter-tabs .filter-tab-btn[data-filter="all"] { min-width: 48px; }
    .tab-count { padding: 0 5px; font-size: 0.7rem; }
}

/* The privacy policy: short sections that scroll, with the button always in reach */
.policy-modal { overflow: hidden; }
.policy-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; margin-top: 6px; -webkit-overflow-scrolling: touch; }
.modal-content.policy-modal .policy-scroll p { margin: 0 0 8px; text-align: left; font-size: 0.9rem; line-height: 1.5; color: var(--text-light); }
.policy-modal h3 { margin: 16px 0 6px; font-size: 0.95rem; font-weight: 700; text-align: left; color: var(--text-color); }
.policy-modal ul { margin: 0 0 8px; padding-left: 18px; font-size: 0.9rem; line-height: 1.5; color: var(--text-light); }
.policy-modal li { margin-bottom: 4px; }
.policy-modal .modal-actions { margin-top: 16px; }

/* === Wide screens (a laptop or a desktop): two halves ===
   The shop stays open in the left half; whatever is tapped on it (products, all sales, customers, the scanner) opens in the right half,
   like WhatsApp Web. The pages are the same ones, only where they sit changes. A phone never reaches this (even turned sideways, it is too short). */
.home-pane-title, .pane-empty, .back-btn .icon-close { display: none; }
.pane-empty img { border-radius: 20px; opacity: 0.9; }
.pane-empty h2 { margin-top: 14px; font-size: 1.35rem; color: var(--text-color); }
.pane-empty p { margin-top: 6px; max-width: 260px; font-size: 0.95rem; line-height: 1.45; }

@media (min-width: 900px) and (min-height: 560px) {
    .app-container.in-app { --split-left: min(50vw, 600px); max-width: none; }

    /* The header: the shop's title over the left half, the open page's title (and its close button) over the right half */
    .app-container.in-app .app-header { min-height: 60px; padding: 0; justify-content: flex-start; }
    .app-container.in-app .home-pane-title { display: block; flex: 0 0 var(--split-left); align-self: stretch; margin: 0; padding: 0 54px; line-height: 60px; border-right: 1px solid var(--border-color); }
    .app-container.in-app .header-title-wrap { flex: 1 1 auto; min-width: 0; }
    .app-container.in-app[data-view="home-view"] .header-title-wrap { visibility: hidden; } /* (nothing is open on the right) */
    .app-container.in-app .menu-btn { display: flex !important; } /* (the menu always stays with the shop) */
    .app-container.in-app .back-btn { left: calc(var(--split-left) + 10px); }
    .app-container.in-app .back-btn .icon-back { display: none; }
    .app-container.in-app .back-btn .icon-close { display: block; }
    .app-container.in-app .add-to-homescreen-btn { right: calc(100% - var(--split-left) + 16px); }

    /* The pages: home on the left, the page that was tapped on the right */
    .app-container.in-app .main-content { position: relative; }
    .app-container.in-app #main-content > .view { position: absolute; top: 0; bottom: 0; left: var(--split-left); right: 0; width: auto; height: auto; padding-bottom: 100px; }
    .app-container.in-app #main-content > .view:not(#home-view) { padding-inline: max(0px, calc((100vw - var(--split-left) - 860px) / 2)); } /* (on a very wide screen the page keeps a readable width, in the middle of its half) */
    .app-container.in-app #main-content > #home-view { display: flex; left: 0; right: auto; width: var(--split-left); padding-bottom: 80px; border-right: 1px solid var(--border-color); }
    .app-container.in-app .pane-empty { position: absolute; top: 0; bottom: 0; left: var(--split-left); right: 0; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--text-light); }
    .app-container.in-app #home-view.active ~ .pane-empty { display: flex; }
    .app-container.in-app .offline-banner-inner { right: auto; width: calc(var(--split-left) - 28px); }

    /* Bars and buttons stay inside the half they belong to */
    .app-container.in-app .bottom-nav { right: auto; width: var(--split-left); max-width: none; margin: 0; border-right: 1px solid var(--border-color); }
    .app-container.in-app .receipt-actions { right: auto; width: var(--split-left); max-width: none; margin: 0; }
    .app-container.in-app .receipt-actions.on-right { left: var(--split-left); right: 0; width: auto; }
    .app-container.in-app .fab { bottom: 28px; right: 32px; }
    .app-container.in-app .camera-container { left: var(--split-left); right: 0; width: auto; }

    /* A mouse: the buttons of the shell say they can be pressed */
    .app-container.in-app :is(.nav-btn, .nav-btn-main, .menu-btn, .back-btn, .fab) { cursor: pointer; }
    @media (hover: hover) {
        .app-container.in-app .nav-btn:hover { color: var(--primary-color); }
        .app-container.in-app :is(.menu-btn, .back-btn):hover { background: rgba(0, 0, 0, 0.05); border-radius: 50%; }
    }

    /* While the scanner is on, the left half waits (as the whole phone screen would) */
    .app-container.in-app[data-view="camera-view"] #home-view,
    .app-container.in-app[data-view="camera-view"] .bottom-nav,
    .app-container.in-app[data-view="camera-view"] .menu-btn,
    .app-container.in-app[data-view="camera-view"] .home-pane-title { opacity: 0.45; pointer-events: none; }
}

/* Product cards: the name on one line, ending in "…" when it is too long, so the price and the stock ("20 packets left") always show.
   (The whole name is in its Edit box.) */
.product-card-info h4 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; min-width: 0; }
/* The last row of products scrolls clear of the + button */
#products-view .product-grid { padding-bottom: 90px; }
/* Boxes to type in, inside PikaShot's own pop-up (the credit customer's name and number) */
.dialog-fields { margin: 4px 0 18px; text-align: left; }
.dialog-fields .form-group { margin-bottom: 12px; }
.dialog-fields .form-group:last-child { margin-bottom: 0; }
.dialog-fields label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-color); }
.dialog-fields input { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 10px; font: inherit; font-size: 1rem; user-select: text; -webkit-user-select: text; }
.dialog-fields input:focus { outline: none; border-color: var(--primary-color); }
.dialog-fields[hidden], #dialog-text[hidden] { display: none; }

/* Product card labels sit one under the other in the top corner: "New stock today!", then Out of stock / Low stock! */
.card-badges { position: absolute; top: 8px; right: 8px; z-index: 4; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: calc(100% - 50px); }
.card-badges > div { position: static; max-width: none; white-space: nowrap; }
/* Each label stays on one line: its text is sized to the card it sits on (the card's own width, so it fits on a narrow phone and on a
   wide screen alike), between 8 px and the usual 11 px, leaving room for the pencil on the left */
.product-card { container-type: inline-size; }
.card-badges { left: 44px; right: 8px; max-width: none; }
.card-badges > div { font-size: clamp(0.5rem, 2.4vw, 0.7rem); padding: 4px clamp(5px, 2vw, 8px); }
@supports (width: 1cqi) {
    .card-badges > div { font-size: clamp(0.5rem, calc((100cqi - 66px) / 8), 0.7rem); padding: 4px clamp(4px, 4cqi, 8px); }
}

/* Invite customer: "Go back" and "WhatsApp invite" each stay on one line on small phones */
#invite-customer-modal .modal-actions-inline .btn { padding-left: 12px; padding-right: 12px; white-space: nowrap; }
#invite-customer-modal .modal-actions-inline .btn-secondary { flex-basis: 40%; }
#invite-customer-modal .modal-actions-inline .btn-primary { flex-basis: 60%; }

/* === Product box: name + picture button on one line; Unit + Stock; Cost price + Selling price === */
#product-form .pf-name-row { align-items: flex-end; gap: 8px; }
#product-form .pf-name-row #product-name-group { flex: 1 1 auto; min-width: 0; }
/* The picture button: a slim tab beside the name (8% of the line), as tall as the box. The camera until there is a photo, then the photo itself with a small tick. */
.pf-pic-btn {
    position: relative; flex: 0 0 8%; min-width: 30px; height: 50px; margin: 0 0 22px; padding: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px dashed var(--primary-color); border-radius: 12px; background: rgba(0, 140, 149, 0.07); color: var(--primary-color);
    background-size: cover; background-position: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s, background-color 0.15s;
}
.pf-pic-btn svg { width: 18px; height: 18px; flex: none; }
.pf-pic-btn:active { transform: scale(0.94); background-color: rgba(0, 140, 149, 0.16); }
.pf-pic-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0, 140, 149, 0.35); }
.pf-pic-btn.has-pic { border-style: solid; border-color: var(--success-color); background-color: #eaf6ec; color: #fff; }
.pf-pic-btn.has-pic::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--success-color) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / 8px no-repeat; box-shadow: 0 0 0 1.5px #fff; }
.pf-pic-btn.has-pic svg { display: none; }
.pf-pic-btn.just-snapped { animation: pf-pic-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.pf-pic-btn:disabled { opacity: 0.5; cursor: default; }
#product-form .pf-pic-btn.input-error-shake { border: 1.5px solid var(--danger-color) !important; }
@keyframes pf-pic-pop { from { transform: scale(0.8); } to { transform: none; } }
#product-form .unit-group { flex: 1.3; }
#product-form .stock-group { flex: 1.7; }
#product-form .cost-group, #product-form .price-group { flex: 1 1 0; min-width: 0; position: relative; }
#product-form .cost-group label, #product-form .price-group label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* "₦150 or ₦170?": the cost question floats ABOVE the cost box (the last line of the box has no room below), pointing down at it */
.cost-ask { top: auto; bottom: calc(100% + 8px); transform-origin: 26px calc(100% + 8px); }
.cost-ask .unit-ask-arrow { top: auto; bottom: -7px; transform: rotate(225deg); }
.cost-ask .unit-ask-btn { padding: 0 12px; }
.cost-ask .cost-new { margin-left: 4px; padding: 1px 5px; border-radius: 6px; background: rgba(0, 140, 149, 0.12); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.cost-ask .unit-ask-btn:active .cost-new { background: rgba(255, 255, 255, 0.25); }
#product-form .form-group input.needs-answer { border-color: var(--primary-color); animation: unit-glow 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pf-pic-btn.just-snapped { animation: none; } #product-form .form-group input.needs-answer { animation: none; box-shadow: 0 0 0 3px rgba(0, 140, 149, 0.25); } }

/* Profit under a group's total on the sales pages: small and quiet (only the business sees it) */
.sales-group-sums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.sales-group-profit { font-size: 0.75rem; font-weight: 600; color: var(--text-light); line-height: 1.3; }
.sales-group-profit.loss { color: #b4505c; }
.sales-group-profit .profit-note { font-weight: 400; }

/* The camera's snap button (product photos): a round shutter above Cancel. The picture is taken when it is tapped, never by itself. */
.snap-photo-btn {
    position: absolute; left: 50%; bottom: 96px; z-index: 11; width: 72px; height: 72px; padding: 0; transform: translateX(-50%);
    display: flex; align-items: center; justify-content: center; border: 4px solid #fff; border-radius: 50%;
    background: rgba(255, 255, 255, 0.22); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.snap-photo-btn[hidden] { display: none; }
.snap-photo-dot { width: 54px; height: 54px; border-radius: 50%; background: #fff; transition: transform 0.12s ease, background-color 0.15s; }
.snap-photo-btn:active .snap-photo-dot { transform: scale(0.88); }
.snap-photo-btn:disabled { cursor: default; }
.snap-photo-btn:disabled .snap-photo-dot { background: var(--primary-color); transform: scale(0.8); }
.snap-photo-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(0, 140, 149, 0.6); }

/* A sale just recorded slides into Today's sales from the right: quick, and smooth enough to notice (_appendSaleEl in app.js) */
#home-view { overflow-x: hidden; } /* (no sideways scroll while it slides. Not on the list itself: that would cut off the side labels, Edited, Credit..., which sit just outside each sale) */
.sale-row.slide-in { animation: sale-slide-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes sale-slide-in { from { transform: translateX(100%); opacity: 0.3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sale-row.slide-in { animation: sale-fade-in 0.3s ease-out both; } }
@keyframes sale-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* The voice button on the right of "Assistant" in the profile: a small speaker, teal when new messages are read aloud, grey and crossed out when not */
.nudge-voice-btn { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 26px; height: 26px; padding: 0; border: none; border-radius: 50%; background: rgba(0, 140, 149, 0.1); color: var(--primary-color); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color 0.15s, color 0.15s, transform 0.1s; }
.nudge-voice-btn[hidden] { display: none; }
.nudge-voice-btn::after { content: ''; position: absolute; inset: -8px; } /* (easy to tap) */
.nudge-voice-btn:active { transform: scale(0.9); }
.nudge-voice-btn .voice-off { display: none; }
.nudge-voice-btn.is-off { background: #eef1f3; color: #8a959e; }
.nudge-voice-btn.is-off .voice-on { display: none; }
.nudge-voice-btn.is-off .voice-off { display: block; }

/* Wide screens: tapping something that opens the page already open on the right redraws it with a short fade-up, so the tap is seen to work
   (_reopenPage in app.js). Its parts move, never the page box itself (the floating + buttons stay put). */
.view.page-reopen > :not(.fab):not(.add-arrow) { animation: page-reopen 0.38s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes page-reopen { from { opacity: 0.25; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.page-reopen > :not(.fab):not(.add-arrow) { animation: page-reopen-fade 0.25s ease-out both; } }
@keyframes page-reopen-fade { from { opacity: 0.4; } to { opacity: 1; } }

/* A sale this phone has not got into the cloud yet (no working internet): a small, quiet line under it, always on one line, gone once it is sent */
.sale-unsent { display: block; max-width: 100%; margin-top: 1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-style: normal; font-size: 0.64rem; font-weight: 500; color: rgba(178, 106, 0, 0.8); }
/* The Edit box of a product below 0: the note says why and which sales did it */
.source-info.below-zero { color: var(--danger-color); background: rgba(208, 2, 27, 0.06); border-radius: 10px; padding: 8px 10px; text-align: left; line-height: 1.4; }
#product-form .form-group input.needs-answer:not(#product-cost):not(#product-price) { border-color: var(--danger-color); }

/* One eye on the sales pages, top right above the totals: it hides every total and profit there (same choice as the other eyes) */
.sales-figures-bar { display: flex; justify-content: flex-end; padding: 12px 20px 0; }
.sales-figures-bar[hidden] { display: none; }
.sales-figures-bar:not([hidden]) + #all-sales-list { padding-top: 6px; }
.sales-group-profit.loss.masked { color: var(--text-light); } /* (hidden, a loss looks like any other line) */

/* No products yet: a moving arrow from under the words to the + button (drawn by _setAddArrow in app.js), and a soft ring round the button */
.add-arrow { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 99; overflow: visible; color: var(--primary-color); }
.add-arrow path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.add-arrow-line { stroke-dasharray: 1 10; animation: add-arrow-flow 0.8s linear infinite; }
.add-arrow-head { animation: add-arrow-nudge 1.1s ease-in-out infinite; }
@keyframes add-arrow-flow { to { stroke-dashoffset: -11; } }
@keyframes add-arrow-nudge { 0%, 100% { transform: translateY(-5px); } 50% { transform: translateY(2px); } }
.fab.add-hint { animation: fab-add-hint 1.6s ease-out infinite; }
@keyframes fab-add-hint { 0% { box-shadow: 0 4px 15px rgba(0,0,0,0.2), 0 0 0 0 rgba(0, 140, 149, 0.45); } 80%, 100% { box-shadow: 0 4px 15px rgba(0,0,0,0.2), 0 0 0 16px rgba(0, 140, 149, 0); } }
@media (prefers-reduced-motion: reduce) { .add-arrow path, .fab.add-hint { animation: none; } }

/* Cartons received for a product kept in a smaller unit (_cartonCard in app.js): "You got 3 cartons", then the question about ONE carton,
   [carton] 1 = [packet] 50, with the same quantity box as Confirm sale ("Packets in 1 carton" on its border), then the total */
.ctn { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.ctn-count { font-size: 0.8rem; color: var(--text-light); }
.dialog-card .ctn-got { margin: 0; font-size: 0.95rem; color: var(--text-light); }
.ctn-got b { color: var(--text-color); }
.ctn-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.ctn-unit { display: flex; flex-direction: column; align-items: center; min-width: 64px; color: var(--primary-color); }
.ctn-unit .unit-svg { width: 46px; height: 46px; }
.ctn-unit b { font-size: 1.6rem; line-height: 1.15; color: var(--text-color); }
.ctn-unit small { font-size: 0.8rem; color: var(--text-light); }
.ctn-sign { font-size: 1.6rem; font-weight: 600; color: var(--text-light); }
.dialog-fields .form-group.ctn-field { width: 100%; margin: 8px 0 0; }
.ctn-field[hidden] { display: none; }
.modal-content .form-group.ctn-field > label { left: 50%; transform: translateX(-50%); }
.dialog-card .ctn-total { margin: 0; font-size: 1rem; font-weight: 700; color: var(--primary-color); }
.ctn-total[hidden] { display: none; }
.ctn-change { background: none; border: none; padding: 6px 10px; color: var(--primary-color); font: inherit; font-weight: 600; text-decoration: underline; }
.ctn-change[hidden] { display: none; }
#dialog-ok:disabled { opacity: 0.5; }

/* A pop-up that must be answered (the carton card): a tap outside gives it a small shake instead of closing it */
.dialog-card.dialog-wiggle { animation: dialog-wiggle 0.36s ease-in-out; }
@keyframes dialog-wiggle { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .dialog-card.dialog-wiggle { animation: none; } }

/* The carton card's "Later": grey, not red (it is the safe choice) */
.dialog-card .btn.btn-cancel.btn-later { color: var(--text-color); border-color: var(--border-color); }
.dialog-card .btn.btn-cancel.btn-later:active { background: var(--background-color); }

/* Check items (after a transfer): the item's picture on every card, two big choices, the price box (_checkItems in app.js) */
.chk-pic { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; background: var(--background-color); border: 1px solid var(--border-color); }
.dialog-card .chk-q { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-color); }
.chk-choices { display: flex; gap: 10px; width: 100%; }
.chk-choice { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border: 2px solid var(--border-color); border-radius: 14px; background: #fff; color: var(--text-color); font: inherit; }
.chk-choice .unit-svg { width: 36px; height: 36px; color: var(--primary-color); }
.chk-choice b { font-size: 1.15rem; }
.chk-choice small { font-size: 0.75rem; color: var(--text-light); }
.chk-choice.on { border-color: var(--primary-color); background: #e6f4f5; box-shadow: 0 0 0 1px var(--primary-color); }
.dialog-fields .form-group.chk-field { width: 100%; margin: 8px 0 0; }
.modal-content .form-group.chk-field > label { left: 50%; transform: translateX(-50%); }
.dialog-fields .chk-field input { height: 54px; text-align: center; font-size: 1.35rem; font-weight: 700; border: 1.5px solid #b4bec7; border-radius: 12px; }
.dialog-card .chk-note { margin: 0; min-height: 1.3em; font-size: 0.9rem; color: var(--text-light); }
.dialog-card .chk-note.good { color: var(--success-color); font-weight: 600; }
.dialog-card .chk-note.bad { color: var(--danger-color); font-weight: 600; }
/* the confetti box's quiet second choice ("Later" under "Check items") */
.celebration-later { display: block; margin: 10px auto 0; padding: 8px 16px; background: none; border: none; color: var(--text-light); font: inherit; font-weight: 600; text-decoration: underline; }
/* New tab: one button that walks through the new items */
/* Products button: a red dot while New has items */
.nav-btn[data-view="products-view"] { position: relative; }
.nav-btn.has-dot::after { content: ''; position: absolute; top: 6px; left: calc(50% + 7px); width: 9px; height: 9px; border-radius: 50%; background: var(--danger-color); border: 2px solid #fff; }

/* Check the items: the speaker (mute) in the card's corner, and dots for how far along (the current one long) */
#dialog-layer .dialog-card { position: relative; }
.dialog-card .card-voice { position: absolute; top: 12px; right: 12px; }
#product-form-modal { position: relative; }
#product-form-modal .pf-voice { position: absolute; top: 14px; left: 14px; z-index: 3; }
#product-form-modal .pf-voice[hidden] { display: none; }
.chk-dots { display: flex; align-items: center; gap: 6px; }
.chk-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-color); transition: width 0.2s; }
.chk-dots i.done { background: var(--primary-color); opacity: 0.45; }
.chk-dots i.on { width: 22px; border-radius: 4px; background: var(--primary-color); }
.chk-choice { transition: background-color 0.12s, border-color 0.12s; }


/* "Not now" / "Later" (the grey choice in a pop-up): always on one line */
.dialog-card .btn.btn-cancel.btn-later { white-space: nowrap; padding-left: 10px; padding-right: 10px; }

/* My products tabs: All, Low stock and Out of stock in full words on every phone (the row slides sideways on the very smallest) */
@media (max-width: 330px) {
    #product-filter-tabs { gap: 5px; padding-left: 8px; padding-right: 8px; }
    #product-filter-tabs .filter-tab-btn { padding-left: 7px; padding-right: 7px; font-size: 0.78rem; }
    #product-filter-tabs .filter-tab-btn[data-filter="all"] { min-width: 42px; }
}

/* The bottles-for-cartons card: "Leave them out", a quiet link under the rest */
.ctn-change.ctn-out { color: var(--text-light); font-weight: 500; }

/* My products tabs are always capsules, never circles (All, Low, Out and Check with no number are short words) */
#product-filter-tabs .filter-tab-btn, #product-filter-tabs .filter-tab-btn[data-filter="all"] { min-width: 56px; }
@media (max-width: 330px) { #product-filter-tabs .filter-tab-btn, #product-filter-tabs .filter-tab-btn[data-filter="all"] { min-width: 50px; } }

/* Under the loader while a log in or sign up waits for the cloud: "Connecting… this can take a few seconds." */
.loader-note { min-height: 1.3em; margin-top: 10px; padding: 0 24px; font-size: 0.92rem; color: var(--text-muted, #667); text-align: center; }

/* Counting cartons of a new product: how the shop sells it (once) */
.ctn-ask { margin: 2px 0 -2px; font-size: 1.1rem; font-weight: 700; color: var(--text-color); }
.ctn-ask[hidden], .ctn-pick[hidden], .ctn-step2[hidden], .ctn-chosen[hidden] { display: none; }
.ctn-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.ctn-pick .btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 76px; padding: 10px 6px; font-size: 1rem; font-weight: 600; }
.ctn-pick .btn svg { width: 34px; height: 34px; }
.ctn-step2 { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.ctn-chosen { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-color); background: var(--background-color); color: var(--text-color); font: inherit; font-weight: 600; }
.ctn-chosen svg { width: 22px; height: 22px; color: var(--primary-color); }
.ctn-chosen u { color: var(--primary-color); font-weight: 600; margin-left: 4px; }
/* The price asked at a first sale: the picture, one ₦ box, and what the shop gains on each one */
.price-ask { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.price-ask label { font-size: 1rem; font-weight: 700; color: var(--text-color); }
.price-rise { margin: 0; padding: 6px 12px; border-radius: 999px; background: #fff3df; color: #7a4a00; font-size: 0.95rem; }
.price-rise s { opacity: 0.75; }
.money-box { display: flex; align-items: center; width: 100%; max-width: 240px; border: 2px solid var(--primary-color); border-radius: 12px; background: var(--surface-color); overflow: hidden; }
.money-box span { padding: 0 4px 0 14px; font-size: 1.6rem; font-weight: 700; color: var(--text-light); }
.money-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 12px 10px 4px; font: inherit; font-size: 1.6rem; font-weight: 700; color: var(--text-color); }
.price-gain { margin: 0; min-height: 1.4em; font-size: 1rem; font-weight: 700; }
.price-gain.good { color: #1d7a3e; }
.price-gain.low { color: #9a5b00; }
.price-gain.bad { color: var(--danger-color); }
.price-cost { margin: -4px 0 0; font-size: 0.9rem; color: #666; }

/* Packs for cartons: the one yes/no question */
.ctn .ctn-ask { font-size: 1.15rem; }

/* "Most shops say 40": what other shops answered for the same carton */
.ctn-hint { margin: -4px 0 0; font-size: 0.9rem; font-weight: 600; color: var(--primary-color); }

/* My products with no products yet: a pack with its barcode, a red line scanning it */
.empty-barcode { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 20px 12px; }
.empty-barcode .eb-pic { width: 190px; max-width: 62%; height: auto; }
.empty-barcode .eb-title { margin: 6px 0 0; font-size: 1.1rem; font-weight: 700; color: var(--text-color); }
.empty-barcode .eb-text { margin: 0; max-width: 300px; font-size: 0.95rem; line-height: 1.45; color: #555; }
.empty-barcode .eb-text b { color: var(--text-color); }
.eb-scan { animation: eb-scan 1.6s ease-in-out infinite alternate; filter: drop-shadow(0 0 2px rgba(255, 59, 48, .8)); }
@keyframes eb-scan { from { transform: translateY(0); } to { transform: translateY(26px); } }
.eb-ring { animation: eb-ring 1.6s ease-in-out infinite; }
@keyframes eb-ring { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .eb-scan, .eb-ring { animation: none; } .eb-scan { transform: translateY(13px); } }


/* Incoming receipt: what each line becomes in this shop, and the one number nobody knows */
.rc-into:empty { display: none; }
.rc-to { display: inline-block; margin-top: 4px; padding: 3px 9px; border-radius: 999px; background: rgba(0, 140, 149, 0.09); color: var(--primary-dark); font-size: 0.84rem; }
.rc-ask { margin-top: 6px; padding: 8px; border: 1.5px solid var(--secondary-color); border-radius: 10px; background: #FFF8EC; }
.rc-ask > span { display: block; font-size: 0.82rem; font-weight: 700; color: var(--text-color); margin-bottom: 6px; }
.rc-nums, .rc-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-pick { margin-bottom: 6px; }
.rc-nums button, .rc-pick button { min-width: 46px; min-height: 44px; padding: 4px 10px; border: 1.5px solid var(--border-color); border-radius: 9px; background: var(--surface-color); color: var(--text-color); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
.rc-pick button { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; }
.rc-pick button svg { width: 18px; height: 18px; }
.rc-nums button:active, .rc-pick button:active, .rc-nums button.on, .rc-pick button.on { border-color: var(--primary-color); background: rgba(0, 140, 149, 0.1); color: var(--primary-dark); }
button.rc-to { border: none; font: inherit; font-size: 0.84rem; cursor: pointer; }
button.rc-to u { margin-left: 4px; font-weight: 700; }


/* "Confirm price!": a price the app set (cost + the shop's usual profit) */
.setup-badge.confirm-badge { background-color: var(--primary-color); }
/* The speaker on the receipt's question and in "Added to your shop" (the same on/off as everywhere) */
.rc-ask { position: relative; }
.rc-ask > span { padding-right: 34px; }
.rc-voice { position: absolute; top: 4px; right: 4px; }
.ad-voice { position: absolute; top: 10px; right: 10px; }
/* Confetti alone (the first product): over everything, taps go through */
#confetti-layer { position: fixed; inset: 0; z-index: 1500; pointer-events: none; }
#confetti-layer #confetti-canvas { position: absolute; inset: 0; }

/* "Added to your products": one line per item, and a quiet line about prices */
.ad-list { display: flex; flex-direction: column; max-height: min(62vh, calc(100vh - 260px)); max-height: min(62dvh, calc(100dvh - 260px)); overflow-y: auto; margin: 0 -4px; text-align: left; } /* (as tall as the screen allows with a calm gap above and below the box: about 5 rows on a small phone, 9 or 10 on a big one; dvh: the height left by the browser's own bars) */
.ad-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px; border-bottom: 1px solid var(--border-color); }
.ad-row:last-child { border-bottom: none; }
.ad-row img { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #f2f2f2; }
.ad-name { flex: 1; min-width: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ad-row > b { flex: none; font-size: 1rem; color: var(--success-color); white-space: nowrap; }
.ad-row > b.ad-wait { color: #b26a00; font-size: 0.9rem; }
.dialog-card p.ad-check { margin: 12px 0 0; text-align: center; font-size: 0.85rem; color: var(--text-light); }
.ad-badge { display: inline-block; margin-right: 2px; padding: 3px 8px; border-radius: 6px; background: var(--primary-color); color: #fff; font-size: 0.72rem; font-weight: 600; }

/* What is inside 1 pack: its own step, sliding up over the product box; one thing at a time */
.dialog-card.ins-card { animation: ins-up 0.32s cubic-bezier(.2,.8,.2,1); }
@keyframes ins-up { from { transform: translateY(48px); opacity: 0; } to { transform: none; opacity: 1; } }
.ins-step.ins-in { animation: ins-in 0.26s ease-out; }
@keyframes ins-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dialog-card.ins-card, .ins-step.ins-in { animation: none; } }
.dialog-card p.ins-name { margin: -4px 0 14px; text-align: center; font-size: 0.85rem; color: var(--text-light); }
.ins-units { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ins-units button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 88px; border: 1.5px solid var(--border-color); border-radius: 14px; background: var(--surface-color); color: var(--text-color); font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.ins-units button svg { width: 34px; height: 34px; color: var(--primary-color); }
.ins-units button:active { border-color: var(--primary-color); background: rgba(0, 140, 149, 0.08); }
.ins-change { display: flex; align-items: center; gap: 6px; margin: 0 auto 12px; padding: 6px 12px; border: none; border-radius: 999px; background: rgba(0, 140, 149, 0.09); color: var(--primary-dark); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.ins-change svg { width: 18px; height: 18px; }
.ins-change u { margin-left: 4px; font-weight: 700; }
.ins-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ins-nums button, .ins-nums input { min-height: 48px; width: 100%; border: 1.5px solid var(--border-color); border-radius: 12px; background: var(--surface-color); color: var(--text-color); font: inherit; font-size: 1.05rem; font-weight: 700; text-align: center; cursor: pointer; }
.ins-nums button[data-n="other"] { font-size: 0.85rem; }
.ins-nums .on { border-color: var(--primary-color); background: rgba(0, 140, 149, 0.1); color: var(--primary-dark); }
.ins-nums input { grid-column: span 2; padding: 0 8px; cursor: text; }
.ins-sum { min-height: 50px; margin-top: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ins-sum b { font-size: 1.15rem; color: var(--primary-dark); }
.ins-sum small { margin-top: 2px; font-size: 0.8rem; color: var(--text-light); }

/* The receipt question: the unit chosen here, with Change */
.rc-unit { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 8px; padding: 4px 10px; border: none; border-radius: 999px; background: rgba(0, 140, 149, 0.09); color: var(--primary-dark); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.rc-unit svg { width: 16px; height: 16px; }
.rc-unit u { margin-left: 4px; }

/* Sign-up, last step: location and camera, one tap each */
.perm-list { display: flex; flex-direction: column; gap: 10px; }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--surface-color); }
.perm-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0, 140, 149, 0.1); color: var(--primary-color); }
.perm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.perm-text b { font-size: 0.95rem; color: var(--text-color); }
.perm-text small { font-size: 0.8rem; line-height: 1.3; color: var(--text-light); }
.perm-btn { flex: none; min-width: 76px; height: 40px; padding: 0 14px; border: 1.5px solid var(--primary-color); border-radius: 999px; background: var(--surface-color); color: var(--primary-color); font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; }
.perm-row.is-on .perm-btn { border-color: var(--success-color); background: rgba(40, 167, 69, 0.08); color: var(--success-color); cursor: default; }
.perm-row.is-off .perm-btn { border-color: var(--border-color); color: var(--text-light); }

/* My customers: calm cards. White, grey words, one big number; red only for what is owed and "Out"; teal only for actions */
#retailer-stock-view .cu-card { padding: 14px 16px; border-left: none; }
.cu-head { display: flex; align-items: center; gap: 12px; }
.cu-who { flex: 1; min-width: 0; }
.cu-who h4 { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-who p { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#retailer-stock-view .cu-call { flex: none; margin: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #eef6f7; color: var(--primary-color); }
.cu-owes { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.cu-owes span { font-size: 0.85rem; color: var(--text-light); }
.cu-owes strong { font-size: clamp(1.3rem, 6vw, 1.5rem); font-weight: 800; letter-spacing: -0.01em; color: #c62828; font-variant-numeric: tabular-nums; }
.cu-bar { height: 4px; margin-top: 8px; border-radius: 2px; background: #eceff1; overflow: hidden; }
.cu-bar > span { display: block; height: 100%; border-radius: 2px; background: var(--primary-color); }
.cu-paid { margin: 5px 0 0; font-size: 0.78rem; color: var(--text-light); font-variant-numeric: tabular-nums; }
.cu-label { margin: 14px 0 2px; font-size: 0.78rem; color: var(--text-light); }
.cu-stock { margin-top: 10px; }
.cu-label + .cu-stock { margin-top: 0; }
.cu-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid #f0f2f4; font-size: 0.9rem; }
.cu-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-row b { flex: none; font-weight: 600; color: var(--text-light); font-size: 0.8rem; }
.cu-row b .cu-about { margin-right: 1px; font-style: normal; font-weight: 800; font-size: 1.2em; line-height: 1; } /* ("~": about, a little bigger and bolder) */
.cu-row.is-out b { color: #c62828; }
.cu-row.is-low b { color: #b26a00; } /* (1–9 left: time to restock them) */
.cu-more[hidden] { display: none; }
.cu-all { display: block; margin: 4px 0 0; padding: 6px 0; border: none; background: none; color: var(--primary-color); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.cu-none { margin: 10px 0 0; font-size: 0.85rem; color: var(--text-light); }
.cu-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.cu-when { flex: 1; min-width: 0; font-size: 0.8rem; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#retailer-stock-view .cu-repaid { display: inline-flex; align-items: center; gap: 6px; width: auto; min-height: 38px; margin: 0; padding: 0 16px; border: none; border-radius: 999px; background: #eef6f7; color: var(--primary-dark); font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; }
#retailer-stock-view .cu-remove { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; min-height: 0; margin: 0 -8px -6px 0; padding: 0; border: none; border-radius: 50%; background: none; color: rgba(198, 40, 40, 0.5); cursor: pointer; } /* (a small faint-red bin: there, but quiet) */
#retailer-stock-view .cu-remove svg { width: 18px; height: 18px; }
#retailer-stock-view .cu-remove:active { background: #fdecec; color: #c62828; }
#retailer-stock-view .cu-card { border: 1px solid #dfe7ea; } /* (a faint line around each customer card) */

/* The scan hint under the box: a soft dark pill, readable over a bright shelf or a white wall */
#scan-feedback { display: inline-block; max-width: 86vw; padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 1.05rem; line-height: 1.3; text-align: center; }

/* Incoming transfer: "Block" (after 5 declines of one sender in 24 hours), small and red, before Decline */
.receipt-modal-row .btn.btn-block-sender { flex: 0 0 auto; width: auto; padding-left: 16px; padding-right: 16px; color: var(--danger-color); border-color: rgba(208, 2, 27, 0.35); }
.receipt-modal-row .btn.btn-block-sender[hidden] { display: none; }

/* A pop-up with the phone's keypad up (app.js: _fitDialogToKeyboard sizes the layer to the screen above the keypad and adds kb-up):
   drawn a little tighter, so the box being typed in and the buttons both stay in view (the price at a sale, "1 carton = ? packets") */
.dialog-layer.kb-up { padding: 8px 12px; }
.dialog-layer.kb-up .dialog-card { padding-top: 16px; padding-bottom: 14px; }
.dialog-layer.kb-up .chk-pic { width: 44px; height: 44px; border-radius: 10px; }
.dialog-layer.kb-up .dialog-card .modal-actions { margin-top: 12px; }
.dialog-layer.kb-up .dialog-fields { margin-bottom: 10px; }

/* Refresh on My customers / My salespeople: a light press when tapped, and the arrows turn while it reads (app.js: _refreshStocks) */
#refresh-stocks-btn { border-radius: 999px; transition: background-color 0.15s, transform 0.1s; }
#refresh-stocks-btn:active { background: #e6f4f5; transform: scale(0.95); }
#refresh-stocks-btn.spinning { color: var(--primary-dark); }
#refresh-stocks-btn.spinning svg { animation: spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) { #refresh-stocks-btn.spinning svg { animation-duration: 2s; } }

/* My products on a phone: the search box slides up out of the way while the list is scrolled down, and back at the least scroll up
   (app.js: _bindSearchTuck). The bar slides; the tabs stay at the top. */
.product-controls-sticky-header { transition: transform 0.2s ease; will-change: transform; }
.product-controls-sticky-header.search-tucked { transform: translateY(calc(-1 * var(--search-h, 0px))); }
.product-controls-sticky-header #product-search-container { transition: opacity 0.15s ease; }
.product-controls-sticky-header.search-tucked #product-search-container { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .product-controls-sticky-header { transition: none; } }

/* The product box: the barcode strip half as tall (68 → 34 px; the same 24 px figures), the name box a little closer under it, and the
   rows of boxes spaced out with what that gives back (net, everything sits a little higher) */
#product-form-modal #product-barcode-display { padding: 4px 12px; line-height: 26px; margin-bottom: 14px; }
#product-form-modal .pf-body .form-row + .form-row { margin-top: 12px; }

/* Home on a phone: no "Hi, Ngozi." under the teal; only the short date ("Wed. Nov 11") and the shop's place on one small line, and the
   teal half as tall, so the two cards sit higher and Today's sales has more room. Wide screens keep the long date and the greeting. */
#welcome-date .date-short { display: none; }
@media (max-width: 899px) {
    /* (the line sits in the middle: as much room above it, from the top of the teal, as below it, to the top of the cards. The teal is a
       little taller, so the cards still sit partly on it. The date stands out; the place is softer, so the two do not compete) */
    #home-view.page { background: linear-gradient(180deg, var(--primary-color) 118px, var(--background-color) 118px); background-attachment: local; } /* (6 px of it is under the water's surface: see .pika-tank) */
    .home-header { padding: 26px 20px 20px; } /* (20 px from the water's calm surface, 6 px down, to the line; 20 px to the cards) */
    .home-header h2#welcome-name { display: none; }
    .home-header p { line-height: 1.3; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; opacity: 0.95; }
    .home-header p.welcome-place { font-size: 0.76rem; font-weight: 400; letter-spacing: 0.01em; opacity: 0.7; }
    #welcome-date .date-long { display: none; }
    #welcome-date .date-short { display: inline; }
}

/* "My shop" says hello when a new message comes: "Hi Ngozi", then the shop's name, then "My shop" again (app.js: _greetHeader), each
   rolling in like the Customers / Salespeople button. The names are small and teal, and never fill the bar. */
#header-title .ht-roll { display: inline-grid; overflow: hidden; max-width: 100%; vertical-align: bottom; padding: 2px 0; margin: -2px 0; }
#header-title .ht-word { grid-area: 1 / 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
#header-title .ht-word.is-name { align-self: center; font-size: 0.82em; font-weight: 700; color: var(--primary-color); letter-spacing: 0.01em; }
#header-title .ht-word.is-out { animation: stock-word-out 0.45s cubic-bezier(0.4, 0, 0.8, 0.4) both; }
#header-title .ht-word.is-in { animation: stock-word-in 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.2s both; }
@media (prefers-reduced-motion: reduce) { #header-title .ht-word.is-out, #header-title .ht-word.is-in { animation-duration: 0.01s; animation-delay: 0s; } }

/* Selling one piece out of a pack or carton: two small words just under the quantity box, in the middle ("Carton · Sachet"; only for
   packs/cartons whose inside is known). The one in use is teal; the other quiet grey. A finger-sized tap area around each word that
   cannot be seen. */
.sale-unit-switch { display: flex; justify-content: center; align-items: center; margin-top: 14px; line-height: 1.1; }
.sale-unit-switch[hidden] { display: none; }
.sale-unit-switch button { position: relative; border: 0; background: none; padding: 0 2px; font: inherit; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; color: #a4acb2; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sale-unit-switch button + button::before { content: '·'; margin: 0 5px 0 3px; color: #c4cbd0; }
.sale-unit-switch button::after { content: ''; position: absolute; inset: -12px -4px; }
.sale-unit-switch button.on { color: var(--primary-color); }

/* Stock lines stay on one line ("10 packs & 2 sachets left"): on a product card the words get smaller with the card (container units),
   in the sale box they are fitted by app.js (_fitLine); cut with … only if nothing else works */
.product-card { container-type: inline-size; }
.product-stock { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(0.6rem, 7.2cqi, 0.75rem); }
/* (the card's bottom strip is 30% of it: the name, price and stock line all fit in it, the stock line at its full height, never squeezed) */
.product-card .product-card-info { padding-top: 6px; padding-bottom: 6px; }
.product-card .product-price { line-height: 1.15; }
.product-card .product-stock { flex-shrink: 0; padding-top: 2px; line-height: 1.25; }
/* ("10 packs & 5 bottles" is long enough on a phone: no "left" after it there) */
@media (max-width: 899px) { .stock-left { display: none; } }
#confirm-sale-modal #sale-product-stock { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; } /* (under the product name, starting where it starts: boxes centre their paragraphs on wide screens) */
#confirm-sale-modal .sale-item-details > div { min-width: 0; }

/* The sale box opens with the quantity box pointed out: the teal border of a box in use runs once around it, from the border line just
   before its title ("How many sachets?"), left to the corner, down the left end, along the bottom, up the right end and back along the
   top, ending just after the title's question mark. It stays until something outside the quantity box is pressed, then fades (app.js:
   _traceQty draws the path to fit the box and its title).
   Nothing is pressed or changed. */
.modal-content .quantity-stepper { position: relative; }
.qty-trace { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; pointer-events: none; z-index: 2; } /* (placed over the box's border by app.js, outside it, so nothing trims the line) */
.qty-trace path { fill: none; stroke: var(--primary-color); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; opacity: 0; }
.qty-trace.run path { animation: qty-trace 0.9s cubic-bezier(0.45, 0, 0.3, 1) forwards; }
@keyframes qty-trace { 0% { stroke-dashoffset: 100; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 1; } } /* (drawn once, then it stays) */
.qty-trace.run.off path { animation: qty-trace-off 0.25s ease-out forwards; } /* (something outside the box was pressed) */
@keyframes qty-trace-off { from { stroke-dashoffset: 0; opacity: 1; } to { stroke-dashoffset: 0; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .qty-trace.run path { animation: none; } }
#confirm-sale-modal .form-group > #sale-quantity-label { z-index: 3; } /* (the title stays over the running border) */
@media (prefers-reduced-motion: reduce) { .qty-trace.run rect { animation: none; } }
/* Phones: the Credit / Discount toggle 25% lower (32 → 24 px) and 15% shorter (108 → 92 px), and the stock line under the product name a little smaller */
@media (max-width: 899px) {
    .triple-toggle { height: 24px; border-radius: 12px; width: 92px; } /* (and 15% shorter: 108 → 92 px; the knob and its three places to match) */
    .triple-slider { border-radius: 10px; width: 27px; }
    .triple-toggle::before { left: 30px; }
    .triple-toggle::after { right: 30px; }
    .triple-toggle input[value="credit"]:checked ~ .triple-slider { transform: translateX(2px); }
    .triple-toggle input[value="default"]:checked ~ .triple-slider { transform: translateX(32.5px); }
    .triple-toggle input[value="discount"]:checked ~ .triple-slider { transform: translateX(63px); }
    #confirm-sale-modal #sale-product-stock { font-size: 0.8rem; }
}

/* A new shop with goods and no sale yet: the way to Record sale is pointed out (app.js: _firstSaleHint), until the first sale. The same
   bubble as "Start by adding products you'll sell", over the round Record sale button, and a slow ring around the button. */
.sale-tooltip { right: 0; left: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); bottom: 108px; }
.sale-tooltip::after { right: auto; left: 50%; margin-left: -8px; }
.nav-btn-main.first-sale::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--primary-color); opacity: 0; pointer-events: none; animation: first-sale-ring 2.2s ease-out infinite; }
@keyframes first-sale-ring { 0% { transform: scale(0.92); opacity: 0.65; } 70% { transform: scale(1.28); opacity: 0; } 100% { transform: scale(1.28); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .nav-btn-main.first-sale::after { animation: none; opacity: 0.35; } }
