/* ==========================================================================
   Merchant Toolkit — design system (RTL-first, mobile-first, no build step)
   ========================================================================== */

/* Local Cairo Font (100% Self-Hosted, Zero Third-Party Requests) */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/cairo-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/cairo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/cairo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
    --bg: #f4f7f6;
    --surface: #ffffff;
    --ink: #0e1b17;
    --ink-2: #4a5a55;
    --ink-3: #8a9a95;
    --line: #e1e8e5;
    --brand: #0f9d74;
    --brand-d: #0a7a59;
    --brand-l: #e3f6ef;
    --deep: #0b1f1a;
    --danger: #d6336c;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(11, 31, 26, .05), 0 8px 24px -8px rgba(11, 31, 26, .12);
    --font: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
    line-height: 1.65; -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--brand-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
.container {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    padding-inline: 1rem;
}
.skip-link { position: absolute; top: -60px; inset-inline-start: 8px; background: var(--deep); color: #fff; padding: .5rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .85); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .6rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; border-radius: 12px; }
.brand:hover { text-decoration: none; }
.brand:focus-visible { outline: 2px solid #059669; outline-offset: 3px; border-radius: 12px; }
.brand-logo-icon { width: 44px; height: 44px; border-radius: 14px; box-shadow: 0 2px 8px -1px rgba(5, 150, 105, 0.3); transition: transform .2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .2s ease; flex-shrink: 0; }
.brand:hover .brand-logo-icon { transform: scale(1.05); box-shadow: 0 4px 14px -2px rgba(5, 150, 105, 0.45); }
.brand-text { display: flex; flex-direction: column; text-align: right; line-height: 1.15; }
.brand-title { font-size: 1.22rem; font-weight: 800; color: #0f172a; letter-spacing: -0.015em; line-height: 1.2; }
.brand-sub { font-size: .72rem; font-weight: 600; color: #64748b; letter-spacing: 0.04em; line-height: 1.2; font-family: system-ui, -apple-system, sans-serif; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; font-size: 1.25rem; background: linear-gradient(135deg, var(--brand), #0b6f55); box-shadow: 0 6px 14px -4px rgba(15, 157, 116, .6); }
.brand-text small { font-size: .65rem; color: var(--ink-3); font-weight: 600; letter-spacing: .08em; }
.nav { display: flex; gap: .25rem; scrollbar-width: none; overflow: visible; }
.nav::-webkit-scrollbar { display: none; }
@media (max-width: 980px) { .nav { overflow-x: auto; -webkit-overflow-scrolling: touch; } }
.nav-link { white-space: nowrap; padding: .45rem .8rem; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: .9rem; transition: background .2s, color .2s; }
.nav-link:hover { background: var(--brand-l); color: var(--brand-d); text-decoration: none; }
.nav-link.is-active { background: var(--deep); color: #fff; }
.pill-soon { font-style: normal; font-size: .62rem; margin-inline-start: .35rem; padding: .05rem .4rem; border-radius: 999px; background: #fff3bf; color: #8a6d00; }
@media (max-width: 980px) { .brand-text small { display: none; } .header-inner { flex-direction: column; align-items: stretch; gap: .4rem; } }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 700; font-size: .95rem; padding: .7rem 1.2rem; border-radius: 12px; border: 1px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s; min-height: 44px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid rgba(15, 157, 116, .35); outline-offset: 1px; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-d)); color: #fff; box-shadow: 0 8px 18px -8px rgba(15, 157, 116, .8); }
.btn-primary:hover { box-shadow: 0 10px 22px -8px rgba(15, 157, 116, .95); text-decoration: none; }
.btn-dark { background: var(--deep); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-d); text-decoration: none; }
.btn-ghost.is-active { background: var(--brand-l); color: var(--brand-d); border-color: var(--brand); font-weight: 700; }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; min-height: 34px; border-radius: 9px; }
.btn-danger-ghost { color: var(--danger); background: transparent; border-color: transparent; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
.field[hidden], [hidden] { display: none !important; }
.val-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e6fcf5;
    color: #099268;
    font-size: .8rem;
    font-weight: 800;
    padding: .15rem .5rem;
    border-radius: 6px;
    border: 1px solid #c3fae8;
    line-height: 1.2;
}
.field > label, .field > .lbl, .field > span { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.field input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
    font: inherit; width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfc; color: var(--ink); min-height: 44px; transition: border-color .2s, background .2s;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #c4d2cd; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); background: #fff; }
.field input.is-invalid { border-color: var(--danger); background: #fff5f8; }
.field .hint { font-size: .74rem; color: var(--ink-3); }
.field .err { font-size: .74rem; color: var(--danger); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
@media (max-width: 520px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
input[dir="ltr"], .ltr { direction: ltr; text-align: start; unicode-bidi: plaintext; }
input[type="file"] { padding: .45rem; }

/* ---------- Home ---------- */
.hero { background: radial-gradient(1200px 400px at 80% -10%, rgba(15, 157, 116, .35), transparent 60%), linear-gradient(160deg, #0b1f1a, #102e27 60%, #0b1f1a); color: #fff; padding: clamp(2.5rem, 7vw, 5rem) 0; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3.2rem); font-weight: 800; max-width: 18ch; }
.hero h1 em { font-style: normal; color: #5eead4; }
.hero p { color: #b8d3cb; max-width: 56ch; font-size: 1.05rem; }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }
.badge { padding: .3rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; padding-block: 2rem; }
.tool-card { position: relative; display: flex; flex-direction: column; gap: .4rem; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); transition: transform .25s, border-color .25s; overflow: hidden; }
.tool-card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--accent, var(--brand)); }
.tool-card:hover { transform: translateY(-4px); border-color: var(--accent, var(--brand)); text-decoration: none; }
.tool-card .ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent, var(--brand)); }
.tool-card .ico svg { width: 26px; height: 26px; }
.tool-card h2 { font-size: 1.1rem; margin: .4rem 0 0; }
.tool-card p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.tool-card .go { margin-top: auto; padding-top: .6rem; font-weight: 700; color: var(--accent, var(--brand-d)); }

/* ---------- Home Categorized Tools Sections & Dividers ---------- */
.tools-section {
    margin-bottom: 2rem;
}
.tools-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .85rem;
    border-bottom: 1.5px solid var(--line);
    margin-bottom: 1.25rem;
}
.tools-section-title-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.tools-section-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid transparent;
    flex-shrink: 0;
}
.tools-section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--deep);
    margin: 0;
    line-height: 1.25;
}
.tools-section-desc {
    font-size: .84rem;
    color: var(--ink-3);
    margin: .2rem 0 0 0;
    line-height: 1.4;
}
.tools-section-badge {
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1.2;
}
.tools-section .tools-grid {
    padding-block: 0 .5rem;
}
.tools-section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line), transparent);
    margin: 2.25rem 0 2.25rem;
    position: relative;
}
.tools-section-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    border-radius: 50%;
}
@media (max-width: 640px) {
    .tools-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
    }
    .tools-section-badge {
        align-self: flex-start;
    }
    .tools-section-title {
        font-size: 1.15rem;
    }
}

.seo-copy { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 2rem; color: var(--ink-2); }
.seo-copy h2 { color: var(--ink); font-size: 1.15rem; }

/* ---------- Ad slots (Zero CLS Safeguards & Fixed Breakpoints) ---------- */
.ad-slot {
    margin: 2rem auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    contain: layout style;
    clear: both;
    text-align: center;
}
.ad-slot--desktop-only {
    display: none !important;
}
@media (min-width: 768px) {
    .ad-slot--desktop-only {
        display: flex !important;
    }
}
.ad-slot-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}
.ad-slot-label {
    display: block;
    font-size: 0.65rem;
    color: var(--muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    user-select: none;
}
/* Rectangle format (300x250 mobile, 336x280 desktop) */
.ad-slot--rectangle {
    min-height: 274px;
    max-width: 336px;
}
@media (min-width: 768px) {
    .ad-slot--rectangle {
        min-height: 304px;
    }
}
/* Leaderboard format (320x100 mobile, 728x90 desktop) */
.ad-slot--leaderboard {
    min-height: 124px;
    max-width: 728px;
}
@media (min-width: 768px) {
    .ad-slot--leaderboard {
        min-height: 114px;
    }
}
/* Infeed format */
.ad-slot--infeed {
    min-height: 180px;
    max-width: 800px;
}

/* Debug Mode (Visual outline when ?adsdebug=1) */
.ad-slot--debug {
    border: 2px dashed #94a3b8;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    color: #475569;
    font-size: 0.82rem;
    text-align: center;
}
.ad-slot-debug-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.ad-slot-badge {
    background: #0f766e;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}
.ad-slot-info code {
    background: #e2e8f0;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}
.ad-slot-size {
    font-size: 0.75rem;
    color: #64748b;
}

/* ---------- Tool workspace (split screen) ---------- */
.tool-head { padding: 1.4rem 0 .6rem; }
.tool-head h1 { font-size: clamp(1.25rem, 3vw, 1.8rem); margin: 0; }
.tool-head p { margin: .2rem 0 0; color: var(--ink-2); }
.workspace {
    display: grid;
    grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
    gap: 1.2rem;
    align-items: start;
    padding-bottom: 2rem;
    min-width: 0;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 0;
}
.panel-form {
    padding: 1rem;
    min-width: 0;
}
.panel-form .field { margin-bottom: .7rem; gap: .25rem; }
.panel-form .field > label, .panel-form .field > .lbl, .panel-form .field > span { font-size: .78rem; font-weight: 700; color: #475569; }
.panel-form .field input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), .panel-form .field select, .panel-form .field textarea {
    font-size: .84rem;
    padding: .5rem .7rem;
    min-height: 40px;
    border-radius: 9px;
}
.panel-form .field select,
.field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fbfdfc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.8rem center;
    background-size: 15px 15px;
    padding-left: 2.3rem;
    padding-right: 0.8rem;
    cursor: pointer;
    line-height: 1.45;
}
.panel-form .field select:focus,
.field select:focus {
    background-color: #ffffff;
    border-color: var(--brand);
}
.panel-form .field input::placeholder, .panel-form .field textarea::placeholder {
    font-size: .8rem;
    color: #94a3b8;
}

.grid-date-currency {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: .75rem;
}
.grid-date-currency .field-currency select {
    padding-inline-start: .65rem;
    padding-inline-end: .35rem;
}
@media (max-width: 520px) {
    .grid-date-currency { grid-template-columns: 1fr; }
}

.panel-form fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
.panel-form legend { display: flex; align-items: center; gap: .5rem; width: 100%; font-weight: 800; font-size: .95rem; padding: 0 0 .6rem; margin-bottom: .6rem; border-bottom: 1px dashed var(--line); }
.panel-form legend .n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-l); color: var(--brand-d); font-size: .75rem; }

/* Section cards & Accordions */
.section-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: .9rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.02);
}
.section-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    font-weight: 800;
    font-size: .95rem;
    padding-bottom: .6rem;
    margin-bottom: .8rem;
    border-bottom: 1px dashed var(--line);
    color: var(--ink);
}
.section-title .n {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-l);
    color: var(--brand-d);
    font-size: .75rem;
    font-weight: 800;
}

.accordion-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: .9rem;
    overflow: hidden;
    transition: all .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.02);
}
.accordion-card:hover { border-color: #cbd5e1; }
.accordion-card[open] {
    border-color: var(--brand);
    box-shadow: 0 4px 12px rgba(15, 157, 116, .08);
}
.accordion-header {
    padding: .75rem 1rem;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    background: #fbfdfc;
    transition: background .15s ease;
}
.accordion-header::-webkit-details-marker { display: none; }
.accordion-header:hover { background: #f4f8f6; }
.accordion-card[open] > .accordion-header {
    border-bottom: 1px solid var(--line);
    background: #f8faf9;
}
.accordion-toggle-badge {
    font-size: .78rem;
    font-weight: 700;
    color: var(--brand-d);
    background: var(--brand-l);
    padding: .25rem .6rem;
    border-radius: 7px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all .15s ease;
}
.accordion-card[open] .accordion-toggle-badge {
    background: #fee2e2;
    color: #b91c1c;
}
.accordion-body { padding: 1rem; background: #fff; }

/* Store Summary Bar */
.store-summary-info {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 1;
    min-width: 0;
}
.store-avatar {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--brand-l);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 1.25rem;
}
.store-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}
.store-summary-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}
.store-summary-text strong {
    font-size: .92rem;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.store-summary-text span {
    font-size: .75rem;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: .15rem;
}
.store-body-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px dashed var(--line);
}

/* Modern Logo Uploader */
.logo-uploader {
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .2rem;
}
.sr-only-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    top: 0;
    inset-inline-start: 0;
}
.logo-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .65rem 1rem;
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    background: #fbfdfc;
    cursor: pointer;
    transition: all .2s ease;
    flex: 1;
    text-align: center;
    font-size: .84rem;
    font-weight: 600;
    color: var(--ink-2);
}
.logo-dropzone:hover {
    border-color: var(--brand);
    background: var(--brand-l);
    color: var(--brand-d);
}
.logo-prompt { display: flex; align-items: center; gap: .4rem; }
.logo-prompt-icon { font-size: 1.1rem; }
.logo-thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    flex-shrink: 0;
}
.logo-thumb[hidden],
.logo-prompt[hidden],
.btn[hidden] { display: none !important; }

