@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════ */
:root {
    --gold:          #d4af37;
    --gold-light:    #f5d060;
    --gold-deep:     #b8922e;
    --gold-glow:     rgba(212, 175, 55, 0.25);
    --gold-glow-sm:  rgba(212, 175, 55, 0.12);

    /* True black base with slight warmth */
    --bg-void:       #050505;
    --bg-base:       #0a0a0c;

    /* Glass layers – progressively more opaque */
    --glass-1:       rgba(255, 255, 255, 0.03);   /* subtle sheen */
    --glass-2:       rgba(255, 255, 255, 0.055);  /* cards */
    --glass-3:       rgba(255, 255, 255, 0.09);   /* modals */
    --glass-input:   rgba(255, 255, 255, 0.06);

    /* Borders – simulate light refraction on glass edges */
    --border-top:    rgba(255, 255, 255, 0.18);   /* bright catch-light */
    --border-side:   rgba(255, 255, 255, 0.07);
    --border-bottom: rgba(0,   0,   0,   0.35);   /* shadow edge */
    --border-gold:   rgba(212, 175, 55, 0.30);
    --border-gold-sm:rgba(212, 175, 55, 0.15);

    --text-main:     #f0f0f2;
    --text-sub:      #b8bcc8;
    --text-muted:    #7a7f8e;
    --text-dim:      #4a4f5e;

    /* Fallback variables for legacy/inline styles */
    --border:        rgba(255, 255, 255, 0.08);
    --bg-card:       rgba(255, 255, 255, 0.035);
    --text-primary:  #f0f0f2;

    --success:       #10b981;
    --success-glass: rgba(16, 185, 129, 0.12);
    --danger:        #ef4444;
    --danger-glass:  rgba(239, 68, 68, 0.12);

    /* Layered shadows for real depth */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.6);
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.6);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
    --shadow-lg:  0 20px 50px rgba(0,0,0,0.55), 0 8px 20px rgba(0,0,0,0.4);
    --shadow-glass: 0 8px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.12);
    --shadow-gold:  0 0 20px rgba(212,175,55,0.25), 0 0 60px rgba(212,175,55,0.08);

    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  22px;
    --radius-xl:  30px;

    --blur-sm:  12px;
    --blur-md:  24px;
    --blur-lg:  40px;

    --a4-width:  210mm;
    --a4-height: 297mm;
}

/* ═══════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .logo {
    font-family: 'Outfit', sans-serif;
}

/* ═══════════════════════════════════════════════════
   BODY – Rich ambient glow background
═══════════════════════════════════════════════════ */
body {
    background-color: var(--bg-void);
    background-image:
        /* Primary warm gold orb top-left */
        radial-gradient(ellipse 60% 45% at 15% 10%,  rgba(212,175,55,0.13) 0%, transparent 65%),
        /* Secondary amber orb bottom-right */
        radial-gradient(ellipse 55% 50% at 88% 90%,  rgba(245,158,11,0.10) 0%, transparent 60%),
        /* Deep blue-black counter-glow */
        radial-gradient(ellipse 70% 60% at 50% 50%,  rgba(10,10,20,0.95)  0%, transparent 100%),
        /* Subtle warm mid orb */
        radial-gradient(ellipse 40% 30% at 75% 25%,  rgba(212,175,55,0.05) 0%, transparent 50%),
        /* Base gradient */
        linear-gradient(160deg, #0c0c10 0%, #060608 100%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════
   GLASS MIXIN (applied via utility classes + selectors)
═══════════════════════════════════════════════════ */

/* Base glass panel – frosted glass slab */
.glass-panel,
.card-form,
.add-item-box,
.table-responsive {
    position: relative;
    background: var(--glass-2);
    backdrop-filter: blur(var(--blur-md)) saturate(180%) brightness(1.05);
    -webkit-backdrop-filter: blur(var(--blur-md)) saturate(180%) brightness(1.05);
    /* Refraction border: bright top/left, dark bottom/right */
    border-top:    1px solid var(--border-top);
    border-left:   1px solid var(--border-side);
    border-right:  1px solid var(--border-side);
    border-bottom: 1px solid var(--border-bottom);
    border-radius: var(--radius-lg);
    box-shadow:
        var(--shadow-glass),
        inset 0 0 0 1px rgba(212,175,55,0.06),
        0 0 40px rgba(212,175,55,0.04);
    overflow: hidden;
}

/* Subtle inner shimmer line at top of glass panels */
.glass-panel::before,
.card-form::before,
.add-item-box::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255,255,255,0.25) 30%,
        rgba(255,255,255,0.40) 50%,
        rgba(255,255,255,0.25) 70%,
        transparent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════ */
.sidebar {
    width: 280px;
    background: rgba(8, 8, 10, 0.75);
    backdrop-filter: blur(var(--blur-lg)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(160%);
    border-right: 1px solid rgba(255,255,255,0.06);
    /* Subtle gold accent on right edge */
    box-shadow:
        2px 0 30px rgba(0,0,0,0.6),
        inset -1px 0 0 rgba(212,175,55,0.08);
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    z-index: 50;
    position: relative;
}

/* Gold dust shimmer overlay on sidebar */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom,
        transparent,
        rgba(212,175,55,0.4) 25%,
        rgba(212,175,55,0.6) 50%,
        rgba(212,175,55,0.4) 75%,
        transparent);
    pointer-events: none;
}

