@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #020617;
    --surface: #0F172A;
    --surface-hover: #1E293B;
    --primary: #22D3EE;
    --cta-green: #22C55E;
    --danger: #EF4444;
    --warning: #F59E0B;
    --text-main: #F8FAFC;
    --text-muted: #64748B;
    --border: rgba(255, 255, 255, 0.05);
    --border-strong: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    background-image: 
        radial-gradient(at 100% 0%, rgba(34, 211, 238, 0.05) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(34, 197, 94, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Typography Helpers */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }

/* Layout Containers */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Elements */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
}

.logo svg {
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.4));
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-shrink: 0;
}

.rules-modal-content {
    max-width: 640px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.rules-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
    overflow-y: auto;
}

.rules-eval-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.4);
}

.rules-bucket-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.15rem;
    margin-bottom: 0.85rem;
    background: rgba(15, 23, 42, 0.35);
}

.rules-bucket-card:last-child {
    margin-bottom: 0;
}

.rules-bucket-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.rules-bucket-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
}

.rules-bucket-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.rules-bucket-badge.auto {
    color: var(--cta-green);
    border-color: rgba(34, 197, 94, 0.35);
}

.rules-bucket-badge.manual {
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.4);
}

.rules-bucket-summary {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.65rem;
    line-height: 1.45;
}

.rules-bucket-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.55;
}

.rules-bucket-list li {
    margin-bottom: 0.35rem;
}

.rules-bucket-list li:last-child {
    margin-bottom: 0;
}

.rule-config-grid .rule-thresholds {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
}

.rule-section-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rule-check-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.45rem 0;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
}

.rule-check-row input {
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

/* Badges */
.role-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn.btn-rules-info {
    flex-shrink: 0;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    color: var(--primary);
    border-color: rgba(34, 211, 238, 0.45);
    background: rgba(34, 211, 238, 0.1);
    font-size: 0.8rem;
    font-weight: 600;
}

.btn.btn-rules-info:hover {
    background: rgba(34, 211, 238, 0.18);
    border-color: var(--primary);
    color: #67e8f9;
}

.btn.btn-rules-info .rules-info-icon {
    display: block;
    flex-shrink: 0;
}

.btn.btn-rules-info .rules-info-label {
    line-height: 1;
}

.btn-primary {
    background: var(--text-main);
    color: var(--bg-dark);
    border: none;
    box-shadow: 0 0 15px rgba(248, 250, 252, 0.1);
}

.btn-primary:hover {
    background: #E2E8F0;
    box-shadow: 0 0 20px rgba(248, 250, 252, 0.2);
    border-color: transparent;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Glassmorphic Cards */
.card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    padding: 1rem 1.5rem 0 1.5rem;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 12px 12px 0 0;
}

.tab {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text-main);
}

.tab.active {
    color: var(--text-main);
    border-bottom: 2px solid var(--primary);
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

/* Datatable */
.datatable-wrapper {
    overflow-x: auto;
    width: 100%;
}

.datatable {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.datatable th {
    background: transparent;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-strong);
}

.datatable td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: #CBD5E1;
}

.datatable tr {
    transition: background-color 0.2s ease;
}

.datatable tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

.datatable tbody tr:last-child td {
    border-bottom: none;
}

/* Timeline */
.timeline {
    border-left: 2px solid var(--border-strong);
    padding-left: 1.5rem;
    position: relative;
}

.timeline-item {
    margin-bottom: 1.5rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.8rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--primary);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.timeline-content {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.cases-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.35);
}

.cases-search-input {
    flex: 1;
    max-width: 420px;
    margin: 0;
}

.cases-count-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.datatable .col-num {
    width: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.datatable td.col-num {
    font-weight: 600;
    color: var(--primary);
}

/* Indicators */
.bucket-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.bucket-Green { background: var(--cta-green); box-shadow: 0 0 10px var(--cta-green); }

.bucket-Yellow,
.bucket-Various_Stations { background: var(--warning); box-shadow: 0 0 10px var(--warning); }

.bucket-Red,
.bucket-Suspicious_Fraud { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

.bucket-Consistent_Fuel { background: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, 0.45); }

/* Login Elements */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem 2.5rem;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.sync-date-fields {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.sync-date-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sync-date-input {
    min-width: 10.5rem;
    padding: 0.45rem 0.65rem;
}

.lms3-ping-status {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.45);
}

.lms3-ping-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}

