/* ==========================================================================
   Invoice Studio | Maasaheb IT Services Gadchiroli
   Modern SaaS Invoicing Suite & Live A4 Rendering Engine
   ========================================================================== */

:root {
    --primary-orange: #ea580c;
    --primary-orange-light: #f97316;
    --primary-orange-gradient: linear-gradient(135deg, #f95721 0%, #ea580c 100%);
    --navy-dark: #0f172a;
    --navy-header: #0b132b;
    --navy-bar: #0d1b2a;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
    --border-dark: #cbd5e1;
    --bg-app: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-sheet: #ffffff;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-sheet: 0 20px 45px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
    --topbar-height: 60px;
    --sidebar-width: 380px;
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--bg-app);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Top Global App Bar
   ========================================================================== */
.app-topbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    position: relative;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
}

.app-brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.app-brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--navy-dark);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-orange);
}

.icon-btn-toggle {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-toggle:hover {
    background-color: var(--bg-app);
    color: var(--text-primary);
}

.preview-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #059669;
    background-color: #ecfdf5;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid #a7f3d0;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.15); }
}

.topbar-center {
    display: flex;
    align-items: center;
}

.zoom-controls {
    display: flex;
    align-items: center;
    background: var(--bg-app);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 2px 4px;
    gap: 4px;
}

.zoom-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.zoom-level {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 42px;
    text-align: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-topbar-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #ffffff;
    border: 1px solid var(--border-dark);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-topbar-secondary:hover {
    background: var(--bg-app);
    border-color: #94a3b8;
}

.btn-topbar-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--primary-orange-gradient);
    border: none;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
    transition: all 0.2s;
}

.btn-topbar-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4);
}

/* ==========================================================================
   Workspace Layout (Sidebar + Preview Stage)
   ========================================================================== */
.workspace-container {
    display: flex;
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
}

/* Left Sidebar / Form Editor */
.sidebar-editor {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 40;
}

.sidebar-editor.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-top-actions {
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: #ffffff;
}

.btn-sidebar-print {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--primary-orange-gradient);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(234, 88, 12, 0.25);
    transition: all 0.2s;
}

.btn-sidebar-print:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(234, 88, 12, 0.35);
}

.sidebar-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.btn-sidebar-save {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem;
    background: var(--navy-dark);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sidebar-save:hover {
    background: #1e293b;
}

.btn-sidebar-new {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem;
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sidebar-new:hover {
    background: var(--bg-app);
}

.sidebar-form-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Form Styles */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.section-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy-dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.req {
    color: var(--primary-orange);
}

.form-group input,
.form-group textarea {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--text-primary);
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-orange-light);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.form-group textarea {
    resize: vertical;
    line-height: 1.45;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.input-with-action {
    display: flex;
    align-items: center;
    position: relative;
}

.input-with-action input {
    padding-right: 2.2rem;
}

.btn-inline-action {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-inline-action:hover {
    color: var(--primary-orange);
    background: rgba(234, 88, 12, 0.08);
}

/* Document Type Segmented Switcher */
.doc-type-pills {
    display: flex;
    gap: 0.3rem;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.doc-type-pill {
    flex: 1;
    padding: 0.42rem 0.45rem;
    font-family: var(--font-heading);
    font-size: 0.74rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}

.doc-type-pill:hover {
    color: var(--navy-dark);
}

.doc-type-pill.active {
    background: #ffffff;
    color: var(--primary-orange);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Quick Add Chips */
.quick-add-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.quick-add-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.quick-add-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.quick-chip {
    background: #ffffff;
    border: 1px solid #fed7aa;
    color: var(--primary-orange);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-chip:hover {
    background: var(--primary-orange);
    color: #ffffff;
    border-color: var(--primary-orange);
}

.btn-add-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary-orange-gradient);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.3rem 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-item:hover {
    opacity: 0.9;
}

/* Item List in Sidebar */
.items-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.sidebar-item-card {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.sidebar-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-index-tag {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--navy-dark);
}

.btn-del-item {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 2px;
}

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

.sidebar-grand-total {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy-dark);
}

.grand-total-val {
    color: var(--primary-orange);
    font-size: 1rem;
    font-weight: 800;
}

/* Accordion */
.form-accordion {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: #ffffff;
    overflow: hidden;
}

.accordion-header {
    padding: 0.75rem 0.85rem;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--navy-dark);
    list-style: none;
    user-select: none;
    transition: background-color 0.2s;
}

.accordion-header::-webkit-details-marker {
    display: none;
}

.accordion-header:hover {
    background-color: var(--bg-app);
}

.accordion-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.chevron-icon {
    transition: transform 0.25s ease;
    color: var(--text-muted);
}

.form-accordion[open] .chevron-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0.85rem;
    border-top: 1px solid var(--border-light);
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.saved-invoices-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.empty-state {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
}

.saved-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
}

.saved-item-row:hover {
    border-color: var(--primary-orange);
    background: #fff7ed;
}

.saved-item-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--navy-dark);
}

