/* ==================== GLOBAL STYLES & VARIABLES ==================== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    
    --secondary-color: #7c3aed;
    --secondary-hover: #6d28d9;
    --secondary-light: #f5f3ff;
    
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --input-focus: #3b82f6;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --font-outfit: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-outfit);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

main {
    flex-grow: 1;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Common Layout Utilities */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-auto { margin-left: auto; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pt-8 { padding-top: 2rem; }
.pb-16 { padding-bottom: 4rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger-color); }
.italic { font-style: italic; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.flex-1 { flex: 1 1 0%; }
.cursor-pointer { cursor: pointer; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--bg-color);
    border-color: var(--text-muted);
}

.btn-outline.text-danger {
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-outline.text-danger:hover {
    background-color: #fef2f2;
    border-color: var(--danger-color);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-pulsing {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    animation: pulsing-glow 2s infinite;
}

@keyframes pulsing-glow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
    }
    70% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* Form Controls */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #374151;
}

.required {
    color: var(--danger-color);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.925rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    color: var(--text-color);
    transition: all 0.15s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
    resize: vertical;
}

/* Animations */
.animate-fade {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tab Switching Content Visibility */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== NAVBAR & HEADER ==================== */
.main-header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s;
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.logo-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.logo-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 550;
    color: #4b5563;
    padding: 0.35rem 0.5rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.history-badge {
    background-color: var(--secondary-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

.mobile-menu-btn svg {
    width: 1.75rem;
    height: 1.75rem;
}

/* Mobile Nav Drawer */
.mobile-nav {
    display: none;
    position: fixed;
    top: 4.5rem;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    z-index: 99;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-lg);
}

.mobile-nav-link {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg-color);
}

.mobile-nav-link.active {
    color: var(--primary-color);
}

/* ==================== LANDING TAB STYLE ==================== */
.hero-section {
    position: relative;
    padding: 5rem 0;
    background-color: #ffffff;
    overflow: hidden;
}

.hero-bg-shapes .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.08;
    z-index: 0;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background-color: var(--primary-color);
    top: -100px;
    right: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background-color: var(--secondary-color);
    bottom: -50px;
    left: -50px;
}

.shape-3 {
    width: 500px;
    height: 500px;
    background-color: #38bdf8;
    top: 30%;
    left: 40%;
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.badge-trusted {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    margin-bottom: 1.5rem;
}

.badge-star {
    font-size: 1.1rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #111827;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: 1.15rem;
    color: #4b5563;
    margin-bottom: 2rem;
    max-width: 580px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.hero-features-list {
    display: flex;
    gap: 1.5rem;
}

.hero-feat-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
}

.feat-icon-check {
    color: var(--success-color);
    font-weight: bold;
    margin-right: 0.5rem;
}

/* Hero Right Visual Card */
.hero-visual-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: rotate(2deg) translateY(10px);
    transition: all 0.3s ease;
}

.hero-visual-card:hover {
    transform: rotate(0deg) translateY(0);
}

.card-header {
    background-color: var(--bg-color);
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #cbd5e1;
    margin-right: 4px;
}

.card-doc-no {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-body {
    padding: 1.5rem;
}

.placeholder-logo {
    width: 60px;
    height: 40px;
    background-color: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: bold;
}

.mock-line {
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
}

.mock-line.w-32 { width: 8rem; }
.mock-line.w-24 { width: 6rem; }
.mock-line.w-16 { width: 4rem; }
.mock-line.w-full { width: 100%; }
.mock-line.w-5/6 { width: 83.333%; }
.mock-line.w-4/6 { width: 66.666%; }

.mock-table {
    width: 100%;
}

.mock-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.7rem;
}

.mock-row.header-row {
    font-weight: bold;
    border-bottom: 2px solid #e5e7eb;
}

.mock-cell.w-2/5 { width: 40%; }
.mock-cell.w-1/5 { width: 20%; }