/* Logo */
.logo {
    font-size: 30px;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg,
        #a07820 0%,
        #d4af37 30%,
        #f5d060 55%,
        #d4af37 75%,
        #8a6618 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 48px;
    letter-spacing: 2px;
    text-transform: uppercase;
    filter: drop-shadow(0 2px 8px rgba(212,175,55,0.4));
    position: relative;
}

/* Nav Links */
.nav-links { list-style: none; }

.nav-links li {
    padding: 13px 18px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.nav-links li::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(212,175,55,0.08), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: inherit;
}

.nav-links li:hover {
    color: var(--gold-light);
    background: rgba(212,175,55,0.07);
    border-color: rgba(212,175,55,0.15);
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}

.nav-links li:hover::before { opacity: 1; }

.nav-links li.active {
    background: linear-gradient(135deg,
        rgba(212,175,55,0.16) 0%,
        rgba(212,175,55,0.08) 100%);
    color: var(--gold);
    font-weight: 600;
    border-top:    1px solid rgba(255,255,255,0.12);
    border-left:   1px solid rgba(255,255,255,0.06);
    border-right:  1px solid rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(0,0,0,0.3);
    box-shadow:
        var(--shadow-sm),
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 0 20px rgba(212,175,55,0.1);
}

/* Active left accent bar */
.nav-links li.active::after {
    content: '';
    position: absolute;
    left: 0; top: 15%; bottom: 15%;
    width: 3px;
    background: linear-gradient(to bottom, var(--gold-light), var(--gold), var(--gold-deep));
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px var(--gold-glow);
}

.nav-links li svg { transition: transform 0.3s ease; }
.nav-links li:hover svg { transform: scale(1.12) rotate(-3deg); }

/* ═══════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════ */
.content {
    flex: 1;
    padding: 40px 50px;
    overflow-y: auto;
    height: 100vh;
}

/* Scrollbar – gold on black */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--gold-deep), var(--gold));
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-light); }

/* ═══════════════════════════════════════════════════
   TAB ANIMATIONS
═══════════════════════════════════════════════════ */
.tab-content {
    display: none;
    opacity: 0;
    transform: translateY(16px) scale(0.985);
}

.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: glassReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes glassReveal {
    from { opacity: 0; transform: translateY(20px) scale(0.97); filter: blur(6px); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    filter: blur(0); }
}

/* ═══════════════════════════════════════════════════
   HEADINGS
═══════════════════════════════════════════════════ */
h2 {
    margin-bottom: 32px;
    font-weight: 700;
    font-size: 30px;
    color: var(--text-main);
    letter-spacing: -0.8px;
}

