/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Prevent iOS auto-zoom on input focus */
input, select, textarea { font-size: max(16px, 1em); touch-action: manipulation; }

/* ── Tokens ────────────────────────────────────────────────────────────────── */
:root {
    --green:        #16a34a;
    --green-dark:   #15803d;
    --green-light:  #dcfce7;
    --green-mid:    #bbf7d0;
    --bg:           #f1f5f9;
    --surface:      #ffffff;
    --border:       #e2e8f0;
    --border-focus: #16a34a;
    --text:         #0f172a;
    --muted:        #64748b;
    --red:          #dc2626;
    --red-light:    #fef2f2;
    --radius-sm:    6px;
    --radius:       10px;
    --radius-lg:    14px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow:       0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
    --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 48px;
}

/* ── PWA Banner ────────────────────────────────────────────────────────────── */
.pwa-banner {
    background: var(--text);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    font-size: 13px;
}

.pwa-banner-icon { font-size: 28px; flex-shrink: 0; }
.pwa-banner-body { flex: 1; min-width: 0; }
.pwa-banner-title { font-weight: 700; font-size: 14px; }
.pwa-banner-sub   { font-size: 12px; color: rgba(255,255,255,.7); margin-top: 2px; }

.pwa-install-btn {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    white-space: nowrap;
}

.pwa-dismiss-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.6);
    cursor: pointer;
    font-size: 16px;
    margin-left: auto;
    padding: 0 4px;
}

/* ── Brand header ──────────────────────────────────────────────────────────── */
.brand-header {
    background: var(--green);
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(22,163,74,.25);
}
.brand-header .brand-logo { justify-self: center; }
.support-btn { width:36px; height:36px; justify-self:end; background:rgba(255,255,255,.15); border:none; border-radius:50%; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .15s; }
.support-btn:hover { background:rgba(255,255,255,.28); }

