﻿/* =========================================
   X3D Print Tracker - Components
   Cards, Forms, Modals, Badges, Toasts
   ========================================= */

/* Masked text input (API keys) — hides text without using type="password" */
.masked-input {
    -webkit-text-security: disc;
    text-security: disc;
}
.masked-input.visible {
    -webkit-text-security: none;
    text-security: none;
}

/* =========================================
   Stats Grid
   ========================================= */
.stats-grid {
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-sub-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 2px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

/* =========================================
   Cards
   ========================================= */
.x3d-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 35px;
}

.x3d-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.x3d-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.x3d-card-header h3 i {
    color: var(--primary);
}

.x3d-card-body {
    padding: 24px;
}

/* =========================================
   Empty State
   ========================================= */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* =========================================
   Upload Area
   ========================================= */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 24px;
    background: var(--bg);
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* OCR Loading Overlay */
.ocr-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.ocr-loading-content {
    text-align: center;
    color: #fff;
}

.ocr-loading-content p {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 16px;
}

.ocr-loading-content small {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
}

.ocr-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-content i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 16px;
}

.upload-content h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text);
}

.upload-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.upload-preview {
    position: relative;
    width: 100%;
}

.upload-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* =========================================
   Form Styles
   ========================================= */
.print-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label,
.form-group .label-spacer {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    color: var(--primary);
    font-size: 0.8rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text);
}

.color-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: pointer;
    background: var(--card-bg);
}

.color-input-group input[type="text"] {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.form-card {
    max-width: 850px;
    margin: 0 auto;
}

/* =========================================
   Form Section Titles
   ========================================= */
.form-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    padding: 8px 0 4px;
    border-bottom: 2px solid var(--primary-light);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 2px;
}

.calculated-field {
    background: var(--bg) !important;
    color: var(--primary) !important;
    font-weight: 600 !important;
}

/* =========================================
   Cost Summary Box
   ========================================= */
.cost-summary {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 8px;
}

.cost-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.cost-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    border: 1px solid var(--border);
}

.cost-item i {
    font-size: 1.3rem;
    color: var(--primary);
    margin-top: 2px;
}

.cost-item.cost-total {
    background: var(--primary-light);
    border-color: var(--primary);
}

.cost-item.cost-total i {
    color: var(--primary-dark);
}

.cost-detail {
    display: flex;
    flex-direction: column;
}

.cost-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.cost-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.cost-sub {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* =========================================
   Cost badge on cards
   ========================================= */
.cost-badge {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 12px;
}

@media (max-width: 767.98px) {
    .cost-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Status Badge
   ========================================= */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-badge.queued {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge.printing {
    background: #fff3e0;
    color: #e65100;
    animation: pulse-badge 2s infinite;
}

.status-badge.completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.failed {
    background: #ffebee;
    color: #c62828;
}

.status-badge.cancelled {
    background: #f5f5f5;
    color: #616161;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* =========================================
   Status Bars (Dashboard Chart)
   ========================================= */
.status-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-bar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-bar-track {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.status-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* =========================================
   List Header / Filters
   ========================================= */
.list-header {
    flex-wrap: wrap;
    gap: 12px;
}

.list-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.85rem;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    width: 220px;
    font-family: inherit;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--card-bg);
    cursor: pointer;
}

/* =========================================
   Modal
   ========================================= */
body.modal-open {
    overflow: hidden;
}

.x3d-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.x3d-modal-overlay.active {
    display: flex;
}

.x3d-modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

/* @keyframes modalIn — single definition below (search: MFA modals section) */

.x3d-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 2;
}

.x3d-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.x3d-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: var(--transition);
}

.x3d-modal-close:hover {
    color: var(--danger);
}

.x3d-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.x3d-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* =========================================
   Print Detail in Modal
   ========================================= */
.detail-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    background: var(--bg);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-item label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-item span {
    font-weight: 600;
    font-size: 0.95rem;
}

.detail-notes {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* =========================================
   Filament Cards
   ========================================= */

.filament-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.filament-card:hover {
    box-shadow: var(--shadow-md);
}

/* Low stock — orange pulsing border */
.filament-card.filament-low-stock {
    border-color: var(--warning);
    animation: pulse-border-orange 2s ease-in-out infinite;
}

@keyframes pulse-border-orange {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 8px 2px rgba(245, 158, 11, 0.5); }
}

/* Out of stock — red border + banner */
.filament-card.filament-out-of-stock {
    border-color: var(--danger);
    opacity: 0.85;
}

.filament-out-of-stock-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    padding: 3px 0;
    letter-spacing: 1px;
    z-index: 1;
}