h3 {
    margin: 32px 0 24px 0;
    color: var(--text-sub);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* ═══════════════════════════════════════════════════
   FORMS & CARDS
═══════════════════════════════════════════════════ */
.card-form, .add-item-box {
    padding: 32px;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 22px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    transition: color 0.25s;
    text-transform: uppercase;
}

/* Inputs – frosted glass fields */
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 13px 16px;
    background: var(--glass-input);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top:    1px solid rgba(255,255,255,0.10);
    border-left:   1px solid rgba(255,255,255,0.06);
    border-right:  1px solid rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(0,0,0,0.4);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 14.5px;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.04);
}

select option {
    background-color: #0a0a0c !important;
    color: #f0f0f2 !important;
}

input:focus, textarea:focus, select:focus {
    background: rgba(255,255,255,0.09);
    border-top-color:    rgba(212,175,55,0.5);
    border-left-color:   rgba(212,175,55,0.3);
    border-right-color:  rgba(212,175,55,0.2);
    border-bottom-color: rgba(212,175,55,0.2);
    box-shadow:
        0 0 0 3px rgba(212,175,55,0.12),
        inset 0 2px 8px rgba(0,0,0,0.2),
        0 0 20px rgba(212,175,55,0.08);
    transform: translateY(-1px);
}

.form-group:focus-within label { color: var(--gold); }

input::placeholder, textarea::placeholder { color: var(--text-dim); }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 42px;
}

select.table-select {
    padding: 6px 32px 6px 12px;
    font-size: 13px;
    max-width: 150px;
    width: auto;
    border-radius: var(--radius-sm);
    background-color: var(--glass-input);
    color: var(--text-main);
    border-top:    1px solid rgba(255,255,255,0.10);
    border-left:   1px solid rgba(255,255,255,0.06);
    border-right:  1px solid rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(0,0,0,0.4);
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    appearance: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

select.table-select:focus {
    background-color: rgba(255,255,255,0.09);
    border-top-color:    rgba(212,175,55,0.5);
    border-left-color:   rgba(212,175,55,0.3);
    border-right-color:  rgba(212,175,55,0.2);
    border-bottom-color: rgba(212,175,55,0.2);
    box-shadow:
        0 0 0 2px rgba(212,175,55,0.12),
        inset 0 2px 4px rgba(0,0,0,0.2);
}

select:disabled, input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.02) !important;
}

input[type="checkbox"] {
    accent-color: var(--gold);
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-transform: none;
    color: var(--text-sub);
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: 0;
}

input[type="range"] {
    width: 100%;
    margin-top: 12px;
    accent-color: var(--gold);
}