/* Options Accordion Title */
.options-summary-title {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.options-title-text {
    font-size: .9rem;
    font-weight: 800;
    color: var(--ink);
}
.options-title-sub {
    font-size: .74rem;
    color: var(--ink-3);
    margin-top: .15rem;
}
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: #eef3f1; border-radius: 12px; }
.seg button { font: inherit; font-weight: 700; font-size: .85rem; padding: .5rem; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); cursor: pointer; transition: all .2s; min-height: 40px; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--brand-d); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.logo-row { display: flex; align-items: center; gap: .8rem; }
.logo-thumb { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; flex: none; }
.logo-thumb[hidden],
.logo-prompt[hidden],
.btn[hidden] { display: none !important; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; margin-bottom: .6rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* line items */
.items { display: flex; flex-direction: column; gap: .5rem; }
.item {
    display: grid;
    grid-template-columns: 1fr 70px 95px 34px;
    gap: .45rem;
    align-items: end;
    padding: .55rem .7rem;
    background: #fbfcfc;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: all .15s ease;
}
.item:focus-within, .item:hover {
    background: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.item .field { margin: 0; }
.item .field label { font-size: .76rem; font-weight: 600; color: #475569; margin-bottom: .2rem; display: block; }
.item .item-name { grid-column: auto; }
.item .del {
    height: 38px;
    width: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1rem;
    color: #ef4444;
}
.item .del:disabled { opacity: .25; cursor: not-allowed; }

@media (max-width: 540px) {
    .item {
        grid-template-columns: 1fr 1fr 36px;
        gap: .4rem;
    }
    .item .item-name {
        grid-column: 1 / -1;
    }
}

.totals-mini { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; margin-top: .8rem; border-radius: 10px; background: var(--deep); color: #fff; font-weight: 700; font-size: .95rem; }
.totals-mini b { color: #5eead4; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* Input combo (e.g., discount value + amount/% toggle) */
.input-combo {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfdfc;
    overflow: hidden;
    transition: border-color .2s, background .2s;
}
.input-combo:hover { border-color: #c4d2cd; }
.input-combo:focus-within {
    border-color: var(--brand);
    background: #fff;
    outline: 3px solid rgba(15, 157, 116, .35);
    outline-offset: 1px;
}
.input-combo input {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    outline: none !important;
    flex: 1;
    min-width: 0;
}
.input-combo select {
    border: 0 !important;
    border-inline-start: 1px solid var(--line) !important;
    border-radius: 0 !important;
    background: #f1f5f4 !important;
    outline: none !important;
    width: auto !important;
    min-width: 68px;
    padding: 0 .5rem !important;
    font-size: .82rem;
    font-weight: 700;
    color: var(--ink-2);
    cursor: pointer;
    text-align: center;
}
.input-combo select:hover { background: #e6ecea !important; color: var(--ink); }

/* Saved Invoices History Drawer */
.history-box {
    margin-top: .9rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfc;
    overflow: hidden;
}
.history-box[hidden] { display: none; }
.history-box summary {
    padding: .65rem .85rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--ink-2);
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background .15s, color .15s;
}
.history-box summary::-webkit-details-marker { display: none; }
.history-box summary::after { content: "▾"; font-size: .9rem; color: var(--ink-3); transition: transform .2s; }
.history-box[open] summary::after { transform: rotate(180deg); }
.history-box summary:hover { background: #f1f5f4; color: var(--ink); }
.history-list {
    border-top: 1px solid var(--line);
    max-height: 240px;
    overflow-y: auto;
     divide-y: 1px solid var(--line);
}
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .85rem;
    border-bottom: 1px solid #eef2f0;
    background: #fff;
    font-size: .82rem;
    transition: background .15s;
}
.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: #f8faf9; }
.history-item-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.history-item-top {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-weight: 700;
    color: var(--ink);
}
.history-item-sub {
    font-size: .75rem;
    color: var(--ink-3);
    display: flex;
    gap: .6rem;
}
.history-item-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
}

.panel-preview {
    position: sticky;
    top: 76px;
    padding: .9rem;
    background: #e6ecea;
    border-radius: 12px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}
.preview-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .8rem;
    padding: .5rem .7rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    min-width: 0;
}
.preview-bar-start { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.preview-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.preview-select {
    height: 36px;
    padding: 0 .6rem 0 1.6rem;
    font-size: .84rem;
    font-weight: 700;
    color: var(--text);
    background: #f8faf9;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: all .15s ease;
}
.preview-select:hover, .preview-select:focus {
    background: #fff;
    border-color: #cbd5e1;
}
.preview-select-sm {
    height: 34px;
    padding: 0 .6rem 0 1.5rem;
    font-size: .82rem;
    font-weight: 700;
    background-color: #fff;
    min-width: 130px;
    max-width: 160px;
    border-radius: 8px;
    border: 1px solid var(--line);
    cursor: pointer;
}
.waybill-top-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.waybill-top-toolbar .toolbar-start {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: nowrap;
}
.waybill-top-toolbar .preview-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: nowrap;
}
.waybill-top-toolbar .preview-actions .btn-sm {
    height: 34px;
    white-space: nowrap;
    padding: .35rem .7rem;
    font-size: .82rem;
}
@media (max-width: 640px) {
    .waybill-top-toolbar .toolbar-start,
    .waybill-top-toolbar .preview-actions {
        flex-wrap: wrap;
        width: 100%;
        justify-content: space-between;
    }
}
.preview-select-sm {
    height: 34px;
    padding: 0 .65rem 0 1.4rem;
    font-size: .8rem;
    font-weight: 700;
    background-color: #fff;
    min-width: 195px;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--line);
}
.waybill-top-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.mode-switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.bidi-num {
    unicode-bidi: isolate;
    direction: ltr;
    display: inline-block;
}
.waybill-toggles-row {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem 1.2rem;
    margin: .6rem 0 .25rem;
}
.waybill-wrap-text,
.waybill-noon-address,
.waybill-amz-shipto-content {
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}
.waybill-flag-prepaid {
    display: inline-block;
    font-size: 7.5pt;
    font-weight: 800;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 1mm;
}
@media (max-width: 640px) {
    .mode-switch-row {
        flex-direction: column;
        align-items: stretch;
    }
    .mode-switch-row .seg-sm {
        width: 100%;
    }
    .mode-switch-row .seg-sm button {
        flex: 1;
        justify-content: center;
        white-space: nowrap;
        padding: .25rem .45rem;
        font-size: .8rem;
    }
    .preview-select-sm {
        width: 100%;
        min-width: 0;
    }
    .waybill-top-toolbar .toolbar-start,
    .waybill-top-toolbar .preview-actions {
        flex-wrap: wrap;
        width: 100%;
        justify-content: space-between;
    }
}
.toolbar-left-group {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}
.seg-sm {
    background: #f1f5f4;
    padding: 3px;
    border-radius: 8px;
    display: inline-flex;
    gap: 2px;
}
.seg-sm button {
    border: 0;
    background: transparent;
    font-size: .82rem;
    font-weight: 700;
    color: var(--muted);
    padding: .25rem .6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all .15s ease;
    height: 30px;
    display: inline-flex;
    align-items: center;
}
.seg-sm button[aria-pressed="true"],
.seg-sm button.is-active,
.seg button[aria-pressed="true"],
.seg button.is-active {
    background: #fff !important;
    color: var(--brand) !important;
    font-weight: 800 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.15) !important;
}
.preview-stage {
    overflow: hidden;
    display: flex;
    justify-content: center;
    border-radius: 10px;
    min-height: 300px;
    max-width: 100%;
    width: 100%;
}
.preview-scaler {
    transform-origin: top center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#sheet {
    display: flex;
    justify-content: center;
    width: 100%;
}

@media (max-width: 980px) {
    .workspace { grid-template-columns: 1fr; }
    .panel-preview { position: static; order: 2; }
    .panel-form { order: 1; }
    .mobile-actions { display: flex; }
}
.mobile-actions { display: none !important; position: fixed; z-index: 40; inset-inline: 0; bottom: 0; gap: .5rem; padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.mobile-actions .btn { flex: 1; padding-inline: .4rem; }
@media (max-width: 768px) {
    body.has-mobile-actions { padding-bottom: 76px; }
    .mobile-actions { display: flex !important; }
    .mobile-actions.is-dual { display: grid !important; grid-template-columns: 1fr 2fr; gap: .5rem; }
}

.toast { position: fixed; z-index: 90; inset-inline: 0; bottom: 90px; margin-inline: auto; width: max-content; max-width: 90vw; background: var(--deep); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .9rem; opacity: 0; transform: translateY(12px); pointer-events: none; transition: all .25s; }
.toast.show { opacity: 1; transform: none; }

.coming { text-align: center; padding: 4rem 0; }
.coming .big { font-size: 4rem; }
.site-footer { background: var(--deep); color: #b8d3cb; margin-top: 2rem; padding: 2rem 0 1rem; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 2rem; }
.footer-inner strong { color: #fff; font-size: 1.1rem; }
.footer-inner p { max-width: 50ch; font-size: .88rem; }
.footer-inner ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.footer-inner a { color: #b8d3cb; font-size: .9rem; }
.footer-copy { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 1.2rem; padding-top: 1rem; font-size: .8rem; }
@media (max-width: 640px) { .footer-inner { grid-template-columns: 1fr; } }

/* ==========================================================================
   Printable document ("sheet") — rendered at real physical sizes
   ========================================================================== */
.sheet { background: #fff; color: #111; font-family: var(--font); direction: rtl; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .3); }
.sheet--a4 { width: 210mm; min-height: 297mm; padding: 14mm 14mm 12mm; font-size: 10.5pt; }
.sheet--thermal { width: 80mm; padding: 4mm 3.5mm 6mm; font-size: 9pt; line-height: 1.45; }
.sheet * { box-sizing: border-box; }

.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; padding-bottom: 4mm; border-bottom: 1.5px solid #111; }
.doc-seller h2 { font-size: 16pt; margin: 0 0 1mm; font-weight: 800; color: #111; }
.doc-seller div { font-size: 9.5pt; color: #444; line-height: 1.45; }
.doc-logo { max-height: 24mm; max-width: 48mm; object-fit: contain; }

.doc-title { text-align: center; margin: 4mm 0 5mm; }
.doc-title-pill { display: inline-block; font-size: 16pt; font-weight: 800; color: #111; letter-spacing: normal; }

/* Metadata cards */
.doc-meta-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4mm 6mm; margin-bottom: 5mm; font-size: 9.5pt; }
.doc-meta-card { padding: 3mm 4mm; border-radius: 6px; background: #fafafa; border: 1px solid #eaeaea; }
.doc-meta-head { font-weight: 700; font-size: 8.5pt; color: #666; margin-bottom: 2mm; padding-bottom: 1.5mm; border-bottom: 1px solid #eaeaea; }
.doc-meta-row { display: flex; justify-content: space-between; gap: 2mm; margin-bottom: 1.2mm; }
.doc-meta-row:last-child { margin-bottom: 0; }
.doc-meta-row span { color: #666; }
.doc-meta-row b { color: #111; }
.doc-status-badge { display: inline-block; padding: 0.5mm 2.2mm; border: 1px solid #111; border-radius: 3px; font-size: 8.5pt; font-weight: 800; color: #111; background: #fff; line-height: 1.3; }

/* Items Table & Column Alignments */
.doc-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-bottom: 4mm; table-layout: fixed; }
.doc-table th { padding: 2.8mm 3mm; vertical-align: middle; font-weight: 700; }
.doc-table td { padding: 2.8mm 3mm; border-bottom: 1px solid #eaeaea; vertical-align: middle; background: #fff; }

.doc-table .col-seq { width: 6%; text-align: center; }
.doc-table .col-desc { width: 44%; text-align: right; word-break: break-word; }
.doc-table .col-qty { width: 14%; text-align: center; font-variant-numeric: tabular-nums; }
.doc-table .col-price { width: 18%; text-align: left; direction: ltr; font-variant-numeric: tabular-nums; unicode-bidi: plaintext; }
.doc-table .col-total { width: 18%; text-align: left; direction: ltr; font-variant-numeric: tabular-nums; unicode-bidi: plaintext; font-weight: 700; }

.doc-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; margin-top: 5mm; }
.doc-foot-side { flex: 1; max-width: 105mm; display: flex; gap: 4mm; align-items: flex-start; justify-content: space-between; }
.doc-foot-details { flex: 1; min-width: 0; }
.doc-payment { font-size: 9pt; color: #333; background: #fafafa; border: 1px solid #eaeaea; padding: 2.5mm 3.5mm; border-radius: 6px; margin-bottom: 3mm; }
.doc-payment b { display: block; margin-bottom: 1mm; color: #111; font-size: 9.5pt; }
.doc-note { font-size: 9pt; color: #444; white-space: pre-line; line-height: 1.45; }

/* Custom QR code */
.doc-qr-wrap { display: flex; align-items: center; justify-content: center; text-align: center; border: 1px solid #eaeaea; background: #fff; padding: 1.5mm; border-radius: 6px; flex-shrink: 0; }
.doc-qr-img { width: 22mm; height: 22mm; display: block; image-rendering: pixelated; }

.doc-thermal-qr { width: 100%; display: flex; align-items: center; justify-content: center; text-align: center; margin: 2mm auto; }
.doc-thermal-qr img { width: 18mm; height: 18mm; display: block; margin: 0 auto; image-rendering: pixelated; }

.doc-totals { min-width: 76mm; font-size: 10pt; }
.doc-total-row { display: flex; justify-content: space-between; align-items: center; padding: 1.6mm 0; border-bottom: 1px solid #eaeaea; }
.doc-total-label { color: #555; font-weight: 600; }
.doc-total-val { font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; text-align: left; }
.doc-totals .grand { font-weight: 800; font-size: 13pt; border-bottom: 0; border-top: 2px solid #111; margin-top: 1.5mm; padding-top: 2mm; color: #111; }
.doc-totals .grand .doc-total-label { color: inherit; font-size: inherit; font-weight: inherit; }
.doc-totals .grand .doc-total-val { color: inherit; font-size: inherit; font-weight: inherit; }

/* Theme 1: Classic (Default Monochrome) */
.sheet--classic .doc-head { border-bottom: 1.5px solid #111; }
.sheet--classic .doc-table th { background: #111; color: #fff; }

/* Theme 2: Modern Clean (Monochrome) */
.sheet--modern { padding: 14mm 14mm 12mm; }
.sheet--modern .doc-head { border-bottom: 2px solid #111; }
.sheet--modern .doc-title { text-align: start; margin: 4mm 0 4mm; }
.sheet--modern .doc-title-pill { font-size: 16pt; font-weight: 800; border-bottom: 2px solid #111; padding-bottom: 1mm; }
.sheet--modern .doc-meta-card { background: #fff; border: 0; border-right: 2px solid #111; border-radius: 0; padding: 1mm 3mm 1mm 0; }
.sheet--modern .doc-meta-head { border-bottom: 1px solid #eee; }
.sheet--modern .doc-table th { background: #f3f4f6; color: #000; border-top: 1.5px solid #111; border-bottom: 1.5px solid #111; }
.sheet--modern .doc-totals .grand { background: #111; color: #fff; border-radius: 4px; padding: 2.5mm 3.5mm; margin-top: 2mm; }
.sheet--modern .doc-totals .grand .doc-total-label,
.sheet--modern .doc-totals .grand .doc-total-val { color: #fff !important; }

/* Theme 3: Minimalist Luxury (Monochrome) */
.sheet--minimal { border: 0; padding: 16mm 14mm 14mm; }
.sheet--minimal .doc-head { border-bottom: 1px solid #ddd; }
.sheet--minimal .doc-seller h2 { font-size: 16pt; font-weight: 700; }
.sheet--minimal .doc-title { text-align: start; margin: 4mm 0 4mm; }
.sheet--minimal .doc-title-pill { font-size: 16pt; font-weight: 400; border-bottom: 1.5px solid #111; padding-bottom: 1mm; display: inline-block; min-width: 50mm; }
.sheet--minimal .doc-meta-cards { gap: 3mm 8mm; }
.sheet--minimal .doc-meta-card { padding: 0; border: 0; background: transparent; }
.sheet--minimal .doc-meta-head { font-size: 8.5pt; color: #888; border-bottom: 1px solid #eee; }
.sheet--minimal .doc-table th { background: transparent; color: #111; border-bottom: 1.5px solid #111; padding: 2.5mm 1mm; font-weight: 800; }
.sheet--minimal .doc-table td { border-bottom: 1px solid #eee; padding: 2.8mm 1mm; }
.sheet--minimal .doc-totals .grand { border-top: 1.5px solid #111; padding-top: 2mm; }

/* WhatsApp button styling */
.btn-whatsapp { background: #25D366; color: #fff; border-color: #25D366; font-weight: 700; }
.btn-whatsapp:hover { background: #20bd5a; border-color: #20bd5a; color: #fff; }

/* thermal specifics */
.sheet--thermal .doc-head { flex-direction: column; align-items: center; text-align: center; gap: 1.5mm; padding-bottom: 2.5mm; border-bottom: 1px dashed #000; }
.sheet--thermal .doc-seller h2 { font-size: 12pt; }
.sheet--thermal .doc-seller div { font-size: 8.5pt; }
.sheet--thermal .doc-logo { max-height: 14mm; max-width: 40mm; }
.sheet--thermal .doc-title { margin: 2mm 0; }
.sheet--thermal .doc-title-pill { font-size: 11pt; padding: 0; font-weight: 800; }
.sheet--thermal .doc-meta-cards { grid-template-columns: 1fr; gap: 1.5mm; font-size: 8.5pt; margin-bottom: 2.5mm; }
.sheet--thermal .doc-meta-card { padding: 0; border: 0; background: transparent; }
.sheet--thermal .doc-meta-head { display: none; }
.sheet--thermal .doc-meta-row { margin-bottom: 0.8mm; }
.sheet--thermal .doc-table { font-size: 8.5pt; }
.sheet--thermal .doc-table th { background: transparent; color: #000; border-block: 1px solid #000; padding: 1mm 0.8mm; }
.sheet--thermal .doc-table td { padding: 1mm 0.8mm; border-bottom: 1px dotted #999; }
.sheet--thermal .doc-table .col-desc { width: 44%; }
.sheet--thermal .doc-table .col-qty { width: 16%; }
.sheet--thermal .doc-table .col-price { width: 20%; }
.sheet--thermal .doc-table .col-total { width: 20%; }
.sheet--thermal .doc-foot { flex-direction: column-reverse; align-items: stretch; gap: 2.5mm; margin-top: 3mm; }
.sheet--thermal .doc-foot-side { display: flex; flex-direction: column; align-items: center; max-width: none; width: 100%; gap: 2mm; }
.sheet--thermal .doc-totals { min-width: 0; font-size: 9pt; }
.sheet--thermal .doc-totals .grand { font-size: 11pt; border-top: 1px solid #000; padding: 1.5mm 0; }
.sheet--thermal .doc-note { font-size: 8pt; text-align: center; width: 100%; }
.sheet--thermal .doc-payment { font-size: 8pt; text-align: center; width: 100%; margin-bottom: 1mm; }
.sheet--thermal .doc-thermal-qr { width: 100%; display: flex; align-items: center; justify-content: center; text-align: center; margin: 2mm auto; }
.sheet--thermal .doc-thermal-qr img { width: 18mm; height: 18mm; display: block; margin: 0 auto; image-rendering: pixelated; }

/* ==========================================================================
   Simplified Tax Invoice (ZATCA Phase 1) - Thermal 80mm & A4 Styles
   ========================================================================== */
.sheet--zatca-receipt {
    width: 80mm;
    min-height: auto;
    padding: 5mm 4mm 6mm;
    background: #fff;
    color: #0f172a;
    font-size: 8.5pt;
    line-height: 1.45;
    direction: rtl;
    box-sizing: border-box;
    font-family: inherit;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .25);
    margin: 0 auto;
}
.sheet--zatca-receipt * { box-sizing: border-box; }
.zatca-receipt-header { text-align: center; }
.zatca-receipt-logo { display: block; max-height: 15mm; max-width: 42mm; margin: 0 auto 2mm; object-fit: contain; }
.zatca-receipt-store { font-size: 13pt; font-weight: 800; color: #0f766e; margin-bottom: 1.5mm; line-height: 1.25; }
.zatca-receipt-meta-sub { font-size: 8pt; color: #475569; margin-bottom: 0.8mm; }
.zatca-receipt-vat-badge {
    display: inline-block;
    font-size: 8pt;
    font-weight: 700;
    color: #0f172a;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 0.8mm 2.5mm;
    margin: 1.5mm 0;
}
.zatca-receipt-title { font-size: 10.5pt; font-weight: 800; color: #000; margin-top: 1mm; }
.zatca-receipt-subtitle { font-size: 7.5pt; font-weight: 700; letter-spacing: 0.5px; color: #64748b; }

.zatca-receipt-divider-dashed { border-bottom: 1px dashed #475569; margin: 2.5mm 0; }
.zatca-receipt-divider-solid { border-bottom: 1.5px solid #000; margin: 2.5mm 0; }

.zatca-receipt-meta-grid { font-size: 8pt; line-height: 1.5; }
.zatca-receipt-meta-row { display: flex; justify-content: space-between; gap: 2mm; margin-bottom: 0.8mm; }
.zatca-receipt-meta-row span { color: #475569; }
.zatca-receipt-meta-row b { color: #000; font-weight: 700; }

.zatca-receipt-table { width: 100%; border-collapse: collapse; font-size: 8pt; margin: 1mm 0 2mm; table-layout: fixed; }
.zatca-receipt-table th { padding: 1.5mm 1mm; border-top: 1.5px solid #000; border-bottom: 1.5px solid #000; font-weight: 800; color: #000; }
.zatca-receipt-table th.th-desc { text-align: right; width: 44%; }
.zatca-receipt-table th.th-qty { text-align: center; width: 14%; }
.zatca-receipt-table th.th-price { text-align: left; width: 21%; direction: ltr; }
.zatca-receipt-table th.th-total { text-align: left; width: 21%; direction: ltr; }
.zatca-receipt-table td { padding: 1.5mm 1mm; border-bottom: 1px dotted #cbd5e1; vertical-align: middle; background: #fff; }
.zatca-receipt-table td.td-desc { text-align: right; word-break: break-word; }
.zatca-receipt-table td.td-qty { text-align: center; font-variant-numeric: tabular-nums; }
.zatca-receipt-table td.td-price { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
.zatca-receipt-table td.td-total { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; font-weight: 700; }

.zatca-receipt-totals { font-size: 8.5pt; margin-top: 1.5mm; }
.zatca-receipt-total-row { display: flex; justify-content: space-between; align-items: center; padding: 1.2mm 0; color: #334155; }
.zatca-receipt-grand-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1.5px solid #0f766e;
    border-radius: 6px;
    padding: 2mm 3mm;
    margin-top: 2mm;
    color: #0f766e;
    font-weight: 800;
}
.zatca-receipt-grand-box .grand-label { font-size: 9pt; }
.zatca-receipt-grand-box .grand-val { font-size: 11.5pt; direction: ltr; font-weight: 800; }

.zatca-receipt-tafqeet {
    font-size: 7.5pt;
    color: #475569;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1.5mm 2.5mm;
    margin-top: 2mm;
    text-align: center;
    line-height: 1.4;
}

.zatca-receipt-qr-wrap { text-align: center; margin-top: 3mm; }
.zatca-receipt-qr-card {
    display: inline-block;
    padding: 2mm;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.zatca-receipt-qr-img { display: block; margin: 0 auto; image-rendering: pixelated; width: 140px; height: 140px; }
.zatca-receipt-qr-caption { font-size: 7.5pt; font-weight: 700; color: #1e293b; margin-top: 1.5mm; }
.zatca-receipt-qr-subcaption { font-size: 6.8pt; color: #64748b; }

.zatca-receipt-disclaimer {
    font-size: 6.8pt;
    line-height: 1.45;
    color: #64748b;
    text-align: center;
    margin-top: 3mm;
    padding-top: 2mm;
    border-top: 1px dotted #cbd5e1;
}
.zatca-receipt-footer-thanks { font-size: 8pt; font-weight: 700; color: #0f766e; text-align: center; margin-top: 2mm; }

/* A4 Sheet Specifics for Simplified Tax Invoice */
.sheet--zatca-a4 {
    width: 210mm;
    min-height: 297mm;
    padding: 14mm 14mm 12mm;
    background: #fff;
    color: #0f172a;
    font-size: 9.5pt;
    line-height: 1.5;
    direction: rtl;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .25);
    margin: 0 auto;
}
.sheet--zatca-a4 * { box-sizing: border-box; }
.zatca-a4-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6mm;
    padding-bottom: 5mm;
    border-bottom: 2px solid #0f766e;
    margin-bottom: 4mm;
}
.zatca-a4-seller-wrap {
    display: flex;
    align-items: center;
    gap: 5mm;
}
.zatca-a4-logo {
    max-height: 24mm;
    max-width: 45mm;
    object-fit: contain;
    flex-shrink: 0;
}
.zatca-a4-store-name { margin: 0 0 1.5mm; font-size: 18pt; font-weight: 800; color: #0f766e; line-height: 1.2; }
.zatca-a4-vat-tag { font-size: 9pt; color: #334155; margin-bottom: 1mm; }
.zatca-a4-vat-tag strong { color: #0f172a; margin-right: 4px; }
.zatca-a4-seller-meta { font-size: 8.5pt; color: #64748b; margin-bottom: 0.5mm; }
.zatca-a4-badge-box { text-align: left; direction: ltr; }
.zatca-a4-doc-title { font-size: 18pt; font-weight: 800; color: #0f766e; direction: rtl; text-align: left; }
.zatca-a4-doc-sub { font-size: 8.5pt; font-weight: 700; color: #64748b; letter-spacing: 0.5px; margin-bottom: 2mm; }
.zatca-a4-phase-pill {
    display: inline-block;
    padding: 1mm 3mm;
    background: #ccfbf1;
    color: #0f766e;
    border-radius: 999px;
    font-size: 8pt;
    font-weight: 700;
}

.zatca-a4-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3mm;
    margin-bottom: 5mm;
}
.zatca-a4-meta-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 2.5mm 3.5mm; }
.zatca-a4-meta-card .meta-label { display: block; font-size: 8pt; color: #64748b; margin-bottom: 1mm; }
.zatca-a4-meta-card .meta-val { display: block; font-size: 9.5pt; font-weight: 700; color: #0f172a; }

.zatca-a4-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-bottom: 6mm; }
.zatca-a4-table th { background: #0f766e; color: #fff; padding: 3mm 3.5mm; font-weight: 700; border: 1px solid #0f766e; }
.zatca-a4-table td { padding: 3mm 3.5mm; border: 1px solid #e2e8f0; background: #fff; vertical-align: middle; }
.zatca-a4-table tbody tr:nth-child(even) td { background: #f8fafc; }

.zatca-a4-bottom-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 6mm;
    align-items: flex-start;
    margin-bottom: 4mm;
}
.zatca-a4-qr-col { display: flex; flex-direction: column; gap: 3mm; }
.zatca-a4-qr-card {
    display: flex;
    gap: 4mm;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 3mm;
}
.zatca-a4-qr-img {
    flex-shrink: 0;
    display: block;
    background: #fff;
    padding: 1.5mm;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    image-rendering: pixelated;
    width: 125px;
    height: 125px;
}
.zatca-a4-qr-info strong { display: block; font-size: 9pt; color: #0f766e; margin-bottom: 1mm; }
.zatca-a4-qr-info span { font-size: 7.5pt; color: #64748b; line-height: 1.4; display: block; }

.zatca-a4-tafqeet-card { background: #f1f5f9; border-radius: 6px; padding: 2.5mm 3.5mm; font-size: 8.5pt; }
.zatca-a4-tafqeet-card .tafqeet-lbl { color: #64748b; font-size: 8pt; }
.zatca-a4-tafqeet-card .tafqeet-txt { font-weight: 700; color: #0f172a; margin-top: 0.5mm; }

.zatca-a4-totals-col { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 3.5mm 4mm; }
.zatca-a4-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2mm 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 9pt;
}
.zatca-a4-total-row span { color: #64748b; }
.zatca-a4-grand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f766e;
    color: #fff;
    border-radius: 6px;
    padding: 3mm 4mm;
    margin-top: 3mm;
    font-weight: 800;
}
.zatca-a4-grand-row .grand-amt { font-size: 13pt; direction: ltr; font-weight: 800; }

.zatca-a4-disclaimer {
    font-size: 7.5pt;
    color: #64748b;
    line-height: 1.5;
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 6px;
    padding: 2.5mm 4mm;
    margin-top: auto;
}
.zatca-a4-disclaimer strong { color: #854d0e; }
.zatca-a4-footer {
    display: flex;
    justify-content: space-between;
    font-size: 8pt;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    padding-top: 2.5mm;
    margin-top: 3mm;
}

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
    html, body { background: #fff !important; }
    .print-only { display: inline !important; }
    body > *:not(main), .no-print, .site-header, .site-footer, .toast, .mobile-actions { display: none !important; }
    main > *:not(.workspace-wrap) { display: none !important; }
    .workspace-wrap > *:not(.workspace), .tool-head { display: none !important; }
    .workspace { display: block; padding: 0; }
    .panel-form { display: none !important; }
    .panel-preview { position: static; padding: 0; border: 0; box-shadow: none; background: #fff; }
    .preview-bar { display: none !important; }
    .preview-stage { overflow: visible; display: block; }
    .preview-scaler { transform: none !important; height: auto !important; width: auto !important; }
    .sheet { box-shadow: none; margin: 0; }
    .sheet--a4 { width: 100%; min-height: 0; }
    .sheet--thermal { width: 80mm; max-width: 100%; margin: 0; padding: 3mm 2.5mm 5mm; }
    .sheet--waybill-thermal { width: 100mm; max-width: 100%; margin: 0; border: 2px solid #000 !important; }
    .sheet--waybill-a4 { width: 100%; margin: 0; padding: 0; }
    .sheet--barcode-thermal { margin: 0; border: none !important; }
    .sheet--barcode-a4 { width: 100%; margin: 0; padding: 0; border: none !important; }
    .sheet--voucher { width: 100%; border: 3px double #1a365d !important; }
    .sheet--zatca-receipt { width: 80mm !important; max-width: 100% !important; margin: 0 !important; padding: 4mm 3mm !important; box-shadow: none !important; }
    .sheet--zatca-a4 { width: 100% !important; min-height: 0 !important; padding: 10mm 12mm !important; box-shadow: none !important; }
    .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    /* PDF Sign & Stamp Print Rules — Hide all UI controls, handles & dashed outlines */
    .drag-handle,
    .resize-handle,
    .draggable-overlay .drag-handle,
    .draggable-overlay .resize-handle {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    .draggable-overlay {
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    #pdf_stage, .pdf-stage {
        background: transparent !important;
        padding: 0 !important;
        min-height: auto !important;
    }
    .pdf-page-container {
        box-shadow: none !important;
        border: none !important;
        margin: 0 auto !important;
        padding: 0 !important;
        background: transparent !important;
    }
    .pdf-canvas {
        display: block !important;
        max-width: 100% !important;
        height: auto !important;
    }
}

/* ==========================================================================
   Merchant Toolkit Suite Extensions: Dropdown, Waybills, Barcodes, & Media
   ========================================================================== */

/* ---------- Navbar Dropdown ---------- */
.nav-dropdown { position: relative; display: inline-flex; }
.nav-dropdown-btn { display: inline-flex; align-items: center; gap: .35rem; background: transparent; border: none; cursor: pointer; }
.dropdown-caret { transition: transform .2s ease; margin-inline-start: .2rem; }
.nav-dropdown:hover .dropdown-caret, .nav-dropdown.is-open .dropdown-caret { transform: rotate(180deg); }
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: 275px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.06);
    padding: .5rem;
    z-index: 1050;
    display: none;
    flex-direction: column;
    gap: .25rem;
}
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu { display: flex; }
@media (max-width: 760px) {
    .nav-dropdown-menu {
        position: fixed;
        top: 98px;
        left: 12px;
        right: 12px;
        inset-inline-end: auto;
        width: auto;
        min-width: 0;
        max-width: calc(100vw - 24px);
        z-index: 99999;
        box-shadow: 0 16px 40px rgba(0,0,0,0.22);
    }
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    transition: background .15s, color .15s;
}
.dropdown-item:hover { background: var(--brand-l); color: var(--brand-d); text-decoration: none; }
.dropdown-item.is-active { background: #e6fcf5; color: #099268; }
.dropdown-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.dropdown-meta { display: flex; flex-direction: column; text-align: start; }
.dropdown-meta strong { font-size: .88rem; font-weight: 700; color: var(--ink); }
.dropdown-meta small { font-size: .72rem; color: var(--muted); margin-top: .15rem; }

/* ---------- Action / Export Dropdown ---------- */
.action-dropdown {
    position: relative;
    display: inline-flex;
}
.action-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-end: 0;
    min-width: 210px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 10px 25px -4px rgba(0,0,0,0.12), 0 3px 8px rgba(0,0,0,0.04);
    padding: .35rem;
    z-index: 100;
    display: none;
    flex-direction: column;
    gap: .2rem;
}
.action-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 6px;
}
.action-dropdown:hover .action-dropdown-menu,
.action-dropdown.is-open .action-dropdown-menu {
    display: flex;
}
.action-dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .75rem;
    border-radius: 8px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: right;
    font: inherit;
    font-size: .84rem;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.action-dropdown-item:hover {
    background: var(--brand-l);
    color: var(--brand-d);
}
.action-dropdown-item svg {
    color: var(--muted);
    flex-shrink: 0;
}
.action-dropdown-item:hover svg {
    color: var(--brand-d);
}

/* ---------- Waybill Generator Styles ---------- */
.sheet--waybill-thermal {
    width: 100mm;
    min-height: 150mm;
    padding: 3.5mm;
    font-size: 9pt;
    line-height: 1.3;
    background: #fff;
    color: #111;
    border: 2px solid #000;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2mm;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.sheet--waybill-a4 {
    width: 210mm;
    min-height: 297mm;
    padding: 8mm;
    background: #fff;
    color: #111;
    box-sizing: border-box;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.waybill-grid-a4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
}
.waybill-box {
    border: 2px solid #000;
    padding: 3.5mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2mm;
    background: #fff;
    page-break-inside: avoid;
}
.waybill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000;
    padding-bottom: 1.5mm;
}
.waybill-logo { max-height: 12mm; max-width: 32mm; object-fit: contain; }
.waybill-sender-info h3 { font-size: 10.5pt; font-weight: 800; margin: 0; }
.waybill-sender-info p { font-size: 7.5pt; color: #333; margin: 0.5mm 0 0; }

.waybill-tracking-block {
    text-align: center;
    border-bottom: 2px dashed #000;
    padding-bottom: 2mm;
}
.waybill-barcode { max-width: 85mm; height: 14mm; margin: 0 auto; display: block; }
.waybill-tracking-num { font-size: 10pt; font-weight: 800; letter-spacing: 1px; margin-top: 1mm; font-family: monospace; }

.waybill-receiver-card {
    border: 1.5px solid #000;
    border-radius: 4px;
    padding: 2.5mm;
    background: #fafafa;
}
.waybill-receiver-badge {
    display: inline-block;
    background: #000;
    color: #fff;
    font-size: 7.5pt;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    margin-bottom: 1.5mm;
}
.waybill-receiver-name { font-size: 12pt; font-weight: 800; margin: 0 0 1mm; }
.waybill-receiver-phone { font-size: 11pt; font-weight: 800; direction: ltr; display: inline-block; color: #000; }
.waybill-receiver-address { font-size: 9.5pt; font-weight: 600; margin-top: 1mm; line-height: 1.35; }
.waybill-city-pill { display: inline-block; background: #e9ecef; color: #111; font-weight: 800; padding: 2px 7px; border-radius: 4px; margin-inline-start: 4px; font-size: 8.5pt; }

.waybill-cod-hero {
    border: 3px solid #000;
    background: #fff;
    padding: 2.5mm;
    text-align: center;
    border-radius: 4px;
}
.waybill-cod-label { font-size: 8.5pt; font-weight: 800; text-transform: uppercase; color: #333; }
.waybill-cod-val { font-size: 18pt; font-weight: 900; color: #000; margin: 0.5mm 0 0; }

.waybill-courier-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2.5mm;
    align-items: center;
    border: 1px solid #777;
    padding: 2mm;
    border-radius: 4px;
    background: #fff;
}
.waybill-qr-wrap { text-align: center; }
.waybill-qr-wrap img { width: 19mm; height: 19mm; display: block; margin: 0 auto; image-rendering: pixelated; }
.waybill-qr-caption { font-size: 6.5pt; font-weight: 700; color: #222; margin-top: 0.5mm; }

.waybill-instructions { font-size: 8pt; line-height: 1.3; }
.waybill-tag { display: inline-block; background: #ffe3e3; color: #c92a2a; border: 1px solid #ffa8a8; font-weight: 800; font-size: 7pt; padding: 1px 4px; border-radius: 3px; margin-bottom: 1mm; }

/* ---------- Barcode Studio Styles ---------- */
.sheet--barcode-thermal {
    background: #fff;
    color: #000;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1.2mm 1.4mm;
    gap: 0.25mm;
    overflow: hidden;
    border: 1px dashed #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.sheet--barcode-thermal.size-38x25 { width: 38mm; height: 25mm; padding: 1mm 1.2mm; gap: 0.2mm; }
.sheet--barcode-thermal.size-50x25 { width: 50mm; height: 25mm; padding: 1mm 1.5mm; gap: 0.2mm; }
.sheet--barcode-thermal.size-40x30 { width: 40mm; height: 30mm; padding: 1.2mm; gap: 0.3mm; }

.barcode-store-name { flex: 0 0 auto; font-size: 6.5pt; font-weight: 700; line-height: 1.15; max-width: 95%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barcode-prod-name { flex: 0 0 auto; font-size: 7pt; font-weight: 800; line-height: 1.15; max-width: 95%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barcode-svg-wrap { flex: 0 0 auto; max-width: 96%; display: flex; justify-content: center; align-items: center; margin: 0.15mm 0; }
.barcode-svg-wrap svg { max-width: 100%; width: auto; height: auto; max-height: 10.5mm; display: block; }
.sheet--barcode-thermal.size-38x25 .barcode-store-name,
.sheet--barcode-thermal.size-50x25 .barcode-store-name { font-size: 6.2pt; }
.sheet--barcode-thermal.size-38x25 .barcode-prod-name,
.sheet--barcode-thermal.size-50x25 .barcode-prod-name { font-size: 6.8pt; }
.sheet--barcode-thermal.size-38x25 .barcode-svg-wrap svg,
.sheet--barcode-thermal.size-50x25 .barcode-svg-wrap svg { max-height: 9.8mm; }
.sheet--barcode-thermal.size-38x25 .barcode-price-row,
.sheet--barcode-thermal.size-50x25 .barcode-price-row { font-size: 7.8pt; }
.sheet--barcode-thermal.size-38x25 .barcode-meta-line,
.sheet--barcode-thermal.size-50x25 .barcode-meta-line { font-size: 5.5pt; }
.barcode-price-row { flex: 0 0 auto; font-size: 8.2pt; font-weight: 900; line-height: 1.15; }
.barcode-meta-line { flex: 0 0 auto; font-size: 5.8pt; color: #333; line-height: 1.15; max-width: 95%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sheet--barcode-a4 {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    background: #fff;
    box-sizing: border-box;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    overflow: hidden;
}
.sheet--barcode-a4.grid-3x8 {
    padding: 8mm 4mm;
    display: grid;
    grid-template-columns: repeat(3, 66mm);
    grid-auto-rows: 33mm;
    gap: 1.5mm 2.5mm;
    justify-content: center;
}
.sheet--barcode-a4.grid-4x10 {
    padding: 7mm 3mm;
    display: grid;
    grid-template-columns: repeat(4, 49.5mm);
    grid-auto-rows: 27mm;
    gap: 1mm 2mm;
    justify-content: center;
}
.barcode-grid-item {
    border: 1px dotted #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1mm;
    box-sizing: border-box;
    overflow: hidden;
}

/* ---------- Barcode Multi-Items UX Styles ---------- */
.bc-capacity-card {
    background: #f8faf9;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .75rem .9rem;
    margin-bottom: .9rem;
}
.bc-capacity-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: .45rem;
}
.bc-capacity-title {
    font-size: .84rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: .4rem;
}
.bc-capacity-badge {
    font-size: .78rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e6fcf5;
    color: #0ca678;
}
.bc-capacity-badge.is-amber {
    background: #fff4e6;
    color: #d9480f;
}
.bc-capacity-badge.is-blue {
    background: #e7f5ff;
    color: #1971c2;
}
.bc-progress-bar {
    width: 100%;
    height: 7px;
    background: #e9ecef;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .4rem;
}
.bc-progress-fill {
    height: 100%;
    background: #0ca678;
    transition: width .25s ease, background-color .25s ease;
}
.bc-progress-fill.is-amber { background: #f59f00; }
.bc-progress-fill.is-blue { background: #228be6; }
.bc-capacity-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .78rem;
    color: var(--muted);
}

.bc-table-head {
    display: grid;
    grid-template-columns: minmax(130px, 2.2fr) minmax(110px, 1.4fr) minmax(70px, 0.9fr) minmax(55px, 0.7fr) 34px;
    gap: .4rem;
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted);
    padding: 0 .4rem .35rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: .5rem;
}
.bc-items-container {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}
.bc-row {
    display: grid;
    grid-template-columns: minmax(130px, 2.2fr) minmax(110px, 1.4fr) minmax(70px, 0.9fr) minmax(55px, 0.7fr) 34px;
    gap: .4rem;
    align-items: center;
}
.bc-row input {
    height: 36px;
    padding: .2rem .5rem;
    font-size: .83rem;
    border-radius: 7px;
}
.bc-sku-combo {
    display: flex;
    position: relative;
    align-items: center;
}
.bc-sku-combo input {
    width: 100%;
    padding-left: 28px !important;
}
.btn-sku-gen {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: .85rem;
    padding: 2px 4px;
    color: var(--muted);
}
.btn-sku-gen:hover { color: var(--brand); }
.btn-del-row {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 700;
    transition: all .15s ease;
}
.btn-del-row:hover:not(:disabled) {
    background: #fff5f5;
    border-color: #ffc9c9;
}
.btn-del-row:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.bc-table-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: .75rem;
}

.bc-paste-box {
    margin-top: .75rem;
    background: #f8faf9;
    border: 1.5px dashed var(--brand);
    border-radius: 8px;
    padding: .75rem;
}
.bc-paste-box textarea {
    width: 100%;
    font-size: .82rem;
    font-family: monospace;
    padding: .5rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    box-sizing: border-box;
    direction: ltr;
}

.bc-preview-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .75rem;
    background: #f1f5f4;
    padding: .4rem .75rem;
    border-radius: 8px;
    margin-bottom: .6rem;
}

@media (max-width: 640px) {
    .bc-table-head { display: none; }
    .bc-row {
        grid-template-columns: 1fr 1fr;
        background: #f8faf9;
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: .5rem;
        gap: .4rem;
    }
    .bc-row .bc-col-name-input { grid-column: span 2; }
    .bc-row .btn-del-row { grid-column: span 2; justify-self: flex-end; }
}

/* ---------- Quotation & Cash Receipt Voucher ---------- */
.sheet--voucher {
    width: 210mm;
    min-height: 135mm;
    padding: 7mm 9mm;
    box-sizing: border-box;
    background: #fff;
    color: #111;
    position: relative;
    border: 3px double #1a365d;
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}
.voucher-corner-deco {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #1a365d;
}
.voucher-corner-deco.tl { top: 4px; left: 4px; border-right: none; border-bottom: none; }
.voucher-corner-deco.tr { top: 4px; right: 4px; border-left: none; border-bottom: none; }
.voucher-corner-deco.bl { bottom: 4px; left: 4px; border-right: none; border-top: none; }
.voucher-corner-deco.br { bottom: 4px; right: 4px; border-left: none; border-top: none; }

.voucher-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #1a365d;
    padding-bottom: 3.5mm;
    margin-bottom: 4mm;
}
.voucher-brand-wrap {
    display: flex;
    align-items: center;
    gap: 3.5mm;
    max-width: 65%;
}
.voucher-brand-logo {
    max-height: 18mm;
    max-width: 38mm;
    object-fit: contain;
    border-radius: 4px;
}
.voucher-store-meta {
    font-size: 8pt;
    color: #4a5568;
    margin-top: 1mm;
    line-height: 1.4;
}
.voucher-blank-amt {
    color: #94a3b8;
    font-size: 11pt;
    font-weight: 600;
    letter-spacing: 1px;
}
.voucher-badge {
    background: #1a365d;
    color: #fff;
    font-size: 13pt;
    font-weight: 800;
    padding: 3px 16px;
    border-radius: 4px;
    letter-spacing: .5px;
}
.voucher-num-box {
    border: 1.5px solid #1a365d;
    border-radius: 6px;
    padding: 3px 12px;
    text-align: center;
    font-weight: 700;
    font-size: 8.5pt;
}
.voucher-amount-hero {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 2px solid #1a365d;
    background: #f7fafc;
    padding: 3px 14px;
    border-radius: 6px;
    font-size: 13pt;
    font-weight: 900;
    color: #1a365d;
}

.voucher-body { display: flex; flex-direction: column; gap: 3.5mm; margin-top: 3.5mm; }
.voucher-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 10.5pt;
    line-height: 1.8;
}
.voucher-lbl { font-weight: 800; color: #1a365d; white-space: nowrap; font-size: 10pt; }
.voucher-line {
    flex: 1;
    border-bottom: 1px dotted #4a5568;
    min-height: 1.5em;
    font-weight: 600;
    padding-inline: 4px;
}
.voucher-tafqeet-line {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 3px 8px;
    font-weight: 700;
    color: #2b6cb0;
    font-size: 10pt;
}

.voucher-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 6mm;
    padding-top: 3mm;
}
.voucher-sign-col { text-align: center; width: 42mm; }
.voucher-sign-line { border-bottom: 1.5px solid #1a365d; margin-top: 12mm; }
.voucher-stamp-circle {
    width: 28mm;
    height: 28mm;
    border: 2px dashed #a0aec0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7.5pt;
    color: #a0aec0;
    margin: 0 auto;
}
.voucher-stamp-circle.is-empty {
    border-color: #cbd5e1;
    color: #94a3b8;
}
@media print {
    .voucher-stamp-circle.is-empty {
        display: none !important;
    }
}
.voucher-handwriting-line {
    min-height: 2.2em;
    border-bottom: 1.5px dotted #94a3b8;
    line-height: 2.2;
}
.v-nav-link {
    font-size: 0.84rem;
    font-weight: 600;
    color: #475569;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-block;
}
.v-nav-link:hover {
    color: #099268;
    background: #e6fcf5;
}
.v-nav-link.is-active {
    color: #fff !important;
    background: #099268 !important;
    font-weight: 700;
}

/* ---------- Image & PDF Suite Styles ---------- */
.dropzone {
    border: 2px dashed var(--line-bold);
    border-radius: 14px;
    padding: 1.6rem 1rem;
    text-align: center;
    background: #fcfdfd;
    cursor: pointer;
    transition: all .2s;
    display: block;
}
.dropzone:hover, .dropzone.is-dragover {
    border-color: var(--brand);
    background: var(--brand-l);
}
.dropzone-ico { font-size: 2.2rem; display: block; margin-bottom: .4rem; }
.dropzone-title { font-weight: 800; font-size: 1.05rem; color: var(--ink); display: block; }
.dropzone-hint { font-size: .82rem; color: var(--muted); margin-top: .2rem; display: block; }

.preset-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .4rem; }
.preset-btn {
    padding: .45rem .85rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
    font-size: .84rem;
    color: var(--ink-2);
    cursor: pointer;
    transition: all .15s;
}
.preset-btn:hover { border-color: var(--brand); color: var(--brand-d); }
.preset-btn.is-active { background: var(--deep); color: #fff; border-color: var(--deep); }

/* AI Background Studio Pills & Swatches */
.bg-ai-pills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .55rem;
    width: 100%;
    margin-top: .4rem;
}

.bg-ai-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .45rem !important;
    min-height: 42px !important;
    padding: .45rem .65rem !important;
    font-size: .83rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    width: 100%;
    box-sizing: border-box;
    transition: all .15s ease;
}

.bg-ai-btn svg {
    flex-shrink: 0;
}

.bg-ai-btn .ai-sparkle-icon {
    color: #059669;
}

.bg-ai-btn.is-active .ai-sparkle-icon {
    color: #34d399 !important;
}

.bg-color-swatch {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-sizing: border-box;
    vertical-align: middle;
}

.swatch-white {
    background: #ffffff;
    border: 1.5px solid #94a3b8;
}

.swatch-blue {
    background: #3b82f6;
    border: 1px solid #2563eb;
}

.swatch-gray {
    background: #cbd5e1;
    border: 1.5px solid #94a3b8;
}

.bg-ai-btn.is-active .swatch-white {
    border-color: rgba(255, 255, 255, 0.85);
}

.bg-ai-btn.is-active .swatch-gray {
    border-color: rgba(255, 255, 255, 0.85);
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: .5rem;
    max-height: 180px;
    overflow-y: auto;
    margin-top: .8rem;
    padding: .4rem;
    background: #f8faf9;
    border-radius: 10px;
}
.thumb-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    background: #fff;
}
.thumb-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-l); }
.thumb-card img { width: 100%; height: 100%; object-fit: cover; }
.thumb-del {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: 0;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}
@media (max-width: 680px) { .compare-stage { grid-template-columns: 1fr; } }
.compare-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: .8rem;
    text-align: center;
    display: flex;
    flex-direction: column;
}
.compare-box-head { font-weight: 800; font-size: .9rem; margin-bottom: .5rem; display: flex; justify-content: space-between; }
.compare-canvas-wrap {
    flex: 1;
    min-height: 240px;
    max-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.checkerboard-bg,
.canvas-checkerboard {
    background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
                      linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
                      linear-gradient(-45deg, transparent 75%, #e2e8f0 75%) !important;
    background-size: 16px 16px !important;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px !important;
    background-color: #f8fafc !important;
}
.savings-badge {
    display: inline-flex;
    align-items: center;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-right: 0.45rem;
    vertical-align: middle;
}
.compare-canvas-wrap img, .compare-canvas-wrap canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.compare-canvas-wrap canvas.can-crop {
    cursor: grab;
}
.compare-canvas-wrap canvas.can-crop:active {
    cursor: grabbing;
}
.crop-overlay-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(12, 133, 90, 0.94);
    color: #fff;
    padding: .28rem .85rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22);
    backdrop-filter: blur(4px);
    z-index: 5;
    white-space: nowrap;
    animation: fadeInCropHint .3s ease-out;
}
@keyframes fadeInCropHint {
    from { opacity: 0; transform: translate(-50%, 6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
.compare-meta { font-size: .78rem; color: var(--muted); margin-top: .5rem; }

/* ---------- Interactive Crop Studio Styles ---------- */
.orig-stage-container {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.orig-stage-container[hidden],
.orig-stage-container.is-hidden {
    display: none !important;
}
.orig-stage-container img {
    display: block;
    max-width: 100%;
    max-height: 380px;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}
.crop-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #0ca678;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
    cursor: move;
    touch-action: none;
    z-index: 10;
}
.crop-grid-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border: 1px dashed rgba(255, 255, 255, 0.7);
}
.cgl-h1, .cgl-h2, .cgl-v1, .cgl-v2 {
    position: absolute;
    background: rgba(255, 255, 255, 0.4);
}
.cgl-h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
.cgl-h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
.cgl-v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.cgl-v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }

/* Corner Resize Handles */
.crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #0ca678;
    border: 2px solid #fff;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    z-index: 12;
    touch-action: none;
}
/* Requirement 5: Hit areas >= 44px for handles via invisible pseudo-element */
.crop-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
}
.handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }

/* Studio Quick Toolbar */
.crop-studio-bar {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .65rem .75rem;
    margin-top: .75rem;
    width: 100%;
    box-sizing: border-box;
}

.crop-studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    width: 100%;
}

.crop-aspect-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    font-weight: 700;
    color: var(--brand-d);
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: .2rem .55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.crop-zoom-indicator {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--muted);
    font-weight: 700;
}

.crop-zoom-badge {
    display: inline-block;
    font-weight: 800;
    color: var(--brand-d);
    background: #fff;
    border: 1px solid var(--line);
    padding: .15rem .45rem;
    border-radius: 6px;
    font-size: .78rem;
    min-width: 42px;
    text-align: center;
}

.crop-studio-slider-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    box-sizing: border-box;
}

.crop-slider-track {
    flex: 1;
    display: flex;
    align-items: center;
}

.crop-slider-track input[type="range"] {
    width: 100%;
    margin: 0;
    min-height: 36px;
    cursor: pointer;
    accent-color: var(--brand);
}

.btn-zoom-step {
    min-width: 40px !important;
    min-height: 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    cursor: pointer;
    touch-action: manipulation;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
}

.btn-zoom-step:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-zoom-step:active {
    background: #e2e8f0;
}

.crop-studio-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    width: 100%;
}

.crop-studio-actions-row.single-action {
    grid-template-columns: 1fr;
}

@media (max-width: 340px) {
    .crop-studio-actions-row {
        grid-template-columns: 1fr;
    }
}

.btn-crop-action {
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .4rem !important;
    font-size: .84rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    padding: .4rem .6rem !important;
    white-space: nowrap !important;
    cursor: pointer;
    touch-action: manipulation;
    text-align: center;
    transition: background .15s, border-color .15s;
}

#btn_crop_reset {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
}

#btn_crop_reset:hover {
    background: #f1f5f9;
}

#btn_crop_reset:active {
    background: #e2e8f0;
}

#btn_studio_white_bg {
    background: #f0fdf4;
    border: 1px solid #10b981;
    color: #047857;
}

#btn_studio_white_bg:hover {
    background: #dcfce7;
}
.upload-privacy-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem .75rem;
    margin-top: .65rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 700;
    color: #166534;
    text-align: center;
}
.dropzone-quick-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-top: .65rem;
    flex-wrap: wrap;
}
.touch-only-inline {
    display: none;
}
.desktop-only-inline {
    display: inline;
}
@media (pointer: coarse), (max-width: 760px) {
    .touch-only-inline {
        display: inline;
    }
    .desktop-only-inline {
        display: none;
    }
}
.tool-seo-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line), transparent);
    margin: 2rem auto;
    max-width: 1000px;
}

/* ---------- Live Camera Studio Modal ---------- */
.camera-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.camera-modal-card {
    background: #0f172a;
    color: #f8fafc;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
}
.camera-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.camera-modal-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 800;
    font-size: .95rem;
    color: #38bdf8;
}
.camera-modal-close {
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: 6px;
    line-height: 1;
    min-height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.camera-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.camera-viewfinder-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.camera-viewfinder-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror selfie preview */
}
.camera-viewfinder-wrap video.no-mirror {
    transform: none; /* Rear camera preview */
}
.camera-face-guide {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.camera-face-oval {
    width: 180px;
    height: 240px;
    border-radius: 50% / 45%;
    border: 2px dashed rgba(56, 189, 248, 0.85);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
}
.camera-guide-caption {
    margin-top: .75rem;
    font-size: .78rem;
    font-weight: 700;
    color: #fff;
    background: rgba(15, 23, 42, 0.75);
    padding: .25rem .65rem;
    border-radius: 999px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.camera-loading-state {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    color: #cbd5e1;
    font-size: .88rem;
    font-weight: 700;
    padding: 1rem;
    text-align: center;
}
.camera-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: .85rem 1.25rem;
    background: #0b1120;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.camera-shutter {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    touch-action: manipulation;
}
.camera-shutter-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 3.5px solid #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    transition: transform .15s ease;
}
.camera-shutter:active .camera-shutter-ring {
    transform: scale(0.92);
}
.camera-shutter-dot {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #10b981;
    transition: background .15s ease;
}
.camera-shutter:hover .camera-shutter-dot {
    background: #059669;
}
.btn-camera-switch {
    color: #cbd5e1 !important;
    gap: .35rem;
    font-size: .82rem !important;
    padding: .4rem .65rem !important;
    min-height: 40px !important;
}
.btn-camera-switch:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Progress bar for AI removal */
.ai-progress-wrap {
    margin-top: .8rem;
    background: #f1f3f5;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}
.ai-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #d6336c, #ae3ec9);
    width: 0%;
    transition: width .2s;
}

/* Color studio picker */
.color-picker-group { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ced4da;
    cursor: pointer;
    transition: transform .15s;
}
.color-circle:hover, .color-circle.is-active { transform: scale(1.15); border-color: var(--deep); }

/* Auto-Trim Controls */
.trim-switch-label {
    display: flex;
    align-items: center;
    gap: .75rem;
    cursor: pointer;
    background: #fdf2f8;
    padding: .75rem 1rem;
    border-radius: 10px;
    border: 1px solid #fbcfe8;
    transition: all .2s;
    user-select: none;
}
.trim-switch-label:hover {
    background: #fce7f3;
    border-color: #f472b6;
}
.trim-pad-btn {
    border-color: #dee2e6;
    color: var(--text);
    transition: all .15s;
    background: #fff;
}
.trim-pad-btn:hover {
    border-color: #d6336c;
    color: #d6336c;
}
.trim-pad-btn.is-active {
    background: #d6336c !important;
    color: #ffffff !important;
    border-color: #d6336c !important;
    box-shadow: 0 2px 6px rgba(214, 51, 108, 0.25);
}
.trim-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .75rem;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    background: #ebfbee;
    color: #2b8a3e;
    border: 1px solid #b2f2bb;
}

/* Sortable PDF image list */
.pdf-items-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .8rem;
    max-height: 340px;
    overflow-y: auto;
}
.pdf-item-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.pdf-item-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.pdf-item-meta { flex: 1; min-width: 0; }
.pdf-item-name { font-weight: 700; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.pdf-item-size { font-size: .72rem; color: var(--muted); }
.pdf-item-actions { display: flex; gap: .3rem; }
.btn-icon-sm {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
}
.btn-icon-sm:hover { background: var(--brand-l); border-color: var(--brand); }

.pdf-item-row.is-dragging { opacity: 0.35; border: 2px dashed var(--brand); }
.pdf-item-row.is-dragover { border: 2px solid var(--brand); background: var(--brand-l); transform: scale(1.01); }

/* Contextual store card field visibility */
#waybill-form #store_card .grid-2:has(#seller_vat),
#waybill-form #store_card .field:has(#seller_vat) {
    display: none !important;
}

/* ==========================================================================
   Waybill Templates (Authentic Noon & Amazon Designs - Zero Disconnected Arabic)
   ========================================================================== */
.sheet--waybill-thermal,
.sheet--waybill-a4,
.waybill-noon-box,
.waybill-amazon-box {
    direction: rtl !important;
    text-align: right;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif !important;
    letter-spacing: 0 !important;
    font-feature-settings: normal !important;
    -webkit-font-smoothing: antialiased;
}
.sheet--waybill-thermal *,
.sheet--waybill-a4 *,
.waybill-noon-box *,
.waybill-amazon-box * {
    letter-spacing: 0 !important;
}

/* 1. Noon Authentic Style (Matching Official Noon Courier Waybill) */
.waybill-noon-box {
    border: 2px solid #000;
    padding: 3.5mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2mm;
    background: #fff;
    color: #000;
    border-radius: 4px;
}
.waybill-noon-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2mm;
}
.waybill-noon-brand-title {
    font-size: 20pt;
    font-weight: 900;
    line-height: 1.1;
    color: #000;
}
.waybill-noon-customer {
    font-size: 13.5pt;
    font-weight: 900;
    margin-top: 1.5mm;
    color: #000;
}
.waybill-noon-address {
    font-size: 9.5pt;
    font-weight: 700;
    line-height: 1.35;
    margin-top: 1mm;
    color: #111;
}
.waybill-noon-zone {
    font-size: 8.5pt;
    font-weight: 900;
    font-family: monospace;
    margin-top: 1mm;
    color: #000;
    background: #f1f3f5;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
}
.waybill-noon-date {
    font-size: 7.5pt;
    color: #444;
    margin-top: 0.8mm;
    font-weight: 700;
}
.waybill-noon-landmark {
    width: 22mm;
    height: 22mm;
    border-radius: 50%;
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 1.5mm;
    box-sizing: border-box;
    background: #fff;
}
.waybill-noon-landmark svg, .waybill-noon-landmark img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.waybill-noon-divider {
    border-top: 2px dashed #000;
    margin: 0.5mm 0;
}
.waybill-noon-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    border: 2px dashed #000;
    border-radius: 4px;
    padding: 2.5mm;
    gap: 2mm;
    align-items: center;
}
.waybill-noon-sort-col {
    text-align: center;
}
.waybill-noon-sort-number {
    font-size: 28pt;
    font-weight: 900;
    line-height: 1;
    font-family: 'Cairo', sans-serif;
    color: #000;
}
.waybill-noon-subcode {
    font-size: 9pt;
    font-weight: 800;
    font-family: monospace;
    margin: 1.5mm 0 1mm;
    color: #000;
}
.waybill-noon-hubs {
    font-size: 8pt;
    font-weight: 800;
    font-family: monospace;
    line-height: 1.35;
    text-align: right;
    border-top: 1px dotted #000;
    padding-top: 1mm;
    margin-top: 1mm;
    color: #000;
}
.waybill-noon-qr-col {
    border-inline-start: 2px dashed #000;
    padding-inline-start: 2.5mm;
    text-align: center;
}
.waybill-noon-qr-tag {
    font-size: 7.5pt;
    font-weight: 800;
    font-family: monospace;
    word-break: break-all;
    color: #000;
}
.waybill-noon-qr-col img {
    width: 25mm;
    height: 25mm;
    display: block;
    margin: 1mm auto;
    image-rendering: pixelated;
}
.waybill-noon-cod-box {
    border: 2.5px solid #000;
    border-radius: 4px;
    padding: 2.5mm 2mm;
    text-align: center;
    background: #fff;
}
.waybill-noon-cod-box.is-cod {
    background: #000;
    color: #fff;
}
.waybill-noon-cod-box.is-cod .waybill-noon-cod-title {
    color: #fff;
}
.waybill-noon-cod-title {
    font-size: 8.5pt;
    font-weight: 800;
    text-transform: uppercase;
}
.waybill-noon-cod-amount {
    font-size: 19pt;
    font-weight: 900;
    margin-top: 0.5mm;
}
.waybill-noon-footer-box {
    border: 1.5px solid #000;
    border-radius: 4px;
    padding: 2mm 2.5mm;
    font-size: 8pt;
    line-height: 1.35;
}
.waybill-noon-instruction-tag {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 900;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 2px;
    margin-bottom: 1mm;
}

/* 2. Amazon Authentic Style (Matching Official Amazon SPX Courier Waybill) */
.waybill-amazon-box {
    border: 2px solid #000;
    padding: 3mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2mm;
    background: #fff;
    color: #000;
}
.waybill-amz-top {
    display: grid;
    grid-template-columns: 1fr auto;
    border: 1.5px solid #000;
}
.waybill-amz-return {
    padding: 2mm;
    font-size: 7.5pt;
    line-height: 1.35;
    border-inline-end: 1.5px solid #000;
}
.waybill-amz-pkg-table {
    display: flex;
    flex-direction: column;
    width: 34mm;
}
.waybill-amz-pkg-cell {
    padding: 1.5mm;
    font-size: 7.5pt;
    font-weight: 800;
    text-align: center;
    border-bottom: 1.5px solid #000;
    font-family: monospace;
}
.waybill-amz-pkg-cell:last-child {
    border-bottom: none;
}
.waybill-amz-shipto {
    border: 1.5px solid #000;
    padding: 2mm 2.5mm;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2mm;
}
.waybill-amz-shipto-content {
    font-size: 8.5pt;
    line-height: 1.35;
}
.waybill-amz-shipto-title {
    font-size: 7.5pt;
    font-weight: 900;
    color: #444;
}
.waybill-amz-customer-name {
    font-size: 13pt;
    font-weight: 900;
    margin: 1mm 0;
}
.waybill-amz-badge {
    background: #000;
    color: #fff;
    padding: 2.5mm 3.5mm;
    text-align: center;
    font-weight: 900;
    font-size: 11pt;
    border-radius: 2px;
    letter-spacing: 0;
    min-width: 25mm;
}
.waybill-amz-barcode-block {
    text-align: center;
    border: 1.5px solid #000;
    padding: 2mm 1mm 1mm;
}
.waybill-amz-barcode-block svg {
    width: 100%;
    max-width: 86mm;
    height: 16mm;
    display: block;
    margin: 0 auto;
}
.waybill-amz-barcode-num {
    font-size: 10.5pt;
    font-weight: 900;
    font-family: monospace;
    margin-top: 1mm;
}
.waybill-amz-route-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1.5px solid #000;
    text-align: center;
    font-family: monospace;
    font-weight: 900;
    font-size: 8pt;
}
.waybill-amz-route-grid div {
    padding: 1.5mm 0;
    border-inline-end: 1px solid #000;
}
.waybill-amz-route-grid div:last-child {
    border-inline-end: none;
}
.waybill-amz-orderid {
    font-size: 8pt;
    font-weight: 800;
    font-family: monospace;
    border-top: 1px solid #000;
    padding: 1mm 2mm;
    background: #f8f9fa;
}
.waybill-amz-bottom {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3mm;
    align-items: center;
    border: 1.5px solid #000;
    padding: 2mm;
}
.waybill-amz-qr img {
    width: 22mm;
    height: 22mm;
    display: block;
    image-rendering: pixelated;
}
.waybill-amz-instructions {
    font-size: 8pt;
    line-height: 1.35;
}

/* Executive Corporate Quotation Layout */
.sheet--quote-executive {
    width: 210mm;
    min-height: 297mm;
    padding: 12mm 14mm;
    background: #fff;
    color: #1a202c;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: inherit;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.quote-top-bar {
    height: 6px;
    background: linear-gradient(90deg, #1c7ed6, #0f9d74);
    margin: -12mm -14mm 8mm;
}
.quote-exec-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5mm;
    margin-bottom: 5mm;
}
.quote-exec-brand { display: flex; align-items: center; gap: 4mm; }
.quote-exec-logo { max-height: 20mm; max-width: 45mm; object-fit: contain; }
.quote-exec-store-name { font-size: 15pt; font-weight: 900; color: #1a365d; }
.quote-exec-store-meta { font-size: 8.5pt; color: #4a5568; margin-top: 1mm; line-height: 1.4; }

.quote-exec-meta-box {
    text-align: end;
    display: flex;
    flex-direction: column;
    gap: 1.5mm;
}
.quote-exec-title {
    font-size: 17pt;
    font-weight: 900;
    color: #1c7ed6;
    letter-spacing: -0.5px;
    margin-bottom: 1.5mm;
}
.quote-exec-meta-row { font-size: 8.5pt; color: #4a5568; }
.quote-exec-meta-row strong { color: #1a202c; font-weight: 800; }

.quote-client-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: 4px solid #1c7ed6;
    border-radius: 6px;
    padding: 3mm 5mm;
    margin-bottom: 5mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.quote-client-title { font-size: 8pt; font-weight: 800; color: #64748b; }
.quote-client-name { font-size: 11.5pt; font-weight: 900; color: #0f172a; margin-top: 0.5mm; }

.quote-exec-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6mm;
    font-size: 9.5pt;
}
.quote-exec-table th {
    background: #1a365d;
    color: #fff;
    padding: 3mm 4mm;
    font-weight: 800;
    text-align: start;
}
.quote-exec-table th:last-child { text-align: end; }
.quote-exec-table td {
    padding: 3.5mm 4mm;
    border-bottom: 1px solid #e2e8f0;
}
.quote-exec-table td:last-child { text-align: end; font-weight: 800; }
.quote-exec-table tr:nth-child(even) { background: #f8fafc; }

.quote-exec-bottom {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 5mm;
    margin-top: 3mm;
}
.quote-spacious-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 3.5mm 4.5mm;
    font-size: 8.5pt;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 2mm;
}
.quote-card-header { font-size: 9pt; font-weight: 800; color: #1a365d; border-bottom: 1px solid #cbd5e1; padding-bottom: 1mm; }

.quote-exec-totals {
    display: flex;
    flex-direction: column;
    gap: 1.5mm;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 3.5mm 4.5mm;
    text-align: end;
}
.quote-exec-totals .grand-total {
    border-top: 1.5px solid #cbd5e1;
    padding-top: 2mm;
    margin-top: 1mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2mm;
}
.quote-exec-totals .grand-total-label {
    font-size: 9.5pt;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
}
.quote-exec-totals .grand-total-val {
    font-size: 11pt;
    font-weight: 900;
    color: #1c7ed6;
    white-space: nowrap;
}

.quote-exec-signatures {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 8mm;
    padding-top: 3mm;
    border-top: 1px dashed #cbd5e1;
}
.quote-sig-box {
    text-align: center;
    width: 48mm;
}
.quote-sig-img { max-height: 20mm; max-width: 44mm; display: block; margin: 0 auto; object-fit: contain; }
.quote-stamp-img { max-height: 24mm; max-width: 24mm; display: block; margin: 0 auto; object-fit: contain; }
.quote-sig-line { border-bottom: 1.5px solid #1a365d; margin-top: 2mm; }




/* Cutout preview canvas in remove-background */
#cutout_canvas_wrap {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
}
#cutout_canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 2px dashed #d6336c;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    transition: all .2s ease;
}
#cutout_canvas.has-solid-bg {
    border: 1px solid #cbd5e1;
}

/* QR Generator Tool */
.qr-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .35rem;
    background: #f1f5f9;
    padding: .35rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}
@media (max-width: 480px) {
    .qr-tabs {
        grid-template-columns: repeat(3, 1fr);
    }
}
.qr-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .5rem .25rem;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    min-height: 46px;
    color: #475569;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.qr-tab svg {
    color: #64748b;
    transition: color .15s ease;
    flex-shrink: 0;
}
.qr-tab:hover {
    background: rgba(255, 255, 255, 0.6);
    color: #0f172a;
}
.qr-tab:hover svg {
    color: #0ca678;
}
.qr-tab.is-active {
    background: #ffffff;
    color: #0ca678;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.qr-tab.is-active svg {
    color: #0ca678;
}
.qr-pane {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}
.qr-pane[hidden],
.qr-pane.is-hidden {
    display: none !important;
}

/* Static QR Notice Banner */
.qr-static-notice {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: 4px solid #0ca678;
    border-radius: 10px;
    padding: .85rem 1rem;
    margin-bottom: 1.2rem;
    font-size: .84rem;
    line-height: 1.55;
    color: var(--text);
}
.qr-static-notice-header {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: .3rem;
}
.qr-static-notice-header svg {
    color: #0ca678;
    flex-shrink: 0;
}
.qr-static-notice p {
    margin: 0;
    color: #475569;
    font-size: .82rem;
}

/* Info Tips */
.qr-info-tip {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: .65rem .85rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: .8rem;
    color: #166534;
    line-height: 1.45;
}
.qr-info-tip svg {
    color: #16a34a;
    flex-shrink: 0;
    margin-top: .15rem;
}

/* QR Field Error Messages */
.qr-field-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: .5rem .75rem;
    font-size: .78rem;
    font-weight: 600;
    color: #dc2626;
    margin-top: .4rem;
}

/* Show / Hide Password (Non-overlapping Flex Input Group for RTL/LTR) */
.password-input-wrap {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.password-input-wrap:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}
.password-input-wrap .input {
    flex: 1;
    min-width: 0;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding-inline: .75rem;
}
.password-input-wrap .input::-ms-reveal,
.password-input-wrap .input::-ms-clear {
    display: none;
}
.btn-toggle-pw {
    flex-shrink: 0;
    background: #f8fafc;
    border: none;
    border-inline-start: 1px solid var(--line);
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .65rem;
    min-height: 44px;
    min-width: 44px;
    transition: background .15s, color .15s;
}
.btn-toggle-pw:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Scannability Alert */
.qr-scannability-alert {
    margin: .75rem 1.25rem 0;
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .82rem;
    line-height: 1.5;
    font-weight: 600;
}
.qr-scannability-alert.is-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}
.qr-scannability-alert.is-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.qr-scannability-alert.is-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Placeholder Canvas Overlay */
.qr-canvas-card {
    position: relative;
}
.qr-placeholder-overlay {
    position: absolute;
    inset: 1.5rem;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: 8px;
    z-index: 5;
    pointer-events: none;
}
.qr-placeholder-overlay[hidden] {
    display: none !important;
}
.qr-placeholder-stamp {
    font-size: 1.5rem;
    font-weight: 900;
    color: #64748b;
    border: 3px dashed #94a3b8;
    padding: .2rem 1.2rem;
    border-radius: 8px;
    transform: rotate(-8deg);
    letter-spacing: .05em;
    user-select: none;
}
.qr-placeholder-text {
    font-size: .82rem;
    font-weight: 700;
    color: #475569;
    text-align: center;
    padding: 0 .75rem;
}

/* Encoded Payload Card */
.qr-encoded-card {
    margin-top: 1.2rem;
    width: 100%;
    max-width: 480px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.qr-encoded-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .4rem;
}
.qr-encoded-title {
    font-size: .78rem;
    font-weight: 700;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.qr-encoded-payload {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: .5rem .65rem;
    font-family: monospace;
    font-size: .75rem;
    color: #0f172a;
    word-break: break-all;
    max-height: 80px;
    overflow-y: auto;
    direction: ltr;
    text-align: left;
}

/* "Use My Data" Button */
.btn-use-my-data {
    color: #0ca678;
    font-weight: 700;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.btn-use-my-data:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #099268;
}

@media (prefers-color-scheme: dark) {
    .qr-tabs {
        background: #1e293b;
        border-color: #334155;
    }
    .qr-tab {
        color: #94a3b8;
    }
    .qr-tab:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #f8fafc;
    }
    .qr-tab.is-active {
        background: #0f172a;
        color: #34d399;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    }
    .qr-tab.is-active svg {
        color: #34d399;
    }
    .qr-static-notice {
        background: #1e293b;
        border-color: #334155;
        border-right-color: #10b981;
    }
    .qr-static-notice-header {
        color: #f8fafc;
    }
    .qr-static-notice p {
        color: #cbd5e1;
    }
    .qr-canvas-card {
        background: #1e293b;
    }
    .qr-encoded-card {
        background: #1e293b;
        border-color: #334155;
    }
    .qr-encoded-title {
        color: #cbd5e1;
    }
    .qr-encoded-payload {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }
    .qr-placeholder-overlay {
        background: rgba(15, 23, 42, 0.9);
    }
    .qr-placeholder-stamp {
        color: #94a3b8;
        border-color: #64748b;
    }
    .qr-placeholder-text {
        color: #e2e8f0;
    }
    .btn-toggle-pw {
        color: #94a3b8;
    }
    .btn-toggle-pw:hover {
        color: #f8fafc;
    }
    .btn-use-my-data {
        background: rgba(12, 166, 120, 0.15);
        border-color: rgba(12, 166, 120, 0.3);
        color: #34d399;
    }
    .btn-use-my-data:hover {
        background: rgba(12, 166, 120, 0.25);
        color: #6ee7b7;
    }
    .qr-export-toolbar {
        background: #1e293b;
        border-bottom-color: #334155;
    }
    .qr-size-label {
        color: #f8fafc;
    }
    .qr-size-badge {
        background: #064e3b;
        color: #a7f3d0;
        border-color: #047857;
    }
    .qr-size-grid {
        background: #0f172a;
        border-color: #334155;
    }
    .qr-size-pill .sz-num {
        color: #cbd5e1;
    }
    .qr-size-pill .sz-lbl {
        color: #94a3b8;
    }
    .qr-size-pill:hover {
        background: rgba(255, 255, 255, 0.08);
    }
    .qr-size-pill.is-active {
        background: #0ca678 !important;
    }
    .qr-static-notice-outside {
        background: #1e293b;
        border-color: #334155;
        border-right-color: #10b981;
        color: #f1f5f9;
    }
    .qr-static-notice-outside .qr-static-notice-header {
        color: #f8fafc;
    }
    .qr-static-notice-outside p {
        color: #cbd5e1;
    }
}

/* Mobile actions adjustments for QR generator flow */
.mobile-preview-actions {
    display: flex;
    width: 100%;
    gap: .5rem;
}
.mobile-preview-actions .btn {
    flex: 1;
    min-height: 44px;
    padding-inline: .4rem;
    font-size: .88rem;
}
#m_flow_next {
    min-height: 44px;
    font-size: .95rem;
    font-weight: 700;
}

/* Color Picker Input Group */
.color-input-group {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .25rem .5rem;
    transition: border-color .15s;
}
.color-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(12, 166, 120, 0.12);
}
.color-picker-input {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}
.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 0;
}
.color-picker-input::-webkit-color-swatch {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}
.color-picker-input::-moz-color-swatch {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}
.color-hex-input {
    border: none !important;
    padding: .35rem .25rem !important;
    font-family: monospace;
    font-size: .88rem;
    font-weight: 700;
    color: var(--text);
    background: transparent !important;
    box-shadow: none !important;
    width: 100%;
}

/* Color Presets */
.color-presets-wrap {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    margin-top: .6rem;
}
.color-presets-label {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 700;
}
.color-preset-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .65rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: .78rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all .15s;
}
.color-preset-pill:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}
.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Caption Presets */
.caption-presets-wrap {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-top: .4rem;
}
.caption-preset-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .32rem .7rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: .78rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all .15s;
}
.caption-preset-pill:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}
.caption-preset-pill svg {
    color: #64748b;
    flex-shrink: 0;
}
.caption-preset-pill:hover svg {
    color: #0ca678;
}

/* Preset Icons */
.qr-preset-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: .5rem;
}
.btn-icon-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    padding: .5rem .3rem;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 700;
    transition: all .15s;
}
.btn-icon-choice:hover {
    border-color: #0ca678;
}
.btn-icon-choice.is-selected {
    border-color: #0ca678;
    background: #f0fdf4;
}
.btn-icon-choice .ico-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.btn-icon-choice .ico-badge svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}
.qr-canvas-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}
.qr-canvas-card canvas {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Range Slider */
.range-slider,
.field input[type="range"],
.panel-form input[type="range"],
input[type="range"].range-slider {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 100% !important;
    height: 6px !important;
    min-height: 6px !important;
    max-height: 6px !important;
    padding: 0 !important;
    margin: 8px 0 !important;
    border: none !important;
    border-radius: 999px !important;
    background: #cbd5e1 !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    direction: ltr !important;
}
.range-slider:focus,
.field input[type="range"]:focus,
.panel-form input[type="range"]:focus,
input[type="range"].range-slider:focus {
    background: #94a3b8 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}
.range-slider::-webkit-slider-runnable-track,
.field input[type="range"]::-webkit-slider-runnable-track,
.panel-form input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: #cbd5e1;
    border: none;
}
.range-slider::-webkit-slider-thumb,
.field input[type="range"]::-webkit-slider-thumb,
.panel-form input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: #0ca678;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.22);
    cursor: pointer;
    transition: transform .15s, background .15s;
}
.range-slider::-webkit-slider-thumb:hover,
.field input[type="range"]::-webkit-slider-thumb:hover,
.panel-form input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #099268;
}
.range-slider::-moz-range-track,
.field input[type="range"]::-moz-range-track,
.panel-form input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #cbd5e1;
    border: none;
}
.range-slider::-moz-range-thumb,
.field input[type="range"]::-moz-range-thumb,
.panel-form input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0ca678;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.22);
    cursor: pointer;
}
/* Blue theme for stamp sliders */
.stamp-slider::-webkit-slider-thumb {
    background: #1d4ed8 !important;
}
.stamp-slider::-webkit-slider-thumb:hover {
    background: #1e40af !important;
}
.stamp-slider::-moz-range-thumb {
    background: #1d4ed8 !important;
}

/* QR Export Resolution Toolbar */
.qr-export-toolbar {
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    padding: .65rem .85rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.qr-size-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.qr-size-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .84rem;
    font-weight: 700;
    color: var(--text);
}
.qr-size-label svg {
    color: #0ca678;
    flex-shrink: 0;
}
.qr-size-badge {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: .2rem .6rem;
    border-radius: 6px;
    font-size: .78rem;
    font-family: monospace;
    font-weight: 700;
    white-space: nowrap !important;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

/* 4-Column Segmented Presets Grid */
.qr-size-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .35rem;
    background: #f1f5f9;
    padding: .3rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.qr-size-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: .35rem .2rem;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all .15s ease;
    text-align: center;
}
.qr-size-pill:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #0f172a;
}
.qr-size-pill .sz-num {
    font-family: monospace;
    font-size: .76rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.2;
}
.qr-size-pill .sz-lbl {
    font-size: .68rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.2;
}
.qr-size-pill.is-active {
    background: #0ca678 !important;
    box-shadow: 0 1px 3px rgba(12, 166, 120, 0.28);
}
.qr-size-pill.is-active .sz-num {
    color: #ffffff !important;
}
.qr-size-pill.is-active .sz-lbl {
    color: #e6fcf5 !important;
    font-weight: 700;
}

.qr-slider-wrap {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    direction: ltr;
}
.qr-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: .68rem;
    color: var(--muted);
    font-weight: 600;
    direction: ltr;
}

/* Static QR Notice (Outside Workspace) */
.qr-static-notice-outside {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-right: 4px solid #0ca678;
    border-radius: 10px;
    padding: .85rem 1.15rem;
    margin: 1.5rem 0 1rem;
    font-size: .84rem;
    line-height: 1.6;
    color: #166534;
}
.qr-static-notice-outside .qr-static-notice-header {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: .3rem;
}
.qr-static-notice-outside .qr-static-notice-header svg {
    color: #0ca678;
    flex-shrink: 0;
}
.qr-static-notice-outside p {
    margin: 0;
    color: #475569;
    font-size: .82rem;
}

/* PDF Sign & Stamp Studio */
.pdf-page-container {
    position: relative;
    background: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    user-select: none;
    max-width: 100%;
}
.pdf-canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.draggable-overlay {
    position: absolute;
    cursor: move;
    border: 1px dashed rgba(29, 78, 216, 0.6);
    background: transparent;
    transition: box-shadow .15s;
    touch-action: none;
    z-index: 10;
}
.draggable-overlay:hover, .draggable-overlay:active {
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.4);
}
.draggable-overlay .drag-handle {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: #1d4ed8;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    z-index: 12;
}
.draggable-overlay .drag-handle svg {
    display: block;
}
.draggable-overlay .resize-handle {
    position: absolute;
    bottom: -10px;
    left: -10px;
    width: 22px;
    height: 22px;
    background: #047857;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    z-index: 12;
}
.draggable-overlay .resize-handle svg {
    display: block;
}
.signature-canvas-wrap {
    background: #fafbfc;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    position: relative;
    touch-action: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .2s;
}
.signature-canvas-wrap:hover {
    border-color: #94a3b8;
}
.signature-canvas-wrap::after {
    content: "✕ ................................................................................................";
    position: absolute;
    bottom: 22px;
    left: 20px;
    right: 20px;
    color: #cbd5e1;
    font-size: 13px;
    letter-spacing: 2px;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0.6;
}
.signature-canvas-wrap canvas {
    display: block;
    width: 100%;
    cursor: crosshair;
    position: relative;
    z-index: 2;
}
.stamp-ink-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all .15s ease-in-out;
}
.stamp-ink-btn:hover {
    transform: scale(1.1);
}
.stamp-ink-btn.is-active {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    transform: scale(1.15);
}
.sig-pen-color {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
    transition: transform .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sig-pen-color:hover {
    transform: scale(1.15);
}
.sig-pen-color.is-active {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    transform: scale(1.2);
}

/* VAT Calculator Tool - Corporate Mode Options */
.vat-mode-options {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.vat-mode-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .8rem 1rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}
.vat-mode-row:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.vat-mode-row.is-active {
    border-color: #0f766e;
    background: #f0fdfa;
    box-shadow: 0 1px 3px rgba(15, 118, 110, 0.08);
}
.vat-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    flex-shrink: 0;
    transition: all .2s;
}
.vat-mode-row.is-active .vat-mode-icon {
    background: #ccfbf1;
    color: #0f766e;
}
.vat-mode-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.vat-mode-meta strong {
    font-size: .92rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}
.vat-mode-row.is-active .vat-mode-meta strong {
    color: #0f766e;
}
.vat-mode-meta small {
    font-size: .78rem;
    color: #64748b;
    line-height: 1.35;
}
.vat-mode-indicator {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: all .2s;
}
.vat-mode-row.is-active .vat-mode-indicator {
    border-color: #0f766e;
    background: #0f766e;
}
.vat-mode-row.is-active .vat-mode-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
/* Backward compatibility for vat-mode-grid if any */
.vat-mode-grid {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.vat-mode-card {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .75rem 1rem;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
}
.vat-mode-card:hover {
    border-color: #0f766e;
}
.vat-mode-card.is-active {
    border-color: #0f766e;
    background: #f0fdfa;
}
.vat-rate-btn {
    transition: all .18s ease;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    font-weight: 600;
}
.vat-rate-btn:hover {
    border-color: #0f766e;
    color: #0f766e;
    background: #f0fdfa;
}
.vat-rate-btn.is-active {
    background: #0f766e !important;
    color: #ffffff !important;
    border-color: #0f766e !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 6px rgba(15, 118, 110, 0.28);
}
.vat-rate-btn.is-active svg {
    stroke: #ffffff !important;
}
.vat-breakdown-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    scroll-margin-top: 72px;
}
.vat-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 1rem;
}
.vat-card-title {
    font-size: clamp(1rem, 3.6vw, 1.15rem);
    font-weight: 800;
    color: var(--deep);
    margin: 0;
}
.vat-rate-badge {
    background: #eff6ff;
    color: #1d4ed8;
    font-size: clamp(.78rem, 2.8vw, .88rem);
    font-weight: 800;
    padding: .32rem .68rem;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.vat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
}
.vat-table td {
    padding: .85rem .6rem;
    border-bottom: 1px solid #f1f5f9;
}
.vat-grand-row {
    background: #f0fdf4 !important;
    border-top: 2px solid #059669;
}
.vat-grand-row td {
    padding: 1.1rem .6rem;
    border-bottom: none;
}
.vat-grand-total {
    font-size: clamp(1.05rem, 3.8vw, 1.45rem);
    font-weight: 900;
    color: #047857;
    white-space: nowrap;
}
.vat-tafqeet-box {
    margin-top: 1rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: .8rem 1rem;
}
.vat-formula-box {
    margin-top: .8rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: .75rem 1rem;
    overflow-x: auto;
}
.vat-formula-text {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.vat-formula-line {
    display: block;
    direction: ltr;
    text-align: left;
    white-space: nowrap;
}
.bidi-num {
    unicode-bidi: isolate;
    direction: ltr;
    display: inline-block;
}
.vat-rate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: .4rem;
}
.vat-input-error {
    margin-top: .45rem;
    padding: .55rem .75rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: .84rem;
    font-weight: 700;
    scroll-margin-top: 72px;
}
.vat-invalid-placeholder {
    padding: 1.15rem;
    background: #fff7ed;
    color: #9a3412;
    border: 1px dashed #fdba74;
    border-radius: 12px;
    font-weight: 700;
    text-align: center;
}
.vat-breakdown-card.is-invalid-hidden {
    display: none !important;
}
.preview-actions .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   Rich SEO Content Block, Reference Tables, How-To Steps & Related Tools
   ========================================================================== */
.seo-copy {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
    color: var(--ink-2);
    line-height: 1.8;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.03);
}
.seo-copy h2 {
    color: var(--deep);
    font-size: 1.25rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: .75rem;
}
.seo-copy p {
    font-size: .95rem;
    color: #334155;
    margin-bottom: .85rem;
}
.seo-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
    padding-bottom: .85rem;
    border-bottom: 1px dashed var(--line);
}
.seo-breadcrumbs a {
    color: var(--brand-d);
    font-weight: 700;
    text-decoration: none;
}
.seo-breadcrumbs a:hover {
    text-decoration: underline;
}
.seo-breadcrumbs .sep {
    color: #cbd5e1;
}
.seo-breadcrumbs strong {
    color: var(--ink);
    font-weight: 700;
}
.seo-section-block {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}
.seo-steps-grid {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.seo-step-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: .85rem;
}
.seo-step-num {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 800;
    font-size: .88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: .15rem;
}
.seo-step-body strong {
    display: block;
    font-size: .94rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: .25rem;
}
.seo-step-body p {
    font-size: .85rem;
    color: #475569;
    margin: 0;
    line-height: 1.6;
}
.seo-table-wrap {
    overflow-x: auto;
    margin-top: .85rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.seo-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
    text-align: right;
    background: #ffffff;
}
.seo-ref-table th {
    background: #f1f5f9;
    color: var(--deep);
    font-weight: 800;
    padding: .85rem 1rem;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
}
.seo-ref-table td {
    padding: .8rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}
.seo-ref-table tbody tr:last-child td {
    border-bottom: none;
}
.seo-ref-table tbody tr:nth-child(even) {
    background: #f8fafc;
}
.seo-features-list {
    margin: .75rem 0 0;
    padding-inline-start: 1.3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: .6rem 1.5rem;
}
.seo-features-list li {
    font-size: .92rem;
    color: #334155;
}
.seo-features-list li::marker {
    color: var(--brand);
}
.seo-faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.seo-faq-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
}
.seo-faq-card h3 {
    font-size: .96rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 .45rem;
}
.seo-faq-card p {
    font-size: .88rem;
    color: #475569;
    margin: 0;
    line-height: 1.65;
}
.seo-related-box {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px dashed #e2e8f0;
}
.seo-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: .85rem;
    margin-top: 1rem;
}
.seo-related-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink);
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.seo-related-card:hover {
    border-color: var(--brand);
    background: #ecfdf5;
    transform: translateY(-2px);
    text-decoration: none;
}
.seo-related-ico {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent, var(--brand)) 12%, white);
    color: var(--accent, var(--brand));
    flex-shrink: 0;
}
.seo-related-ico svg {
    width: 21px;
    height: 21px;
}
.seo-related-meta {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.seo-related-meta strong {
    font-size: .9rem;
    font-weight: 800;
    color: var(--deep);
}
.seo-related-meta small {
    font-size: .78rem;
    color: #64748b;
    line-height: 1.4;
}
.seo-preset-hub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: .75rem 1rem;
    margin-bottom: 1.35rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.seo-preset-hub-lbl {
    font-size: .82rem;
    font-weight: 800;
    color: #475569;
}
.seo-preset-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}
.seo-preset-pill {
    display: inline-flex;
    align-items: center;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: var(--ink);
    text-decoration: none;
    transition: all .15s ease;
}
.seo-preset-pill:hover {
    border-color: var(--brand);
    color: var(--brand-ink);
    background: #ecfdf5;
    text-decoration: none;
}
.seo-preset-pill.is-active {
    background: var(--deep);
    border-color: var(--deep);
    color: #fff;
}

/* ---------- Footer Grid ---------- */
.footer-grid {
    grid-template-columns: 1.25fr 1fr 1fr 1fr;
    gap: 2rem;
}

/* ==========================================================================
   App-Like Mobile UI/UX Architecture (Header Drawer, Workspace Tabs & Stages)
   ========================================================================== */
.mobile-menu-btn,
.mobile-ws-switcher,
.mobile-go-preview-btn,
.mobile-back-edit-btn,
.mobile-compare-tabs {
    display: none;
}

/* Mobile Tools Top Popover Sheet (Outside Header, Never Locks Page Scroll) */
.mobile-sheet-backdrop {
    position: fixed;
    top: 54px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: rgba(11, 31, 26, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8px 10px 16px;
    opacity: 0;
    transition: opacity .16s ease;
    touch-action: none;
}
.mobile-sheet-backdrop[hidden] { display: none !important; }
.mobile-sheet-backdrop.is-open { opacity: 1; }
.mobile-sheet {
    width: 100%;
    max-width: 500px;
    max-height: calc(100vh - 76px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: .85rem;
    box-shadow: 0 16px 38px rgba(11, 31, 26, 0.22);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-8px) scale(0.98);
    transition: transform .18s cubic-bezier(0.22, 1, 0.36, 1);
    touch-action: pan-y;
}
.mobile-sheet-backdrop.is-open .mobile-sheet {
    transform: translateY(0) scale(1);
}
.mobile-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: .55rem;
    margin-bottom: .65rem;
    border-bottom: 1px solid var(--line);
}
.mobile-sheet-head strong {
    font-size: .9rem;
    font-weight: 800;
    color: var(--deep);
}
.mobile-sheet-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: var(--ink);
    font-size: .85rem;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.mobile-sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .45rem;
}
.mobile-sheet-card {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .6rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--ink);
    text-decoration: none;
    transition: all .15s ease;
}
.mobile-sheet-card.is-active,
.mobile-sheet-card:hover {
    border-color: var(--accent, var(--brand));
    background: color-mix(in srgb, var(--accent, var(--brand)) 10%, white);
    text-decoration: none;
}
.mobile-sheet-ico {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent, var(--brand)) 14%, white);
    color: var(--accent, var(--brand));
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.mobile-sheet-ico svg { width: 17px; height: 17px; }
.mobile-sheet-name {
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--deep);
}

@media (max-width: 980px) {
    /* Sticky Segmented Workspace Switcher (Form <-> Preview) */
    .mobile-ws-switcher {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .25rem;
        padding: .25rem;
        margin-bottom: .65rem;
        background: #e2e8f0;
        border-radius: 10px;
        position: sticky;
        top: 56px;
        z-index: 38;
        box-shadow: 0 3px 10px rgba(11, 31, 26, 0.06);
    }
    .mobile-ws-tab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .35rem;
        min-height: 44px;
        padding: .45rem .6rem;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #334155; /* WCAG AA contrast against #e2e8f0 */
        font: inherit;
        font-size: .88rem; /* >= 14px */
        font-weight: 800;
        white-space: nowrap;
        cursor: pointer;
        transition: all .15s ease;
    }
    .mobile-ws-tab:focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }
    .mobile-ws-tab.is-active {
        background: #ffffff;
        color: var(--deep);
        box-shadow: 0 1px 4px rgba(11, 31, 26, 0.12);
    }
    .mobile-ws-pulse {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--brand);
        box-shadow: 0 0 0 2px rgba(15, 157, 116, 0.22);
    }

    /* Show only active panel on mobile to eliminate 1500px blind scroll */
    .workspace[data-mobile-tab="form"] > .panel-preview {
        display: none;
    }
    .workspace[data-mobile-tab="preview"] > .panel-form {
        display: none;
    }

    .mobile-go-preview-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .4rem;
        width: 100%;
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 .85rem !important;
        margin-top: .45rem;
        font-size: .88rem !important;
        font-weight: 800 !important;
        border-radius: 10px !important;
        background: #ecfdf5 !important;
        color: var(--brand-d) !important;
        border: 1px solid #a7f3d0 !important;
        box-shadow: none !important;
        cursor: pointer;
    }
}

@media (max-width: 980px) {
    /* 1. Compact Single-Row App Header (50px height) & collapse nav on tablet/mobile */
    .site-header .header-inner {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding-block: .4rem !important;
        gap: .5rem !important;
    }
    .brand {
        gap: .55rem;
    }
    .brand-logo-icon {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }
    .brand-title {
        font-size: 1.1rem;
    }
    .brand-sub {
        font-size: .64rem;
    }
    .site-header .nav {
        display: none !important;
    }
    .mobile-menu-btn {
        display: inline-flex !important;
        align-items: center;
        gap: .35rem;
        padding: .4rem .85rem;
        min-height: 40px;
        border-radius: 999px;
        background: var(--deep);
        color: #fff;
        border: 0;
        font: inherit;
        font-size: .82rem;
        font-weight: 800;
        cursor: pointer;
    }
    .mobile-ws-switcher {
        top: 51px;
    }

    /* 2. Sleek Fixed Bottom Bar (.mobile-actions) with Safe-Area & >= 44px Touch Targets */
    body.has-mobile-actions {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .mobile-actions {
        padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom, 0px)) !important;
        gap: .5rem !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 -4px 18px rgba(11, 31, 26, 0.09);
    }
    .mobile-actions .btn {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 .75rem !important;
        font-size: .88rem !important;
        font-weight: 800 !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
        gap: .35rem !important;
        box-shadow: none !important;
    }
    .mobile-actions .btn svg {
        width: 16px !important;
        height: 16px !important;
        flex-shrink: 0;
    }
    .mobile-actions .btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
        pointer-events: none;
    }

    /* Screen < 400px: Max 2 buttons fitting comfortably */
    @media (max-width: 400px) {
        .mobile-actions {
            padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom, 0px)) !important;
            gap: .35rem !important;
        }
        .mobile-actions .btn {
            min-height: 44px !important;
            font-size: .78rem !important;
            padding: .2rem .35rem !important;
            white-space: normal !important;
            line-height: 1.2 !important;
            text-align: center;
        }
    }

    /* 3. Clean Uncluttered Preview Tab on Mobile */
    .tool-head { padding: .75rem 0 .4rem; }
    .tool-head h1 { font-size: 1.18rem; }
    .tool-head p { font-size: .82rem; line-height: 1.4; }
    .ad-slot { margin: 1.25rem auto; }
    .panel-form { padding: .65rem; }
    .section-card { padding: .75rem; margin-bottom: .6rem; }

    .panel-preview {
        padding: .65rem !important;
        background: #fff !important;
        border: 1px solid var(--line) !important;
        border-radius: 12px !important;
    }
    .preview-stage, #stage {
        padding: 0 !important;
        min-height: 220px !important;
        overflow-x: auto !important;
    }
    .preview-bar {
        padding: .45rem .55rem !important;
        margin-bottom: .5rem !important;
        background: #f8fafc !important;
        flex-wrap: wrap !important;
        gap: .4rem !important;
    }
    .preview-bar-start {
        width: 100%;
        justify-content: space-between;
    }
    #current_preset_badge {
        white-space: normal !important;
        line-height: 1.3;
        font-size: .78rem !important;
    }

    /* Hide Duplicate Action Buttons inside Preview Bar & Redundant Status Badges on Mobile */
    body.has-mobile-actions .preview-bar .preview-actions,
    body.has-mobile-actions .waybill-top-toolbar .preview-actions,
    #resizer_root .preview-bar,
    #qr_preview_panel .preview-bar {
        display: none !important;
    }

    /* 4. Single-Stage Before/After Switcher in Image Resizer */
    .mobile-compare-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .25rem;
        width: 100%;
        padding: .25rem;
        margin-bottom: .65rem;
        background: #f1f5f9;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
    }
    .mobile-compare-tab {
        min-height: 44px;
        height: 44px;
        padding: 0 .6rem;
        border: 0;
        border-radius: 8px;
        background: transparent;
        font: inherit;
        font-size: .88rem; /* >= 14px */
        font-weight: 800;
        color: #334155; /* WCAG AA contrast against #f1f5f9 */
        white-space: nowrap;
        cursor: pointer;
        transition: all .15s ease;
    }
    .mobile-compare-tab:focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }
    .mobile-compare-tab.is-active {
        background: var(--deep);
        color: #fff;
    }
    .compare-box {
        padding: .6rem !important;
        border-radius: 10px !important;
    }
    .compare-box-head {
        margin-bottom: .4rem !important;
        font-size: .8rem !important;
    }
    #compare_stage[data-active-compare="orig"] [data-compare-pane="result"] {
        display: none !important;
    }
    #compare_stage[data-active-compare="result"] [data-compare-pane="orig"] {
        display: none !important;
    }

    /* 5. Compact SEO Copy & 2-Column Footer on Mobile */
    .seo-copy {
        padding: 1rem;
    }
    .seo-steps-grid, .seo-faq-grid, .seo-related-grid, .seo-features-list {
        grid-template-columns: 1fr;
        gap: .65rem;
    }
    .seo-step-card, .seo-faq-card, .seo-related-card {
        padding: .75rem .9rem;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.25rem !important;
    }
    .footer-brand-col {
        grid-column: 1 / -1;
    }
}

