/* HMA Scanner - Estilos PWA
   Hugo Morales & Asociados S.A.S.
   Version 1.0 - Feb 2026 */

/* === Variables === */
:root {
    --primary: #4a5240;
    --primary-light: #5d6652;
    --primary-dark: #3a4132;
    --accent: #c4a35a;
    --accent-light: #d4b86e;
    --accent-dark: #a88a42;
    --bg: #f5f5f3;
    --bg-card: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #2563eb;
    --info-light: #eff6ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --header-h: 56px;
    --nav-h: 64px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === App Layout === */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    padding-top: var(--safe-top);
}

.screen.active {
    display: flex;
}

/* === Header === */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    padding: 0 16px;
    background: var(--primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: center;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.header-btn:hover, .header-btn:active {
    background: rgba(255,255,255,0.25);
}

.header-btn.invisible {
    visibility: hidden;
}

/* === Content === */
.content {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.content.no-nav {
    padding-bottom: calc(var(--safe-bottom) + 16px);
}

.content.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* === Login Screen === */
.login-container {
    width: 100%;
    max-width: 360px;
    padding: 32px 24px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--accent);
    box-shadow: var(--shadow-md);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(196, 163, 90, 0.2);
}

.form-input.pin-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.5em;
    font-weight: 600;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-dark);
    box-shadow: var(--shadow);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-full {
    width: 100%;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

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

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    height: 36px;
    padding: 0 16px;
    font-size: 0.875rem;
    border-radius: 6px;
}

.btn-lg {
    height: 56px;
    padding: 0 32px;
    font-size: 1.125rem;
    border-radius: var(--radius);
}

/* === Home Screen === */
.home-welcome {
    text-align: center;
    padding: 16px 0;
}

.home-welcome h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.home-welcome .sede-name {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 2px;
}

.scan-button-container {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.scan-button {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(196, 163, 90, 0.4);
    transition: all 0.3s;
}

.scan-button:active {
    transform: scale(0.95);
    box-shadow: 0 4px 15px rgba(196, 163, 90, 0.3);
}

.scan-button .scan-icon {
    font-size: 3rem;
    line-height: 1;
}

.scan-button .scan-label {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Stats Cards */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* Recent List */
.section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 20px 0 12px;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.recent-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.recent-icon.factura { background: var(--success-light); color: var(--success); }
.recent-icon.nc { background: var(--danger-light); color: var(--danger); }

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

.recent-num {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-nit { font-size: 0.75rem; color: var(--text-light); }
.recent-total { font-size: 0.9375rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.recent-time { font-size: 0.6875rem; color: var(--text-muted); }

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-light);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.9375rem; }

/* === Scanner Screen === */
.scanner-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    position: relative;
}

#qr-reader {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

#qr-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: absolute;
    top: 0;
    left: 0;
}

.scanner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.scanner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(70vw, 280px);
    height: min(70vw, 280px);
}

.scanner-frame::before,
.scanner-frame::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: var(--accent);
    border-style: solid;
}

.scanner-frame::before {
    top: 0; left: 0;
    border-width: 3px 0 0 3px;
    border-radius: 4px 0 0 0;
}

.scanner-frame::after {
    top: 0; right: 0;
    border-width: 3px 3px 0 0;
    border-radius: 0 4px 0 0;
}

.scanner-frame-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
}

.scanner-frame-bottom::before,
.scanner-frame-bottom::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: var(--accent);
    border-style: solid;
}

.scanner-frame-bottom::before {
    bottom: 0; left: 0;
    border-width: 0 0 3px 3px;
    border-radius: 0 0 0 4px;
}

.scanner-frame-bottom::after {
    bottom: 0; right: 0;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 4px 0;
}

.scanner-line {
    position: absolute;
    left: 10px; right: 10px;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(196, 163, 90, 0.6);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { top: 10px; }
    50% { top: calc(100% - 10px); }
}

.scanner-hint {
    position: absolute;
    bottom: 80px;
    left: 0; right: 0;
    text-align: center;
    color: #fff;
    font-size: 0.875rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    z-index: 11;
}

.scanner-actions {
    position: absolute;
    bottom: 20px;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    z-index: 11;
    padding-bottom: var(--safe-bottom);
}

/* === Result Screen === */
.result-content { padding: 16px; }

.result-status {
    text-align: center;
    padding: 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
}

.result-status.success { background: var(--success-light); color: var(--success); }
.result-status.error { background: var(--danger-light); color: var(--danger); }
.result-status.warning { background: var(--warning-light); color: var(--warning); }
.result-status.nit-warning { background: #fff3cd; color: #856404; border: 2px solid #ffc107; }
.result-status.nit-warning .status-detail { opacity: 1; color: #664d03; line-height: 1.5; }
.result-status.nit-warning .status-detail b { color: #dc3545; }
.result-status .status-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.result-status .status-text { font-size: 1rem; font-weight: 600; }
.result-status .status-detail { font-size: 0.8125rem; margin-top: 4px; opacity: 0.8; }

/* Invoice Details */
.invoice-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
}

.invoice-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
}

.invoice-card-header h3 { font-size: 0.9375rem; font-weight: 600; }

.invoice-card-body { padding: 4px 0; }

.invoice-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.invoice-row:last-child { border-bottom: none; }
.invoice-row-label { font-size: 0.8125rem; color: var(--text-light); flex-shrink: 0; }
.invoice-row-value { font-size: 0.9375rem; font-weight: 600; text-align: right; word-break: break-all; }
.invoice-row-value.total { font-size: 1.125rem; color: var(--primary); }

/* Categoria Section */
.categoria-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.categoria-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.categoria-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
}
.categoria-required {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--danger);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.categoria-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.cat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 25px;
    border: 2.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    font-family: inherit;
    user-select: none;
}
.cat-btn:active { transform: scale(0.96); }
.cat-btn.selected {
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: scale(1.02);
}
.cat-btn.selected::after {
    content: ' \2713';
    margin-left: 4px;
    font-weight: 700;
}
/* Badge de categoria en historial */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff;
    margin-top: 2px;
}

