:root {
    --primary: #1e40af;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
}
body { font-family: 'Segoe UI', sans-serif; font-size: 16px; }
.card-menu { border-radius: 16px; padding: 24px; text-align: center; cursor: pointer; transition: transform .15s, box-shadow .15s; border: none; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.card-menu:active { transform: scale(.96); }
.card-menu i { font-size: 2rem; margin-bottom: 8px; }
.card-menu h6 { font-size: 1rem; font-weight: 700; margin: 0; }
.btn-lg-custom { font-size: 1.1rem; padding: 14px 24px; border-radius: 12px; font-weight: 600; }
.input-lg-custom { font-size: 1.2rem; padding: 14px 16px; border-radius: 12px; }
.chip-btn { display: inline-block; padding: 10px 20px; border-radius: 24px; font-weight: 600; font-size: .95rem; cursor: pointer; border: 2px solid #e5e7eb; background: #fff; transition: all .15s; }
.chip-btn.active, .chip-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }
.loading-spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #e5e7eb; border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-custom { border-radius: 12px; padding: 12px 20px; font-weight: 500; }
.empty-state { text-align: center; padding: 48px 24px; color: #9ca3af; }
.empty-state i { font-size: 3rem; margin-bottom: 12px; }
.numeric-input { font-size: 1.5rem; font-weight: 700; text-align: center; }

/* Modern Date Cards */
.date-card-modern, .date-card-today, .date-card-holiday {
    border-radius: 14px; padding: 16px 18px; margin-bottom: 10px; background: #fff;
    border-left: 5px solid var(--primary); cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.05); transition: transform .12s, box-shadow .12s;
}
.date-card-modern:active, .date-card-today:active, .date-card-holiday:active { transform: scale(.98); }
.date-card-today { border-left-color: var(--success); background: linear-gradient(135deg, #f0fdf4, #dcfce7); box-shadow: 0 4px 16px rgba(22,163,74,.12); }
.date-card-holiday { border-left-color: var(--danger); background: linear-gradient(135deg, #fef2f2, #fecaca40); }
.date-num-box { width: 44px; height: 44px; border-radius: 12px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; color: #334155; flex-shrink: 0; }
.date-num-box.today { background: var(--success); color: #fff; }
.date-num-box.holiday { background: var(--danger); color: #fff; }
.today-badge { font-size: .65rem; font-weight: 700; background: var(--success); color: #fff; padding: 2px 8px; border-radius: 8px; text-transform: uppercase; }
.holiday-badge { font-size: .65rem; font-weight: 600; background: #fecaca; color: #991b1b; padding: 2px 8px; border-radius: 8px; }
.holiday-overlay { position: absolute; top: 0; right: 0; background: #dc2626; color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 0 12px 0 8px; z-index: 2; letter-spacing: .5px; }

/* QR Scanner */
.qr-scanner-box { position: relative; border-radius: 16px; overflow: hidden; background: #000; height: 300px; }
.qr-scanner-box #qr-reader { width: 100%; height: 100%; }
.qr-scanner-box #qr-reader video { width: 100%; height: 100%; object-fit: cover; }
.qr-scanner-box #qr-reader img[alt="Info icon"] { display: none; }
.qr-scanner-box #qr-shaded-region { display: none !important; }
.qr-close-btn { position: absolute; top: 10px; right: 10px; z-index: 20; border-radius: 50%; width: 34px; height: 34px; padding: 0; opacity: .85; }
.qr-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10; pointer-events: none; }
.qr-frame { width: 200px; height: 200px; position: relative; }
.qr-corner { position: absolute; width: 28px; height: 28px; border-color: #22c55e; border-style: solid; }
.qr-corner.tl { top: 0; left: 0; border-width: 4px 0 0 4px; border-radius: 8px 0 0 0; }
.qr-corner.tr { top: 0; right: 0; border-width: 4px 4px 0 0; border-radius: 0 8px 0 0; }
.qr-corner.bl { bottom: 0; left: 0; border-width: 0 0 4px 4px; border-radius: 0 0 0 8px; }
.qr-corner.br { bottom: 0; right: 0; border-width: 0 4px 4px 0; border-radius: 0 0 8px 0; }
.qr-scanline { position: absolute; left: 10%; width: 80%; height: 2px; background: linear-gradient(90deg, transparent, #22c55e, transparent); top: 50%; animation: scanmove 2s ease-in-out infinite; }
@keyframes scanmove { 0%,100% { top: 15%; } 50% { top: 85%; } }
.qr-hint { color: #fff; font-size: .75rem; font-weight: 600; margin-top: 14px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }

/* Voice */
.voice-btn { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; border-color: #dc2626; }
.voice-btn:active { background: #991b1b; color: #fff; }
.voice-status-bar { display: flex; align-items: center; padding: 10px 16px; background: #fef2f2; border-radius: 10px; font-weight: 500; font-size: .85rem; font-family: 'Segoe UI', -apple-system, sans-serif; letter-spacing: .2px; }
.blink { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.voice-pulse-ring { width:80px;height:80px;border-radius:50%;background:linear-gradient(135deg,#3b82f6,#2563eb);display:flex;align-items:center;justify-content:center;margin:0 auto;animation:voicePulse 1.5s infinite;box-shadow:0 0 0 0 rgba(59,130,246,.5); }
@keyframes voicePulse { 0%{box-shadow:0 0 0 0 rgba(59,130,246,.5)} 70%{box-shadow:0 0 0 20px rgba(59,130,246,0)} 100%{box-shadow:0 0 0 0 rgba(59,130,246,0)} }
.voice-step-dot { width:10px;height:10px;border-radius:50%;background:#e2e8f0;transition:all .3s }
.voice-step-dot.active { background:#3b82f6;transform:scale(1.3) }

/* Spreadsheet Table */
.spreadsheet-table { font-size: .8rem; white-space: nowrap; }
.spreadsheet-table thead { background: #1e293b; color: #fff; }
.spreadsheet-table th { padding: 8px 10px; font-weight: 600; position: sticky; top: 0; }
.spreadsheet-table td { padding: 6px 10px; vertical-align: middle; }
.spreadsheet-table tbody tr:nth-child(even) { background: #f8fafc; }
.spreadsheet-table code { font-size: .75rem; background: #e0e7ff; padding: 2px 6px; border-radius: 4px; color: var(--primary); }


/* Barcode 1D Scanner */
.barcode-scanner-box { position: relative; border-radius: 16px; overflow: hidden; background: #000; height: 250px; }
.barcode-scanner-box #qr-reader { width: 100%; height: 100%; }
.barcode-scanner-box #qr-reader video { width: 100%; height: 100%; object-fit: cover; }
.barcode-scanner-box #qr-reader img[alt="Info icon"] { display: none; }
.barcode-scanner-box #qr-shaded-region { display: none !important; }
.barcode-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10; pointer-events: none; }
.barcode-frame { width: 280px; height: 80px; border: 2px solid rgba(34,197,94,.8); border-radius: 12px; position: relative; background: rgba(34,197,94,.05); }
.barcode-line { position: absolute; top: 50%; left: 5%; width: 90%; height: 2px; background: #22c55e; box-shadow: 0 0 8px #22c55e; animation: barcode-scan 2s linear infinite; }
@keyframes barcode-scan { 0%,100%{transform:translateY(-30px)} 50%{transform:translateY(30px)} }
.barcode-hint { color: #fff; font-size: .8rem; margin-top: 12px; text-shadow: 0 1px 4px rgba(0,0,0,.8); font-weight: 500; }

/* Voice Input - Centered & Bigger */
.voice-btn { background: linear-gradient(135deg,#dc2626,#b91c1c) !important; color:#fff !important; border-color:#dc2626 !important; }
.voice-btn:active { transform: scale(.95); }
.voice-status-bar { animation: voice-pulse 1.5s ease-in-out infinite; }
@keyframes voice-pulse { 0%,100%{opacity:1} 50%{opacity:.6} }


/* Print Styles - A4 Layout */
@media print {
    body { background: #fff !important; font-size: 11px; }
    .container-fluid { max-width: 100% !important; padding: 0 !important; }
    #toast-container, .btn, button, .chip-btn, .form-control, .form-select, nav, .admin-sidebar,
    .admin-header, [onclick], .card-menu { display: none !important; }
    .print-report-preview { display: block !important; }
    .card { border: none !important; box-shadow: none !important; padding: 0 !important; }
    table { border-collapse: collapse; width: 100%; page-break-inside: auto; }
    tr { page-break-inside: avoid; page-break-after: auto; }
    thead { display: table-header-group; }
    @page { size: A4 portrait; margin: 15mm; }
    h6 { page-break-after: avoid; }
}

/* Print preview styling */
.print-report-preview { font-size: .9rem; }
.print-report-preview table { margin-bottom: 1rem; }
.print-report-preview h6 { margin-top: 1rem; color: #1e40af; }


/* Custom Modal/Popup Styles */
.modal { backdrop-filter: blur(4px); }
.modal .modal-content {
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: modalSlideUp .25s ease-out;
}
.modal .modal-dialog-centered .modal-content {
    border-radius: 20px;
}
.modal .list-group-item { border-radius: 10px; margin-bottom: 4px; border: 1px solid #f1f5f9; transition: background .15s; }
.modal .list-group-item:active { background: #eff6ff; transform: scale(.98); }
.modal .modal-body { max-height: 60vh; overflow-y: auto; }
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== GLOBAL NUMERIC KEYPAD ===== */
#global-numpad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
    box-shadow: 0 -4px 20px rgba(0,0,0,.15);
    padding: 8px 8px 12px;
    animation: gnpSlideUp .2s ease-out;
}
@keyframes gnpSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.gnp-keypad {
    max-width: 400px;
    margin: 0 auto;
    user-select: none;
}
.gnp-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.gnp-btn {
    flex: 1;
    height: 52px;
    font-size: 1.3rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
    transition: background .08s, transform .08s;
    -webkit-tap-highlight-color: transparent;
}
.gnp-btn:active {
    background: #e2e8f0;
    transform: scale(.96);
}
.gnp-btn-danger {
    background: #fef2f2;
    color: #dc2626;
}
.gnp-btn-danger:active {
    background: #fecaca;
}
.gnp-btn-ghost {
    background: #e2e8f0;
    color: #475569;
}
.gnp-btn-ghost:active {
    background: #cbd5e1;
}
.gnp-btn-primary {
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    letter-spacing: 1px;
}
.gnp-btn-primary:active {
    background: #1d4ed8;
}
