:root {
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --bg-body: #f4f6fb;
    --bg-surface: #ffffff;
    --bg-sidebar: #1b1f3b;
    --text-primary: #1f2430;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --accent: #4f46e5;
    --accent-soft: #eef2ff;
    --shadow-sm: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.06);
    --radius: 14px;
    /* Bootstrap's corner sizes for inputs, buttons, input groups, badges */
    --bs-border-radius: 10px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 12px;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #4338ca;
    --bs-link-hover-color-rgb: 67, 56, 202;
}

[data-bs-theme="dark"] {
    --bg-body: #12131a;
    --bg-surface: #1a1c27;
    --bg-sidebar: #0e0f18;
    --text-primary: #e9eaf0;
    --text-muted: #9096a8;
    --border-color: #2a2d3d;
    --accent-soft: rgba(99,102,241,0.16);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --bs-link-color: #a5b4fc;
    --bs-link-color-rgb: 165, 180, 252;
    --bs-link-hover-color: #c7d2fe;
    --bs-link-hover-color-rgb: 199, 210, 254;
    /* Bootstrap's own surfaces (tables, inputs, dropdowns, modals, toasts) follow the same palette. */
    --bs-body-bg: #1a1c27;
    --bs-body-color: #e9eaf0;
    --bs-border-color: #2a2d3d;
    --bs-secondary-bg: #222536;
    --bs-tertiary-bg: #1f2130;
}

/* Bootstrap keeps .table-light / .btn-light light in dark mode; give them dark equivalents. */
[data-bs-theme="dark"] .table-light {
    --bs-table-color: var(--text-primary);
    --bs-table-bg: #222536;
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: #262a3c;
    --bs-table-striped-color: var(--text-primary);
    --bs-table-active-bg: #2a2e42;
    --bs-table-active-color: var(--text-primary);
    --bs-table-hover-bg: #2a2e42;
    --bs-table-hover-color: var(--text-primary);
    color: var(--bs-table-color);
    border-color: var(--bs-table-border-color);
}
/* Same for the coloured rows (overdue tasks, rows with problems, claims to act on): Bootstrap keeps them pastel with
   black text, so the dark theme's light text, links and muted dates were unreadable on them. Deep tints instead. */
[data-bs-theme="dark"] .table-danger,
[data-bs-theme="dark"] .table-warning {
    --bs-table-color: var(--text-primary);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-active-color: var(--text-primary);
    --bs-table-hover-color: var(--text-primary);
    color: var(--bs-table-color);
    border-color: var(--bs-table-border-color);
}
[data-bs-theme="dark"] .table-danger {
    --bs-table-bg: #3a1d25;
    --bs-table-border-color: #5a2a35;
    --bs-table-striped-bg: #42212a;
    --bs-table-active-bg: #4a2530;
    --bs-table-hover-bg: #4a2530;
}
[data-bs-theme="dark"] .table-warning {
    --bs-table-bg: #362d16;
    --bs-table-border-color: #554620;
    --bs-table-striped-bg: #3e341a;
    --bs-table-active-bg: #2e2611;
    --bs-table-hover-bg: #2e2611;
}
[data-bs-theme="dark"] .btn-light {
    --bs-btn-color: var(--text-primary);
    --bs-btn-bg: #2a2e42;
    --bs-btn-border-color: #3a3f57;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #343953;
    --bs-btn-hover-border-color: #454b66;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #343953;
    --bs-btn-active-border-color: #454b66;
}

* { box-sizing: border-box; }