.conditional-field {
    display: none;
    padding: 22px;
    background: rgba(212, 175, 55, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top:    1px solid rgba(212,175,55,0.15);
    border-left:   1px solid rgba(212,175,55,0.08);
    border-right:  1px solid rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(0,0,0,0.3);
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    box-shadow: inset 0 2px 12px rgba(0,0,0,0.2);
}

/* ═══════════════════════════════════════════════════
   BUTTONS – Real glass button design
═══════════════════════════════════════════════════ */
.btn {
    position: relative;
    background: var(--glass-2);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    color: var(--text-main);
    /* Refraction border */
    border-top:    1px solid rgba(255,255,255,0.18);
    border-left:   1px solid rgba(255,255,255,0.10);
    border-right:  1px solid rgba(0,0,0,0.35);
    border-bottom: 1px solid rgba(0,0,0,0.45);
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow:
        var(--shadow-sm),
        inset 0 1px 0 rgba(255,255,255,0.12);
    overflow: hidden;
}

/* Shine sweep on hover */
.btn::after {
    content: '';
    position: absolute;
    top: -50%; left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(105deg,
        transparent,
        rgba(255,255,255,0.08) 45%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.08) 55%,
        transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
    pointer-events: none;
}

.btn:hover::after { left: 120%; }

.btn:hover {
    background: rgba(255,255,255,0.10);
    border-top-color:   rgba(255,255,255,0.28);
    border-left-color:  rgba(255,255,255,0.15);
    border-color-right: rgba(0,0,0,0.5);
    transform: translateY(-2px);
    box-shadow:
        var(--shadow-md),
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 0 15px rgba(212,175,55,0.12);
    color: #fff;
}

.btn:active {
    transform: scale(0.96) translateY(1px);
    box-shadow: var(--shadow-xs), inset 0 2px 4px rgba(0,0,0,0.4);
}

/* Primary – golden metallic */
.btn.primary {
    background: linear-gradient(145deg,
        #c49a28 0%,
        #d4af37 30%,
        #f0cc55 55%,
        #d4af37 75%,
        #a07820 100%);
    border-top:    1px solid rgba(255,255,255,0.35);
    border-left:   1px solid rgba(255,255,255,0.20);
    border-right:  1px solid rgba(80,50,0,0.5);
    border-bottom: 1px solid rgba(80,50,0,0.6);
    color: #0c0900;
    font-weight: 700;
    box-shadow:
        0 4px 20px rgba(212,175,55,0.35),
        0 1px 3px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.4),
        inset 0 -1px 0 rgba(0,0,0,0.2);
    text-shadow: 0 1px 1px rgba(255,255,255,0.2);
}

.btn.primary:hover {
    box-shadow:
        0 8px 30px rgba(212,175,55,0.50),
        0 2px 6px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 0 50px rgba(212,175,55,0.20);
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn.danger {
    background: var(--danger-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ff6b6b;
    border-top:    1px solid rgba(239,68,68,0.20);
    border-left:   1px solid rgba(239,68,68,0.12);
    border-right:  1px solid rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(0,0,0,0.4);
    padding: 8px 14px;
    font-size: 12.5px;
    box-shadow: none;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #ff4444;
    box-shadow: 0 0 15px rgba(239,68,68,0.15);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════ */
.table-responsive {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th, .data-table td {
    padding: 15px 22px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.data-table th {
    background: rgba(0,0,0,0.4);
    font-weight: 600;
    font-size: 11px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    border-bottom: 1px solid rgba(212,175,55,0.15);
}

.data-table tbody tr {
    transition: background 0.2s;
    background: transparent;
}

.data-table tbody tr:hover {
    background: rgba(212,175,55,0.04);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table td {
    font-size: 14px;
    color: var(--text-sub);
}

.product-img-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════
   PREVIEW AREA
═══════════════════════════════════════════════════ */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.preview-wrapper {
    background: rgba(255,255,255,0.015);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 40px;
    border-radius: var(--radius-lg);
    border-top:    1px solid rgba(255,255,255,0.08);
    border-left:   1px solid rgba(255,255,255,0.05);
    border-right:  1px solid rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    overflow: auto;
    box-shadow: inset 0 2px 20px rgba(0,0,0,0.3);
}

/* ═══════════════════════════════════════════════════
   A4 DOCUMENT (white paper – unchanged for print quality)
═══════════════════════════════════════════════════ */
.a4-document {
    width: var(--a4-width);
    min-height: var(--a4-height);
    background-color: #ffffff;
    color: #1e293b;
    box-shadow:
        0 25px 70px -10px rgba(0,0,0,0.5),
        0 0 0 1px rgba(0,0,0,0.08),
        0 4px 6px rgba(0,0,0,0.3);
    padding: 20mm 18mm;
    position: relative;
    font-size: 9.5pt;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Invoice specific (inside A4 – white paper) */
.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.doc-company-info {
    text-align: left;
    max-width: 65%;
}

.doc-company-info h1 {
    font-size: 20pt;
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.15;
    color: #0f172a;
    margin: 0 0 4px 0;
}

.doc-brand-name {
    font-size: 8pt !important;
    font-weight: 700;
    color: #c49a28; /* Golden Accent */
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 2px 0 6px 0;
    display: block;
    opacity: 1;
}

.doc-company-info p {
    margin: 0 0 3px 0;
    font-size: 9pt;
    color: #475569;
    line-height: 1.4;
}

.doc-logo-container {
    position: relative;
    width: 180px;
    height: 70px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.doc-logo {
    position: absolute;
    max-height: 100%;
    object-fit: contain;
}

.doc-title {
    font-size: 18pt;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #94a3b8; /* Light grey, darker than original #e2e8f0 */
    border-left: 4px solid #c49a28; /* Golden Accent Bar */
    padding-left: 12px;
    margin: 24px 0;
    text-align: left;
    line-height: 1;
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
}

.doc-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 24px;
}

.doc-client-info, .doc-details {
    width: 48%;
}

.doc-client-info h4, .doc-details h4 {
    margin: 0 0 10px 0;
    color: #94a3b8;
    font-weight: 700;
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.doc-client-info strong {
    font-size: 11pt;
    color: #0f172a;
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.doc-table th, .doc-table td {
    padding: 12px 14px;
    text-align: left;
    font-size: 9pt;
    border-bottom: 1px solid #edf2f7;
}

.doc-table th {
    background-color: #f8fafc;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    font-size: 8pt;
    letter-spacing: 0.8px;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
}

.doc-table td {
    color: #334155;
}

.doc-table td.right, .doc-table th.right {
    text-align: right;
}

.doc-totals {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.doc-totals td {
    padding: 6px 12px;
    text-align: right;
    color: #475569;
    font-size: 9pt;
}

.doc-totals tr:last-child td {
    font-weight: 800;
    font-size: 12pt;
    color: #0f172a;
    border-top: 1px solid #e2e8f0;
    border-bottom: 3px double #0f172a; /* Double border for totals look */
    padding-top: 12px;
    padding-bottom: 12px;
}

.doc-footer {
    margin-top: 48px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
    gap: 32px;
}

.doc-terms {
    width: 58%;
    font-size: 8pt;
    color: #64748b;
    line-height: 1.5;
}

.doc-terms h4 {
    margin: 0 0 6px 0;
    color: #0f172a;
    font-weight: 700;
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-signature {
    width: 35%;
    text-align: center;
    margin-top: 10px;
}

.doc-signature-line {
    border-top: 1px solid #94a3b8;
    padding-top: 6px;
    font-weight: 600;
    color: #475569;
    font-size: 8.5pt;
    width: 160px;
    margin: 0 auto;
}

.doc-signature-company {
    font-weight: 700;
    font-size: 8.5pt;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════
   MODAL – Deep glass overlay
═══════════════════════════════════════════════════ */
.modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(4, 4, 6, 0.60);
    display: none; /* flex when active */
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 10px;
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
}

.modal-content {
    position: relative;
    background: rgba(14, 14, 18, 0.75);
    backdrop-filter: blur(var(--blur-lg)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(180%);
    border-top:    1px solid rgba(255,255,255,0.15);
    border-left:   1px solid rgba(255,255,255,0.09);
    border-right:  1px solid rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(0,0,0,0.5);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    margin: auto; /* Centers when fits, aligns top and scrolls when too tall */
    padding: 40px;
    box-shadow:
        0 30px 80px rgba(0,0,0,0.7),
        inset 0 1px 0 rgba(255,255,255,0.15),
        0 0 0 1px rgba(212,175,55,0.08),
        var(--shadow-gold);
    animation: glassModalIn 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Catch-light at top of modal */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0; left: 15%; right: 15%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255,255,255,0.3) 35%,
        rgba(255,255,255,0.5) 50%,
        rgba(255,255,255,0.3) 65%,
        transparent);
    border-radius: 50%;
    pointer-events: none;
}

@keyframes glassModalIn {
    0%   { transform: scale(0.88) translateY(20px); opacity: 0; filter: blur(8px); }
    100% { transform: scale(1)    translateY(0);    opacity: 1; filter: blur(0); }
}

.close-modal-btn {
    float: right;
    font-size: 26px;
    cursor: pointer;
    color: var(--text-dim);
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
    margin-top: -15px;
    margin-right: -15px;
    padding: 10px;
}

.close-modal-btn:hover {
    color: var(--danger);
    transform: scale(1.15) rotate(90deg);
}

.cancel-modal-btn {
    background: transparent;
    box-shadow: none;
    border-color: transparent;
}
.cancel-modal-btn:hover { background: rgba(255,255,255,0.04); }

/* ═══════════════════════════════════════════════════
   LOGIN OVERLAY
═══════════════════════════════════════════════════ */
.login-overlay {
    position: fixed;
    inset: 0;
    /* Rich depth background */
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(212,175,55,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 70% 55% at 80% 75%, rgba(180,130,20,0.08) 0%, transparent 55%),
        #050505;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.login-card {
    position: relative;
    background: rgba(18, 18, 22, 0.70);
    backdrop-filter: blur(var(--blur-lg)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(180%);
    border-top:    1px solid rgba(255,255,255,0.18);
    border-left:   1px solid rgba(255,255,255,0.10);
    border-right:  1px solid rgba(0,0,0,0.45);
    border-bottom: 1px solid rgba(0,0,0,0.55);
    padding: 48px;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 400px;
    box-shadow:
        0 30px 80px rgba(0,0,0,0.65),
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 0 80px rgba(212,175,55,0.10),
        0 0 0 1px rgba(212,175,55,0.06);
    animation: glassModalIn 0.6s cubic-bezier(0.34, 1.4, 0.64, 1);
    text-align: center;
}

/* Catch-light on login card */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255,255,255,0.35) 30%,
        rgba(255,255,255,0.55) 50%,
        rgba(255,255,255,0.35) 70%,
        transparent);
    border-radius: 50%;
    pointer-events: none;
}

.login-card .logo { margin-bottom: 30px; }

/* ═══════════════════════════════════════════════════
   PRINT RULES
═══════════════════════════════════════════════════ */
@media print {
    body { background: white !important; }
    .no-print, .sidebar, .preview-header { display: none !important; }
    .content, .app-container {
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }
    .preview-wrapper {
        background: none !important;
        padding: 0 !important;
        border: none !important;
    }
    .a4-document {
        box-shadow: none !important;
        margin: 0 !important;
        width: 210mm !important;
        height: auto !important;
        min-height: 297mm !important;
        padding: 10mm !important;
    }
}

/* ═══════════════════════════════════════════════════
   MOBILE HEADER
═══════════════════════════════════════════════════ */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(6, 6, 8, 0.88);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-bottom: 1px solid rgba(212,175,55,0.12);
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#mobile-menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-main);
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 4, 8, 0.55);
    z-index: 990;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ═══════════════════════════════════════════════════
   SEARCH AUTOCOMPLETE
═══════════════════════════════════════════════════ */
.search-results-panel {
    background: rgba(10, 10, 14, 0.92);
    backdrop-filter: blur(var(--blur-md)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-md)) saturate(180%);
    border-top:    1px solid rgba(255,255,255,0.12);
    border-left:   1px solid rgba(255,255,255,0.07);
    border-right:  1px solid rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(0,0,0,0.5);
    border-radius: var(--radius-md);
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255,255,255,0.08),
        0 0 25px rgba(212,175,55,0.08);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.18s ease, padding-left 0.18s ease;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-sub);
    font-size: 14px;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover {
    background: rgba(212,175,55,0.08);
    padding-left: 20px;
    color: var(--gold-light);
}

.search-result-item:active { transform: scale(0.99); }

/* ═══════════════════════════════════════════════════
   CATEGORIES TREE
═══════════════════════════════════════════════════ */
.category-card {
    background: var(--glass-2);
    backdrop-filter: blur(var(--blur-md)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--blur-md)) saturate(160%);
    border-top:    1px solid rgba(255,255,255,0.12);
    border-left:   1px solid rgba(255,255,255,0.06);
    border-right:  1px solid rgba(0,0,0,0.35);
    border-bottom: 1px solid rgba(0,0,0,0.40);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 18px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.07);
}

.category-card:hover {
    box-shadow:
        var(--shadow-md),
        inset 0 1px 0 rgba(255,255,255,0.10),
        0 0 25px rgba(212,175,55,0.10);
    transform: translateY(-2px);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(212,175,55,0.10);
    padding-bottom: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.category-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-actions { display: flex; gap: 8px; }

.subcategory-list {
    list-style: none;
    padding-left: 8px;
    margin-bottom: 14px;
}

.subcategory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    margin-bottom: 6px;
    border-top:    1px solid rgba(255,255,255,0.06);
    border-left:   1px solid rgba(255,255,255,0.03);
    border-right:  1px solid rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(0,0,0,0.30);
    transition: background 0.2s ease, transform 0.2s ease;
}

.subcategory-item:hover {
    background: rgba(212,175,55,0.07);
    transform: translateX(3px);
}

.subcategory-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 6px;
}

.subcategory-actions { display: flex; gap: 8px; }

.inline-add-subcat-form {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.inline-add-subcat-form input {
    flex: 1;
    min-width: 150px;
    padding: 10px 14px;
    font-size: 13px;
}

.inline-add-subcat-form button {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
    width: auto;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE – ≤992px
═══════════════════════════════════════════════════ */
@media (max-width: 992px) {
    .sidebar { width: 240px; padding: 24px 16px; }
    .content { padding: 24px; }
    .doc-meta-row { flex-direction: column; gap: 20px; }
    .doc-client-info, .doc-details { width: 100%; }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE – ≤768px (Mobile)
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .mobile-header  { display: flex; }
    .content {
        padding: 16px;
        height: calc(100vh - 65px);
    }
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100%;
        width: 280px;
        z-index: 1000;
        background: rgba(8, 8, 12, 0.92);
        backdrop-filter: blur(var(--blur-lg));
        -webkit-backdrop-filter: blur(var(--blur-lg));
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { left: 0; }
    .sidebar-overlay.active { display: block; opacity: 1; }

    .form-group div[style*="display: flex"] { flex-direction: column; gap: 12px; }
    #doc-discount-group                      { flex-direction: column; }

    div[style*="justify-content: flex-end"] {
        flex-direction: column;
        align-items: stretch !important;
    }

    .btn { width: 100%; margin-bottom: 8px; }

    .preview-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .preview-header div { width: 100% !important; }

    .preview-wrapper {
        padding: 10px;
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        display: block;
        overflow: hidden;
        background: rgba(0,0,0,0.04);
    }

    .a4-document {
        transform-origin: top left;
        margin: 0 auto;
        margin-bottom: 0 !important;
    }
}

/* ═══════════════════════════════════════════════════
   MOBILE ACTION BUTTONS (inline overrides)
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .category-actions .btn,
    .subcategory-actions .btn,
    .inline-add-subcat-form .btn {
        width: auto !important;
        margin-bottom: 0 !important;
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    .inline-add-subcat-form {
        flex-direction: row !important;
        align-items: center !important;
    }
    
    /* Polished Mobile Modals & Fluid Typography */
    html {
        font-size: 14px;
    }
    .modal-content {
        padding: 20px 16px;
        width: 96%;
        max-height: 92vh;
        overflow-y: auto;
    }
    .form-group label {
        font-size: 13px;
    }
    input, select, textarea, .btn {
        font-size: 14px !important;
    }
}

/* ═══════════════════════════════════════════════════
   DRAG & DROP IMAGE UPLOAD ZONE
   ═══════════════════════════════════════════════════ */
.dropzone {
    border: 2px dashed var(--border-gold);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: 6px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--gold-light);
    background: rgba(212, 175, 55, 0.05);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15), inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dropzone-inner {
    pointer-events: none; /* Allows drop events to bubble correctly */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-icon {
    color: var(--text-muted);
    transition: color 0.3s ease, transform 0.3s ease;
}

.dropzone:hover .dropzone-icon, .dropzone.dragover .dropzone-icon {
    color: var(--gold-light);
    transform: translateY(-2px);
}

.dropzone-text {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-main);
}

.dropzone-link {
    color: var(--gold);
    text-decoration: underline;
    font-weight: 600;
}

.dropzone-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

/* Newly Uploaded Images Preview Layout */
.new-image-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.new-image-preview-item:hover {
    transform: scale(1.05);
}

.new-image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.new-image-preview-delete {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
    padding: 0;
}

.new-image-preview-delete:hover {
    background: #ff4444;
    transform: scale(1.15);
}

/* ═══════════════════════════════════════════════════
   PACKAGE BUILDER RESPONSIVE LAYOUT
   ═══════════════════════════════════════════════════ */
.package-modal-flex {
    display: flex;
    gap: 20px;
    height: 480px;
    margin-top: 20px;
}

.package-panel {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.package-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

/* Package Modal List Items */
.pkg-search-item {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.pkg-search-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.pkg-content-item {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

/* ═══════════════════════════════════════════════════
   PACKAGE MODAL - LARGE FULL WINDOW LAYOUT
   ═══════════════════════════════════════════════════ */
#package-modal .modal-content {
    max-width: 1350px;
    width: 95%;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 25px 30px;
}

#package-modal .package-modal-flex {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0; /* Vital for nested flex containers to scroll correctly */
    margin-top: 15px;
}

#package-modal .package-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 768px) {
    #package-modal .modal-content {
        height: auto;
        max-height: 94vh;
        padding: 20px 16px;
    }
    
    #package-modal .package-modal-flex {
        flex-direction: column;
        height: auto;
        max-height: 60vh;
        overflow-y: auto;
        gap: 15px;
    }
    
    #package-modal .package-panel {
        min-height: 260px;
        max-height: 350px;
        flex: none;
    }
}