/* Support Modal */
.support-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:1000; align-items:center; justify-content:center; padding:16px; }
.support-overlay.open { display:flex; }
.support-modal { background:#fff; border-radius:16px; width:100%; max-width:460px; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,.2); }
.support-modal-header { background:#16a34a; padding:20px 24px; display:flex; align-items:center; justify-content:space-between; }
.support-modal-title { font-size:16px; font-weight:800; color:#fff; }
.support-modal-sub { font-size:12px; color:rgba(255,255,255,.75); margin-top:2px; }
.support-close { background:rgba(255,255,255,.2); border:none; color:#fff; width:28px; height:28px; border-radius:50%; font-size:14px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.support-close:hover { background:rgba(255,255,255,.35); }
.support-modal-body { padding:24px; display:flex; flex-direction:column; gap:16px; }
.support-field { display:flex; flex-direction:column; gap:6px; }
.support-field label { font-size:11px; font-weight:700; color:#6b7280; text-transform:uppercase; letter-spacing:.4px; }
.support-field select, .support-field textarea { border:1.5px solid #e5e7eb; border-radius:10px; padding:10px 12px; font-size:14px; font-family:inherit; outline:none; resize:none; }
.support-field select:focus, .support-field textarea:focus { border-color:#16a34a; }
.support-submit { background:#16a34a; color:#fff; border:none; border-radius:10px; padding:12px; font-size:14px; font-weight:700; cursor:pointer; font-family:inherit; }
.support-submit:hover { background:#15803d; }
.support-submit:disabled { opacity:.6; cursor:not-allowed; }
.support-feedback { padding:10px 14px; border-radius:8px; font-size:13px; font-weight:600; }
.support-feedback.success { background:#f0fdf4; color:#15803d; border:1px solid #bbf7d0; }
.support-feedback.error { background:#fef2f2; color:#dc2626; border:1px solid #fecaca; }

.btn-logout {
    color: rgba(255,255,255,.8);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid rgba(255,255,255,.4);
    padding: 5px 12px;
    border-radius: 20px;
    transition: all .15s;
    white-space: nowrap;
}

.btn-logout:hover {
    color: #fff;
    border-color: rgba(255,255,255,.8);
    background: rgba(255,255,255,.1);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.brand-tagline {
    font-size: 12px;
    color: rgba(255,255,255,.65);
    font-weight: 400;
}

/* ── Container ─────────────────────────────────────────────────────────────── */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 28px 16px 0;
}

/* ── Tab navigation ────────────────────────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 5px;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s ease;
    font-family: var(--font);
}

.tab-btn:hover:not(.active) {
    background: var(--bg);
    color: var(--text);
}

.tab-btn.active {
    background: var(--green);
    color: #fff;
    box-shadow: 0 2px 8px rgba(22,163,74,.3);
}

/* ── Product card ──────────────────────────────────────────────────────────── */
.product-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow .2s;
}

.product-card:hover { box-shadow: var(--shadow); }

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.product-number {
    font-weight: 700;
    font-size: 14px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.btn-remove {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
    font-family: var(--font);
}

.btn-remove:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-light);
}

/* ── Form fields ───────────────────────────────────────────────────────────── */
.product-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 13px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

textarea { resize: vertical; }

.field-group input,
.field-group textarea { width: 100%; }

/* ── Type toggle ───────────────────────────────────────────────────────────── */
.type-toggle {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    width: fit-content;
    background: var(--bg);
}

.type-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.type-option input[type=radio] { display: none; }

.type-option span {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    transition: background .15s, color .15s;
}

.type-option input:checked + span {
    background: var(--green);
    color: #fff;
}

/* ── Variable section ──────────────────────────────────────────────────────── */
.variable-section {
    border: 1.5px solid var(--green-mid);
    border-radius: var(--radius-lg);
    padding: 18px;
    background: #f0fdf4;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.variable-attrs { display: flex; flex-direction: column; gap: 12px; }

.btn-generate-vars {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    width: fit-content;
    transition: background .15s;
    font-family: var(--font);
}

.btn-generate-vars:hover { background: var(--green-dark); }

/* ── Fill all variations ───────────────────────────────────────────────────── */
.var-fill-all {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 6px;
}

.var-fill-inputs { display: flex; gap: 8px; }

.var-fill-all input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 13px;
    width: 160px;
    font-family: var(--font);
}

.var-fill-all input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

.btn-fill-all {
    background: var(--green-light);
    color: var(--green-dark);
    border: 1.5px solid var(--green-mid);
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    font-family: var(--font);
}

.btn-fill-all:hover {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

/* ── Variations table ──────────────────────────────────────────────────────── */
.variations-table {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.var-header {
    display: grid;
    grid-template-columns: 1fr 120px 120px;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.var-row {
    display: grid;
    grid-template-columns: 1fr 120px 120px;
    gap: 8px;
    padding: 8px 14px;
    align-items: center;
    border-top: 1px solid var(--border);
}

.var-row:hover { background: #fafafa; }

.var-label { font-size: 13px; font-weight: 500; color: var(--text); }

.var-price, .var-stock {
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
    width: 100% !important;
    font-family: var(--font) !important;
}

.var-price:focus, .var-stock:focus {
    border-color: var(--green) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(22,163,74,.12) !important;
}

/* ── Multiselect ───────────────────────────────────────────────────────────── */
.multiselect { position: relative; }

.multiselect-box {
    min-height: 42px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    cursor: text;
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.multiselect-box.open,
.multiselect-box:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

.multiselect-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--green-light);
    color: var(--green-dark);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}

.multiselect-tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--green);
    background: none;
    border: none;
    padding: 0;
}

.multiselect-tag-remove:hover { color: var(--red); }

.multiselect-search {
    border: none !important;
    outline: none !important;
    padding: 2px 4px !important;
    font-size: 13px !important;
    flex: 1;
    min-width: 80px;
    background: transparent !important;
    font-family: var(--font) !important;
}

.multiselect-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 220px;
    overflow-y: auto;
}

.multiselect-option {
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background .1s;
}

.multiselect-option:hover { background: var(--green-light); }

.multiselect-option.selected {
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 600;
}

.multiselect-empty {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--muted);
}

.multiselect-create {
    color: var(--green) !important;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.multiselect-create:hover { background: var(--green-light) !important; }

.cat-arrow { color: var(--muted); font-size: 12px; margin-right: 2px; }

/* ── Photo upload ──────────────────────────────────────────────────────────── */
.image-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.photo-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    background: var(--bg);
    transition: all .15s;
}

.photo-dropzone:hover {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green-dark);
}

.photo-dropzone input[type="file"] { display: none; }
.photo-dropzone .upload-icon { font-size: 30px; }

.btn-add-photo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 2px dashed var(--green);
    border-radius: var(--radius);
    color: var(--green);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: var(--surface);
    transition: background .15s;
    width: fit-content;
}

.btn-add-photo:hover { background: var(--green-light); }
.btn-add-photo input[type="file"] { display: none; }

.image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.image-thumb-wrap {
    position: relative;
    display: inline-block;
    cursor: grab;
    touch-action: none;
}

.image-thumb-wrap:active { cursor: grabbing; }
.image-thumb-wrap.dragging { opacity: 0.35; }

.image-thumb-wrap.drag-over .image-thumb {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.3);
    transform: scale(1.05);
    transition: transform .1s;
}

.image-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
}

.image-thumb-wrap:first-child .image-thumb {
    border-color: var(--green);
    width: 100px;
    height: 100px;
}

.thumb-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    border: none;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.thumb-badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--green);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: .3px;
}

/* ── Simple attrs section ──────────────────────────────────────────────────── */
.simple-attrs-section {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--bg);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.btn-add {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--surface);
    border: 2px dashed var(--green);
    border-radius: var(--radius-lg);
    color: var(--green);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    margin-bottom: 24px;
    font-family: var(--font);
}

.btn-add:hover { background: var(--green-light); }

.form-footer { text-align: center; margin-top: 8px; }

.btn-submit {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    padding: 14px 56px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(22,163,74,.3);
    font-family: var(--font);
}

.btn-submit:hover {
    background: var(--green-dark);
    box-shadow: 0 4px 12px rgba(22,163,74,.4);
}

.btn-submit:disabled {
    background: #86efac;
    box-shadow: none;
    cursor: not-allowed;
}

/* ── Results ───────────────────────────────────────────────────────────────── */
.results {
    margin-top: 28px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.results h2 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--text); }

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.result-item:last-child { border-bottom: none; }
.result-icon { font-size: 16px; flex-shrink: 0; }
.result-name { flex: 1; font-weight: 500; }
.result-error { color: var(--red); font-size: 12px; }