@media (max-width: 340px) {
    .brand {
        gap: .45rem;
    }
    .brand-logo-icon {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }
    .brand-title {
        font-size: 1rem;
    }
    .brand-sub {
        display: none;
    }
    .mobile-menu-btn {
        padding: .35rem .65rem;
        font-size: .78rem;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.qr-spin {
    display: inline-block;
    animation: spin 0.9s linear infinite;
}

@media print {
    .mobile-ws-switcher,
    .mobile-go-preview-btn,
    .mobile-back-edit-btn,
    .mobile-compare-tabs,
    .mobile-menu-btn,
    .mobile-sheet-backdrop {
        display: none !important;
    }
    .workspace > .panel-preview {
        display: block !important;
    }
}

/* ==========================================================================
   QR & Barcode Reader Tool (/tools/qr-reader)
   ========================================================================== */
.reader-privacy-banner {
    display: flex;
    align-items: center;
    gap: .65rem;
    background: rgba(12, 166, 120, 0.08);
    border: 1px solid rgba(12, 166, 120, 0.25);
    border-radius: 8px;
    padding: .65rem 1rem;
    font-size: .84rem;
    color: var(--text-color);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.reader-privacy-banner svg {
    color: var(--primary);
    flex-shrink: 0;
}

.reader-workspace {
    align-items: flex-start;
}

/* Mode Switcher Tabs */
.reader-mode-tabs {
    display: flex;
    gap: .5rem;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.reader-mode-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .65rem .75rem;
    min-height: 44px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}
.reader-mode-tab:hover {
    color: var(--text-color);
}
.reader-mode-tab.is-active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Camera Viewport & Viewfinder */
.reader-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 420px;
    background: #0b0f14;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.reader-viewport video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reader-viewfinder {
    position: absolute;
    inset: 12%;
    border-radius: 14px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: border-color .2s ease;
}
.reader-viewfinder.is-detected {
    border-color: #0ca678;
    box-shadow: 0 0 0 9999px rgba(12, 166, 120, 0.2), 0 0 20px #0ca678;
}

/* Reticle Corners */
.reader-reticle-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 3.5px solid #0ca678;
}
.corner-tl { top: -2px; left: -2px; border-right: none; border-bottom: none; border-top-left-radius: 8px; }
.corner-tr { top: -2px; right: -2px; border-left: none; border-bottom: none; border-top-right-radius: 8px; }
.corner-br { bottom: -2px; right: -2px; border-left: none; border-top: none; border-bottom-right-radius: 8px; }
.corner-bl { bottom: -2px; left: -2px; border-right: none; border-top: none; border-bottom-left-radius: 8px; }

/* Animated Laser Sweep Line */
.reader-laser {
    position: absolute;
    left: 2px;
    right: 2px;
    height: 2.5px;
    background: linear-gradient(90deg, transparent, #0ca678, #20c997, transparent);
    box-shadow: 0 0 10px #0ca678, 0 0 4px #20c997;
    animation: laserSweep 2.2s ease-in-out infinite alternate;
}
@keyframes laserSweep {
    0% { top: 6%; opacity: 0.8; }
    50% { opacity: 1; }
    100% { top: 92%; opacity: 0.8; }
}

.reader-viewfinder-hint {
    position: absolute;
    bottom: -32px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: .78rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

/* Standby & Error States */
.reader-camera-standby,
.reader-camera-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    background: #111827;
    color: #f3f4f6;
    z-index: 5;
    gap: .75rem;
}
.reader-camera-standby p {
    font-size: .88rem;
    color: #9ca3af;
    margin: 0;
}
.reader-camera-error-icon {
    color: #f87171;
}
.reader-camera-error strong {
    font-size: 1rem;
    color: #fecaca;
}
.reader-camera-error p {
    font-size: .82rem;
    color: #d1d5db;
    max-width: 320px;
    line-height: 1.5;
    margin: 0;
}

/* Camera Controls Bar */
.reader-camera-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .75rem;
    margin-top: .75rem;
}
.reader-cam-btn {
    min-height: 44px;
    padding: .5rem 1rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .84rem;
}
.reader-cam-btn.is-active {
    background: rgba(245, 159, 0, 0.15);
    color: #d97706;
    border-color: #d97706;
}

/* File Upload & Dropzone */
.reader-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--card-bg);
    cursor: pointer;
    transition: all .2s ease;
    position: relative;
}
.reader-dropzone:hover,
.reader-dropzone.is-dragover {
    border-color: var(--primary);
    background: rgba(12, 166, 120, 0.04);
}
.reader-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.reader-dropzone-icon {
    color: var(--primary);
    margin-bottom: .6rem;
}
.reader-dropzone-content strong {
    display: block;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: .35rem;
}
.reader-dropzone-content p {
    font-size: .82rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}
