/* ============================================================
   ADMIN TOOLS (Admin menu inside the website)
   Uses the site palette from site.css (--black, --lime, fonts)
   ============================================================ */

.admin-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--lime);
    color: var(--black);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.admin-pill:hover { background: var(--lime-dark); color: var(--black); }

.admin-page { padding: 24px 0 48px; font-family: var(--font-body); color: var(--text-dark); }
.admin-page h1 { font-family: var(--font-display); font-size: 2.2rem; letter-spacing: 1px; margin: 0 0 4px; }
.admin-page h2 { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .5px; margin: 0 0 12px; }
.admin-subtitle { color: #666; margin-bottom: 20px; }

/* Tabs */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 3px solid var(--black);
    margin-bottom: 24px;
}
.admin-tabs a {
    padding: 10px 18px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    border-radius: 6px 6px 0 0;
    background: #eee;
}
.admin-tabs a:hover { background: #ddd; }
.admin-tabs a.active { background: var(--black); color: var(--lime); }
.admin-tabs a i { margin-right: 6px; }

/* Flash messages */
.admin-alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-weight: 600; }
.admin-alert.success { background: #e7f6ea; color: #1d6b2c; border: 1px solid #b7e1c0; }
.admin-alert.error { background: #fdecec; color: #9b1c1c; border: 1px solid #f4c2c2; }
.admin-alert.warning { background: #fff7e0; color: #7a5a00; border: 1px solid #f1dc9c; }

/* Cards / stat tiles */
.admin-card { background: #fff; border: 1px solid #e3e3e3; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.admin-stat {
    display: block;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-left: 5px solid var(--lime-dark);
    border-radius: 8px;
    padding: 16px;
    text-decoration: none;
    color: var(--text-dark);
}
.admin-stat:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); color: var(--text-dark); }
.admin-stat .label { font-size: .85rem; color: #666; text-transform: uppercase; letter-spacing: .5px; }
.admin-stat .value { font-family: var(--font-display); font-size: 2.2rem; line-height: 1.1; }
.admin-stat .hint { font-size: .8rem; color: #888; }
.admin-stat.attention { border-left-color: #e0a800; }
.admin-stat.danger { border-left-color: #d9534f; }

/* Tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.admin-table th { background: var(--black); color: #fff; font-weight: 600; padding: 10px; text-align: left; white-space: nowrap; }
.admin-table td { padding: 9px 10px; border-bottom: 1px solid #eee; vertical-align: middle; }
.admin-table tr:hover td { background: #fafafa; }
.admin-table .num { text-align: right; white-space: nowrap; }
.admin-table .center { text-align: center; }
.admin-table tr.is-hidden td { color: #999; background: #f7f7f7; }
.admin-table tr.is-low td.qty-cell input { border-color: #e0a800; background: #fff8e1; }
.admin-table tr.is-out td.qty-cell input { border-color: #d9534f; background: #fdecec; }
.admin-table-wrap { overflow-x: auto; }
.admin-table a {  font-weight: 600; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 600; background: #eee; color: #555; }
.tag.hidden-tag { background: #555; color: #fff; }
.tag.low-tag { background: #fff1c2; color: #7a5a00; }
.tag.out-tag { background: #fdecec; color: #9b1c1c; }

/* Filters */
.admin-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.admin-filters .field { display: flex; flex-direction: column; gap: 4px; }
.admin-filters label { font-size: .8rem; color: #666; font-weight: 600; }
.admin-filters input[type=text], .admin-filters input[type=date], .admin-filters select,
.admin-form input[type=text], .admin-form input[type=number], .admin-form input[type=email], .admin-form textarea, .admin-form select,
.admin-table input[type=number] {
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: .95rem;
}
.admin-filters .check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; }
.admin-table input[type=number] { width: 100px; text-align: right; }

.status-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.status-chips a { padding: 5px 12px; border-radius: 16px; border: 1px solid #ccc; text-decoration: none; color: var(--text-dark); font-size: .85rem; font-weight: 600; background: #fff; }
.status-chips a.active { background: var(--black); color: var(--lime); border-color: var(--black); }
.status-chips a .count { opacity: .7; margin-left: 4px; }

/* Buttons */
.btn-admin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid var(--black);
    border-radius: 5px;
    background: var(--black);
    color: var(--lime);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: .95rem;
}
.btn-admin:hover { background: #222; color: var(--lime); }
.btn-admin.secondary { background: #fff; color: var(--black); }
.btn-admin.secondary:hover { background: #f0f0f0; }
.btn-admin.small { padding: 4px 10px; font-size: .8rem; }
.btn-admin.danger { background: #b52b27; border-color: #b52b27; color: #fff; }

/* Order detail */
.admin-grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.admin-grid-2 > * { min-width: 0; }   /* wide tables scroll inside their card instead of widening the page */
@media (max-width: 900px) { .admin-grid-2 { grid-template-columns: minmax(0, 1fr); } }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.status-actions button { border: none; color: #fff; border-radius: 5px; padding: 9px 14px; font-weight: 700; cursor: pointer; }
.status-actions button:hover { filter: brightness(.9); }
.admin-form .field { margin-bottom: 12px; }
.admin-form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.admin-form input[type=text], .admin-form input[type=number], .admin-form input[type=email], .admin-form textarea { width: 100%; }
.admin-form .help { font-size: .8rem; color: #777; margin-top: 3px; }
.admin-form .field-validation-error, .admin-form .text-danger { color: #b52b27; font-size: .85rem; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: #666; font-weight: 600; }
.kv dd { margin: 0; }
.history-list { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.history-list li { padding: 8px 0; border-bottom: 1px solid #eee; }
.history-list .when { color: #888; font-size: .8rem; }

/* Pagination */
.admin-pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.admin-pager a, .admin-pager span { padding: 6px 12px; border: 1px solid #ccc; border-radius: 4px; text-decoration: none; color: var(--text-dark); }
.admin-pager .current { background: var(--black); color: var(--lime); border-color: var(--black); }

.sticky-save {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 2px solid var(--black);
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    z-index: 5;
}
.muted { color: #888; }

/* Small screens */
@media (max-width: 768px) {
    .admin-page { padding-left: 16px; padding-right: 16px; }
    .admin-pill .admin-pill-label { display: none; }
    .admin-tabs a { padding: 8px 12px; font-size: .9rem; }
}

/* Stock: read-only quantity + stock log */
.admin-table input.stock-readonly {
    width: 80px;
    text-align: right;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f1f1f1;
    color: var(--text-dark);
    font-weight: 700;
    cursor: default;
    pointer-events: none;
}
.admin-table tr.is-low td.qty-cell input.stock-readonly { border-color: #e0a800; background: #fff8e1; }
.admin-table tr.is-out td.qty-cell input.stock-readonly { border-color: #d9534f; background: #fdecec; }
.stock-change { font-weight: 700; }
.stock-change.up { color: #1d6b2c; }
.stock-change.down { color: #b52b27; }
#addStockModal .modal-content { font-family: var(--font-body); }
#addStockModal .modal-title { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .5px; }

/* ============================================================
   IN-STORE ORDERS (Admin > New order)
   ============================================================ */
.pos-page { padding-bottom: 110px; }
.tag.pos-tag { background: var(--lime); color: var(--black); }

.pos-search {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--black);
    border-radius: 8px;
    padding: 0 14px;
    margin-bottom: 16px;
}
.pos-search i { color: #777; font-size: 1.1rem; }
.pos-search input {
    flex: 1;
    border: 0;
    outline: 0;
    padding: 14px 12px;
    font-size: 1.15rem;
    font-family: var(--font-body);
    background: transparent;
}
.pos-search-count { color: #888; font-size: .85rem; white-space: nowrap; }

.pos-list-card { padding: 0; overflow: hidden; }
.pos-list { list-style: none; margin: 0; padding: 0; }
.pos-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 110px 150px 130px 90px;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    transition: background .3s;
}
.pos-row:last-child { border-bottom: 0; }
.pos-row:hover { background: #fafafa; }
.pos-row.added { background: #f3fbd0; }
.pos-row.is-out { opacity: .55; }
.pos-thumb { width: 48px; height: 48px; border-radius: 6px; background: #f1f1f1; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #aaa; }
.pos-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pos-name { display: flex; flex-direction: column; min-width: 0; }
.pos-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-price { font-weight: 700; text-align: right; white-space: nowrap; }
.pos-stock { display: flex; flex-direction: column; gap: 3px; font-size: .85rem; }
.tag.pos-inorder { background: var(--black); color: var(--lime); align-self: flex-start; }

.qty-stepper { display: inline-flex; align-items: stretch; border: 1px solid #ccc; border-radius: 6px; overflow: hidden; background: #fff; }
.qty-stepper .step { width: 34px; border: 0; background: #f1f1f1; font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.qty-stepper .step:hover:not(:disabled) { background: #e2e2e2; }
.qty-stepper .step:disabled { cursor: not-allowed; }
.qty-stepper input.qty { width: 54px; border: 0; text-align: center; font-weight: 700; font-size: 1rem; -moz-appearance: textfield; }
.qty-stepper input.qty::-webkit-outer-spin-button, .qty-stepper input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.admin-table .qty-stepper input.qty { width: 54px; border: 0; padding: 6px 0; }
.btn-admin:disabled, .btn-admin.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.pos-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    background: var(--black);
    color: #fff;
    padding: 12px max(16px, calc((100vw - 1140px) / 2));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 16px rgba(0,0,0,.2);
}
.pos-bar-summary { display: flex; align-items: center; gap: 14px; font-size: 1.05rem; }
.pos-bar-summary i { color: var(--lime); font-size: 1.3rem; }
.pos-bar-total { font-family: var(--font-display); font-size: 1.8rem; color: var(--lime); letter-spacing: .5px; }
.pos-bar .btn-admin.secondary { background: transparent; color: #fff; border-color: #fff; }
.btn-admin.pos-create, .btn-admin.pos-place { background: var(--lime); color: var(--black); border-color: var(--lime); font-size: 1.05rem; padding: 10px 22px; }
.btn-admin.pos-create:hover, .btn-admin.pos-place:hover { background: var(--lime-dark); color: var(--black); }
.btn-admin.pos-place { width: 100%; justify-content: center; }
.btn-admin.pos-quote { width: 100%; justify-content: center; font-size: 1.05rem; padding: 10px 22px; }

.pos-toast {
    position: fixed;
    left: 50%;
    bottom: 90px;
    transform: translate(-50%, 20px);
    background: #1d6b2c;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 30;
    max-width: calc(100vw - 32px);
}
.pos-toast.show { opacity: 1; transform: translate(-50%, 0); }
.pos-toast.error { background: #b52b27; }

/* Overview (review) screen */
.pos-customer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border: 2px solid var(--lime-dark); border-radius: 8px; background: #fbfee8; }
.pos-customer-search { position: relative; }
.pos-customer-search input { width: 100%; padding: 10px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 1rem; }
.pos-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 10; list-style: none; margin: 4px 0 0; padding: 4px; background: #fff; border: 1px solid #ccc; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; }
.pos-results li.muted { padding: 8px; }
.pos-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 4px; cursor: pointer; }
.pos-results button:hover, .pos-results button:focus { background: #f3fbd0; }
.pos-results small { color: #777; }

.pos-toggle { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--black); border-radius: 8px; overflow: hidden; }
.pos-toggle.three { grid-template-columns: repeat(3, 1fr); }
.pos-toggle.three label:not(:first-of-type) { border-left: 1px solid #ddd; }
@media (max-width: 480px) { .pos-toggle.three { grid-template-columns: 1fr; } }
.pos-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pos-toggle label { margin: 0 !important; padding: 12px; text-align: center; cursor: pointer; font-weight: 700; background: #fff; }
.pos-toggle input:checked + label { background: var(--black); color: var(--lime); }
.pos-toggle input:focus-visible + label { outline: 3px solid var(--lime-dark); outline-offset: -3px; }
.pos-addresses { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.pos-address { display: block; font-weight: 400 !important; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; cursor: pointer; }
.pos-address:has(input:checked) { border-color: var(--black); background: #fafafa; }
.pos-new-address select { width: 100%; padding: 7px 10px; border: 1px solid #ccc; border-radius: 5px; }
#newCustomerModal .modal-title { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .5px; }

@media (max-width: 900px) {
    .pos-row { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "thumb name price" "stock stock stock" "qty qty add"; }
    .pos-thumb { grid-area: thumb; }
    .pos-name { grid-area: name; }
    .pos-price { grid-area: price; }
    .pos-stock { grid-area: stock; flex-direction: row; align-items: center; gap: 8px; }
    .pos-qty { grid-area: qty; }
    .pos-add { grid-area: add; text-align: right; }
    .pos-bar-total { font-size: 1.4rem; }
    .pos-bar-summary { gap: 8px; font-size: .95rem; }
}
@media (max-width: 576px) {
    .pos-bar { padding: 10px 12px; }
    .pos-bar .btn-admin { padding: 8px 12px; font-size: .9rem; }
}

/* Stock table: products grouped with their options */
.stock-table tbody.stock-group { border-top: 2px solid #d6d6d6; }
.stock-table thead + tbody.stock-group { border-top: 0; }
.stock-table .stock-item { display: flex; flex-direction: column; gap: 2px; }
.stock-table .stock-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.stock-table .stock-tags:empty { display: none; }

.stock-table tr.stock-group-head td { background: #f4f5f0; border-bottom: 1px solid #e6e6e6; padding-top: 12px; padding-bottom: 12px; }
.stock-table tr.stock-group-head:hover td { background: #f4f5f0; }
.stock-table tbody.is-hidden-group tr.stock-group-head td { background: #f1f1f1; color: #888; }

.stock-table tr.stock-option td:first-child { padding-left: 34px; position: relative; }
/* tree connector: vertical line down the group, elbow into each option */
.stock-table tr.stock-option td:first-child::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 0;
    bottom: 0;
    border-left: 2px solid var(--lime-dark);
}
.stock-table tr.stock-option.is-last td:first-child::before { bottom: 50%; }
.stock-table tr.stock-option td:first-child::after {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 12px;
    border-top: 2px solid var(--lime-dark);
}
.stock-table .stock-option-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.stock-table tr.stock-option td { border-bottom-color: #f1f1f1; }

/* Customer addresses (Admin > Customers) */
.customer-address { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eee; }
.customer-address:last-child { border-bottom: 0; }
.customer-address-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.admin-form input[type=tel] { width: 100%; padding: 7px 10px; border: 1px solid #ccc; border-radius: 5px; font-family: var(--font-body); font-size: .95rem; }

/* Nine admin tabs: a little less padding so they stay on one line on a laptop */
@media (min-width: 992px) { .admin-tabs a { padding: 10px 13px; } }

/* Online / in-store (Admin > Orders, Overview) */
.tag.web-tag { background: #e3f1fb; color: #0b5c8a; }
.source-chips { margin-bottom: 8px; }
.source-chips a i { margin-right: 4px; }
.admin-stat .split { font-size: .8rem; color: #555; margin-top: 2px; }

/* Monthly cash-up */
.admin-filters input[type=month] { padding: 7px 10px; border: 1px solid #ccc; border-radius: 5px; font-family: var(--font-body); font-size: .95rem; }
.cashup-month .btn-admin, .cashup-month input[type=month] { height: 40px; }
.tag.cashup-done { background: #e7f6ea; color: #1d6b2c; }
.admin-table tr.cashup-total td { border-top: 2px solid var(--black); background: #f6f6f6; font-weight: 700; }
.admin-page .small { font-size: .85rem; }

/* New order / Quotes switch (under the admin tabs) */
.pos-subnav { display: flex; gap: 6px; margin: -12px 0 18px; flex-wrap: wrap; }
.pos-subnav a { padding: 6px 14px; border-radius: 16px; border: 1px solid #ccc; background: #fff; color: var(--text-dark); text-decoration: none; font-weight: 600; font-size: .9rem; }
.pos-subnav a.active { background: var(--black); color: var(--lime); border-color: var(--black); }
.pos-subnav a i { margin-right: 4px; }
a.tag { text-decoration: none; }

/* Editing a quote */
.quote-edit-table input.quote-qty { width: 80px; text-align: center; }
.quote-edit-table tr.is-removed td { color: #aaa; text-decoration: line-through; }
.quote-edit-table tr.is-removed td input { text-decoration: none; }
.quote-add select { width: 100%; margin-top: 6px; padding: 4px; border: 1px solid #ccc; border-radius: 5px; font-family: var(--font-body); }
.quote-add input[type=search] { width: 100%; padding: 7px 10px; border: 1px solid #ccc; border-radius: 5px; }

/* Commission calculator (Cash-up) */
.commission-calc { margin-top: 14px; }
.commission-panel { margin-top: 12px; padding: 14px; border: 1px dashed #bbb; border-radius: 8px; background: #fafafa; max-width: 560px; }
.commission-rate { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.commission-rate label { margin: 0; white-space: nowrap; }
.admin-form.commission-rate input[type=number] { width: 120px; flex: 0 0 120px; padding: 7px 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 1rem; text-align: right; }

/* "Download PDF" of part of a page (js/print.js) – the same look as the printout */
.pdf-export { background: #fff; max-width: 1000px !important; padding: 0 !important; }
.pdf-export .admin-tabs, .pdf-export .admin-alert, .pdf-export .no-print, .pdf-export .btn-admin, .pdf-export .pos-subnav { display: none !important; }
.pdf-export .admin-table-wrap { overflow: visible !important; }
.pdf-export .admin-table { font-size: 12px; }
.pdf-export .admin-table th, .pdf-export .admin-table td { padding: 5px 7px; }
.pdf-export .admin-card { box-shadow: none; }
.pdf-export .commission-panel.d-none { display: none !important; }
.btn-admin.is-busy { opacity: .8; cursor: progress; }

@page { size: A4 portrait; margin: 12mm; }
@media print {
    #site-header, #site-footer, .admin-tabs, .admin-alert, .no-print, .btn-admin { display: none !important; }
    html, body { background: #fff !important; }
    .page-content { padding: 0 !important; margin: 0 !important; }
    /* Use the full page width (Bootstrap's .container is narrower at print widths) */
    .admin-page.container, .admin-page { max-width: none !important; width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .admin-page h1 { font-size: 1.8rem; }
    .admin-subtitle { margin-bottom: 10px; }
    .admin-card { border-color: #bbb; box-shadow: none; padding: 10px 12px; margin-bottom: 12px; }
    .admin-stat { border-color: #bbb; box-shadow: none; padding: 8px 12px; break-inside: avoid; }
    .admin-stat .value { font-size: 1.6rem; }
    .admin-stats { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
    /* Tables: no scroll box, fit the page, long lists may run onto the next page */
    .admin-table-wrap { overflow: visible !important; }
    .admin-table { font-size: 9.5pt; table-layout: auto; width: 100%; }
    .admin-table th, .admin-table td { padding: 4px 6px; }
    .admin-table th { background: #eee !important; color: #000 !important; white-space: normal; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .admin-table td:first-child { white-space: nowrap; }
    .admin-table tr { break-inside: avoid; }
    .admin-table thead { display: table-header-group; }
    .admin-table a { color: #000; text-decoration: none; }
    .kv { font-size: 9.5pt; }
    .commission-panel { background: none; border-color: #bbb; max-width: none; }
    .admin-form.commission-rate input[type=number] { border: 0; padding: 0; width: auto; }
}


/* Admin > Discounts */
.discount-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .discount-layout { grid-template-columns: 1fr; } }
.discount-info ul { padding-left: 18px; }
.discount-info li { margin-bottom: 8px; color: #444; }
.discount-preview { background: #f4fbe0; border: 1px solid #d4f300; border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; }
.discount-preview s { color: #8a8a8a; margin: 0 4px; }
.tag.discount-active { background: #e7f6ea; color: #1d6b2c; }
.tag.discount-scheduled { background: #e3f1fb; color: #0b5c8a; }
.tag.discount-ended { background: #eee; color: #777; }

/* New order: order discount box */
.pos-discount { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pos-discount input { max-width: 110px; }
.pos-discount-suffix { font-weight: 700; }
/* Item discounts (order overview) */
.line-discount { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.line-discount-input { width: 64px; text-align: right; padding: 4px 6px; }
.line-discount-clear { border: 0; background: none; color: #b42318; padding: 2px 4px; line-height: 1; cursor: pointer; }
.line-price .full-price { display: block; font-size: .85em; }
.pos-review-table tr.has-discount .unit-price { color: #b42318; font-weight: 700; }
.tag.shop-discount-tag { background: #b42318; color: #fff; }
.shop-discount { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; }
.shop-discount-state { font-style: italic; }
.pos-price .pos-sale-price { color: #b42318; display: block; }
.pos-price s { display: block; }
.pos-price .shop-discount-tag { margin-top: 2px; }
.tag.line-discount-tag { background: #fde8e7; color: #b42318; margin-left: 4px; }
.btn-link-admin { border: 0; background: none; padding: 0; color: #b42318; font-weight: 600; cursor: pointer; }
.btn-link-admin:hover { text-decoration: underline; }
#discountHelp { color: #1d6b2c; font-weight: 600; }

/* Admin: Back button at the top of every admin page (js/admin.js – TU.adminNav) */
.admin-back {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 5px 12px 5px 10px;
    border: 1px solid #cfcfcf; border-radius: 16px; background: #fff; color: #333; font-size: 0.85rem; font-weight: 600;
    text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
.admin-back:hover { background: var(--lime); border-color: var(--lime-dark); color: var(--black); }

/* "Hidden online" tag on New order (product is hidden from the website but can be sold in store) */
.pos-name .tag { align-self: flex-start; width: auto; margin: 2px 0; }

/* Admin > Orders: website payments waiting for PayFast */
.waiting-payfast { border-left: 4px solid #f0ad4e; }
.waiting-payfast h2 .tag { vertical-align: middle; }
.waiting-confirm { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.waiting-confirm input[name=PfPaymentId] { width: 150px; padding: 4px 8px; }

/* Admin > Order: the customer's order link */
.track-link { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.track-link input { flex: 1 1 200px; min-width: 0; font-size: .85rem; }

/* Stock & Prices: "Hide from list" */
.stock-listhide { border: 0; background: none; color: #777; font-size: .78rem; padding: 0 4px; cursor: pointer; white-space: nowrap; }
.stock-listhide:hover { color: #222; text-decoration: underline; }
.stock-listhide.is-on { color: #0a58ca; font-weight: 600; }
.tag.list-hidden-tag { background: #e7eefc; color: #0a3d91; }

/* ── Admin > Reports ─────────────────────────────────── */
.report-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.report-views { display: inline-flex; border: 2px solid #111; border-radius: 8px; overflow: hidden; }
.report-views a { padding: 8px 16px; font-weight: 700; color: #111; text-decoration: none; background: #fff; }
.report-views a + a { border-left: 2px solid #111; }
.report-views a.active { background: #111; color: var(--lime, #d4f300); }
.report-period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-pick { margin: 0; }
.report-pick input, .report-pick select { padding: 6px 10px; font-weight: 600; }
.report-heading { margin: 8px 0 12px; }
.report-stats .admin-stat .value { white-space: nowrap; }
.report-split small { font-size: .6em; color: #888; }
.report-cmp { font-size: .8rem; font-weight: 700; margin-top: 4px; }
.report-cmp.up { color: #198754; }
.report-cmp.down { color: #b42318; }
.report-chart-wrap { margin-top: 12px; }
.report-chart { width: 100%; height: auto; display: block; }
.report-chart .grid { stroke: #e6e6e6; stroke-width: 1; }
.report-chart .ylabel, .report-chart .xlabel { font-size: 13px; fill: #777; font-family: inherit; }
.report-chart polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.report-chart .line-total { stroke: #111; stroke-width: 3.5; }
.report-chart .line-web { stroke: #0a58ca; stroke-width: 2; }
.report-chart .line-pos { stroke: #e8590c; stroke-width: 2; stroke-dasharray: 6 4; }
.report-chart .dot { fill: var(--lime, #d4f300); stroke: #111; stroke-width: 2; cursor: pointer; }
.report-chart a .dot:hover, .report-chart .dot:hover { r: 8; }
.report-chart .vlabel { font-size: 13px; font-weight: 700; fill: #111; font-family: inherit; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.report-chart .vlabel-sm { font-size: 12px; dominant-baseline: middle; }
.report-legend { display: flex; gap: 14px; font-size: .85rem; font-weight: 600; }
.report-legend .sw { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 4px; }
.report-legend .sw-total { border-color: #111; border-top-width: 4px; }
.report-legend .sw-web { border-color: #0a58ca; }
.report-legend .sw-pos { border-color: #e8590c; border-top-style: dashed; }
.report-table tbody tr.row-link { cursor: pointer; }
.report-bars { list-style: none; padding: 0; margin: 0; }
.report-bars li { margin-bottom: 10px; }
.report-bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; margin-bottom: 3px; flex-wrap: wrap; }
.report-bar-label span:first-child { font-weight: 700; }
.report-bar { height: 10px; background: #eee; border-radius: 5px; overflow: hidden; }
.report-bar span { display: block; height: 100%; background: #111; }

/* "Sold by" (who made the sale): order page, Orders list, Cash-up */
.sold-by-select { padding: 5px 8px; border: 1px solid #ccc; border-radius: 5px; font-family: var(--font-body); font-size: .9rem; max-width: 100%; background: #fff; transition: border-color .2s, box-shadow .2s; }
.sold-by-select.is-saving { opacity: .6; }
.sold-by-select.is-saved { border-color: #2e7d32; box-shadow: 0 0 0 3px rgba(46, 125, 50, .18); }
.sold-by-field { display: flex; align-items: center; gap: 8px; }
.sold-by-field .sold-by-select { flex: 1; padding: 7px 10px; font-size: .95rem; }
.cashup-subhead { font-size: 1.05rem; margin: 18px 0 8px; }
.commission-table tr.commission-person-first td { border-top: 2px solid #ddd; }
@media print { .sold-by-select { border: 0; appearance: none; -webkit-appearance: none; padding: 0; background: none; } }

/* Reports: filters, figure tiles, comparison line, detail tabs */
.report-controls { display: block; }
.report-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.report-jump { padding: 6px 10px; font-weight: 600; border: 1px solid #ccc; border-radius: 5px; font-family: var(--font-body); }
.report-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eee; }
.report-filters label { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.report-filters label span { font-size: .75rem; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .03em; }
.report-filters select { padding: 6px 8px; border: 1px solid #ccc; border-radius: 5px; font-family: var(--font-body); font-size: .9rem; min-width: 150px; background: #fff; }
.report-filters select:disabled { opacity: .5; }
.report-clear { align-self: flex-end; }
.report-chips { margin-top: 10px; }
.report-chip { display: inline-flex; align-items: center; gap: 6px; background: #111; color: var(--lime, #d4f300); border-radius: 999px; padding: 4px 12px; font-size: .85rem; font-weight: 700; text-decoration: none; }
.report-chip:hover { color: #fff; }
.report-filtered { display: block; font-size: .85rem; font-weight: 600; color: #0a58ca; margin-top: 2px; }
.report-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; margin-bottom: 16px; }
.report-tile { display: block; background: #fff; border: 2px solid #e6e6e6; border-radius: 10px; padding: 10px 12px; color: #111; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.report-tile:hover { border-color: #999; color: #111; }
.report-tile.active { border-color: #111; box-shadow: inset 0 -4px 0 var(--lime, #d4f300); }
.report-tile .label { display: block; font-size: .75rem; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .03em; }
.report-tile .value { display: block; font-size: 1.25rem; font-weight: 800; white-space: nowrap; margin-top: 2px; }
.report-tile .report-cmp { margin-top: 2px; }
.report-chart .line-cmp { stroke: #9a9a9a; stroke-width: 2; stroke-dasharray: 3 5; }
.report-chart .dot-cmp { fill: #fff; stroke: #9a9a9a; stroke-width: 1.5; }
.report-legend .sw-cmp { border-color: #9a9a9a; border-top-style: dotted; }
.report-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 20px 0 0; border-bottom: 2px solid #111; }
.report-tabs a { padding: 8px 14px; font-weight: 700; color: #111; text-decoration: none; background: #eee; border-radius: 8px 8px 0 0; }
.report-tabs a.active { background: #111; color: var(--lime, #d4f300); }
.report-tab-card { border-top-left-radius: 0; border-top-right-radius: 0; }
.report-tab-tools { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }
.report-seg { display: inline-flex; align-items: center; gap: 0; font-size: .82rem; font-weight: 700; color: #666; }
.report-seg a { margin-left: -1px; padding: 4px 10px; border: 1px solid #ccc; color: #111; text-decoration: none; background: #fff; font-weight: 600; }
.report-seg a:first-of-type { margin-left: 8px; border-radius: 6px 0 0 6px; }
.report-seg a:last-of-type { border-radius: 0 6px 6px 0; }
.report-seg a.active { background: #111; border-color: #111; color: var(--lime, #d4f300); }
.report-subhead { font-size: 1.05rem; margin: 4px 0 8px; }
.report-up { color: #198754; font-weight: 700; }
.report-down { color: #b42318; font-weight: 700; }
.report-matrix th, .report-matrix td { padding-left: 6px; padding-right: 6px; font-size: .85rem; }
.report-matrix td:nth-child(2) { white-space: nowrap; }
.report-mini-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.report-mini-stats div { border: 1px solid #e6e6e6; border-radius: 8px; padding: 8px 14px; min-width: 130px; }
.report-mini-stats span { display: block; font-size: .75rem; font-weight: 700; color: #666; text-transform: uppercase; }
.report-mini-stats strong { font-size: 1.3rem; }
.report-mini-stats small { display: block; color: #888; font-size: .75rem; }
@media (max-width: 600px) { .report-filters select { min-width: 0; width: 100%; } .report-filters label { flex: 1 1 45%; } }

.report-page .report-table { font-size: .9rem; }
.report-page .report-table th { white-space: nowrap; }
.report-page .report-table td.report-when { white-space: nowrap; }

/* Admin > Products: an option's optional description, under its name */
.opt-desc-input { display: block; width: 100%; min-width: 180px; margin-top: 6px; font-size: .85rem; resize: vertical; }