.filament-card.filament-out-of-stock .filament-card-header {
    margin-top: 18px;
}

/* Stock filter buttons */
.filament-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filament-filter-btn {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filament-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filament-filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.filament-filter-btn .filter-count {
    display: inline-block;
    font-size: 0.72rem;
    background: rgba(255,255,255,0.2);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.filament-filter-btn.active .filter-count {
    background: rgba(255,255,255,0.25);
}

/* Grouped card styles */
.filament-group-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.filament-group-card:hover {
    box-shadow: var(--shadow-md);
}

.filament-group-main {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.filament-group-main.filament-low-stock {
    border-left: 3px solid var(--warning);
    animation: pulse-border-orange 2s ease-in-out infinite;
}

.filament-group-main.filament-out-of-stock {
    border-left: 3px solid var(--danger);
    opacity: 0.85;
}

.filament-spool-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.filament-group-spools {
    border-top: 1px dashed var(--border);
    background: var(--bg);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.filament-group-spools.expanded {
    max-height: 600px;
    padding: 12px 16px;
}

/* Chevron expand/collapse indicator */
.filament-group-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: transform 0.3s ease, background 0.2s ease;
    margin-left: auto;
}
.filament-group-main:hover .filament-group-chevron {
    background: var(--bg-primary);
    color: var(--primary);
}
.filament-group-spools.expanded ~ .filament-group-main .filament-group-chevron,
.filament-group-card:has(.filament-group-spools.expanded) .filament-group-chevron {
    transform: rotate(180deg);
}

/* Group toggle icon-only button */
.filament-filter-btn.filament-group-toggle {
    padding: 6px 10px;
    min-width: unset;
}

.filament-spool-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 4px;
    background: var(--bg-primary);
    font-size: 0.85rem;
    gap: 8px;
}

.filament-spool-item:last-child {
    margin-bottom: 0;
}

.filament-spool-item .spool-remaining {
    font-weight: 600;
    white-space: nowrap;
}

.filament-spool-item.spool-low {
    border-left: 3px solid var(--warning);
}

.filament-spool-item.spool-empty {
    border-left: 3px solid var(--danger);
    opacity: 0.7;
}

/* ========================================
   Filament List View (detailed table)
   ======================================== */
.filament-list-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filament-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.filament-list-table thead {
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.filament-list-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.filament-list-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.filament-list-table tbody tr:hover {
    background: var(--bg-primary);
}

.filament-list-table tbody tr.filament-row-empty {
    opacity: 0.6;
    background: rgba(239, 68, 68, 0.04);
}

.filament-list-table tbody tr.filament-row-low {
    background: rgba(245, 158, 11, 0.06);
}

.filament-color-dot {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    vertical-align: middle;
    flex-shrink: 0;
}

.filament-mini-bar {
    width: 50px;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

.filament-mini-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.filament-mini-bar-fill.warning {
    background: var(--warning);
}

.filament-mini-bar-fill.danger {
    background: var(--danger);
}

/* Sortable headers */
.filament-sortable {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: color 0.2s ease;
}
.filament-sortable:hover {
    color: var(--primary);
}
.filament-sortable .sort-hint {
    opacity: 0.3;
    font-size: 0.85em;
}
.filament-sortable:hover .sort-hint {
    opacity: 0.6;
}

.filament-list-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Bulk action bar */
.filament-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    font-weight: 600;
    font-size: 0.88rem;
    animation: fadeIn 0.2s ease;
}

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

/* Grand total summary bar */
.filament-total-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    margin-bottom: 16px;
}

.filament-total-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.filament-total-item .total-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.filament-total-item .total-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filament-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filament-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.filament-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.filament-info small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Manufacturer badges */
.manufacturer-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.badge-bambu {
    background: rgba(0, 174, 66, 0.12);
    color: #00ae42;
    border: 1px solid rgba(0, 174, 66, 0.25);
}

.badge-creality {
    background: rgba(30, 90, 168, 0.12);
    color: #1e5aa8;
    border: 1px solid rgba(30, 90, 168, 0.25);
}

.badge-generic {
    background: rgba(107, 114, 128, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(107, 114, 128, 0.25);
}

.badge-action {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78em;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-family: monospace;
}

/* Color select with swatch preview */
.color-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.color-select-wrapper select {
    padding-left: 32px;
    width: 100%;
}

.color-preview-swatch {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    z-index: 1;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

/* Colored options inside filament color select */
#fColor option {
    padding: 4px 8px;
    font-weight: 500;
}
#fColor optgroup {
    font-weight: 700;
    font-style: normal;
    padding-top: 4px;
}

/* Conflict resolution modal */
.conflict-candidate {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.conflict-candidate:hover {
    background: var(--bg);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.conflict-candidate:active {
    transform: scale(0.98);
}

.filament-bar-track {
    width: 100%;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

.filament-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.filament-usage {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.filament-cost-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
}
.filament-cost-info i {
    margin-right: 3px;
    opacity: 0.7;
}

/* Auto-calculated readonly fields */
.auto-calc-field {
    background: var(--bg-secondary) !important;
    opacity: 0.85;
    cursor: not-allowed;
}

/* =========================================
   Recent Print Row
   ========================================= */
.recent-print-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.recent-print-item:last-child {
    border-bottom: none;
}

.recent-print-item:hover {
    background: var(--bg);
    margin: 0 -24px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
}

.recent-print-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.recent-print-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-print-thumb i {
    color: var(--text-light);
}

.recent-print-info {
    flex: 1;
    min-width: 0;
}

.recent-print-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-print-info small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Toast Notifications — moved to single block below (search: x3d-toast) */

/* =========================================
   Toast Notifications (x3d-toast — avoids BS5 .toast conflict)
   ========================================= */
.x3d-toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.x3d-toast {
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 500px;
    animation: x3dToastIn 0.4s ease;
    pointer-events: auto;
}

.x3d-toast.success { background: var(--success); }
.x3d-toast.error { background: var(--danger); }
.x3d-toast.warning { background: var(--warning); }
.x3d-toast.info { background: var(--info); }

.x3d-toast i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

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

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

/* =========================================
   Help Modal
   ========================================= */
.help-modal {
    max-width: 700px;
}

.help-modal .x3d-modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.help-section h4 i {
    margin-right: 8px;
    color: var(--primary);
}

.help-section p {
    color: var(--text-secondary);
    font-size: 0.92em;
    margin-bottom: 12px;
}

/* Feature Guide accordion */
.help-plan-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.help-plan-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: none;
    background: var(--bg);
    color: var(--text);
    font-size: 0.92em;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.help-plan-toggle:hover {
    background: var(--bg-hover, var(--bg));
}

.help-plan-toggle i:last-child {
    transition: transform 0.25s ease;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.help-plan-toggle.active i:last-child {
    transform: rotate(180deg);
}

.help-plan-toggle span i {
    margin-right: 8px;
    color: var(--primary);
}

.help-plan-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.help-plan-content.open {
    max-height: 300px;
}

.help-plan-content ul {
    list-style: none;
    padding: 10px 16px;
    margin: 0;
}

.help-plan-content li {
    padding: 4px 0;
    font-size: 0.88em;
    color: var(--text-secondary);
}

.help-plan-content li i {
    color: var(--success);
    margin-right: 8px;
    font-size: 0.85em;
}

/* FAQ accordion */
.help-faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.help-faq-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: none;
    background: var(--bg);
    color: var(--text);
    font-size: 0.92em;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.help-faq-toggle:hover {
    background: var(--bg-hover, var(--bg));
}

.help-faq-toggle i:last-child {
    transition: transform 0.25s ease;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.help-faq-toggle.active i:last-child {
    transform: rotate(180deg);
}

.help-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.help-faq-answer.open {
    max-height: 200px;
}

.help-faq-answer p {
    padding: 10px 16px;
    font-size: 0.88em;
    color: var(--text-secondary);
    margin: 0;
}

/* =========================================
   Shepherd.js Theme (X3D)
   ========================================= */
.shepherd-theme-x3d.shepherd-element {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
}

.shepherd-theme-x3d .shepherd-arrow:before {
    background: var(--card-bg);
    border: 1px solid var(--border);
}

.shepherd-theme-x3d .shepherd-header {
    background: var(--bg);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    padding: 12px 16px;
}

.shepherd-theme-x3d .shepherd-title {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shepherd-step-counter {
    font-size: 0.75em;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.shepherd-theme-x3d .shepherd-cancel-icon {
    color: var(--text-secondary);
}

.shepherd-theme-x3d .shepherd-cancel-icon:hover {
    color: var(--danger);
}

.shepherd-theme-x3d .shepherd-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 14px 16px;
    line-height: 1.5;
}

.shepherd-theme-x3d .shepherd-footer {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--border);
}

.shepherd-theme-x3d .shepherd-button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.shepherd-theme-x3d .shepherd-button:hover {
    opacity: 0.9;
}

.shepherd-theme-x3d .shepherd-button-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.shepherd-theme-x3d .shepherd-button-secondary:hover {
    background: var(--bg-hover, var(--bg));
    color: var(--text);
}

/* Mobile: full-width shepherd tooltip */
@media (max-width: 576px) {
    .shepherd-theme-x3d.shepherd-element {
        max-width: calc(100vw - 32px);
    }
}

/* ── Shepherd specificity overrides (vendor uses 3-class selectors) ── */
.shepherd-theme-x3d.shepherd-has-title .shepherd-content .shepherd-header {
    background: var(--bg);
    padding: 12px 16px;
}
.shepherd-theme-x3d.shepherd-has-title .shepherd-content .shepherd-cancel-icon {
    color: var(--text-secondary);
}
.shepherd-theme-x3d.shepherd-has-title .shepherd-content .shepherd-cancel-icon:hover {
    color: var(--danger);
}
.shepherd-theme-x3d.shepherd-element.shepherd-has-title[data-popper-placement^=bottom]>.shepherd-arrow:before {
    background-color: var(--bg);
}

/* ── Shepherd modal overlay in dark mode ── */
[data-bs-theme="dark"] .shepherd-modal-overlay-container.shepherd-modal-is-visible {
    opacity: 0.65;
}

/* ── Shepherd: Plans step (wider) ── */
.shepherd-theme-x3d.shepherd-element:has(.tour-plans-grid) {
    max-width: 560px;
}

/* ── Tour Plans Grid ── */
.tour-plans-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.tour-plan-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    padding: 8px 6px;
    text-align: center;
    font-size: 0.72em;
    display: flex;
    flex-direction: column;
}

.tour-plan-header {
    font-size: 1.1em;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tour-plan-header i {
    font-size: 1.3em;
}

.tour-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 6px 0;
    text-align: left;
    flex: 1;
}

.tour-plan-features li {
    padding: 1px 0;
    line-height: 1.3;
    color: var(--text-secondary);
}

.tour-plan-limit {
    font-size: 0.85em;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    padding-top: 4px;
    margin-top: auto;
    font-weight: 600;
}

.tour-plans-cta {
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    margin: 4px 0 0 0;
    font-size: 0.9em;
}

/* Mobile: stack plans grid */
@media (max-width: 576px) {
    .tour-plans-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .shepherd-theme-x3d.shepherd-element:has(.tour-plans-grid) {
        max-width: calc(100vw - 32px);
    }
}

/* =========================================
   Contextual Info Tooltips (ⓘ)
   ========================================= */
.x3d-help-tip {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8em;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    margin-left: 4px;
}

.x3d-help-tip:hover {
    opacity: 1;
    color: var(--primary);
}

.x3d-popover {
    position: fixed;
    z-index: 1050;
    max-width: 280px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.x3d-popover-body {
    padding: 10px 14px;
    font-size: 0.85em;
    color: var(--text-secondary);
    line-height: 1.45;
}

.x3d-popover-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.x3d-popover.x3d-popover-bottom .x3d-popover-arrow {
    top: -6px;
    bottom: auto;
    border-right: none;
    border-bottom: none;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

/* =========================================
   Upgrade Banner
   ========================================= */
.upgrade-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 20px;
    font-size: 0.9em;
    font-weight: 500;
    color: #fff;
    position: sticky;
    top: 60px;
    z-index: 999;
    background: linear-gradient(135deg, var(--primary), #818cf8);
}

.upgrade-banner.visible {
    display: flex;
}

.upgrade-banner.plan-bronze {
    background: linear-gradient(135deg, #cd7f32, #d4944c);
}

.upgrade-banner.plan-silver {
    background: linear-gradient(135deg, #a0a0a0, #c0c0c0);
    color: #333;
}

.upgrade-banner.plan-gold {
    background: linear-gradient(135deg, #daa520, #f0c850);
    color: #333;
}

.upgrade-banner.plan-platinum {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

.upgrade-banner-text {
    flex: 1;
    text-align: center;
}

.upgrade-banner-explore {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: inherit;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88em;
    font-weight: 500;
    transition: var(--transition);
}

.upgrade-banner-explore:hover {
    background: rgba(255,255,255,0.3);
}

.upgrade-banner-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.3em;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.upgrade-banner-close:hover {
    opacity: 1;
}

/* Upgrade Feature List (in modal) */
.upgrade-feature-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upgrade-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.92em;
    color: var(--text);
}

.upgrade-feature-item i {
    color: #ffc107;
    font-size: 1em;
}

/* =========================================
   Cookie Consent Banner
   ========================================= */

.cookie-consent-banner {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    animation: fadeInOverlay 0.3s ease-out;
}

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

@keyframes slideUpBanner {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.cookie-consent-inner {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    animation: slideUpBanner 0.4s ease-out;
    position: relative;
}

.cookie-consent-lang-toggle {
    position: absolute;
    bottom: 12px;
    right: 16px;
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.cookie-consent-lang-toggle .lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}
.cookie-consent-lang-toggle .lang-btn:not(:last-child) {
    border-right: 1px solid var(--border);
}
.cookie-consent-lang-toggle .lang-btn:hover {
    background: var(--border);
}
.cookie-consent-lang-toggle .lang-btn.active {
    background: var(--primary);
    color: #fff;
}
.cookie-consent-lang-toggle .lang-flag {
    font-size: 0.85rem;
    line-height: 1;
}

.cookie-consent-text {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.cookie-consent-text > i {
    font-size: 1.5em;
    color: var(--primary);
    margin-top: 2px;
    flex-shrink: 0;
}

.cookie-consent-text p {
    margin: 0;
    font-size: 0.92em;
    line-height: 1.6;
    color: var(--text);
}

.cookie-consent-text a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 500;
}

.cookie-consent-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cookie-consent-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.cookie-consent-details h4 {
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.cookie-consent-category {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cookie-consent-category:last-of-type {
    border-bottom: none;
    margin-bottom: 12px;
}

.cookie-consent-category strong {
    display: block;
    font-size: 0.92em;
    color: var(--text);
}

.cookie-consent-category small {
    display: block;
    font-size: 0.82em;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Alert styles for modals ── */
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger, #ef4444);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.92em;
}

@media (max-width: 768px) {
    .cookie-consent-inner {
        padding: 16px;
    }

    .cookie-consent-actions {
        flex-direction: column;
    }

    .cookie-consent-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .cookie-consent-text {
        flex-direction: column;
        text-align: center;
    }

    .cookie-consent-text > i {
        align-self: center;
    }
}

/* =========================================
   Multicolor Filament Slots
   ========================================= */
.filament-color-slot {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px 8px;
    margin-bottom: 8px;
    position: relative;
    transition: border-color 0.15s;
}
.filament-color-slot:hover {
    border-color: var(--primary-light);
}
.filament-slot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.filament-slot-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--primary);
}
.filament-slot-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    opacity: 0.7;
    transition: opacity 0.15s;
}
.filament-slot-remove:hover {
    opacity: 1;
    background: rgba(var(--danger-rgb, 220, 53, 69), 0.1);
}
.filament-color-slot .form-group {
    margin-bottom: 6px;
}
.filament-color-slot label {
    font-size: 0.78rem;
    margin-bottom: 2px;
}
.filament-color-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}
.filament-color-dots span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: inline-block;
}

/* =========================================
   AI Filament Modal
   ========================================= */
.ai-filament-modal {
    max-width: 560px;
}
.ai-modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* --- Text input block --- */
.ai-input-block {
    margin-bottom: 16px;
}
.ai-input-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.ai-input-block-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-bg, rgba(0, 168, 98, 0.1));
    color: var(--primary);
    font-size: 0.85rem;
    flex-shrink: 0;
}
.ai-input-block label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
}
.ai-input-section textarea {
    width: 100%;
    resize: vertical;
    min-height: 70px;
    max-height: 160px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    font-size: 0.9rem;
    background: var(--input-bg, var(--card-bg));
    color: var(--text-primary);
    transition: border-color 0.2s;
}
.ai-input-section textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 168, 98, 0.12);
}

/* --- Action row --- */
.ai-action-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}
.ai-voice-btn {
    flex-shrink: 0;
    gap: 6px;
}
.ai-voice-btn.recording {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    animation: voicePulse 1.2s infinite;
}
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
}
.ai-process-btn {
    flex: 1;
    gap: 6px;
    font-weight: 600;
}

/* --- Divider --- */
.ai-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 20px;
}
.ai-divider::before,
.ai-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.ai-divider span {
    font-size: 0.82rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* --- Attach dropzone --- */
.ai-attach-block {
    margin-bottom: 8px;
}
.ai-attach-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}
.ai-attach-dropzone:hover,
.ai-attach-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(0, 168, 98, 0.04);
}
.ai-attach-dropzone-content {
    margin-bottom: 12px;
}
.ai-attach-icon {
    font-size: 1.8rem;
    color: var(--text-light);
    margin-bottom: 8px;
    display: block;
}
.ai-attach-dropzone:hover .ai-attach-icon,
.ai-attach-dropzone.dragover .ai-attach-icon {
    color: var(--primary);
}
.ai-attach-main {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}
.ai-attach-formats {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0;
}
.ai-attach-browse-btn {
    font-size: 0.82rem;
}