.reader-dropzone-content kbd {
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .78rem;
    font-family: monospace;
}

.reader-file-preview-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #0b0f14;
    max-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.reader-file-preview-card img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    display: block;
}
.reader-file-preview-status {
    padding: .65rem;
    font-size: .82rem;
    text-align: center;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.reader-supported-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-top: 1rem;
    font-size: .78rem;
}
.reader-badge-title {
    color: var(--muted);
    font-weight: 600;
}

/* Empty State in Output */
.reader-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}
.reader-empty-icon {
    color: var(--muted);
    opacity: 0.5;
    margin-bottom: .65rem;
}
.reader-empty-state strong {
    display: block;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: .4rem;
}
.reader-empty-state p {
    font-size: .82rem;
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Results Card & Badges */
.reader-result-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-color);
}
.reader-timestamp {
    font-size: .76rem;
    color: var(--muted);
    margin-right: auto;
}

/* Security Warning Box */
.reader-security-alert {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .82rem;
    color: #92400e;
    line-height: 1.5;
}
.reader-security-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
}

/* Result Payload Sub-boxes */
.reader-box-label {
    display: block;
    font-size: .84rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: .45rem;
}
.reader-url-display {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .75rem 1rem;
    word-break: break-all;
    font-size: .88rem;
    margin-bottom: .85rem;
    direction: ltr;
    text-align: left;
}
.reader-url-display a {
    color: var(--primary);
    text-decoration: underline;
}