.saved-item-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.btn-del-saved {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
}

.sidebar-footer-note {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.75rem 0;
}

/* ==========================================================================
   Live Preview Stage & A4 Sheet Engine
   ========================================================================== */
.preview-stage {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    background-color: #e2e8f0;
    padding: 2.5rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.paper-viewport {
    transform-origin: top center;
    transition: transform 0.2s ease;
}

/* Exact A4 Proportions: 210mm x 297mm */
.a4-sheet {
    width: 210mm;
    min-height: 297mm;
    background: #ffffff;
    box-shadow: var(--shadow-sheet);
    margin: 0 auto 3rem auto;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding-bottom: 2rem;
    font-size: 13px;
    line-height: 1.5;
    color: #1e293b;
}

/* ==========================================================================
   A4 Sheet Header (Angled Orange Banner & Navy Ribbon)
   ========================================================================== */
.sheet-header {
    width: 100%;
    position: relative;
    margin-bottom: 2rem;
}

.sheet-header-top {
    height: 110px;
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    overflow: hidden;
}

.header-title-box {
    padding-left: 2.75rem;
    z-index: 2;
}

.invoice-wordmark {
    font-family: var(--font-heading);
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--navy-header);
    letter-spacing: 0.06em;
    line-height: 1;
}

/* Decorative Slanted Accent Stripe */
.header-slanted-stripe {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 51.5%;
    width: 14px;
    background: var(--primary-orange-gradient);
    transform: skewX(-24deg);
    z-index: 2;
}

/* Main Slanted Orange Branding Banner */
.header-orange-banner {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 50%;
    background: var(--primary-orange-gradient);
    transform: skewX(-24deg);
    transform-origin: top right;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 2.5rem;
    z-index: 2;
}

.brand-company-row {
    transform: skewX(24deg); /* Unskew text/logo */
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #ffffff;
}

.banner-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-full-logo {
    height: 48px;
    max-width: 320px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}

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

.company-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.company-tagline {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.02em;
}

/* Dark Navy Slanted Website Ribbon */
.sheet-header-ribbon {
    width: 100%;
    height: 32px;
    position: relative;
    overflow: hidden;
}

.ribbon-navy-bar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 58%;
    background-color: var(--navy-bar);
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 2.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transform: skewX(-24deg);
    transform-origin: top left;
}

.ribbon-navy-bar > * {
    transform: skewX(24deg); /* Unskew inside text */
}

/* ==========================================================================
   A4 Meta Information (Client & Invoice Meta)
   ========================================================================== */
.sheet-meta-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 2.75rem;
    margin-bottom: 2.25rem;
}

.meta-client {
    max-width: 55%;
}

.meta-label {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 0.35rem;
}

.client-name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--navy-dark);
    line-height: 1.3;
    margin-bottom: 0.2rem;
}

.client-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.client-extra {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.meta-invoice {
    text-align: right;
}

.meta-grid {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 1.5rem;
    row-gap: 0.45rem;
    text-align: left;
}

.meta-field-label {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy-dark);
}

.meta-field-val {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy-dark);
    text-align: right;
}

/* ==========================================================================
   A4 Items Table
   ========================================================================== */
.sheet-table-section {
    padding: 0 2.75rem;
    margin-bottom: 2.5rem;
}

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

.items-table th {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy-dark);
    padding: 0.65rem 0.5rem;
    border-top: 1.5px solid var(--border-dark);
    border-bottom: 1.5px solid var(--border-dark);
    text-align: left;
}

.items-table th.col-num {
    width: 8%;
}

.items-table th.col-desc {
    width: 68%;
    padding-left: 1rem;
}

.items-table th.col-total {
    width: 24%;
    text-align: right;
}

.items-table td {
    padding: 1.25rem 0.5rem;
    vertical-align: top;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid #f1f5f9;
}

.items-table td.cell-num {
    font-weight: 600;
    color: var(--navy-dark);
}

.items-table td.cell-desc {
    padding-left: 1rem;
    white-space: pre-line;
    line-height: 1.5;
    font-weight: 600;
}

.items-table td.cell-total {
    text-align: right;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--navy-dark);
}

/* ==========================================================================
   A4 Lower Section: Bank Details (Left) & Grand Total (Right)
   ========================================================================== */
.sheet-lower-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 2.75rem;
    margin-top: auto;
    margin-bottom: 2.5rem;
}

.lower-bank-details {
    max-width: 55%;
    font-size: 0.78rem;
    line-height: 1.5;
}

.bank-title {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--navy-dark);
    margin-bottom: 0.35rem;
}

.bank-line {
    color: var(--navy-dark);
    margin-bottom: 0.15rem;
}

.bank-line strong {
    font-weight: 700;
    margin-right: 0.25rem;
}

.lower-total-display {
    text-align: right;
}

.grand-total-large {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--navy-dark);
    letter-spacing: -0.02em;
}

/* ==========================================================================
   A4 Footer: Terms (Left) & Signature (Right)
   ========================================================================== */