/* --- Invoice hint --- */
.ai-invoice-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.25);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.ai-invoice-hint i {
    color: #f0ad4e;
    font-size: 1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

/* --- File preview --- */
.ai-file-preview {
    margin-top: 12px;
}
.ai-file-preview-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
}
.ai-preview-img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border);
}
.ai-preview-pdf {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.ai-preview-pdf i {
    font-size: 1.6rem;
    color: #e74c3c;
}
.ai-preview-pdf span {
    font-weight: 500;
    font-size: 0.9rem;
    word-break: break-all;
}
.ai-clear-file-btn {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--danger) !important;
    border-color: var(--danger) !important;
}
.ai-clear-file-btn:hover {
    background: var(--danger) !important;
    color: #fff !important;
}

/* --- Result section --- */
.ai-result-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.ai-result-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 14px 0;
    color: var(--text-primary);
}
.ai-preview-card {
    background: var(--bg-secondary, var(--bg));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 0;
    margin-bottom: 16px;
}
.preview-row {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
}
.preview-row:not(:last-child) {
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}
.preview-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.preview-label i {
    font-size: 0.8rem;
    width: 16px;
    text-align: center;
    color: var(--primary);
}
.preview-value {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.ai-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* --- Loading --- */
.ai-loading {
    margin-top: 20px;
}
.ai-loading .loading-spinner {
    text-align: center;
    padding: 30px 20px;
}
.ai-loading .loading-spinner i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}
.ai-loading .loading-spinner p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .ai-filament-modal { max-width: 95vw; }
    .ai-action-row { flex-direction: column; }
    .ai-process-btn { width: 100%; }
    .ai-voice-btn { width: 100%; }
    .preview-label { min-width: 100px; }
    .ai-attach-dropzone { padding: 16px 12px; }
}