.reader-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}
.reader-actions-row .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.reader-detail-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .75rem;
    margin-bottom: .85rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.reader-detail-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .84rem;
    flex-wrap: wrap;
}
.reader-detail-title {
    color: var(--muted);
    font-weight: 600;
    min-width: 90px;
}
.reader-detail-value {
    color: var(--text-color);
    font-weight: 700;
}

.reader-code-display {
    background: #0f172a;
    color: #38bdf8;
    font-family: monospace;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: .85rem;
}

.reader-raw-text {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .75rem;
    font-size: .84rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: .85rem;
    color: var(--text-color);
    line-height: 1.5;
}

/* History */
.reader-history-card {
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .85rem;
}
.reader-history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .6rem;
    font-size: .82rem;
}
.reader-history-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    max-height: 180px;
    overflow-y: auto;
}
.reader-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 6px;
    padding: .4rem .6rem;
    font-size: .8rem;
}
.reader-history-snippet {
    font-family: monospace;
    color: var(--text-color);
    font-size: .76rem;
    word-break: break-all;
    direction: ltr;
    text-align: left;
}
.reader-history-empty {
    color: var(--muted);
    font-size: .78rem;
    text-align: center;
    margin: .5rem 0;
}

.print-guidance {
    margin: -.35rem 0 .7rem;
    padding: .45rem .65rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: .74rem;
    line-height: 1.5;
    color: #334155;
}