.lms3-ping-idle .lms3-ping-dot { background: var(--text-muted); }
.lms3-ping-checking .lms3-ping-dot { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }
.lms3-ping-ok .lms3-ping-dot { background: var(--cta-green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.55); }
.lms3-ping-error .lms3-ping-dot { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.55); }

.lms3-ping-ok { color: var(--cta-green); border-color: rgba(34, 197, 94, 0.35); }
.lms3-ping-error { color: #ef4444; border-color: rgba(239, 68, 68, 0.35); }
.lms3-ping-checking { color: #f59e0b; border-color: rgba(245, 158, 11, 0.35); }

.lms3-ping-control {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: rgba(15, 23, 42, 0.75);
}

.lms3-ping-control-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.lms3-ping-control-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.lms3-ping-control-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.lms3-ping-card {
    border-color: rgba(34, 211, 238, 0.25);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(100, 116, 139, 0.55);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(34, 197, 94, 0.85);
    border-color: rgba(34, 197, 94, 0.95);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.45);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* XL Modal - Two Column */
.modal-xl {
    max-width: 1000px !important;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 92vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    flex-shrink: 0;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-badge {
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.3);
}

.modal-badge.bucket-Green {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
    border-color: rgba(34,197,94,0.3);
}

.modal-badge.bucket-Yellow,
.modal-badge.bucket-Various_Stations {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
    border-color: rgba(245,158,11,0.3);
}

.modal-badge.bucket-Red,
.modal-badge.bucket-Suspicious_Fraud {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border-color: rgba(239,68,68,0.3);
}

.modal-badge.bucket-Consistent_Fuel {
    background: rgba(56,189,248,0.15);
    color: #38bdf8;
    border-color: rgba(56,189,248,0.35);
}

.modal-close-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: var(--border);
    color: var(--text-main);
}

.modal-body {
    display: grid;
    grid-template-columns: 340px 1fr;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.modal-left-panel {
    padding: 1.5rem;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: rgba(255,255,255,0.02);
}

.modal-right-panel {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.panel-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.info-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.info-value {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
}

.info-value.mono {
    font-family: 'Fira Code', monospace;
    color: var(--primary);
    font-size: 0.85rem;
}

.info-reason-block {
    padding: 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.fine-breakdown-details {
    padding: 0;
    overflow: hidden;
}

.fine-breakdown-details > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    user-select: none;
}

.fine-breakdown-details > summary::-webkit-details-marker {
    display: none;
}

.fine-breakdown-summary-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.fine-breakdown-chevron {
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
    margin-right: 0.15rem;
}

.fine-breakdown-details[open] .fine-breakdown-chevron {
    transform: rotate(45deg);
    margin-top: -0.15rem;
}

.fine-breakdown-amount {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--danger);
}

.fine-breakdown-content {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.6;
    padding: 0 0.75rem 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0;
    padding-top: 0.65rem;
}

.txn-count-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.1);
    color: var(--primary);
    border: 1px solid rgba(34, 211, 238, 0.2);
    margin-left: 0.25rem;
}

/* Updated timeline for right panel */
.modal-right-panel .timeline {
    flex: 1;
    padding-right: 0.25rem;
}

.modal-right-panel .timeline-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.modal-right-panel .timeline-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding-top: 0.1rem;
    min-width: 115px;
}

.modal-right-panel .timeline-content {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    flex: 1;
    font-size: 0.82rem;
    transition: border-color 0.2s;
    background: rgba(255,255,255,0.02);
}

.modal-right-panel .timeline-content:hover {
    border-color: var(--border-strong);
}


/* Funny Loader */
.siren-loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.05);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin-siren 1s cubic-bezier(0.5, 0, 0.5, 1) infinite, color-siren 3s linear infinite;
}

@keyframes spin-siren {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes color-siren {
    0% { border-top-color: var(--primary); box-shadow: 0 -10px 20px rgba(34, 211, 238, 0.2); }
    33% { border-top-color: var(--cta-green); box-shadow: 10px 10px 20px rgba(34, 197, 94, 0.2); }
    66% { border-top-color: var(--warning); box-shadow: -10px 10px 20px rgba(245, 158, 11, 0.2); }
    100% { border-top-color: var(--primary); box-shadow: 0 -10px 20px rgba(34, 211, 238, 0.2); }
}
