:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --bg-main: #fcfcfd;
    --bg-sidebar: #0f172a;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-on-dark: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.04), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.04), 0 8px 10px -6px rgb(0 0 0 / 0.04);

    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.025em;
}

#app {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar Styling (Vertical) */
.sidebar {
    width: 230px;
    background-color: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Sidebar Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    letter-spacing: -0.04em;
    padding: 0 0.5rem;
}

.logo i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.logo span {
    background: linear-gradient(135deg, var(--white) 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-new-doc-btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 1.25rem;
    padding: 0.7rem 1rem;
    font-weight: 600;
    font-size: 0.88rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sidebar-new-doc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
    filter: brightness(1.08);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.95rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #94a3b8;
    text-decoration: none;
    position: relative;
    font-weight: 500;
    font-size: 0.88rem;
}

.nav-item i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    transform: translateX(4px);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

.nav-item.active i {
    color: var(--white);
}

/* Main Content Area */
.main-viewport {
    flex: 1 1 0%;
    min-width: 0;
    width: calc(100% - 230px);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.header {
    height: 64px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-sizing: border-box;
}

.content {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Document Type Switcher Bar & Pills */
.doc-type-switcher-bar {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.doc-type-switcher-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.doc-type-switcher-label i {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

.doc-type-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.doc-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: #ffffff;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.doc-type-btn i {
    width: 15px;
    height: 15px;
}

.doc-type-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: #f8fafc;
}

.doc-type-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.doc-type-btn.active i {
    color: #ffffff;
}

/* UI Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-main);
    border-color: var(--secondary);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, transparent 0%, rgba(99, 102, 241, 0.05) 100%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
}

/* Data Table Styling */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    text-align: left;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.45rem;
    font-weight: 700;
    white-space: nowrap;
}

.data-table td {
    padding: 0.6rem 0.45rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-main);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: #f1f5f9;
}

/* Badge Styling */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge.paid {
    background: #dcfce7;
    color: #166534;
}

.badge.pending {
    background: #fef9c3;
    color: #854d0e;
}

.badge.overdue {
    background: #fee2e2;
    color: #991b1b;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: #475569;
    letter-spacing: 0.01em;
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0.5rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: var(--text-main);
    box-sizing: border-box;
}

.form-input:hover {
    border-color: #94a3b8;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder {
    color: #94a3b8;
    font-size: 0.86rem;
}

textarea.form-input {
    height: auto;
    min-height: 70px;
    padding: 0.75rem 0.85rem;
    resize: vertical;
}

/* Grid & Layout Helpers for Invoice & System Forms */
.invoice-builder-container {
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr;
    gap: 1.25rem;
}

.form-grid-3-alt {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 1.25rem;
}

.form-grid-client-2 {
    display: grid;
    grid-template-columns: 1.15fr 1.15fr 0.95fr 0.95fr 1.4fr;
    gap: 1.15rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .form-grid-3,
    .form-grid-3-alt,
    .form-grid-client-2,
    .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.input-with-button {
    display: flex;
    gap: 6px;
    align-items: center;
}

.input-with-button .form-input {
    flex: 1;
}

.btn-input-action {
    height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-md);
}

.nif-quick-btn {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: color 0.15s ease;
}

.nif-quick-btn:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Utility Buttons */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--primary);
}


/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2.5rem 1rem;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: calc(100vh - 5rem);
    display: flex;
    flex-direction: column;
    margin: auto 0;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Animations */

.animate-in {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive for Sidebar & Layout */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 1.5rem 0.5rem;
    }

    .logo span,
    .nav-item span,
    .sidebar-new-doc-btn span {
        display: none;
    }

    .sidebar-new-doc-btn {
        padding: 0.75rem 0.5rem;
    }

    .nav-item {
        justify-content: center;
        padding: 0.85rem;
    }

    .main-viewport {
        width: calc(100% - 80px);
    }
}

@media (max-width: 768px) {
    .content {
        padding: 1rem 0.75rem;
    }

    .doc-type-switcher-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .doc-type-pills {
        width: 100%;
    }

    .doc-type-btn {
        flex: 1;
        justify-content: center;
    }
}

/* Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 1.25rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    animation: toastScaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--primary);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.success {
    border-left-color: #10b981;
}

@keyframes toastScaleIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modulo de Faturacao e-Fatura Styling */
.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.form-section-title i {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

/* ========================================================
   Items Builder Table (Artigos & Serviços) - Sleek & Compact
   ======================================================== */
.items-builder-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.items-builder-table thead tr {
    background-color: #f8fafc;
}

.items-builder-table thead th {
    padding: 10px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.items-builder-table tbody tr {
    transition: background-color 0.15s ease;
}

.items-builder-table tbody tr:hover {
    background-color: #f8fafc;
}

.items-builder-table tbody td {
    padding: 6px 5px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    box-sizing: border-box;
}

.items-builder-table tbody tr:last-child td {
    border-bottom: none;
}

/* Individual Cell Inputs */
.item-cell-input {
    width: 100%;
    height: 35px;
    padding: 4px 8px;
    font-size: 0.82rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    transition: all 0.15s ease-in-out;
    outline: none;
}

.item-cell-input:hover {
    border-color: #94a3b8;
    background-color: #fafbfc;
}

.item-cell-input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.item-cell-input.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    letter-spacing: -0.01em;
}

.item-cell-input.text-right {
    text-align: right;
}

.item-cell-input.text-center {
    text-align: center;
}

.item-cell-input.font-semibold {
    font-weight: 600;
}

/* Number input spin buttons subtlety */
.item-cell-input[type="number"]::-webkit-inner-spin-button,
.item-cell-input[type="number"]::-webkit-outer-spin-button {
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

.item-cell-input[type="number"]:hover::-webkit-inner-spin-button,
.item-cell-input[type="number"]:hover::-webkit-outer-spin-button {
    opacity: 0.85;
}

/* Tipo Badge (Servico / Produto) */
.item-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    height: 35px;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.item-type-badge i {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.item-type-badge.servico {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.item-type-badge.servico:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: #4f46e5;
    transform: translateY(-1px);
}

.item-type-badge.produto {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.item-type-badge.produto:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: #059669;
    transform: translateY(-1px);
}

/* Subtotal text in table row */
.item-subtotal-text {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
    white-space: nowrap;
    padding-right: 4px;
    font-family: 'Outfit', sans-serif;
}

/* Delete item button */
.btn-remove-item {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 0 auto;
}

.btn-remove-item i {
    width: 15px;
    height: 15px;
}

.btn-remove-item:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
    transform: scale(1.08);
}

/* Action Strip under items table */
.items-table-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.85rem;
    flex-wrap: wrap;
}

.btn-add-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add-line i {
    width: 14px;
    height: 14px;
}

.btn-add-line.service {
    background: #f5f3ff;
    color: #6366f1;
    border: 1.5px dashed #c7d2fe;
}

.btn-add-line.service:hover {
    background: #ede9fe;
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.15);
}

.btn-add-line.product {
    background: #ecfdf5;
    color: #059669;
    border: 1.5px dashed #a7f3d0;
}

.btn-add-line.product:hover {
    background: #d1fae5;
    border-color: #10b981;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);
}
.rubric-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}
.rubric-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}
.rubric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.badge-tax {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.03em;
}
.badge-tax.iva15 {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.badge-tax.isento {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.rubric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}
.rubric-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.rubric-item label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}
.rubric-item input {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}
.totals-summary-box {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}
.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.totals-row.main-total {
    border-top: 2px dashed var(--border);
    margin-top: 1rem;
    padding-top: 1.25rem;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
}
.totals-row.main-total span:last-child {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}
.transmit-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 0.85rem 1rem;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
}
.transmit-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.transmit-toggle label {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.ef-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}
.ef-status-banner.validated {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #065f46;
}
.ef-status-banner.pending {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #92400e;
}
.ef-status-banner.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #991b1b;
}
.iud-code {
    font-family: monospace;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.06);
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
    user-select: all;
}

/* e-Fatura Transmission Result Modal Styles */
.ef-result-modal-view {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ef-result-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.ef-result-hero.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.06) 100%);
    border: 1.5px solid rgba(16, 185, 129, 0.35);
}

.ef-result-hero.rejected {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(220, 38, 38, 0.06) 100%);
    border: 1.5px solid rgba(239, 68, 68, 0.35);
}

