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

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: #F9FAFB;
    color: #111827;
}

/* ── Login ── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #F3F4F6;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-top: 8px;
}

.login-subtitle {
    color: #6B7280;
    font-size: 13px;
    margin-top: 4px;
}

.shield-icon {
    font-size: 32px;
}

.login-error {
    background: #FEF2F2;
    color: #DC2626;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #FECACA;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    gap: 6px;
}

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

.btn-primary {
    background: #3B82F6;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #2563EB;
}

.btn-secondary {
    background: #6B7280;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #4B5563;
}

.btn-outline {
    background: transparent;
    color: #374151;
    border: 1px solid #D1D5DB;
}

.btn-outline:hover {
    background: #F3F4F6;
}

.btn-block {
    width: 100%;
    padding: 10px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-filter {
    background: #F3F4F6;
    color: #374151;
    padding: 6px 14px;
}

.btn-filter:hover {
    background: #E5E7EB;
}

.btn-filter.active {
    background: #3B82F6;
    color: #fff;
}

/* ── Header ── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left .shield-icon {
    font-size: 22px;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.refresh-timer {
    font-size: 12px;
    color: #6B7280;
    background: #F3F4F6;
    padding: 4px 12px;
    border-radius: 9999px;
}

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

.username {
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
}

/* ── Filter Bar ── */
.filter-bar {
    position: sticky;
    top: 56px;
    z-index: 90;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
}

.filter-buttons {
    display: flex;
    gap: 6px;
}

/* ── Main Content ── */
.main-content {
    margin-top: 56px;
    padding: 20px 24px 40px;
}

/* ── Metrics Grid ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid #E5E7EB;
}

.metric-card.border-blue   { border-left-color: #3B82F6; }
.metric-card.border-red    { border-left-color: #EF4444; }
.metric-card.border-green  { border-left-color: #10B981; }
.metric-card.border-amber  { border-left-color: #F59E0B; }
.metric-card.border-purple { border-left-color: #8B5CF6; }

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}

.metric-label {
    font-size: 12px;
    color: #6B7280;
    margin-top: 6px;
    font-weight: 500;
}

/* ── Chart ── */
.chart-container {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 14px;
}

/* ── Analysis Panel ── */
.analysis-panel {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.analysis-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.select-input {
    padding: 7px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    outline: none;
    color: #374151;
}

.select-input:focus {
    border-color: #3B82F6;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
}

.badge-info {
    background: #EFF6FF;
    color: #1D4ED8;
}

.badge-red {
    background: #FEF2F2;
    color: #DC2626;
}

.badge-green {
    background: #F0FDF4;
    color: #16A34A;
}

.badge-amber {
    background: #FFFBEB;
    color: #D97706;
}

.badge-blue {
    background: #EFF6FF;
    color: #2563EB;
}

.badge-gray {
    background: #F3F4F6;
    color: #6B7280;
}

.badge-orange {
    background: #FFF7ED;
    color: #EA580C;
}

.badge-purple {
    background: #F5F3FF;
    color: #7C3AED;
}

/* ── Progress Bar ── */
.analysis-progress {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #F3F4F6;
}

.progress-bar-container {
    height: 8px;
    background: #F3F4F6;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #2563EB);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #6B7280;
    margin-top: 8px;
}

.progress-latest {
    margin-top: 8px;
    font-size: 12px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Tabs ── */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #E5E7EB;
    margin-bottom: 0;
    background: #fff;
    border-radius: 8px 8px 0 0;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    position: relative;
}

.tab-btn:hover {
    color: #374151;
}

.tab-btn.active {
    color: #3B82F6;
    border-bottom-color: #3B82F6;
}

.tab-badge {
    background: #EF4444;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 9999px;
    margin-left: 4px;
    font-weight: 600;
}

/* ── Tab Toolbar ── */
.tab-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-left: 1px solid #E5E7EB;
    border-right: 1px solid #E5E7EB;
}

.search-input {
    padding: 6px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    width: 280px;
    outline: none;
}

.search-input:focus {
    border-color: #3B82F6;
}

.row-count {
    font-size: 12px;
    color: #9CA3AF;
    margin-left: auto;
}

/* ── Table ── */
.table-wrapper {
    max-height: calc(100vh - 500px);
    overflow-y: auto;
    border: 1px solid #E5E7EB;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fff;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: #F9FAFB;
    position: sticky;
    top: 0;
    border-bottom: 2px solid #E5E7EB;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    z-index: 10;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #F3F4F6;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table tr.threat-row {
    background: #FEF2F2;
    border-left: 3px solid #EF4444;
}

.data-table tr.uncertain-row {
    background: #FFFBEB;
    border-left: 3px solid #F59E0B;
}

.data-table tr:hover {
    background: #F9FAFB;
}

.data-table tr.threat-row:hover {
    background: #FEE2E2;
}

.data-table tr.uncertain-row:hover {
    background: #FEF3C7;
}

.data-table input[type="checkbox"] {
    cursor: pointer;
    width: 15px;
    height: 15px;
}

/* ── Explanation Row ── */
.explanation-row td {
    padding: 12px 16px;
    background: #F9FAFB;
    border-left: 3px solid #3B82F6;
    white-space: normal;
    max-width: none;
}

.explanation-box {
    font-size: 13px;
    line-height: 1.6;
    color: #374151;
}

/* ── Expand Button ── */
.btn-expand {
    background: none;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 12px;
    color: #6B7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-expand:hover {
    background: #F3F4F6;
}

/* ── Status Badges ── */
.status-2xx { background: #F0FDF4; color: #16A34A; }
.status-3xx { background: #EFF6FF; color: #2563EB; }
.status-4xx { background: #FFFBEB; color: #D97706; }
.status-5xx { background: #FEF2F2; color: #DC2626; }

/* ── Analysis complete message ── */
.analysis-complete {
    margin-top: 12px;
    padding: 10px 14px;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 6px;
    font-size: 13px;
    color: #16A34A;
    font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .analysis-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    .header {
        padding: 0 12px;
    }
    .main-content {
        padding: 20px 12px;
    }
}