.sheet--barcode-thermal.sheet--calibration,
.sheet--barcode-a4.sheet--calibration {
    display: block !important;
    padding: 0 !important;
}

@media print {
    html,
    body,
    body.has-mobile-actions {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
        height: auto !important;
    }
    .no-print,
    .qr-placeholder-overlay,
    .mobile-actions,
    .bc-preview-nav,
    .preview-bar,
    .print-guidance,
    .tool-head,
    .seo-block,
    .ad-slot {
        display: none !important;
    }
    .container,
    .workspace-wrap,
    .workspace {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }
    .workspace > .panel-form {
        display: none !important;
    }
    .panel,
    .panel-preview,
    .workspace > .panel-preview {
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        overflow: visible !important;
    }
    .preview-stage,
    #stage {
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        display: block !important;
    }
    .preview-scaler,
    #scaler {
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        height: auto !important;
        display: block !important;
    }
    #barcode_sheet_container {
        margin: 0 !important;
        box-shadow: none !important;
    }
    .sheet--barcode-thermal {
        margin: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;
    }
    .sheet--barcode-thermal.sheet--calibration,
    .sheet--barcode-a4.sheet--calibration {
        padding: 0 !important;
    }
    .barcode-print-pages {
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        width: auto !important;
        height: auto !important;
    }
    .barcode-print-pages .sheet--barcode-thermal,
    .barcode-print-pages .sheet--barcode-a4 {
        break-after: page !important;
        page-break-after: always !important;
        margin: 0 !important;
    }
    .barcode-print-pages .sheet--barcode-thermal:last-child,
    .barcode-print-pages .sheet--barcode-a4:last-child {
        break-after: auto !important;
        page-break-after: auto !important;
    }
    .sheet--barcode-a4 {
        width: 210mm !important;
        height: 296.8mm !important;
        min-height: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;
    }
}