/* Photo Section */
.photo-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.photo-section h4 { font-size: 0.875rem; font-weight: 600; margin-bottom: 12px; color: var(--text-light); }

.photo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.photo-upload-area:hover, .photo-upload-area.dragover {
    border-color: var(--accent);
    background: rgba(196, 163, 90, 0.05);
}

.photo-upload-area .upload-icon { font-size: 2rem; color: var(--text-muted); margin-bottom: 8px; }
.photo-upload-area p { font-size: 0.875rem; color: var(--text-light); }

.photo-preview { display: none; position: relative; }
.photo-preview img { width: 100%; border-radius: var(--radius-sm); }
.photo-preview .remove-photo {
    position: absolute; top: 8px; right: 8px;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(0,0,0,0.6); color: #fff; border: none;
    font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Notes */
.notes-section { margin-bottom: 16px; }

.notes-input {
    width: 100%;
    min-height: 80px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.9375rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.notes-input:focus { outline: none; border-color: var(--accent); }

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
}

/* === Historial Screen === */
.historial-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.date-selector { display: flex; align-items: center; gap: 8px; }

.date-selector input[type="date"] {
    height: 40px;
    padding: 0 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    -webkit-appearance: none;
}

.date-selector input[type="date"]:focus { outline: none; border-color: var(--accent); }

.historial-stats { display: flex; gap: 12px; margin-bottom: 16px; }

.historial-stat {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.historial-stat .h-stat-value { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.historial-stat .h-stat-label { font-size: 0.6875rem; color: var(--text-light); text-transform: uppercase; }

.historial-list { display: flex; flex-direction: column; gap: 8px; }

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

.historial-item .h-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
    background: var(--success-light); color: var(--success);
}

.historial-item .h-icon.with-photo { background: var(--info-light); color: var(--info); }
.historial-item .h-info { flex: 1; min-width: 0; }
.historial-item .h-num { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.historial-item .h-nit { font-size: 0.75rem; color: var(--text-light); }
.historial-item .h-right { text-align: right; flex-shrink: 0; }
.historial-item .h-total { font-size: 0.875rem; font-weight: 700; color: var(--primary); }
.historial-item .h-time { font-size: 0.6875rem; color: var(--text-muted); }

/* === Bottom Navigation === */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--accent); }
.nav-item .nav-icon { font-size: 1.5rem; line-height: 1; }
.nav-item .nav-label { font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-icon { font-size: 1.25rem; flex-shrink: 0; line-height: 1; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #bfdbfe; }

/* === Toast === */
.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: calc(100% - 32px);
    text-align: center;
    pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-success { background: var(--success); }
.toast.toast-danger { background: var(--danger); }
.toast.toast-warning { background: #92400e; }

/* === Loader Overlay === */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-overlay.active { display: flex; }

.loader-spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loader-text { color: #fff; font-size: 0.875rem; margin-top: 12px; text-align: center; }
.loader-box { display: flex; flex-direction: column; align-items: center; }

/* === Badge === */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px;
    font-size: 0.6875rem; font-weight: 700; line-height: 1;
}

.badge-accent { background: var(--accent); color: #fff; }
.badge-success { background: var(--success); color: #fff; }
.badge-danger { background: var(--danger); color: #fff; }

/* === Duplicate Warning === */
.duplicate-card {
    background: var(--warning-light);
    border: 2px solid #fbbf24;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.duplicate-card .dup-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #92400e; margin-bottom: 8px; }
.duplicate-card .dup-detail { font-size: 0.875rem; color: #78350f; line-height: 1.6; }

/* === Utilities === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-row { display: flex; flex-direction: row; }

/* === Media Queries === */
@media (min-width: 480px) {
    .scanner-frame { width: min(60vw, 320px); height: min(60vw, 320px); }
}

@media (min-width: 768px) {
    .content { max-width: 480px; margin: 0 auto; }
    .header { max-width: 480px; margin: 0 auto; }
    .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
}


/* === DIAN Lookup (solo_url QR) === */
.result-status.dian-loading {
    background: #e8f4fd;
    color: #1565c0;
    border: 2px solid #42a5f5;
}
.result-status.dian-loading .status-detail {
    opacity: 1;
    color: #1976d2;
    line-height: 1.6;
}
.dian-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(21, 101, 192, 0.2);
    border-top-color: #1565c0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@media print {
    .header, .bottom-nav, .scanner-container, .loader-overlay { display: none !important; }
}
