* { box-sizing: border-box; }

/* The HTML hidden attribute must win over our own display rules (label/list-row are display:flex). */
[hidden] { display: none !important; }

body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    background: #f5f6f8;
    color: #1a1a1a;
}

header {
    background: #16324F;
    color: white;
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

header h1 { margin: 0; font-size: 1.15rem; font-weight: 600; }

.brand { display: flex; align-items: center; }
.site-logo { height: 38px; width: auto; display: block; }

nav a, nav button.nav-link {
    color: white;
    text-decoration: none;
    margin-left: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

nav a:hover, nav button.nav-link:hover { background: rgba(255, 255, 255, 0.3); }

.logout-form { display: inline; margin: 0; padding: 0; box-shadow: none; background: none; max-width: none; }

main {
    padding: 1.5rem 2rem 3rem;
    max-width: 1100px;
    margin: 0 auto;
}

h2 { margin-top: 2rem; color: #16324F; }

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    text-align: left;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid #eee;
    font-size: 0.92rem;
}

th { background: #E7ECF1; color: #16324F; }

tr.low-stock, tr.due-row { background: #fff2f0; }
tr.low-stock td:first-child::before, tr.due-row td:first-child::before { content: "⚠ "; }

form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    gap: 0.35rem;
    font-weight: 600;
    color: #333;
}

input, select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: normal;
}

button {
    background: #16324F;
    color: white;
    border: none;
    padding: 0.7rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

button:hover { background: #0F2439; }

.job-summary {
    background: white;
    padding: 1.1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.job-summary p { margin: 0.3rem 0; font-size: 0.95rem; }

.inline-form { margin-top: 0.85rem; max-width: none; padding: 0; box-shadow: none; background: none; }
.inline-form label { flex-direction: row; align-items: center; gap: 0.6rem; }
.inline-form select { width: auto; }

.badge {
    display: inline-block;
    background: #E7ECF1;
    color: #16324F;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge.due { background: #FFF7EF; color: #B8691F; }

/* ---- Printable bills (sale-detail, repair-detail) ---- */
.print-only { display: none; }
.store-name-print { font-weight: 700; font-size: 1.1rem; color: #16324F; margin: 0 0 0.5rem; }

@media print {
    .no-print { display: none !important; }
    .print-only { display: block; }
    .sidebar { display: none !important; }
    .app-shell { display: block; }
    .app-content { max-width: 100%; padding: 0; margin: 0; }
    body { background: #fff; }
}

tfoot td { font-weight: 600; border-top: 2px solid #ddd; }
tr.grand-total td { font-size: 1.05rem; color: #16324F; }

.site-footer {
    max-width: 1100px;
    margin: 2rem auto 0;
    padding: 1.25rem 2rem 2rem;
    text-align: center;
    color: #555;
    font-size: 0.85rem;
    border-top: 1px solid #ddd;
}

.site-footer .store-name {
    font-weight: 700;
    color: #16324F;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.site-footer p { margin: 0.15rem 0; }

.site-footer a { color: #555; text-decoration: underline; }
.site-footer a:hover { color: #16324F; }

/* ---- Public home page ---- */

.home-page {
    background: #F5F6F8;
    font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #1F2933;
}

.home-page h1, .home-page h2, .home-page h3 {
    font-family: 'Oswald', -apple-system, sans-serif;
    letter-spacing: 0.01em;
}

.hero {
    position: relative;
    background: #16324F;
    color: #F5F6F8;
    padding: 3.5rem 2rem;
    overflow: hidden;
}

.hero-text { max-width: 640px; position: relative; z-index: 1; }

.hero-kicker {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
    color: #E8A968;
    margin: 0 0 0.75rem;
}

.hero h2 {
    font-size: 2.1rem;
    line-height: 1.25;
    margin: 0 0 1rem;
    font-weight: 600;
    color: #fff;
}

.hero-sub {
    font-size: 1.05rem;
    color: #C9D6E0;
    margin: 0 0 1.5rem;
    max-width: 52ch;
}

.hero-sub-gu {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #E8A968;
    margin: 0 0 1rem;
    max-width: 52ch;
}

.hero-cta {
    display: inline-block;
    background: #D9822B;
    color: #fff;
    text-decoration: none;
    padding: 0.75rem 1.4rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95rem;
}
.hero-cta:hover { background: #B8691F; }

.hero-pattern {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 45%;
    opacity: 0.10;
    background-image:
        linear-gradient(#F5F6F8 1px, transparent 1px),
        linear-gradient(90deg, #F5F6F8 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.home-main {
    max-width: 760px;
    margin: 0 auto;
    padding: 3rem 2rem 1rem;
}

.section-heading {
    font-size: 1.5rem;
    color: #16324F;
    margin: 0 0 1.5rem;
}

.cta-banner {
    background: #16324F;
    color: #F5F6F8;
    padding: 2rem 2.25rem;
    border-radius: 4px;
    margin: 2.5rem 0 2rem;
}
.cta-banner h2 { color: #fff; margin: 0 0 0.5rem; font-size: 1.35rem; }
.cta-banner p { margin: 0; color: #C9D6E0; max-width: 60ch; }

.find-us {
    margin: 2.5rem 0 1rem;
}

.find-us-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 1.75rem;
    align-items: start;
}

@media (max-width: 640px) {
    .find-us-grid { grid-template-columns: 1fr; }
}

.find-us-details p { margin: 0.4rem 0; color: #374151; font-size: 0.95rem; }
.find-us-details a { color: #16324F; font-weight: 600; text-decoration: none; }
.find-us-details a:hover { text-decoration: underline; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.category-card {
    background: white;
    border: 1px solid #E2E5E9;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-image {
    background: #EAF0F5;
    padding: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid #D9822B;
}

.card-image svg { width: 100%; height: 96px; }

.card-body { padding: 1.25rem 1.4rem 1.5rem; }
.card-body h3 { margin: 0 0 0.4rem; font-size: 1.1rem; color: #16324F; }
.card-body p { margin: 0; color: #52606D; font-size: 0.92rem; }

.map-frame {
    width: 100%;
    height: 260px;
    border: 0;
    border-radius: 4px;
    filter: grayscale(15%);
}

.login-form { max-width: 380px; }
.login-form h2 { margin-top: 0; color: #16324F; }

.error-message {
    background: #fdeeee;
    color: #a33;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
}
.success-message {
    background: #eefaf0;
    color: #276b3f;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* ---- ERP app shell (sidebar layout) ---- */

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

.sidebar {
    width: 236px;
    flex-shrink: 0;
    background: #16324F;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-logo { height: 34px; width: auto; display: block; }

.sidebar-nav { padding: 0.6rem 0; flex: 1; }

.sidebar-nav a,
.sidebar-footer a,
.sidebar-footer button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin: 0;
    padding: 0.7rem 1.25rem;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.sidebar-nav a:hover,
.sidebar-footer a:hover,
.sidebar-footer button:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.sidebar-nav a.active,
.sidebar-footer a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-left-color: #D9822B;
}

.sidebar svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0;
}
.sidebar-footer form {
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
    max-width: none;
    display: block;
    border-radius: 0;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    background: #fff;
    border-bottom: 1px solid #E2E5E9;
    padding: 0.9rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.app-topbar h1 { margin: 0; font-size: 1.25rem; color: #16324F; font-weight: 700; }
.breadcrumb { margin: 0 0 0.2rem; font-size: 0.8rem; color: #52606D; }
.breadcrumb a { color: #52606D; text-decoration: none; }
.breadcrumb a:hover { color: #16324F; text-decoration: underline; }
.topbar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.app-content {
    padding: 1.5rem 1.75rem 3rem;
    max-width: 1100px;
    width: 100%;
    margin: 0;
}
.app-content > :first-child { margin-top: 0; }
.app-content h2 { margin-top: 1.75rem; }
.page-intro { margin: 0 0 1.25rem; color: #52606D; }

.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: #16324F; color: #fff; }
.btn-primary:hover { background: #0F2439; }
.btn-secondary { background: #E7ECF1; color: #16324F; }
.btn-secondary:hover { background: #d9e1ea; }
.btn-danger { background: #FBEAEA; color: #A33; }
.btn-danger:hover { background: #f5d5d5; }

.notice-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    background: #FFF7EF;
    border: 1px solid #EBC9A5;
    color: #7a5a2e;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}
.notice-banner form { margin: 0; padding: 0; background: none; box-shadow: none; max-width: none; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border: 1px solid #E2E5E9;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}
.stat-label { margin: 0 0 0.25rem; font-size: 0.8rem; color: #52606D; }
.stat-value { margin: 0; font-size: 1.6rem; font-weight: 700; color: #16324F; }
.stat-card.warn { border-color: #EBC9A5; background: #FFF7EF; }
.stat-card.warn .stat-value { color: #B8691F; }

/* Sidebar sub-menu (Products -> All Products + one row per category), Zoho-style */
.sidebar-sub { padding: 0.15rem 0 0.4rem; background: rgba(0, 0, 0, 0.16); }
.sidebar-nav .sidebar-sub a {
    padding: 0.42rem 1rem 0.42rem 2.9rem;
    font-size: 0.85rem;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.7);
    justify-content: space-between;
    white-space: normal; /* long category names wrap instead of being clipped */
}
.sidebar-nav .sidebar-sub a > span:first-child { flex: 1; min-width: 0; }
.sidebar-nav .sidebar-sub a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: #D9822B;
}
.sidebar-sub-count {
    flex-shrink: 0;
    margin-left: 0.5rem;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
}

@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: stretch;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .sidebar-brand {
        display: flex;
        align-items: center;
        padding: 0.5rem 0.9rem;
        border-bottom: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }
    .sidebar-logo { height: 26px; }
    .sidebar-nav { display: flex; flex: 1; padding: 0; }
    .sidebar-nav a {
        width: auto;
        padding: 0.7rem 0.8rem;
        border-left: 0;
        border-bottom: 3px solid transparent;
        font-size: 0.85rem;
    }
    .sidebar-nav a.active { border-left-color: transparent; border-bottom-color: #D9822B; }
    .sidebar-footer {
        display: flex;
        padding: 0;
        border-top: 0;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }
    .sidebar-footer a, .sidebar-footer button { width: auto; padding: 0.7rem 0.8rem; border-left: 0; }
    .sidebar-footer span { display: none; }
    .sidebar-sub { display: none; } /* the list pane's category <select> takes over on phones */
    .app-topbar, .app-content { padding-left: 1rem; padding-right: 1rem; }
}

/* ---- Product form: spec sections, inline input rows, hints ---- */

.spec-section {
    border: 1px solid #E2E5E9;
    border-radius: 8px;
    padding: 1rem 1.1rem 1.1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #FAFBFC;
}
.spec-section legend {
    padding: 0 0.4rem;
    font-weight: 700;
    color: #16324F;
    font-size: 0.9rem;
}

.input-row { display: flex; gap: 0.5rem; }
.input-row input { flex: 1; min-width: 0; }
.input-row select { flex: 0 0 auto; }

.hint { font-weight: 400; color: #52606D; font-size: 0.8rem; line-height: 1.4; }
.muted { color: #6B7785; font-size: 0.85em; }
.check-row { flex-direction: row; align-items: flex-start; gap: 0.6rem; font-weight: 400; }
.check-row input { margin-top: 0.2rem; }

/* ---- Coils / bundles ---- */
.coil-code { font-family: "Courier New", Courier, monospace; font-weight: 700; letter-spacing: 0.04em; }
.coil-tag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.45rem;
    border-radius: 4px;
    background: #EAF0F5;
    color: #16324F;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.78rem;
    font-weight: 700;
}
.stock-links { display: block; margin-top: 0.3rem; font-size: 0.8rem; }
.stock-links a { color: #B8691F; font-weight: 600; text-decoration: none; margin-right: 0.75rem; }
.stock-links a:hover { text-decoration: underline; }

/* ---- Coil sticker (bundle-sticker.html) — a standalone printable label ---- */
body.sticker-page { background: #fff; padding: 1.5rem; }
.sticker {
    width: 96mm;
    border: 1px dashed #9AA6B2;
    border-radius: 3mm;
    padding: 4mm 5mm;
    font-family: Arial, Helvetica, sans-serif;
    color: #000;
    background: #fff;
}
.sticker-shop { font-size: 8pt; letter-spacing: 0.05em; text-transform: uppercase; color: #333; }
.sticker-code {
    font-family: "Courier New", Courier, monospace;
    font-size: 30pt;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.1;
    margin: 1mm 0;
}
.sticker-barcode svg { display: block; width: 100%; height: 14mm; }
.sticker-product { font-size: 12pt; font-weight: 700; margin-top: 1.5mm; }
.sticker-meta { display: flex; justify-content: space-between; gap: 2mm; font-size: 9pt; margin-top: 1mm; }
.sticker-price { font-size: 12pt; font-weight: 700; margin-top: 1mm; }
.sticker-actions { margin-top: 1rem; display: flex; align-items: center; gap: 0.75rem; }
.sticker-actions button { padding: 0.5rem 1rem; }
@media print {
    body.sticker-page { padding: 0; }
    .sticker { border-color: transparent; }
    @page { margin: 6mm; }
}

/* ---- Pricing calculator panel ---- */
.calc-section { background: #F3F6FA; }
.calc-panel {
    background: #fff;
    border: 1px solid #D9E1EA;
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
}
.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.9rem;
    color: #374151;
    border-bottom: 1px dashed #E2E5E9;
}
.calc-row:last-child { border-bottom: 0; }
.calc-row strong { color: #16324F; }
.calc-row.highlight strong { color: #B8691F; }
input[readonly] { background: #F1F3F5; color: #374151; }

/* ---- Product photo gallery manager (Add section + Edit dialog) ---- */
.form-field { display: flex; flex-direction: column; gap: 0.5rem; }
.form-field-label { font-size: 0.9rem; font-weight: 600; color: #333; }

.photo-manager { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.photo-slot {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    background: #F1F3F5;
    border: 1px solid #E2E5E9;
    cursor: grab;
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #C6CDD4;
    font-size: 1.6rem;
    cursor: default;
    border-style: dashed;
}
.photo-slot-toolbar { position: absolute; top: 3px; right: 3px; display: flex; gap: 3px; }
.photo-slot-toolbar button {
    background: rgba(15, 36, 57, 0.7);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}
.photo-slot-toolbar button:hover { background: rgba(15, 36, 57, 0.95); }
.photo-slot-cover {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(15, 36, 57, 0.75);
    color: #fff;
    font-size: 0.62rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.photo-manager-dropzone {
    border: 1.5px dashed #C6CDD4;
    border-radius: 8px;
    padding: 0.8rem;
    text-align: center;
    font-size: 0.82rem;
    color: #6B7785;
    cursor: pointer;
}
.photo-manager-dropzone:focus { outline: 2px solid #16324F; outline-offset: 2px; }
.photo-manager-dropzone.drag-over { border-color: #16324F; background: #EAF0F5; color: #16324F; }

.link-btn {
    background: none;
    border: none;
    padding: 0;
    color: #B8691F;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* ---- Products: three-pane layout (sidebar | list pane | detail pane), products.html ---- */
.three-pane { display: flex; flex: 1; height: 100vh; min-height: 0; }

.list-pane {
    width: 340px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #E2E5E9;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}
.list-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #E2E5E9;
}
.list-pane-header h1 { margin: 0; font-size: 1.05rem; color: #16324F; font-weight: 700; }
.list-pane-count { font-size: 0.75rem; color: #6B7785; }
.btn-icon-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #D9822B;
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-icon-add:hover { background: #B8691F; }
.list-pane-tools {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #EEF1F4;
}
.list-pane-tools input[type="search"] { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; font-size: 0.85rem; }
.list-pane-category-select { display: none; font-size: 0.85rem; }
.list-pane .notice-banner { margin: 0.75rem 1rem 0; padding: 0.6rem 0.8rem; font-size: 0.82rem; }
.list-pane-rows { flex: 1; overflow-y: auto; }
.list-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #EEF1F4;
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
}
.list-row:hover { background: #F5F7FA; }
.list-row.active { background: #EAF0F5; border-left-color: #D9822B; }
.list-row-thumb {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 6px;
    background: #EAF0F5;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7785;
    font-weight: 700;
}
.list-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.list-row-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #16324F;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-row-sub { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.76rem; color: #6B7785; }
.list-row-cat { background: #EAF0F5; border-radius: 4px; padding: 0 0.35rem; }
.list-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; flex-shrink: 0; }
.list-row-price { font-size: 0.88rem; font-weight: 700; color: #16324F; }
.list-row-stock { font-size: 0.74rem; color: #6B7785; }
.list-row-stock.warn { color: #B8691F; font-weight: 600; }
.list-pane-empty { margin: 0; padding: 1.5rem 1rem; text-align: center; color: #6B7785; font-size: 0.88rem; }

.detail-pane { flex: 1; min-width: 0; height: 100vh; overflow-y: auto; }
.detail-pane-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    text-align: center;
    color: #6B7785;
}
.detail-pane-empty svg { width: 48px; height: 48px; color: #C6CDD4; }
.detail-pane-empty p { margin: 0; }
.detail-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #E2E5E9;
    position: sticky;
    top: 0;
    z-index: 2;
}
.detail-pane-header h1 { margin: 0; font-size: 1.2rem; color: #16324F; font-weight: 700; }
.detail-pane-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn-close {
    font-size: 1.5rem;
    line-height: 1;
    color: #6B7785;
    text-decoration: none;
    padding: 0.2rem 0.5rem;
}
.btn-close:hover { color: #16324F; }
.detail-pane .notice-banner { margin: 1rem 1.5rem 0; }

/* <details>-based dropdown menus (More ▾ on a product, + on All Products) — no JS needed */
.menu-dropdown { position: relative; }
.menu-dropdown > summary { list-style: none; cursor: pointer; }
.menu-dropdown > summary::-webkit-details-marker { display: none; }
.menu-dropdown-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 190px;
    background: #fff;
    border: 1px solid #E2E5E9;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 0.35rem 0;
    z-index: 5;
}
.menu-dropdown-title { margin: 0.25rem 0.9rem 0.3rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: #6B7785; }
.menu-dropdown-panel a, .menu-dropdown-panel button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.9rem;
    background: none;
    border: 0;
    border-radius: 0;
    color: #16324F;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.menu-dropdown-panel a:hover, .menu-dropdown-panel button:hover { background: #F5F7FA; color: #16324F; }
.menu-dropdown-panel button.menu-danger { color: #A33; }
.menu-dropdown-panel form { margin: 0; padding: 0; background: none; box-shadow: none; max-width: none; display: block; border-radius: 0; }

.pane-tabs { display: flex; padding: 0 1.5rem; background: #fff; border-bottom: 1px solid #E2E5E9; }
.pane-tab {
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.7rem 0.9rem;
    color: #52606D;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
.pane-tab:hover { background: none; color: #16324F; }
.pane-tab.active { color: #16324F; border-bottom-color: #D9822B; }
.pane-tab-panel { padding: 1.5rem; }
.pane-tab-panel table { box-shadow: none; border: 1px solid #E2E5E9; }

.overview { display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 2rem; align-items: start; }
.overview h3 { margin: 1.5rem 0 0.6rem; font-size: 0.95rem; color: #16324F; }
.overview-main > h3:first-child { margin-top: 0; }
.field-list {
    margin: 0;
    display: grid;
    grid-template-columns: 170px 1fr;
    row-gap: 0.55rem;
    column-gap: 1rem;
    font-size: 0.9rem;
}
.field-list dt { margin: 0; color: #6B7785; }
.field-list dd { margin: 0; color: #1a1a1a; font-weight: 500; }
.overview-side { display: flex; flex-direction: column; gap: 1rem; }
.detail-photo-add {
    aspect-ratio: 4 / 3;
    border: 1.5px dashed #C6CDD4;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    color: #6B7785;
    font-size: 0.85rem;
    text-decoration: none;
}
.detail-photo-add:hover { border-color: #16324F; color: #16324F; }
.stock-panel {
    background: #fff;
    border: 1px solid #E2E5E9;
    border-radius: 10px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.stock-stat-label {
    display: inline-block;
    font-size: 0.78rem;
    color: #6B7785;
    border-bottom: 1px dashed #C6CDD4;
    margin-bottom: 0.3rem;
}
.stock-stat-value { display: block; font-size: 1.15rem; font-weight: 700; color: #16324F; }
.stock-stat-value.warn { color: #B8691F; }
.stock-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.stock-tile { border: 1px solid #E2E5E9; border-radius: 8px; padding: 0.7rem 0.8rem; }
.stock-tile-value { display: block; font-size: 1.3rem; font-weight: 700; color: #16324F; }
.stock-tile-label { font-size: 0.75rem; color: #6B7785; }

.detail-pane .product-form { max-width: 640px; margin: 1.5rem; }
.form-actions { display: flex; align-items: center; gap: 0.75rem; }
.form-actions .btn-secondary { padding: 0.65rem 1rem; }

@media (max-width: 900px) {
    .three-pane { flex-direction: column; height: auto; }
    .list-pane { width: 100%; height: auto; position: static; border-right: 0; }
    .list-pane-rows { overflow: visible; }
    .list-pane-category-select { display: block; }
    .three-pane.has-pane .list-pane { display: none; }
    .three-pane:not(.has-pane) .detail-pane { display: none; }
    .detail-pane { height: auto; overflow: visible; }
    .overview { grid-template-columns: 1fr; }
    .field-list { grid-template-columns: 130px 1fr; }
    .detail-pane .product-form { margin: 1rem; }
}

/* ---- Product photo gallery in the detail pane ---- */
.detail-photo {
    aspect-ratio: 4 / 3;
    background: #EAF0F5;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.detail-photo img { width: 100%; height: 100%; object-fit: contain; }
.detail-photo-empty { color: #9AA6B2; font-size: 0.9rem; }
.detail-photo-gallery { display: flex; flex-direction: column; gap: 0.6rem; }
.detail-photo-thumbs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.detail-photo-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #E2E5E9;
    cursor: pointer;
    opacity: 0.8;
}
.detail-photo-thumb:hover { opacity: 1; border-color: #16324F; }