/* ── Payment Type Selection Modal ── */
.payment-type-modal {
    max-width: 560px;
    width: 95vw;
}
.payment-type-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 20px;
}
.payment-type-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.payment-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px 20px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}
.payment-type-card:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
.payment-type-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
}
.payment-type-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.payment-type-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}
.payment-type-methods {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}
.payment-method-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.payment-method-badge i {
    font-size: 0.8rem;
}
@media (max-width: 480px) {
    .payment-type-options {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   AI Credits Topbar Badge
   ========================================= */
.ai-topbar-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--success, #4caf50);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    pointer-events: none;
    transition: background 0.3s ease;
}

#topbarAiCredits.credits-low .ai-topbar-badge {
    background: var(--warning, #ff9800);
}

#topbarAiCredits.credits-zero .ai-topbar-badge {
    background: var(--danger, #ef4444);
}

#topbarAiCredits.credits-zero {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Feedback Reply Bubbles ─────────────────── */
.feedback-reply-bubble {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
}

.feedback-reply-admin {
    background: rgba(255, 152, 0, 0.1);
    border-left-color: var(--warning);
}

.feedback-reply-user {
    background: var(--bg-secondary);
    border-left-color: var(--primary);
}

[data-bs-theme="dark"] .feedback-reply-bubble {
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
}

[data-bs-theme="dark"] .feedback-reply-admin {
    background: rgba(255, 152, 0, 0.12);
    color: #e0e0e0;
}

[data-bs-theme="dark"] .feedback-reply-user {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
}

/* =========================================
   iPhone 15 / Small Mobile (≤430px)
   ========================================= */
@media (max-width: 430px) {

    /* Stat cards: compact */
    .stat-card {
        padding: 14px 12px;
    }
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .stat-value {
        font-size: 1.35rem;
    }
    .stat-label {
        font-size: 0.72rem;
    }

    /* Toast notifications: prevent overflow */
    .x3d-toast {
        min-width: unset;
        max-width: calc(100vw - 32px);
        font-size: 0.82rem;
        padding: 10px 14px;
    }
    .x3d-toast-container {
        width: calc(100vw - 24px);
        left: 12px;
        transform: none;
        bottom: 16px;
    }

    /* Forms: tighter spacing */
    .form-group label {
        font-size: 0.8rem;
    }

    /* Grouped card items */
    .x3d-grouped-card .card-item {
        padding: 10px 12px;
    }

    /* Cookie consent */
    .cookie-consent {
        padding: 14px;
        font-size: 0.82rem;
    }
    .cookie-consent .btn {
        font-size: 0.8rem;
        padding: 8px 14px;
    }
}