.mock-totals {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mock-total-row {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    font-size: 0.75rem;
}

/* Products Section */
.products-section {
    padding: 6rem 0;
    background-color: var(--bg-color);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 1rem;
}

.section-desc {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.1rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.product-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.hover-glow:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.1);
    border-color: rgba(37, 99, 235, 0.2);
}

.prod-icon-wrapper {
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: white;
}

.invoice-icon {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.quotation-icon {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.prod-icon-wrapper svg {
    width: 2rem;
    height: 2rem;
}

.product-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #111827;
}

.product-card p {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.btn-link {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
}

/* Features details section */
.features-details-section {
    padding: 6rem 0;
    background-color: #ffffff;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feat-card {
    padding: 2rem;
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.feat-icon {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.feat-card h4 {
    font-size: 1.2rem;
    font-weight: 750;
    margin-bottom: 0.5rem;
}

.feat-card p {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.5;
}

/* How It Works Section */
.how-it-works-section {
    padding: 6rem 0;
    background-color: var(--bg-color);
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-top: 3rem;
}

.step-item {
    text-align: center;
    position: relative;
}

.step-num {
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-md);
}

.step-item h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.step-item p {
    color: #4b5563;
    font-size: 0.95rem;
}

/* Stats Section */
.stats-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, #1e3a8a, #0f172a);
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    text-align: center;
    gap: 2rem;
}

.stat-box .stat-number {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-box .stat-label {
    font-size: 1.1rem;
    color: #cbd5e1;
    font-weight: 500;
}

/* CTA Banner */
.cta-banner {
    padding: 5rem 0;
    background-color: #ffffff;
    text-align: center;
}

.cta-banner h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.cta-banner p {
    font-size: 1.15rem;
    color: #4b5563;
    max-width: 600px;
    margin: 0 auto;
}

/* ==================== WORKSPACE STYLING (GENERATOR) ==================== */
.workspace-container {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    height: calc(100vh - 4.5rem);
    overflow: hidden;
}

/* Editor Panel (Left) */
.editor-panel {
    padding: 2rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    background-color: var(--bg-color);
}

.editor-header-card {
    background-color: #ffffff;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.editor-header-card h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.015em;
}

/* Toggle Switch inside Form */
.doc-toggle-switch {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    display: flex;
}

.toggle-btn {
    border: none;
    background-color: transparent;
    padding: 0.35rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-btn.active {
    background-color: #ffffff;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Info / Tip Alert Box */
.info-alert-box {
    background-color: var(--primary-light);
    border-left: 4px solid var(--primary-color);
    color: var(--text-color);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    grid-column: span 2 / span 2;
}
.info-alert-box strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.25rem;
}

/* Form section cards */
.form-section-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.section-title-bar {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--bg-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}

.section-step-num {
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

.section-title-bar h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

/* Logo & signature upload layouts */
.logo-upload-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-preview-box {
    width: 100px;
    height: 70px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--bg-color);
    position: relative;
}

.logo-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-preview-box .placeholder-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: bold;
}

.logo-actions, .sig-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Items editor table */
.items-editor-container {
    overflow-x: auto;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.items-editor-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.items-editor-table th {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.items-editor-table td {
    padding: 0.5rem;
    vertical-align: top;
}

.item-delete-btn {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.item-delete-btn:hover {
    opacity: 1;
}

/* Radio Group custom layout */
.radio-group {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    background-color: var(--bg-color);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 550;
    cursor: pointer;
}

.radio-label input {
    margin-right: 0.25rem;
}

/* Signature workspace */
.signature-workspace {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.tab-sub-nav {
    display: flex;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.tab-sub-btn {
    flex-grow: 1;
    border: none;
    background-color: transparent;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
}

.tab-sub-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: #ffffff;
}

.signature-box-content {
    display: none;
    padding: 1rem;
    background-color: #ffffff;
}

.signature-box-content.active {
    display: block;
}

#signature-canvas {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #fafafa;
    cursor: crosshair;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    box-sizing: border-box;
}

.canvas-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.signature-upload-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.signature-preview-box {
    width: 150px;
    height: 60px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--bg-color);
}

.signature-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.signature-preview-box .placeholder-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: bold;
}

/* Actions Row at bottom of form */
.form-action-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Preview Panel (Right) */
.preview-panel {
    background-color: #374151;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Customizer Toolbar */
.preview-toolbar {
    width: 100%;
    max-width: 794px;
    background-color: rgba(17, 24, 39, 0.95);
    border: 1px solid #4b5563;
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    color: white;
    box-shadow: var(--shadow-lg);
}

.toolbar-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.35rem;
}

.toolbar-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.option-label {
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 600;
}

.option-group select {
    background-color: #1f2937;
    color: white;
    border-color: #4b5563;
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
}

.theme-colors {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    height: 100%;
}

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
}

.color-dot.active {
    border-color: white;
    transform: scale(1.15);
}

/* ==================== VIRTUAL A4 PREVIEW LAYOUTS ==================== */
.a4-sheet-container {
    width: 100%;
    max-width: 794px;
    box-shadow: var(--shadow-2xl);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.a4-document {
    width: 794px;
    min-height: 1123px; /* A4 aspect ratio in pixels */
    background-color: #ffffff;
    padding: 3rem;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    color: #1f2937;
    flex-shrink: 0;
}

.doc-accent-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
}

/* Document Header layout */
.doc-header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.doc-brand-block {
    display: flex;
    gap: 1.5rem;
    flex: 1 1 0%;
}

.doc-logo-holder {
    width: 90px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.doc-logo-holder img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fallback-logo-preview {
    width: 100%;
    height: 100%;
    background-color: #f3f4f6;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 800;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-company-details h2 {
    font-size: 1.35rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
    text-transform: uppercase;
}

.multiline-text {
    white-space: pre-wrap;
    line-height: 1.4;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 0.1rem;
    color: #4b5563;
}

.bold-label {
    font-weight: 600;
    color: #1f2937;
}

.doc-meta-title-block {
    text-align: right;
    min-width: 220px;
}

.doc-title-text {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin-bottom: 1rem;
}

.doc-meta-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-item {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.meta-label {
    color: #6b7280;
    font-weight: 500;
}

.doc-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
}

/* Bill to details */
.doc-parties-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.party-section-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 1px solid;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Item preview table */
.doc-items-table-container {
    flex-grow: 1;
    margin-bottom: 2rem;
}

.doc-items-table {
    width: 100%;
    border-collapse: collapse;
}

.doc-items-table th {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.doc-items-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.85rem;
    vertical-align: top;
}

.doc-items-table tr:last-child td {
    border-bottom: 1px solid var(--border-color);
}

.hsn-cell {
    color: #6b7280;
}

.item-desc-preview {
    font-weight: 500;
}

/* Totals & summary preview section */
.doc-summary-area {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2.5rem;
    page-break-inside: avoid;
}

.info-block-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.35rem;
    letter-spacing: 0.025em;
}

.info-block div {
    color: #4b5563;
    font-size: 0.8rem;
}

.doc-totals-table {
    width: 100%;
    border-collapse: collapse;
}

.doc-totals-table td {
    padding: 0.45rem 0;
    font-size: 0.85rem;
}

.doc-totals-table tr.grand-total-row td {
    padding: 0.75rem 0;
}

/* Signature Holder */
.preview-signature-holder {
    margin-top: 2rem;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.sig-line {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    border-top: 1px solid #d1d5db;
    width: 160px;
    padding-top: 0.25rem;
    margin-top: 0.5rem;
}

.signature-render-area {
    width: 160px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-render-area img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Font Classes for Preview */
.font-outfit { font-family: var(--font-outfit); }
.font-sans { font-family: var(--font-sans); }
.font-serif { font-family: var(--font-serif); }
.font-mono { font-family: var(--font-mono); }

/* Template Layout Styles */

/* Modern Layout template: Minimal left header, logo right, bold numbers */
.layout-modern.a4-document {
    padding: 3.5rem;
}

.layout-modern .doc-header-row {
    flex-direction: row-reverse;
}

.layout-modern .doc-meta-title-block {
    text-align: left;
}

.layout-modern .doc-brand-block {
    justify-content: flex-end;
    text-align: right;
}

.layout-modern .doc-logo-holder {
    margin-left: auto;
}

.layout-modern .party-section-heading {
    border-bottom: none;
    background-color: #f3f4f6;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
}

/* Minimalist layout: Elegant and pure text focused */
.layout-minimalist.a4-document {
    padding: 3rem;
}

.layout-minimalist .doc-accent-bar {
    display: none;
}

.layout-minimalist .doc-items-table th {
    background-color: transparent !important;
    color: #1f2937 !important;
    border-bottom: 2px solid #1f2937;
    padding-left: 0;
    padding-right: 0;
}

.layout-minimalist .doc-items-table td {
    padding-left: 0;
    padding-right: 0;
}

.layout-minimalist .party-section-heading {
    border-bottom: 1px solid #1f2937;
    color: #1f2937 !important;
}

.layout-minimalist .grand-total-row {
    border-top: 1px solid #1f2937 !important;
    border-bottom: 1px solid #1f2937 !important;
}

/* Custom Letterhead Layout Template */
.layout-letterhead.a4-document {
    background-image: var(--lh-bg-url, none);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    padding-top: calc(var(--lh-top-pad, 0px) + 2rem) !important;
    padding-bottom: calc(var(--lh-bottom-pad, 0px) + 2rem) !important;
    padding-left: 3rem !important;
    padding-right: 3rem !important;
}

/* Watermark placeholder for custom letterhead layout when no background is uploaded */
.layout-letterhead.a4-document::before {
    content: 'Custom Letterhead Background\A(Upload your letterhead image in the left panel)';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    white-space: pre-wrap;
    font-size: 1.15rem;
    font-weight: 700;
    color: #cbd5e1;
    opacity: var(--lh-watermark-opacity, 0.4);
    pointer-events: none;
    z-index: 0;
    border: 2px dashed #cbd5e1;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    width: 80%;
    box-sizing: border-box;
    display: block;
}

/* Hide watermark on printing */
@media print {
    .layout-letterhead.a4-document::before {
        display: none !important;
    }
}

.layout-letterhead.a4-document .doc-accent-bar {
    display: none !important;
}

.layout-letterhead.a4-document .fallback-logo-preview {
    background-color: transparent !important;
    border: none !important;
}

/* Styling for products section in grid (3 columns) */
@media (min-width: 1025px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ==================== HISTORY DASHBOARD ==================== */
.history-dashboard-container {
    padding: 3rem 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.dashboard-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
}

.search-wrapper input {
    max-width: 450px;
}

.history-table-wrapper {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background-color: var(--bg-color);
    padding: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #4b5563;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-color);
}

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

.history-table tr:hover td {
    background-color: #fafafa;
}

.doc-type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.badge-invoice {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.badge-quotation {
    background-color: var(--secondary-light);
    color: var(--secondary-color);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 1.5rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1rem;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ==================== FOOTER ==================== */
.main-footer {
    background-color: #111827;
    color: #ffffff;
    padding: 4rem 0 2rem;
    margin-top: auto;
}

.footer-container {
    display: flex;
    flex-direction: column;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 4rem;
}

.logo-icon-sm {
    width: 2rem;
    height: 2rem;
}

.logo-icon-sm svg {
    width: 1.2rem;
    height: 1.2rem;
}

.footer-brand p {
    color: #9ca3af;
    line-height: 1.6;
}

.footer-links-col h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #f3f4f6;
}

.footer-links-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links-col a {
    color: #9ca3af;
    font-size: 0.9rem;
    transition: color 0.15s;
}

.footer-links-col a:hover {
    color: #ffffff;
}

/* ==================== MEDIA RESPONSIVENESS ==================== */
@media (max-width: 1024px) {
    .workspace-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    
    .editor-panel, .preview-panel {
        overflow-y: visible;
        height: auto;
        padding: 1.5rem;
    }
    
    .preview-panel {
        background-color: var(--bg-color);
        border-top: 1px solid var(--border-color);
    }
    
    .preview-toolbar {
        max-width: 100%;
        background-color: #ffffff;
        color: var(--text-color);
        border-color: var(--border-color);
    }
    
    .option-group select {
        background-color: #ffffff;
        color: var(--text-color);
    }
    
    .toolbar-title {
        color: var(--text-muted);
        border-bottom-color: var(--bg-color);
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .hero-left {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-title {
        font-size: 2.75rem;
    }
    
    .products-grid, .features-grid, .steps-container {
        grid-template-columns: 1fr;
    }
    
    .hero-visual-card {
        max-width: 500px;
        margin: 0 auto;
        transform: none !important;
    }
    
    .footer-top {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {
    .nav-links, .header-cta {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .col-span-2 {
        grid-column: span 1 / span 1;
    }
    
    .form-action-row {
        flex-direction: column;
    }
    
    .toolbar-options {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .filters-card {
        flex-direction: column;
    }
    
    .search-wrapper input {
        max-width: 100%;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }
    
    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero-features-list {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    
    .dashboard-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .dashboard-actions button {
        width: 100%;
        justify-content: center;
    }
    
    .editor-panel, .preview-panel {
        padding: 1rem 0.75rem;
    }
    
    .form-section-card {
        padding: 1.25rem 1rem;
    }
}

@media (max-width: 500px) {
    .logo-upload-container {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==================== HIGH-FIDELITY PRINT STYLES ==================== */
@media print {
    /* Hide all workspace controls, header, footer, editor inputs, customized widgets */
    .no-print, 
    header, 
    footer, 
    .mobile-nav,
    .editor-panel, 
    .preview-toolbar,
    .form-action-row,
    #tab-landing,
    #tab-history,
    .canvas-controls,
    .tab-sub-nav {
        display: none !important;
    }
    
    /* Global body changes for print */
    body, html {
        background-color: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    /* Format the document container to expand and avoid scaling margins */
    .workspace-container {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        background-color: #ffffff !important;
    }
    
    .preview-panel {
        display: block !important;
        background-color: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .a4-sheet-container {
        box-shadow: none !important;
        border-radius: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        overflow: visible !important;
    }
    
    .a4-document {
        display: block !important;
        width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 0 !important;
        border: none !important;
        transform: none !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }
    
    .doc-items-table-container {
        display: block !important;
        flex-grow: 0 !important;
        margin-bottom: 2rem !important;
    }
    
    .layout-letterhead.a4-document {
        padding-top: calc(var(--lh-top-pad, 0px) + 2rem) !important;
        padding-bottom: calc(var(--lh-bottom-pad, 0px) + 2rem) !important;
        padding-left: 3rem !important;
        padding-right: 3rem !important;
    }
    
    /* Ensure colors are printed exactly */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Print margins setup */
    @page {
        size: A4;
        margin: 15mm 15mm 15mm 15mm;
    }
    
    /* Avoid bad linebreaks on elements */
    .doc-items-table tr {
        page-break-inside: avoid !important;
    }
    
    .doc-summary-area {
        display: block !important;
    }
    
    .summary-left-notes {
        width: 50% !important;
        float: left !important;
        display: block !important;
    }
    
    .summary-right-totals {
        width: 45% !important;
        float: right !important;
        display: block !important;
    }
    
    .doc-summary-area::after {
        content: "" !important;
        display: table !important;
        clear: both !important;
    }
    
    /* Ensure text colors are readable on black-and-white printers */
    .doc-title-text,
    .party-section-heading,
    .info-block-title,
    #preview-grand-total {
        color: #000000 !important;
    }
    
    .doc-accent-bar {
        background-color: #374151 !important; /* Muted gray for print */
    }
    
    .doc-items-table th {
        background-color: #eaeaea !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
    }
    
    .doc-totals-table tr.grand-total-row td {
        border-top: 2px solid #000000 !important;
        border-bottom: 2px solid #000000 !important;
        color: #000000 !important;
    }
}