.ef-result-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ef-result-hero.success .ef-result-icon {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.ef-result-hero.rejected .ef-result-icon {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.ef-result-hero.success .ef-result-icon i,
.ef-result-hero.rejected .ef-result-icon i {
    width: 28px;
    height: 28px;
}

.ef-result-text h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.ef-result-hero.success .ef-result-text h2 {
    color: #065f46;
}

.ef-result-hero.rejected .ef-result-text h2 {
    color: #991b1b;
}

.ef-result-text p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.ef-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
}

.ef-summary-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ef-summary-card .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.ef-summary-card .value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.ef-summary-card .doc-ref {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    width: fit-content;
}

.badge-validated {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.ef-iud-card {
    background: #fdfdfd;
    border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.ef-iud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ef-iud-header .label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-copy-iud,
.btn-copy-json {
    background: white;
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btn-copy-iud:hover,
.btn-copy-json:hover {
    background: #f1f5f9;
    border-color: var(--primary);
    color: var(--primary);
}

.ef-iud-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.05);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    word-break: break-all;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.ef-messages-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.ef-messages-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ef-messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ef-message-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ef-message-item.msg-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.ef-message-item.msg-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.ef-message-item.msg-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.ef-message-item .msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
}

.ef-message-item .msg-desc {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
}

.ef-json-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ef-json-header {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border);
}

.ef-json-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ef-json-body {
    max-height: 240px;
    overflow-y: auto;
    background: #0f172a;
    padding: 1rem;
}

.ef-json-body pre {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    color: #38bdf8;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}

.ef-detail-response-box {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.ef-detail-response-box.validated {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.25);
}

.ef-detail-response-box.rejected {
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.25);
}

.ef-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ========================================================
   Pesquisa de NIF / Contribuinte (Local & e-Fatura DNRE)
   ======================================================== */
.nif-search-container {
    max-width: 950px;
    margin: 0 auto;
}

.nif-search-hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 2rem 2.25rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.nif-search-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.nif-search-hero h3 {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.nif-search-hero p {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
    max-width: 650px;
}

.nif-search-input-group {
    display: flex;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px;
    border-radius: var(--radius-md);
    align-items: center;
}

.nif-search-input-group input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.nif-search-input-group input::placeholder {
    color: #64748b;
}

.nif-search-input-group button {
    white-space: nowrap;
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    font-size: 1rem;
}

.nif-search-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #94a3b8;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.nif-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nif-chip {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: monospace;
}

.nif-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.contribuinte-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.3s ease;
}

.contribuinte-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.contribuinte-name {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.35rem;
}

.contribuinte-nif-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: monospace;
    font-size: 1rem;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--text-main);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.contribuinte-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contribuinte-source-badge.local {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.contribuinte-source-badge.efatura {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.contribuinte-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.contribuinte-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.contribuinte-item .item-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.contribuinte-item .item-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-word;
}

.contribuinte-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.nif-inline-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--primary);
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.contribuinte-source-badge.both {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(16, 185, 129, 0.15) 100%);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

/* Painel de Resposta Detalhada do Middleware */
.mw-details-panel {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-top: 1.75rem;
    overflow: hidden;
    transition: all 0.25s ease;
}

.mw-details-panel:hover {
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.mw-details-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.mw-details-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.3px;
}

.mw-details-title i {
    color: #38bdf8;
    width: 22px;
    height: 22px;
}

.mw-badges-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mw-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.2px;
}

.mw-badge-pill.status-200 {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.mw-badge-pill.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.mw-badge-pill.latency {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.mw-badge-pill.repo {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.mw-details-body {
    padding: 1.5rem;
}

.mw-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.mw-info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
}

.mw-info-box .info-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mw-info-box .info-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    font-family: monospace;
    word-break: break-all;
}

.mw-messages-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.mw-messages-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.5rem;
}

.mw-json-card {
    border: 1px solid #1e293b;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #0f172a;
}

.mw-json-toolbar {
    background: #1e293b;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
}

.mw-json-toolbar span {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mw-json-content {
    max-height: 400px;
    overflow: auto;
    padding: 1rem 1.25rem;
    margin: 0;
    background: #0b1120;
    color: #38bdf8;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}
/* =========================================================================
   Estilos para Faturação Normal (Vendas e Prestação de Serviços)
   ========================================================================= */
.items-builder-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.5rem;
}
.items-builder-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 0.75rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.items-builder-table td {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.items-builder-table tr:hover td {
    background: rgba(99, 102, 241, 0.02);
}
.item-cell-input {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: #fff;
    transition: all 0.2s ease;
}
.item-cell-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.item-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}
.item-type-badge.servico {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.item-type-badge.produto {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.btn-remove-item {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.btn-remove-item:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.05);
}
.btn-add-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1.25rem;
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.04);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-add-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}
.item-subtotal-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    text-align: right;
    white-space: nowrap;
}

/* Settings Page Styling */
.settings-tabs-nav {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.settings-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.4rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: all 0.2s ease;
    position: relative;
}

.settings-tab-btn:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}

.settings-tab-btn.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.settings-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.settings-section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.settings-section-header h4 {
    font-size: 1.05rem;
    margin: 0;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.25);
}

.badge-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-role-admin {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-dark);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-role-user {
    background: rgba(14, 165, 233, 0.12);
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

@media print {

    .top-nav-bar,
    .sidebar,
    .header,
    .btn,
    .btn-outline,
    .btn-icon {
        display: none !important;
    }

    .main-viewport {
        margin: 0;
        padding: 0;
    }

    .content {
        padding: 0;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #eee !important;
        padding: 0 !important;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem !important;
    }
}