.sheet-footer-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 2.75rem;
}

.footer-terms {
    max-width: 55%;
}

.terms-motto {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.25rem;
}

.terms-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--navy-dark);
    margin-bottom: 0.35rem;
}

.terms-list {
    padding-left: 0;
    list-style: none;
    font-size: 0.65rem;
    color: #475569;
    line-height: 1.45;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.terms-list li {
    position: relative;
}

.footer-signature {
    text-align: right;
    min-width: 220px;
}

.sig-company {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 3.5rem;
}

.sig-space {
    height: 1px;
}

.sig-signatory {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--navy-dark);
    border-top: 1px dashed var(--border-dark);
    padding-top: 0.35rem;
    display: inline-block;
}

/* ==========================================================================
   Security Auth Gate Overlay (Password Protection)
   ========================================================================== */
.auth-gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, rgba(15, 23, 42, 0.94) 0%, rgba(3, 7, 18, 0.98) 100%);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.auth-gate-overlay.unlocked {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 1px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    text-align: center;
    animation: authSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes authSlideUp {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: #fff7ed;
    color: var(--primary-orange);
    border: 1px solid #ffedd5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem auto;
}

.auth-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--navy-dark);
    margin-bottom: 0.35rem;
}

.auth-header p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    text-align: left;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--navy-dark);
}

.auth-input-wrap {
    display: flex;
    align-items: center;
    position: relative;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    transition: all 0.2s;
}

.auth-input-wrap svg {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.auth-input-wrap input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.4rem;
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
}

.auth-input-wrap:focus-within {
    border-color: var(--primary-orange-light);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.btn-toggle-pw {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.btn-toggle-pw:hover {
    color: var(--navy-dark);
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.remember-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.auth-alert {
    display: none;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #ef4444;
}

.btn-auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem;
    background: var(--primary-orange-gradient);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.45);
}

.auth-default-hint {
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    margin-top: 0.25rem;
}

/* ==========================================================================
   Modals Engine (Database Registry & Change Credentials)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #ffffff;
    border-radius: 18px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: authSlideUp 0.3s ease both;
}

.modal-card-lg {
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--navy-dark);
}

.modal-header p {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.btn-modal-close:hover {
    color: var(--navy-dark);
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.btn-modal-secondary {
    padding: 0.55rem 1rem;
    background: #f1f5f9;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-modal-primary {
    padding: 0.55rem 1.15rem;
    background: var(--navy-dark);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   Database Invoices Registry Modal Components
   ========================================================================== */
.db-stats-row {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.db-stat-box {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-val {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--navy-dark);
}

.db-actions-quick {
    margin-left: auto;
}

.btn-excel-export {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #107c41; /* Official Excel Green */
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.15rem;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 124, 65, 0.25);
    transition: all 0.2s;
}

.btn-excel-export:hover {
    background: #0b6a36;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 124, 65, 0.35);
}

.db-search-bar {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.db-search-input-wrap {
    display: flex;
    align-items: center;
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.db-search-input-wrap svg {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
}

.db-search-input-wrap input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.2rem;
    border: none;
    outline: none;
    font-size: 0.82rem;
    background: transparent;
}

.db-table-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.db-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
}

.db-table th {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--navy-dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.65rem 0.5rem;
    border-bottom: 2px solid var(--border-light);
    text-align: left;
}

.db-table td {
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.db-table td strong {
    color: var(--navy-dark);
}

.table-actions-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.btn-table-action {
    background: #f1f5f9;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--navy-dark);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-table-action:hover {
    background: #e2e8f0;
}

.btn-table-action.btn-table-del {
    color: #ef4444;
}

.btn-table-action.btn-table-del:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* ==========================================================================
   Topbar Invoices Database & User Profile Dropdown
   ========================================================================== */
.btn-topbar-db {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-topbar-db:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.user-auth-menu {
    position: relative;
}

.btn-user-avatar {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--navy-dark);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-user-avatar:hover {
    background: #e2e8f0;
}

.user-dropdown-card {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    z-index: 100;
}

.user-dropdown-card.active {
    display: flex;
}

.dropdown-header {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.dropdown-id {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin-top: 2px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--navy-dark);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

.dropdown-item.text-danger {
    color: #ef4444;
}

.dropdown-item.text-danger:hover {
    background: #fee2e2;
}

/* ==========================================================================
   Print Engine Styles (@media print)
   ========================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html, body {
        background: #ffffff !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hide Web UI Controls */
    .app-topbar,
    .sidebar-editor,
    .zoom-controls {
        display: none !important;
    }

    .workspace-container {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .preview-stage {
        background: none !important;
        padding: 0 !important;
        overflow: visible !important;
        display: block !important;
    }

    .paper-viewport {
        transform: none !important;
    }

    .a4-sheet {
        box-shadow: none !important;
        margin: 0 !important;
        width: 100% !important;
        min-height: 297mm !important;
        page-break-after: always;
    }
}