body {
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Login ---------- */
/* Forgot / Reset Password: a centred card on the brand gradient */
.login-body {
    background:
        radial-gradient(circle at 15% 20%, rgba(129,140,248,0.45), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(79,70,229,0.35), transparent 50%),
        linear-gradient(135deg, #312e81, #1b1f3b 60%, #111327);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}
.login-wrap { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 2.5rem;
    box-shadow: 0 24px 60px rgba(8,10,30,0.35);
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h1 { font-size: 1.5rem; margin: 0.5rem 0 0; }

/* Sign-in page: brand panel on the left, form on the right (form only on small screens) */
.login-split { display: block; background: #fff; }
.auth-shell { display: flex; min-height: 100vh; }
.auth-hero {
    position: relative; overflow: hidden;
    flex: 1 1 50%;
    display: flex; flex-direction: column; justify-content: center;
    padding: 3rem 4rem;
    color: #e0e7ff;
    background:
        radial-gradient(circle at 20% 15%, rgba(129,140,248,0.55), transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(79,70,229,0.45), transparent 50%),
        linear-gradient(150deg, #312e81, #1b1f3b 55%, #111327);
}
.auth-hero-glow {
    position: absolute; width: 520px; height: 520px; right: -180px; top: -160px;
    border-radius: 50%; border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 0 0 60px rgba(255,255,255,0.03), 0 0 0 140px rgba(255,255,255,0.02);
    pointer-events: none;
}
.auth-hero-inner { position: relative; max-width: 440px; }
.auth-hero-mark {
    width: 56px; height: 56px; border-radius: 16px;
    display: grid; place-items: center;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
    font-size: 1.5rem; color: #fff; margin-bottom: 1.5rem;
}
.auth-hero-title { font-size: 2.5rem; font-weight: 700; color: #fff; margin: 0; letter-spacing: -0.02em; }
.auth-hero-tagline { font-size: 1.1rem; color: #c7d2fe; margin: 0.35rem 0 2rem; }
.auth-hero-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.auth-hero-list li { display: flex; align-items: center; gap: 0.75rem; font-size: 0.95rem; }
.auth-hero-list i {
    width: 32px; height: 32px; flex: none; border-radius: 9px;
    display: grid; place-items: center; font-size: 0.85rem;
    background: rgba(255,255,255,0.1); color: #fff;
}
.auth-hero-foot { position: absolute; left: 4rem; bottom: 1.75rem; font-size: 0.8rem; color: rgba(224,231,255,0.55); }

.auth-panel {
    flex: 1 1 50%;
    display: flex; align-items: center; justify-content: center;
    padding: 2.5rem 1.5rem;
    background: #fff;
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form .login-brand { text-align: left; margin-bottom: 1.75rem; min-height: 40px; }
.auth-form .login-logo { max-height: 56px; max-width: 200px; }
.auth-title { font-size: 1.75rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; color: #111827; }
.auth-subtitle { color: var(--text-muted); margin: 0.35rem 0 1.75rem; }
.auth-form .form-label { font-weight: 600; font-size: 0.875rem; color: #374151; }

.company-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0.5rem; }
.company-option {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.6rem 0.75rem; border-radius: 10px; cursor: pointer;
    border: 1.5px solid var(--border-color); color: #4b5563; font-weight: 600;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.company-option:hover { border-color: #a5b4fc; }
.btn-check:checked + .company-option { border-color: var(--accent); background: #eef2ff; color: var(--accent); }
.btn-check:focus-visible + .company-option { box-shadow: 0 0 0 0.2rem rgba(79,70,229,0.25); }

.auth-input .input-group-text { background: #f9fafb; color: #9ca3af; border-color: var(--border-color); min-width: 44px; justify-content: center; }
.auth-input .form-control { border-color: var(--border-color); padding-top: 0.6rem; padding-bottom: 0.6rem; }
.auth-input:focus-within .input-group-text { color: var(--accent); }
.auth-input .form-control:focus { box-shadow: none; border-color: #a5b4fc; }
.auth-input .btn-outline-secondary { border-color: var(--border-color); color: #9ca3af; }
.auth-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.auth-submit { border-radius: 10px; font-weight: 600; font-size: 1rem; padding: 0.7rem; background: var(--accent); border-color: var(--accent); }
.auth-submit:hover { background: #4338ca; border-color: #4338ca; }

@media (max-width: 991.98px) {
    .auth-hero { display: none; }
    .auth-panel { background: #f4f6fb; }
    .auth-form { background: #fff; padding: 2rem 1.5rem; border-radius: 18px; box-shadow: 0 10px 30px rgba(17,24,39,0.08); }
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    background:
        radial-gradient(circle at 0% 0%, rgba(129,140,248,0.22), transparent 40%),
        linear-gradient(180deg, #1e1b4b, var(--bg-sidebar) 45%, #111327);
    color: #cbd0e6;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
    z-index: 1030;
    overflow-y: auto;
    /* Reaching the top / bottom of the menu must not start scrolling the page behind it (and the other way round). */
    overscroll-behavior: contain;
}
.app-shell.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }

.sidebar-brand {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 1.25rem 1.25rem 1rem; text-align: center;
    font-weight: 700; font-size: 1.1rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .brand-logo-icon { color: var(--accent); }
/* Uploaded logos are recoloured so one transparent PNG works everywhere:
   solid white on the dark sidebar, solid black on the login page. */
.brand-logo { max-height: 48px; max-width: 190px; object-fit: contain; filter: brightness(0) invert(1); }
.sidebar-brand .brand-logo-icon { font-size: 2rem; }
/* System name: a small caption under the logo so it doesn't compete with it */
.sidebar-brand-text {
    line-height: 1; font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase; color: #9aa0c3;
}
.sidebar-close { position: absolute; top: 0.6rem; right: 0.6rem; color: #cbd0e6; }
.sidebar-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1025;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.login-logo { max-height: 64px; max-width: 220px; object-fit: contain; filter: brightness(0); }
.logo-preview { background: #1b1f3b; border-radius: 8px; padding: 0.5rem 0.75rem; }
.logo-preview .login-logo { filter: brightness(0) invert(1); }
.login-logo-icon { font-size: 2.5rem; color: var(--accent); }
.company-switch {
    font-size: 0.85rem; font-weight: 600; border-radius: 999px; padding: 0.3rem 0.85rem;
    background: var(--accent-soft); border-color: transparent; color: var(--accent);
}
.company-switch:hover, .company-switch.show { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-bs-theme="dark"] .company-switch { color: #a5b4fc; }

.sidebar-nav { padding: 0.75rem 0.75rem 1.5rem; flex: 1; }
.nav-section {
    font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
    color: #7c82a8; padding: 1.25rem 0.75rem 0.4rem;
}
.sidebar-nav .nav-link {
    position: relative;
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.55rem 0.75rem; margin-bottom: 2px; border-radius: 10px;
    color: #c3c8e2; font-size: 0.9rem; font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav .nav-link i { width: 1.1rem; text-align: center; color: #8b91b8; transition: color 0.15s; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-nav .nav-link:hover i { color: #fff; }
.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(99,102,241,0.9), rgba(79,70,229,0.75));
    color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,0.35);
}
.sidebar-nav .nav-link.active i { color: #fff; }
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.2s ease;
}
.app-shell.sidebar-collapsed .app-main { margin-left: 0; }

.app-topbar {
    height: var(--topbar-height);
    background: color-mix(in srgb, var(--bg-surface) 85%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.btn-icon {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; color: var(--text-primary);
}
.btn-icon:hover { background: var(--bg-body); }

.notif-badge { position: absolute; top: 2px; right: 2px; font-size: 0.6rem; }
.notif-dropdown { width: 320px; max-height: 400px; overflow-y: auto; overscroll-behavior: contain; }
.notif-item { position: relative; }
.notif-item .dropdown-item { padding-right: 2rem; }
.notif-item .notif-clear { position: absolute; top: 0.6rem; right: 0.5rem; font-size: 0.6rem; opacity: 0.4; }
.notif-item .notif-clear:hover { opacity: 0.9; }

.user-menu { display: flex; align-items: center; gap: 0.6rem; border: none; background: transparent; padding: 0.25rem 0.6rem 0.25rem 0.3rem; border-radius: 999px; text-align: left; }
.user-menu:hover { background: var(--bg-body); }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.72rem; color: var(--text-muted); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.9rem;
}

.app-content { padding: 1.75rem; flex: 1; }
@media (max-width: 575.98px) { .app-content { padding: 1rem; } }

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.page-header h2 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }

.card {
    background: var(--bg-surface); border: 1px solid var(--border-color);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-header {
    background: transparent; border-bottom: 1px solid var(--border-color);
    font-weight: 600; padding: 0.85rem 1.15rem;
}
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 1.15rem; }

/* Tables: quiet uppercase headings, roomy rows, soft hover */
.table { --bs-table-bg: transparent; margin-bottom: 0.5rem; }
.table > thead th {
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); border-bottom-width: 1px; white-space: nowrap;
    padding-top: 0.7rem; padding-bottom: 0.7rem;
}
.table > thead th a { color: inherit; }
.table > tbody > tr > td { padding-top: 0.7rem; padding-bottom: 0.7rem; border-color: var(--border-color); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--accent-soft); }

/* Forms & buttons */
.form-control, .form-select { border-color: var(--border-color); }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 0.2rem rgba(99,102,241,0.15); }
.form-label { font-weight: 500; font-size: 0.875rem; }
.btn { font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3; --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: #4338ca; --bs-btn-active-border-color: #4338ca; }
.badge { font-weight: 600; border-radius: 6px; }
.alert { border-radius: 12px; }
.dropdown-menu { border-radius: 12px; border-color: var(--border-color); box-shadow: 0 12px 32px rgba(16,24,40,0.12); padding: 0.4rem; }
.dropdown-item { border-radius: 8px; }
.modal-content { border-radius: 16px; border: 0; box-shadow: 0 24px 60px rgba(16,24,40,0.25); }
.nav-tabs .nav-link { font-weight: 500; }
.pagination { gap: 4px; }
.pagination .page-link { border-radius: var(--bs-border-radius-sm); }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); }

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    padding: 1rem 1.1rem;
    display: flex; align-items: center; gap: 0.9rem;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.15rem; flex-shrink: 0;
}
.bg-primary { background: linear-gradient(135deg,#6366f1,#4338ca); }
.bg-success { background: linear-gradient(135deg,#22c55e,#15803d); }
.bg-info    { background: linear-gradient(135deg,#38bdf8,#0284c7); }
.bg-warning { background: linear-gradient(135deg,#fbbf24,#d97706); }
.bg-danger  { background: linear-gradient(135deg,#f87171,#dc2626); }

.stat-value { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Misc ---------- */
/* Bootstrap's table cell colour rule is more specific than a single class, so repeat it for tables. */
.margin-good, .table > :not(caption) > * > .margin-good { color: #15803d; font-weight: 600; }
.margin-warn, .table > :not(caption) > * > .margin-warn { color: #d97706; font-weight: 600; }
.margin-bad, .table > :not(caption) > * > .margin-bad { color: #dc2626; font-weight: 600; }
[data-bs-theme="dark"] .margin-good, [data-bs-theme="dark"] .table > :not(caption) > * > .margin-good { color: #4ade80; }
[data-bs-theme="dark"] .margin-warn, [data-bs-theme="dark"] .table > :not(caption) > * > .margin-warn { color: #fbbf24; }
[data-bs-theme="dark"] .margin-bad, [data-bs-theme="dark"] .table > :not(caption) > * > .margin-bad { color: #f87171; }

/* ---------- Notes ---------- */
.notes-list { max-height: 460px; overflow-y: auto; overscroll-behavior: contain; }
.note-item {
    border: 1px solid var(--border-color); border-radius: 10px;
    padding: 0.6rem 0.75rem; margin-bottom: 0.6rem; background: var(--bg-surface);
}
.note-item.note-pinned { border-color: #fbbf24; background: rgba(251,191,36,0.07); }
.note-content { white-space: pre-wrap; max-height: 9.5em; overflow-y: auto; overscroll-behavior: contain; margin: 0.25rem 0; }

/* ---------- Live notification toasts (top-right, under the bell) ---------- */
.notif-toast-container { top: calc(var(--topbar-height) + 0.5rem); right: 0.75rem; z-index: 1085; }
.notif-toast { min-width: 300px; border-left: 4px solid var(--accent); }
.notif-toast a { text-decoration: none; color: inherit; }

a.stat-card { color: inherit; text-decoration: none; }
a.stat-card:hover { border-color: #a5b4fc; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79,70,229,0.12); }
.product-table td, .product-table th { font-size: 0.875rem; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-shell.sidebar-mobile-open .app-sidebar { transform: translateX(0); }
    .app-shell.sidebar-mobile-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .app-main { margin-left: 0; }
}

/* ---------- Print (reports): page content only, no sidebar / top bar ---------- */
@media print {
    .app-sidebar, .app-topbar, .sidebar-backdrop, .alert-dismissible { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    .card, .stat-card { box-shadow: none !important; break-inside: avoid; }
    .stat-grid { grid-template-columns: repeat(3, 1fr) !important; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* Product picker (quotation / invoice / cash sale lines): name over a SKU tag, in the list and once picked. */
.picker-suggestions { min-width: min(26rem, 90vw); }
/* Search-suggestion lists (customer / product pickers) scroll on their own, without dragging the page along. */
.picker-suggestions, [id$="Suggestions"] { overscroll-behavior: contain; }
.picker-option { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; }
.picker-option-text, .picker-picked-text { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; min-width: 0; flex: 1; }
.picker-name { font-weight: 600; line-height: 1.3; color: var(--text-primary); text-align: left; }
.picker-sku {
    font-family: var(--bs-font-monospace); font-size: 0.75rem; line-height: 1.4;
    padding: 0 0.4rem; border-radius: 6px;
    background: var(--accent-soft); color: var(--accent);
}
[data-bs-theme="dark"] .picker-sku { color: #a5b4fc; }
.picker-price { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.picker-option mark { padding: 0; background: rgba(250, 204, 21, 0.35); color: inherit; border-radius: 2px; }
.list-group-item.active .picker-name, .list-group-item.active .picker-price { color: inherit; }

.picker-picked {
    display: flex; align-items: center; gap: 0.5rem; width: 100%;
    padding: 0.45rem 0.75rem; text-align: left;
    background: var(--bg-surface); color: var(--text-primary);
    border: 1px solid var(--border-color); border-radius: var(--bs-border-radius);
    transition: border-color .15s, box-shadow .15s;
}
.picker-picked:hover, .picker-picked:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.picker-picked { align-items: flex-start; }
.picker-picked .picker-edit { margin-top: 0.3rem; }
.picker-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.5rem; font-size: 0.8rem; color: var(--text-muted); }
.picker-competitor { font-size: 0.8rem; color: var(--text-muted); }
.picker-competitor.is-cheaper { color: var(--bs-danger-text-emphasis); }
/* The card already shows these, so the line's own hint rows hide while a product is picked. */
.has-picked > .product-hint, .has-picked > .competitor-hint { display: none; }

/* Line item tables: compact number columns so the product column gets the room. */
#itemsTable .col-qty { width: 4.5rem; }
#itemsTable .col-price { width: 6.75rem; }
#itemsTable .col-serial { width: 9rem; }
#itemsTable .col-total { width: 6.75rem; }
#itemsTable .col-margin { width: 5.5rem; }
#itemsTable .col-action { width: 2.75rem; }
#itemsTable th { white-space: normal; }
#itemsTable > :not(caption) > * > * { padding-left: 0.35rem; padding-right: 0.35rem; }
#itemsTable .qty-input, #itemsTable .price-input { padding-left: 0.5rem; padding-right: 0.35rem; }
#itemsTable .line-total { white-space: nowrap; }
#itemsTable .line-actions { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
#itemsTable .line-discount-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#itemsTable .line-discount-panel { margin-top: 0.5rem; max-width: 17rem; }
#itemsTable .line-discount-type { flex: 0 0 3.75rem; padding-left: 0.45rem; padding-right: 1.4rem; background-position: right 0.35rem center; }
.picker-edit { font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; }
.picker-picked:hover .picker-edit { opacity: 1; color: var(--accent); }

/* Bulk upload / update: step bar and file drop box (render_steps(), file_drop_zone()) */
.wizard-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.wizard-steps li { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-weight: 500; }
.wizard-steps li + li::before { content: ''; width: 2.5rem; height: 2px; background: var(--border-color); }
.wizard-steps .step-num {
    width: 1.75rem; height: 1.75rem; border-radius: 50%; display: inline-grid; place-items: center;
    border: 2px solid var(--border-color); font-size: 0.8rem; background: var(--bg-surface);
}
.wizard-steps li.current { color: var(--text-primary); }
.wizard-steps li.current .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.wizard-steps li.done .step-num { background: var(--bs-success); border-color: var(--bs-success); color: #fff; }
.drop-zone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
    min-height: 11rem; padding: 1.5rem 1rem; margin: 0; text-align: center; cursor: pointer;
    border: 2px dashed var(--border-color); border-radius: var(--bs-border-radius-lg); background: var(--bs-tertiary-bg);
    transition: border-color 0.15s, background-color 0.15s;
}
.drop-zone:hover, .drop-zone.dragover, .drop-zone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone .drop-icon { font-size: 2.25rem; color: var(--accent); }
.drop-zone .drop-file { font-weight: 600; overflow-wrap: anywhere; }
.drop-zone.has-file { border-style: solid; border-color: var(--bs-success); }
.column-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.column-tags .badge { font-weight: 500; }

/* Brands / Categories: rows show text and switch to an edit form with Edit. */
.inline-edit .edit-form { display: none; }
.inline-edit.editing .edit-form { display: flex; }
.inline-edit.editing .show-text { display: none !important; }

/* Table rows that open a page when clicked (e.g. the Mail list): the hand pointer over every part of the row. */
tr.row-link, tr.row-link > td, tr.row-link > td * { cursor: pointer; }

/* Products page: competitor links that need attention — a collapsible panel with a scrolling list. */
.attention-panel { border: 1px solid var(--bs-warning-border-subtle); border-radius: var(--bs-border-radius-lg); background: var(--bs-body-bg); overflow: hidden; }
.attention-panel > summary { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; cursor: pointer; list-style: none; background: var(--bs-warning-bg-subtle); }
.attention-panel > summary::-webkit-details-marker { display: none; }
.attention-panel[open] > summary { border-bottom: 1px solid var(--bs-warning-border-subtle); }
.attention-icon { flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--bs-warning); color: #212529; }
.attention-chevron { flex: none; color: var(--bs-secondary-color); transition: transform 0.15s; }
.attention-panel[open] .attention-chevron { transform: rotate(180deg); }
.attention-list { max-height: 32rem; overflow-y: auto; overscroll-behavior: contain; }
.attention-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover { background: var(--bs-tertiary-bg); }
.attention-info { flex: 1 1 22rem; min-width: 0; }
.attention-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; margin-left: auto; }
.attention-actions select { width: 20rem; max-width: 100%; }
.min-w-0 { min-width: 0; }