.summary {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 2px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

/* ── Loading overlay ───────────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    gap: 14px;
}

.loading-step  { font-size: 16px; font-weight: 700; color: var(--green); }
.loading-sub   { font-size: 13px; font-weight: 600; color: var(--green); opacity: .7; }
.loading-count { font-size: 13px; color: var(--muted); }

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Edit tab ──────────────────────────────────────────────────────────────── */
.edit-search-wrap {
    position: relative;
    margin-bottom: 20px;
}

.edit-search-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    font-size: 15px;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: var(--shadow-sm);
}

.edit-search-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

.edit-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 340px;
    overflow-y: auto;
}

.edit-result-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 13px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

.edit-result-item:last-child { border-bottom: none; }
.edit-result-item:hover { background: var(--green-light); }

.edit-result-name { font-size: 14px; font-weight: 600; color: var(--text); }
.edit-result-meta { font-size: 12px; color: var(--muted); }

.edit-search-loading,
.edit-search-empty {
    padding: 16px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    line-height: 1.6;
}

.edit-product-form {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.edit-product-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.edit-product-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.edit-product-badge {
    background: var(--green-light);
    color: var(--green-dark);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

.edit-fields { display: flex; flex-direction: column; gap: 16px; }

.edit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-edit-save {
    padding: 13px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    font-family: var(--font);
    box-shadow: 0 2px 8px rgba(22,163,74,.25);
}

.btn-edit-save:hover { background: var(--green-dark); }
.btn-edit-save:disabled { background: #86efac; cursor: not-allowed; box-shadow: none; }

.btn-edit-cancel {
    padding: 13px 20px;
    background: var(--surface);
    color: var(--muted);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: var(--font);
}

.btn-edit-cancel:hover { background: var(--bg); color: var(--text); }

.edit-msg {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.edit-msg-ok    { background: var(--green-light); color: var(--green-dark); }
.edit-msg-error { background: var(--red-light);   color: var(--red); }

.edit-discount-wrap {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.edit-discount-preview {
    font-size: 13px;
    font-weight: 700;
    color: var(--green-dark);
}

.btn-clear-discount {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
    font-family: var(--font);
    white-space: nowrap;
}

.btn-clear-discount:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-light);
}

.edit-var-cell { display: flex; flex-direction: column; gap: 3px; }

.edit-var-cell-label {
    display: none;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

@media (max-width: 600px) {
    .edit-var-cell-label { display: block; }
}

.edit-var-sale {
    border: 1.5px solid var(--green-mid);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font);
    color: var(--green-dark);
    background: var(--green-light);
}

.edit-var-sale:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

/* ── Edit variations table ─────────────────────────────────────────────────── */
.edit-var-table {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.edit-var-header {
    display: grid;
    grid-template-columns: 1fr 130px 130px;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.edit-var-row {
    display: grid;
    grid-template-columns: 1fr 130px 130px;
    gap: 8px;
    padding: 8px 14px;
    align-items: center;
    border-top: 1px solid var(--border);
}

.edit-var-row:hover { background: #fafafa; }

.edit-var-label { font-size: 13px; font-weight: 500; color: var(--text); }

.edit-var-price,
.edit-var-stock {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font);
    color: var(--text);
}

.edit-var-price:focus,
.edit-var-stock:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.brand-footer {
    text-align: center;
    padding: 32px 16px 16px;
    font-size: 12px;
    color: var(--muted);
}

.brand-footer a {
    color: var(--green);
    text-decoration: none;
    font-weight: 600;
}

.brand-footer a:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .field-row { grid-template-columns: 1fr; }

    .tab-btn { font-size: 13px; padding: 10px 10px; }

    .edit-var-header { display: none; }
    .edit-var-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px;
        padding: 12px;
    }
    .edit-var-label {
        grid-column: 1 / -1;
        font-weight: 700;
        font-size: 13px;
        padding-bottom: 4px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 2px;
    }
    .edit-var-price,
    .edit-var-sale,
    .edit-var-stock { font-size: 14px; }

    .btn-submit { padding: 13px 32px; }

    .brand-header { height: 52px; }
}

/* ── Delete button ─────────────────────────────────────────────────────────── */
.btn-delete-product {
    grid-column: 1 / -1;
    padding: 13px;
    background: var(--surface);
    color: var(--red);
    border: 1.5px solid #fca5a5;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background .15s, border-color .15s;
}
.btn-delete-product:hover {
    background: var(--red-light);
    border-color: var(--red);
}

/* ── Add variation ─────────────────────────────────────────────────────────── */
.btn-add-var {
    background: transparent;
    border: 1.5px dashed var(--border);
    color: var(--primary);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    width: 100%;
    margin: 12px 0 4px;
    transition: border-color .15s, background .15s;
}
.btn-add-var:hover { border-color: var(--primary); background: #f0fdf4; }

.add-var-form {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 10px 0;
    background: var(--surface);
}
.add-var-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* ── Description textarea ─────────────────────────────────────────────────── */
#editDescription {
    resize: vertical;
    min-height: 70px;
}

/* ── Status pills ──────────────────────────────────────────────────────────── */
.status-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 30px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all .18s;
    white-space: nowrap;
}
.status-pill:hover { border-color: #cbd5e1; color: var(--text); }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    opacity: .35;
    transition: opacity .18s;
}
.status-pill.active .status-dot { opacity: 1; }

.status-pill-publish.active {
    background: #f0fdf4;
    border-color: var(--green);
    color: var(--green-dark);
    box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}
.status-pill-draft.active {
    background: #fffbeb;
    border-color: #d97706;
    color: #92400e;
    box-shadow: 0 0 0 3px rgba(217,119,6,.1);
}
.status-pill-private.active {
    background: #faf5ff;
    border-color: #9333ea;
    color: #6b21a8;
    box-shadow: 0 0 0 3px rgba(147,51,234,.1);
}

/* ── Attribute chips ───────────────────────────────────────────────────────── */
.attr-chips-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    display: block;
}
.attr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.attr-chip {
    padding: 7px 15px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all .15s;
    white-space: nowrap;
}
.attr-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0fdf4;
}
.attr-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(22,163,74,.25);
}