/* ═══════════════════════════════════════════════════
   TRADED PRODUCT FEATURE
═══════════════════════════════════════════════════ */

/* --- Checkbox toggle --- */
.traded-toggle-wrap {
    margin-bottom: 0 !important;
}

.traded-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}

.traded-checkbox-label:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
}

.traded-checkbox { display: none; }

.traded-checkbox-custom {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border);
    border-radius: 5px;
    background: var(--glass-input);
    position: relative;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.traded-checkbox:checked + .traded-checkbox-custom {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
}

.traded-checkbox:checked + .traded-checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

.traded-checkbox:checked ~ span strong { color: #a78bfa; }

/* --- Calculator panel --- */
.traded-calc-panel {
    margin-top: 4px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
    overflow: hidden;
    animation: tradedSlideIn 0.25s ease;
}

@keyframes tradedSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.traded-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.08);
}

.traded-badge-inline {
    font-size: 12px;
    font-weight: 600;
    color: #a78bfa;
    letter-spacing: 0.3px;
}

.traded-calc-body { padding: 16px; }

.traded-input-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .traded-input-row { flex-direction: column; gap: 8px; }
}

/* --- Breakdown rows --- */
.traded-breakdown {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.calc-row:last-child { border-bottom: none; }
.calc-row:hover { background: rgba(255, 255, 255, 0.02); }

.calc-label {
    color: var(--text-sub);
    font-weight: 500;
}

.calc-value {
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.gst-row   { background: rgba(251, 191, 36, 0.04); }
.gst-amount { color: #fbbf24 !important; }

.subtotal-row { background: rgba(255, 255, 255, 0.02); }

.profit-amount { color: #34d399 !important; }

.final-row {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
    border-top: 1px solid rgba(99, 102, 241, 0.25) !important;
}

.final-row .calc-label {
    color: #c4b5fd;
    font-weight: 700;
    font-size: 14px;
}

.final-price {
    color: #a78bfa !important;
    font-size: 15px;
    font-weight: 700;
}

/* --- Traded badge in products table --- */
.traded-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a78bfa;
    margin-left: 6px;
    vertical-align: middle;
}

/* --- Base price read-only state when traded --- */
input.traded-readonly {
    background: rgba(255, 255, 255, 0.03) !important;
    color: #a78bfa !important;
    cursor: not-allowed !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    font-weight: 600;
}

/* --- Traded tab table cell colours --- */
.traded-tab-gst    { color: #fbbf24; font-weight: 600; }
.traded-tab-profit { color: #34d399; font-weight: 600; }
.traded-tab-final  { color: #a78bfa; font-weight: 700; font-size: 14px; }