/* ── Custom select (global) ────────────────────────────────────────────────── */
select {
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 38px 10px 13px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%2394a3b8' fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
select:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%2316a34a' fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
}
select.field-input { width: 100%; }

/* ── Toast notification ────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 13px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font);
    color: #fff;
    opacity: 0;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s;
    z-index: 9999;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    letter-spacing: .01em;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.toast.toast-ok    { background: linear-gradient(135deg, #16a34a, #15803d); }
.toast.toast-error { background: linear-gradient(135deg, #dc2626, #b91c1c); }

/* ── Save button loading state ─────────────────────────────────────────────── */
@keyframes _spin { to { transform: rotate(360deg); } }

.btn-edit-save.loading {
    pointer-events: none;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}
.btn-edit-save.loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: _spin .65s linear infinite;
    flex-shrink: 0;
}

/* ── Variation delete button ───────────────────────────────────────────────── */
.btn-var-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    transition: color .15s, background .15s, border-color .15s;
    padding: 0;
    align-self: center;
    flex-shrink: 0;
}
.btn-var-delete:hover {
    color: var(--red);
    background: var(--red-light);
    border-color: #fca5a5;
}
.btn-var-delete:disabled { cursor: not-allowed; }

/* ── Edit Gallery ──────────────────────────────────────────────────────────── */
.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 90px;
    align-items: flex-start;
}
.gallery-loading {
    font-size: 13px;
    color: var(--muted);
    padding: 8px 0;
}
.gallery-thumb {
    position: relative;
    width: 82px;
    height: 82px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    color: #fff;
    border: none;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s, background .15s;
    padding: 0;
}
.gallery-thumb:hover .gallery-remove { opacity: 1; }
.gallery-remove:hover { background: var(--red); }

.gallery-add {
    width: 82px;
    height: 82px;
    border-radius: var(--radius);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    flex-shrink: 0;
    transition: border-color .15s, color .15s, background .15s;
}
.gallery-add:hover {
    border-color: var(--green);
    color: var(--green);
    background: #f0fdf4;
}
.gallery-add.loading {
    pointer-events: none;
    animation: _spin .8s linear infinite;
}

/* Mobile: gallery-remove always visible */
@media (max-width: 600px) {
    .gallery-remove { opacity: 1; }
}

/* ── Upload status toggle ──────────────────────────────────────────────────── */
.type-option input[value="publish"]:checked + span {
    background: var(--green);
    color: #fff;
}
.type-option input[value="draft"]:checked + span {
    background: #d97706;
    color: #fff;
}

/* ── Burger button ─────────────────────────────────────────────────────────── */
.burger-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    border-radius: 8px;
    width: 36px;
    align-items: center;
    justify-self: start;
}
.burger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,.85);
    border-radius: 2px;
    transition: background .15s;
}
.burger-btn:hover span { background: #fff; }

/* ── Drawer overlay ────────────────────────────────────────────────────────── */
#drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
#drawer-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* ── Drawer ────────────────────────────────────────────────────────────────── */
#drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100%;
    background: var(--surface);
    z-index: 300;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
}
#drawer.open { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    background: var(--green);
    flex-shrink: 0;
}
.drawer-header .brand-logo { gap: 8px; }
.drawer-header .brand-name  { font-size: 16px; color: #fff; font-weight: 700; }
.drawer-close {
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.drawer-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    transition: background .15s, color .15s;
    width: 100%;
}
.drawer-item:hover { background: var(--green-light); color: var(--green-dark); }
.drawer-item.active {
    background: var(--green-light);
    color: var(--green-dark);
}
.drawer-item.active .drawer-icon { color: var(--green); }
.drawer-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: var(--muted);
    flex-shrink: 0;
}
.drawer-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.drawer-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all .15s;
    background: var(--surface);
}
.drawer-logout:hover { color: var(--red); border-color: var(--red); background: var(--red-light); }

/* ── Orders ────────────────────────────────────────────────────────────────── */
.orders-search-row { margin-bottom: 10px; }

.orders-filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.orders-filter-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all .15s;
}
.orders-filter-btn:hover { border-color: var(--green); color: var(--green); }
.orders-filter-btn.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.orders-loading, .orders-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--muted);
    font-size: 14px;
}

.order-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: box-shadow .15s, border-color .15s;
}
.order-row:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-sm);
}
.order-row-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.order-number { font-size: 14px; font-weight: 700; color: var(--green-dark); }
.order-customer { font-size: 13px; color: var(--muted); }
.order-row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.order-total { font-size: 14px; font-weight: 700; color: var(--text); }
.order-date  { font-size: 11px; color: var(--muted); }

/* Order status badges */
.order-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
}
.os-processing { background: #dbeafe; color: #1d4ed8; }
.os-pending    { background: #fef9c3; color: #854d0e; }
.os-on-hold    { background: #fef9c3; color: #854d0e; }
.os-completed  { background: var(--green-light); color: var(--green-dark); }
.os-cancelled  { background: #fef2f2; color: #dc2626; }
.os-refunded   { background: #f3e8ff; color: #7e22ce; }
.os-failed     { background: #fef2f2; color: #dc2626; }

.btn-orders-more {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all .15s;
}
.btn-orders-more:hover { border-color: var(--green); color: var(--green); }

/* Order detail */
.order-detail-back { margin-bottom: 12px; }
.btn-order-back {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font);
    transition: all .15s;
}
.btn-order-back:hover { border-color: var(--green); color: var(--green); }

.order-detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.order-detail-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.order-detail-date { font-size: 12px; color: var(--muted); font-weight: 400; }

.order-detail-section {
    padding: 14px 0;
    border-top: 1px solid var(--border);
}
.order-detail-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}
.order-detail-value { font-size: 14px; color: var(--text); line-height: 1.5; }
.order-detail-value.muted { color: var(--muted); font-size: 13px; }

.order-status-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.order-status-row select { width: 100%; }
.order-status-row .btn-edit-save { width: 100%; padding: 13px; font-size: 15px; }

.order-items-list { display: flex; flex-direction: column; gap: 10px; }
.order-item-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
}
.order-item-name { flex: 1; color: var(--text); }
.order-item-sku  { color: var(--muted); font-size: 11px; }
.order-item-qty  { color: var(--muted); flex-shrink: 0; }
.order-item-price { font-weight: 700; color: var(--text); flex-shrink: 0; }

.order-detail-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 0;
    border-top: 2px solid var(--text);
    margin-top: 4px;
    font-weight: 700;
    font-size: 16px;
}

/* ── Order status select ───────────────────────────────────────────────────── */
.order-status-select { flex: 1; width: auto; font-weight: 600; }

/* ── Order action forms (tracking / note) ──────────────────────────────────── */
.order-action-form { display: flex; flex-direction: column; gap: 8px; }
.order-action-btn  { width: 100%; padding: 13px; font-size: 15px; margin-top: 4px; }

/* ── Settings tab ──────────────────────────────────────────────────────────── */
.settings-page         { padding: 20px 16px 40px; max-width: 560px; margin: 0 auto; }
.settings-section      { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.settings-section-title{ font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.settings-section-desc { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.6; }
.settings-loading      { font-size: 13px; color: var(--muted); padding: 8px 0; }

/* ── Courier setup steps ────────────────────────────────────────────────────── */
.courier-step            { display: flex; flex-direction: column; gap: 12px; }
.courier-step-title      { font-size: 13px; font-weight: 700; color: var(--text); }
.courier-step-info       { font-size: 13px; color: var(--muted); line-height: 1.6; }
.btn-courier-primary     { background: var(--green); color: #fff; border: none; border-radius: 10px; padding: 12px 20px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: var(--font); align-self: flex-start; transition: background .15s; }
.btn-courier-primary:hover{ background: var(--green-dark); }
.btn-courier-primary:disabled{ opacity: .6; cursor: not-allowed; }

.courier-msg             { font-size: 13px; padding: 10px 14px; border-radius: 8px; }
.courier-msg.success     { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green-mid); white-space: pre-line; }
.courier-msg.error       { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.courier-msg.hidden      { display: none; }

.courier-results-title   { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; margin-top: 4px; }
.courier-actions-list    { display: flex; flex-direction: column; gap: 6px; }
.courier-action-item     { background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.courier-action-item:hover{ border-color: var(--green); background: var(--green-light); }
.courier-action-label    { font-size: 14px; font-weight: 700; color: var(--text); }
.courier-action-key      { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: monospace; }
.courier-empty           { font-size: 13px; color: var(--muted); padding: 8px 0; }

/* ── Courier configured state ───────────────────────────────────────────────── */
.courier-configured      { display: flex; align-items: center; gap: 12px; background: var(--green-light); border: 1.5px solid var(--green-mid); border-radius: 12px; padding: 14px 16px; }
.courier-configured-icon { width: 32px; height: 32px; background: var(--green); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; flex-shrink: 0; }
.courier-configured-info { flex: 1; }
.courier-configured-label{ font-size: 14px; font-weight: 700; color: var(--text); }
.courier-configured-sub  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.courier-remove-btn      { background: none; border: 1.5px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; font-family: var(--font); flex-shrink: 0; }
.courier-remove-btn:hover{ border-color: #dc2626; color: #dc2626; }

/* ── Voucher button in order detail ─────────────────────────────────────────── */
.btn-voucher { background: #1d4ed8; color: #fff; }
.btn-voucher:hover { background: #1e40af; }

/* ── Companion install steps ─────────────────────────────────────────────────── */
.companion-install-steps  { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.companion-install-row    { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.companion-install-num    { width: 26px; height: 26px; background: var(--green); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.companion-install-text   { flex: 1; font-size: 13px; color: var(--text); line-height: 1.5; }
.btn-courier-secondary    { background: none; border: 1.5px solid var(--green); color: var(--green); border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: var(--font); white-space: nowrap; text-decoration: none; flex-shrink: 0; }
.btn-courier-secondary:hover { background: var(--green-light); }

/* ── Stock Tab ──────────────────────────────────────────────────────────────── */
.stock-page           { padding: 16px; max-width: 640px; margin: 0 auto; }
.stock-header         { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.stock-search-input   { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; font-family: var(--font); background: var(--bg); color: var(--text); box-sizing: border-box; }
.stock-search-input:focus { outline: none; border-color: var(--green); }
.stock-scan-btn       { flex-shrink: 0; width: 44px; height: 44px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.stock-scan-btn:active { border-color: var(--green); color: var(--green); }

/* Scanner Overlay */
.scanner-overlay      { position: fixed; inset: 0; background: #000; z-index: 1000; display: flex; flex-direction: column; }
.scanner-overlay.hidden { display: none; }
.scanner-header       { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; padding-top: max(16px, env(safe-area-inset-top)); background: rgba(0,0,0,.7); flex-shrink: 0; }
.scanner-title        { color: #fff; font-size: 16px; font-weight: 700; }
.scanner-close        { background: rgba(255,255,255,.15); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; touch-action: manipulation; }
.scanner-viewport     { flex: 1; position: relative; overflow: hidden; background: #000; }
/* html5-qrcode overrides */
#scannerViewport      { position: absolute; inset: 0; }
#scannerViewport video { width: 100% !important; height: 100% !important; object-fit: cover !important; }
#scannerViewport img  { display: none !important; }
#scannerViewport > div { border: none !important; box-shadow: none !important; }
#html5-qrcode-button-camera-stop,
#html5-qrcode-button-camera-start,
#html5-qrcode-anchor-scan-type-change { display: none !important; }
/* laser line */
.scanner-laser        { position: absolute; left: 5%; right: 5%; top: 50%; height: 2px; background: #ff2d2d; box-shadow: 0 0 6px 2px rgba(255,45,45,.7); border-radius: 2px; pointer-events: none; animation: laser-pulse 1.5s ease-in-out infinite; z-index: 10; }
@keyframes laser-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.scanner-status       { background: rgba(0,0,0,.7); color: #fff; text-align: center; padding: 14px 20px; padding-bottom: max(14px, env(safe-area-inset-bottom)); font-size: 14px; min-height: 48px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.scanner-manual       { background: #111; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 24px; flex-shrink: 0; }
.scanner-manual.hidden { display: none; }
.scanner-manual-input { width: 100%; padding: 16px; font-size: 20px; font-weight: 700; text-align: center; border: 2px solid #444; border-radius: 12px; background: #222; color: #fff; box-sizing: border-box; font-family: var(--font); letter-spacing: 2px; }
.scanner-manual-input:focus { outline: none; border-color: var(--green); }
.scanner-manual-input::placeholder { color: #555; letter-spacing: 0; font-weight: 400; font-size: 15px; }
.scanner-manual-btn   { width: 100%; padding: 15px; background: var(--green); color: #fff; border: none; border-radius: 12px; font-size: 17px; font-weight: 700; cursor: pointer; font-family: var(--font); touch-action: manipulation; }
.stock-loading        { text-align: center; padding: 32px; color: var(--muted); font-size: 14px; }
.stock-empty          { text-align: center; padding: 32px; color: var(--muted); font-size: 14px; }

/* ── Settings ────────────────────────────────────────────────────────────────── */
.settings-page        { padding: 20px 16px; display: flex; flex-direction: column; gap: 28px; max-width: 560px; margin: 0 auto; }
.settings-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.settings-card        { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.settings-card--info  { justify-content: flex-start; }
.settings-card-left   { display: flex; align-items: center; gap: 14px; min-width: 0; }
.settings-card-icon   { width: 38px; height: 38px; background: var(--green-light); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--green); }
.settings-card-label  { font-size: 15px; font-weight: 600; color: var(--text); }
.settings-card-sub    { font-size: 12px; color: var(--muted); margin-top: 2px; }
.settings-card-sub.perm-granted { color: var(--green); }
.settings-card-sub.perm-denied  { color: var(--red); }
.settings-perm-btn    { flex-shrink: 0; padding: 8px 14px; border-radius: 8px; border: none; background: var(--green); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; touch-action: manipulation; font-family: var(--font); white-space: nowrap; }
.settings-perm-btn:disabled { background: var(--border); color: var(--muted); cursor: default; }

.stock-item           { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.stock-item:last-child { border-bottom: none; }
.stock-item-img       { width: 46px; height: 46px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--border); display: flex; align-items: center; justify-content: center; }
.stock-item-img img   { width: 100%; height: 100%; object-fit: cover; }
.stock-item-no-img    { font-size: 20px; }
.stock-item-info      { flex: 1; min-width: 0; }
.stock-item-name      { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-item-sku       { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stock-badge          { border: none; border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: var(--font); flex-shrink: 0; min-width: 52px; text-align: center; }
.stock-badge-ok       { background: #dcfce7; color: #166534; }
.stock-badge-low      { background: #fef9c3; color: #713f12; }
.stock-badge-zero     { background: #fee2e2; color: #991b1b; }
.stock-badge-var      { background: #ede9fe; color: #4c1d95; }
.stock-badge:hover    { opacity: .85; }

/* ── Stock Modal ────────────────────────────────────────────────────────────── */
.stock-modal-overlay  { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 900; display: flex; align-items: flex-end; justify-content: center; }
.stock-modal-overlay.hidden { display: none; }
.stock-modal          { background: var(--bg); border-radius: 20px 20px 0 0; width: 100%; max-width: 480px; padding: 20px 20px 32px; max-height: 80vh; overflow-y: auto; }
.stock-modal-header   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.stock-modal-title    { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; }
.stock-modal-close    { background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.stock-modal-body     { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.stock-modal-row      { display: flex; flex-direction: column; gap: 8px; }
.stock-modal-label    { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stock-stepper        { display: flex; align-items: stretch; border: 1.5px solid var(--border); border-radius: 14px; overflow: hidden; height: 60px; }
.stock-ctrl           { flex: 0 0 60px; background: var(--surface, #f8fafc); border: none; font-size: 26px; font-weight: 300; cursor: pointer; color: var(--text); font-family: var(--font); transition: background .1s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.stock-ctrl:active    { background: var(--green-light, #f0fdf4); color: var(--green); }
.stock-qty-input      { flex: 1; text-align: center; border: none; border-left: 1.5px solid var(--border); border-right: 1.5px solid var(--border); font-size: 26px; font-weight: 800; font-family: var(--font); color: var(--text); background: var(--bg); min-width: 0; }
.stock-qty-input:focus { outline: none; background: #f0fdf4; }
.stock-modal-footer   { }
.btn-stock-save       { width: 100%; padding: 14px; background: var(--green); color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; font-family: var(--font); }
.btn-stock-save:hover { background: var(--green-dark, #15803d); }
.btn-stock-save:disabled { opacity: .6; cursor: default; }


/* ── Home Tab ───────────────────────────────────────────────────────────────── */
.home-page            { padding: 16px; max-width: 600px; margin: 0 auto; padding-bottom: 40px; }

/* Dashboard */
.home-dashboard       { margin-bottom: 16px; }
.dash-loading         { text-align: center; padding: 20px; color: var(--muted); font-size: 14px; }

.dash-pending         { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.dash-pending-active  { border-color: #fbbf24; background: #fffbeb; }
.dash-pending-dot     { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.dash-pending-active .dash-pending-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.dash-pending-stats   { display: flex; gap: 24px; }
.dash-pending-item    { display: flex; flex-direction: column; gap: 2px; }
.dash-pending-num     { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.dash-pending-active .dash-pending-num { color: #92400e; }
.dash-pending-lbl     { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }

.dash-stats           { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.dash-stat            { flex: 1; padding: 16px 10px 14px; text-align: center; min-width: 0; position: relative; }
.dash-stat::before    { content: ''; position: absolute; top: 0; left: 16px; right: 16px; height: 3px; background: var(--green); border-radius: 0 0 3px 3px; opacity: .15; }
.dash-stat-label      { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.dash-stat-orders     { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.dash-stat-revenue    { font-size: 18px; font-weight: 800; color: var(--green); white-space: nowrap; }
.dash-divider         { width: 1px; background: var(--border); flex-shrink: 0; }

/* Nav Cards - 2x2 grid, full responsive */
.home-cards           { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.home-card            { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px 16px 18px; text-align: left; cursor: pointer; font-family: var(--font); transition: border-color .15s, box-shadow .15s, transform .1s; display: flex; flex-direction: column; gap: 3px; -webkit-tap-highlight-color: transparent; box-shadow: var(--shadow-sm); }
.home-card:active     { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.12); transform: scale(.98); }
.home-card-icon       { width: 44px; height: 44px; background: var(--green-light); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--green); margin-bottom: 12px; flex-shrink: 0; }
.home-card-label      { font-size: 14px; font-weight: 700; color: var(--text); }
.home-card-sub        { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* Notification Banner */
.notif-banner         { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 12px; padding: 11px 14px; margin-bottom: 10px; }
.notif-banner-text    { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); font-weight: 500; }
.notif-banner-icon    { font-size: 18px; }
.notif-btn            { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: var(--font); }
.notif-btn-active     { background: var(--muted); }

/* Home Support */
.home-support         { background: var(--bg); border: 1.5px solid var(--border); border-radius: 16px; padding: 18px 16px; }
.home-support-title   { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.home-support-sub     { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.home-support .support-submit { width: 100%; margin-top: 12px; }

@media (max-width: 360px) {
    .dash-stat-revenue  { font-size: 14px; }
    .home-card-label    { font-size: 13px; }
}

/* ── Discounts ───────────────────────────────────────────────────────────────── */
.disc-page            { padding: 20px 16px; max-width: 560px; margin: 0 auto; }
.disc-tabs            { display: flex; gap: 8px; margin-bottom: 20px; }
.disc-tab             { flex: 1; padding: 10px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font); color: var(--muted); touch-action: manipulation; }
.disc-tab.active      { border-color: var(--green); color: var(--green); background: var(--green-light); }
.disc-tab-content     { display: flex; flex-direction: column; gap: 16px; }
.disc-tab-content.hidden { display: none; }
.disc-search-wrap     { display: flex; gap: 8px; }
.disc-search-input    { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 15px; font-family: var(--font); }
.disc-search-input:focus { outline: none; border-color: var(--green); }
.disc-search-btn      { padding: 10px 16px; background: var(--green); color: #fff; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font); touch-action: manipulation; white-space: nowrap; }
.disc-loading         { color: var(--muted); font-size: 14px; padding: 12px 0; }
.disc-product-item    { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); margin-bottom: 8px; }
.disc-product-item:hover { border-color: var(--green); background: var(--green-light); }
.disc-product-img     { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.disc-product-img-placeholder { width: 44px; height: 44px; background: var(--border); border-radius: 6px; flex-shrink: 0; }
.disc-product-name    { font-size: 14px; font-weight: 600; color: var(--text); }
.disc-product-price   { font-size: 13px; color: var(--muted); margin-top: 2px; }
.disc-on-sale         { color: var(--red); font-weight: 700; }
.disc-badge-var       { display: inline-block; font-size: 10px; font-weight: 600; background: #e0f2fe; color: #0369a1; border-radius: 4px; padding: 1px 5px; vertical-align: middle; margin-left: 4px; }
.disc-selected-product { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--green-light); border-radius: var(--radius); border: 1.5px solid var(--green-mid); }
.disc-selected-img    { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.disc-selected-name   { font-size: 15px; font-weight: 700; color: var(--text); }
.disc-selected-price  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.disc-fields          { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.disc-field           { display: block; width: 100%; }
.disc-field label     { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.disc-field input     { display: block; width: 100%; box-sizing: border-box; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 15px; font-family: var(--font); background: var(--surface); }
.disc-field input:focus { outline: none; border-color: var(--green); }
.disc-field input[type="date"] { width: -webkit-fill-available; width: fill-available; max-width: 100%; }
.disc-cat-picker      { position: relative; }
.disc-cat-btn         { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 15px; font-family: var(--font); cursor: pointer; text-align: left; color: var(--muted); }
.disc-cat-btn:focus   { outline: none; border-color: var(--green); }
.disc-cat-list        { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); max-height: 230px; overflow-y: auto; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.disc-cat-list.hidden { display: none; }
.disc-cat-option      { padding: 10px 14px; font-size: 14px; cursor: pointer; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-cat-option:hover { background: var(--green-light); color: var(--green); }
.disc-actions         { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.disc-mode-toggle     { display: flex; gap: 6px; }
.disc-mode-btn        { flex: 1; padding: 8px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font); color: var(--muted); touch-action: manipulation; }
.disc-mode-btn.active { border-color: var(--green); background: var(--green-light); color: var(--green); }
.disc-input-wrap      { position: relative; }
.disc-input-wrap input { padding-right: 36px; }
.disc-input-suffix    { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 15px; font-weight: 700; color: var(--muted); pointer-events: none; }
.disc-btn-apply       { flex: 1; padding: 13px; background: var(--green); color: #fff; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 700; cursor: pointer; font-family: var(--font); touch-action: manipulation; }
.disc-btn-remove      { flex: 1; padding: 13px; background: var(--red-light); color: var(--red); border: 1.5px solid #fca5a5; border-radius: var(--radius); font-size: 15px; font-weight: 700; cursor: pointer; font-family: var(--font); touch-action: manipulation; }
.disc-btn-remove.hidden { display: none; }
.disc-status          { font-size: 14px; color: var(--green); font-weight: 600; min-height: 20px; }
.disc-progress        { display: flex; flex-direction: column; gap: 8px; }
.disc-progress.hidden { display: none; }
.disc-progress-bar-wrap { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.disc-progress-bar    { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s ease; width: 0%; }
.disc-progress-text   { font-size: 13px; color: var(--muted); font-weight: 600; }
