/* components.css — Buttons, forms, tables, badges, cards, modals, toasts
 *
 * iOS/macOS design language: clean, minimal, rounded, frosted glass,
 * consistent spacing (8px base), standardized component heights.
 *
 * Height scale: XS=24px, SM=28px, MD=34px, LG=40px, XL=48px
 * Font scale: 11px(xs), 12px(sm), 13px(body), 14px(md), 16px(lg), 20px(xl)
 * Radius: XS=4px, SM=6px, MD=8px, LG=12px, XL=16px, Full=9999px
 * Spacing: 4, 8, 12, 16, 20, 24, 32, 40, 48
 */

/* ═══════════════════════════════════════════════════════════════
   BUTTONS — iOS style
   ═══════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 34px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
    letter-spacing: -0.003em;
    box-sizing: border-box;
}

.btn:active {
    transform: scale(0.97);
}

.btn:focus-visible {
    box-shadow: var(--focus-ring);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 1px 3px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px var(--accent-glow);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 1px 2px var(--accent-glow);
}

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

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 1px 3px var(--danger-border);
}

.btn-danger:hover {
    box-shadow: 0 4px 12px var(--danger-border);
    filter: brightness(1.05);
}

.btn-danger:focus-visible {
    box-shadow: var(--focus-ring-danger);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 3px var(--success-border);
}

.btn-success:hover {
    box-shadow: 0 4px 12px var(--success-border);
    filter: brightness(1.05);
}

/* Size variants */
.btn-xs {
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-sm {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-lg {
    height: 40px;
    padding: 0 20px;
    font-size: 14px;
}

.btn-xl {
    height: 48px;
    padding: 0 24px;
    font-size: 16px;
    border-radius: 12px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
}

.btn:disabled, .btn[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Full-width button (used by login/setup forms) */
.btn-full-width {
    width: 100%;
}

/* Button group */
.btn-group {
    display: inline-flex;
    gap: 0;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

/* ═══════════════════════════════════════════════════════════════
   FORMS — macOS style
   ═══════════════════════════════════════════════════════════════ */
.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
    letter-spacing: -0.003em;
}

.form-field .required { color: var(--danger); }

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 0 12px;
    height: 34px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-field textarea {
    height: auto;
    min-height: 80px;
    padding: 8px 12px;
}

.form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--text-muted);
}

.form-field input:hover,
.form-field select:hover,
.form-field textarea:hover {
    border-color: var(--border-strong);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-field input[aria-invalid="true"],
.form-field.has-error input {
    border-color: var(--danger);
}

.form-field input[aria-invalid="true"]:focus,
.form-field.has-error input:focus {
    box-shadow: 0 0 0 3px var(--danger-bg);
}

/* Checkbox / toggle — must NOT inherit full-width + 34px height */
.form-field input[type="checkbox"],
.form-field input[type="radio"] {
    width: auto;
    height: auto;
    padding: 0;
    border: none;
    box-shadow: none;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Inline checkbox layout: label + checkbox on the same line */
.form-field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.form-field-inline label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.003em;
    margin-bottom: 0;
    cursor: pointer;
}

.form-field-inline input[type="checkbox"],
.form-field-inline input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* Form grid — responsive two-column form layout */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0 20px;
    }
    /* Fields that should span full width */
    .form-grid .form-field-full,
    .form-grid .form-field-inline,
    .form-grid .nat-dynamic-fields,
    .form-grid .flex {
        grid-column: 1 / -1;
    }
}

/* Full-width variants for inputs/selects (used by modals) */
.input-full-width { width: 100%; }
.select-full-width { width: 100%; }

/* ═══════════════════════════════════════════════════════════════
   FILTER BAR — unified compact style (single source of truth)
   ═══════════════════════════════════════════════════════════════ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light, var(--border));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.filter-bar .form-field {
    margin-bottom: 0;
}

.filter-bar .form-field label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.filter-bar .form-field input,
.filter-bar .form-field select {
    height: 30px;
    font-size: 12px;
    padding: 0 10px;
}

.filter-bar .btn {
    height: 30px;
    font-size: 12px;
}

.filter-bar .btn-sm {
    height: 30px;
    padding: 0 12px;
}

.filter-bar .btn-xs {
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
}

/* Filter bar sub-components (used by report-components and compliance) */
.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.filter-item.filter-search {
    flex: 1;
    min-width: 180px;
}

.filter-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select,
.filter-input {
    padding: 0 10px;
    height: 32px;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    box-sizing: border-box;
}

.filter-select:hover,
.filter-input:hover {
    border-color: var(--border-strong);
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-card);
}

.filter-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Status count pills — clickable quick-filter */
.status-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.status-pills .btn {
    height: 26px;
    padding: 0 12px;
    font-size: 11px;
    border-radius: 13px;
    font-weight: 500;
}

.field-error {
    font-size: 12px;
    color: var(--danger);
    min-height: 1.3em;
    margin-top: 4px;
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES — clean, spacious
   ═══════════════════════════════════════════════════════════════ */
/* ─── Base Data Table — premium dashboard style ────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    white-space: nowrap;
    transition: color var(--transition), background var(--transition);
}

.data-table td {
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light, var(--border));
    transition: background var(--transition), box-shadow var(--transition);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover td {
    background: var(--accent-light);
}

.data-table tbody tr:active td {
    background: var(--accent-medium);
}

/* Alternating row subtle tint (every even row) */
.data-table tbody tr:nth-child(even) td {
    background: var(--bg-sunken, var(--bg-tertiary));
}

.data-table tbody tr:nth-child(even):hover td {
    background: var(--accent-light);
}

/* First and last cell radius for rounded container look */
.data-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius);
}

.data-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius);
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 14px !important;
}

.empty-row::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--bg-tertiary);
}

/* Sortable column headers */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    padding-right: 24px;
}

.data-table th.sortable:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.data-table th.sortable:active {
    background: var(--accent-medium);
}

/* Mono cell (IPs, hashes, codes) */
.data-table td.text-mono,
.data-table .cell-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════════════════
   BADGES — rounded pills
   ═══════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 11px;
    letter-spacing: 0.01em;
    white-space: nowrap;
    line-height: 1;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info-border);
}

.badge-neutral {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.badge-accent {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid var(--accent-glow);
}

/* Pulsing badge for live status */
.badge-live::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 6px;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ═══════════════════════════════════════════════════════════════
   METRIC CARDS — frosted glass, subtle shadow
   ═══════════════════════════════════════════════════════════════ */
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

/* Subtle top accent line */
.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition);
}

.metric-card:hover::before { opacity: 1; }

.metric-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.metric-value {
    font-size: 1.85rem;
    font-weight: 700;
    margin: 6px 0 2px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.metric-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.metric-trend {
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-stable { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 420px;
}

.toast {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s var(--transition-spring);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.45;
}

.toast-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info-border);
}

.toast-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.toast-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.toast-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.toast-close:hover { opacity: 1; }

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-exit {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   MODAL — iOS sheet style
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    max-width: 560px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-wide { max-width: 640px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}

.modal-header h2,
.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 16px 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════ */
/* ─── Pagination — pill buttons with glass ──────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light, var(--border));
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pagination-info {
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 2px;
}

.pagination-buttons .btn {
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.pagination-buttons .btn-primary {
    box-shadow: var(--shadow-xs);
}

.pagination-buttons .btn-secondary {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.pagination-buttons .btn-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.pagination-buttons .btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 8px;
}

.pagination-buttons .btn.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   DROPDOWN
   ═══════════════════════════════════════════════════════════════ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 4px;
    z-index: 100;
    animation: dropdownIn 0.15s ease;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.dropdown-item-danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

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

/* ═══════════════════════════════════════════════════════════════
   TOOLTIP
   ═══════════════════════════════════════════════════════════════ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 50;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════════════════════════ */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    background: var(--accent-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar-sm { width: 24px; height: 24px; font-size: 11px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   SWITCH / TOGGLE — iOS toggle
   ═══════════════════════════════════════════════════════════════ */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

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

.switch-track {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 11px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.switch-track::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
    background: var(--accent);
    border-color: var(--accent);
}

.switch input:checked + .switch-track::before {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
    box-shadow: var(--focus-ring);
}

/* ═══════════════════════════════════════════════════════════════
   STANDALONE INPUT/SELECT (outside .form-field context)
   ═══════════════════════════════════════════════════════════════ */
.input-standalone,
.select-standalone {
    padding: 0 12px;
    height: 34px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.input-standalone:focus,
.select-standalone:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.input-standalone::placeholder {
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   GENERIC INPUT CLASSES — for inputs used outside .form-field
   Applies the same visual style as .form-field inputs so all
   controls look consistent regardless of context.
   ═══════════════════════════════════════════════════════════════ */
.input,
.form-input {
    padding: 0 12px;
    height: 34px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

textarea.input,
textarea.form-input {
    height: auto;
    min-height: 60px;
    padding: 8px 12px;
    resize: vertical;
}

select.input,
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.input:hover,
.form-input:hover {
    border-color: var(--border-strong);
}

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

.input::placeholder,
.form-input::placeholder {
    color: var(--text-muted);
}

.input:disabled,
.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

/* Compact variant — used in filter bars, inline forms */
.input-sm {
    padding: 0 10px;
    height: 30px;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

select.input-sm {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 24px;
}

.input-sm:hover { border-color: var(--border-strong); }
.input-sm:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.input-sm::placeholder { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES — commonly used with form controls
   ═══════════════════════════════════════════════════════════════ */
.w-full      { width: 100% !important; }
.max-w-prose { max-width: 720px; }
.mb-05   { margin-bottom: 4px !important; }
.mb-1    { margin-bottom: 8px !important; }
.mb-2    { margin-bottom: 16px !important; }
.mb-3    { margin-bottom: 24px !important; }

/* ═══════════════════════════════════════════════════════════════
   QR CODE IMAGE
   ═══════════════════════════════════════════════════════════════ */
.qr-image {
    display: block;
    margin: 0 auto 16px;
    max-width: 250px;
    border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   CONFIG MANAGEMENT
   ═══════════════════════════════════════════════════════════════ */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.config-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.config-category-title {
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.config-editor {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    tab-size: 2;
    white-space: pre;
    overflow-x: auto;
}

.config-editor:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.config-status-bar {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 0 0 6px 6px;
    border: 1px solid var(--border);
    border-top: none;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */

/* Body font size class */
.text-body { font-size: 13px; }

/* Sparkline canvas (used by SOC metric cards) */
.sparkline-canvas {
    width: 100%;
    height: 30px;
    display: block;
    margin-top: 4px;
}

/* Event feed header (used by SOC threat pages) */
.event-feed-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST — frosted glass, slide-in from right (enhancements)
   ═══════════════════════════════════════════════════════════════ */
.toast-icon {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
    margin-top: 1px;
}

.toast-message {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

/* ═══════════════════════════════════════════════════════════════
   SPINNER — smooth rotation
   ═══════════════════════════════════════════════════════════════ */
.spinner {
    display: inline-block;
    border-radius: 50%;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    animation: spinnerRotate 0.8s linear infinite;
    box-sizing: border-box;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-md {
    width: 24px;
    height: 24px;
    border-width: 2.5px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* Screen-reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes spinnerRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ═══════���════════════════════════════���══════════════════════════
   FORM BUILDER — schema-driven form layout
   ═══════════════════════════════════════════════════════════��═══ */
.form-builder {
    width: 100%;
}

.form-layout-vertical .form-field {
    margin-bottom: 16px;
}

.form-layout-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.form-layout-inline .form-field {
    margin-bottom: 0;
    flex: 1;
    min-width: 160px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

/* Toggle container alignment */
.toggle-container {
    display: flex;
    align-items: center;
    min-height: 34px;
}

/* ─── Tag Input ─────────────────────────────────────────────── */
.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 4px 8px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: text;
}

.tag-input-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.tag-input-container .tag-list {
    display: contents;
}

.tag-input-field {
    flex: 1;
    min-width: 80px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    padding: 2px 0;
}

.tag-input-field::placeholder {
    color: var(--text-muted);
}

/* ═════════��══════════════════════════��══════════════════════════
   SEVERITY BARS — horizontal distribution
   ════��═══════════════════════════════════════════════════════��══ */
.severity-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.severity-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.severity-bar-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: right;
}

.severity-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

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

.bar-critical { background: var(--danger); }
.bar-high { background: var(--warning); }
.bar-medium { background: var(--warning); }
.bar-low { background: var(--info); }

.severity-bar-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 32px;
    font-variant-numeric: tabular-nums;
}

/* ═���════════════���════════════════════════════════════════════════
   EVENT FEED — live scrolling list
   ══════════════════��════════════════════════════════════════════ */
.event-feed {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
}

.event-feed-list {
    display: flex;
    flex-direction: column;
}

.event-feed-list > * {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light, var(--border));
    font-size: 13px;
    transition: background 0.15s ease;
}

.event-feed-list > *:hover {
    background: var(--bg-hover, var(--accent-light));
}

.event-feed-list > *:last-child {
    border-bottom: none;
}

/* ═══════════════════════════════════════════════════════════════
   SKELETON — shimmer loading placeholders
   ═══════════════════════════════════════════════════════════════ */
.skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-row {
    display: flex;
    gap: 12px;
}

.skeleton-line {
    height: 14px;
    width: 100%;
    border-radius: 6px;
    background: var(--bg-tertiary);
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

.skeleton-line-short {
    width: 65%;
}

.skeleton-cell {
    flex: 1;
    height: 14px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

.skeleton-block {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

/* Stagger shimmer on rows */
.skeleton-row:nth-child(2) .skeleton-line,
.skeleton-row:nth-child(2) .skeleton-cell,
.skeleton-row:nth-child(2) .skeleton-block {
    animation-delay: 0.15s;
}

.skeleton-row:nth-child(3) .skeleton-line,
.skeleton-row:nth-child(3) .skeleton-cell,
.skeleton-row:nth-child(3) .skeleton-block {
    animation-delay: 0.3s;
}

.skeleton-row:nth-child(4) .skeleton-line,
.skeleton-row:nth-child(4) .skeleton-cell,
.skeleton-row:nth-child(4) .skeleton-block {
    animation-delay: 0.45s;
}

@keyframes skeletonShimmer {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Table skeleton variant */
.skeleton-table .skeleton-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light, var(--border));
}

/* ═══════════════════════════════════════════════════════════════
   STATUS INDICATOR — threat/health level dot with label
   ═══════════════════════════════════════════════════════════════ */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color var(--transition);
}

.status-normal {
    background-color: var(--success);
    box-shadow: 0 0 0 2px var(--success-bg);
}

.status-elevated {
    background-color: var(--warning);
    box-shadow: 0 0 0 2px var(--warning-bg);
}

.status-high {
    background-color: var(--danger);
    box-shadow: 0 0 0 2px var(--danger-bg);
}

.status-critical {
    background-color: var(--danger);
    box-shadow: 0 0 4px var(--danger), 0 0 0 2px var(--danger-bg);
}

.status-label {
    color: var(--text-primary);
    letter-spacing: -0.003em;
}

/* Pulse animation for active/live indicators */
.status-dot-pulse {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}

/* ═══════════════════════════════════════════════════════════════
   BREADCRUMB — navigation trail
   ═══════════════════════════════════════════════════════════════ */
.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
}

.breadcrumb-link:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.breadcrumb-separator {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    color: var(--text-muted);
    font-size: 14px;
    user-select: none;
    list-style: none;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
    padding: 2px 4px;
}

/* Modal size variant for small dialogs (confirm) */
.modal-sm {
    max-width: 400px;
}

/* ═══════════════════════════════════════════════════════════════
   DATA TABLE — advanced reusable table component
   ═══════════════════════════════════════════════════════════════ */

/* ─── Data Table Container — glass card with depth ─────── */
.data-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-slow);
}

.data-table-container:hover {
    box-shadow: var(--shadow-md);
}

/* Scrollable table wrapper inside container */
.data-table-container .data-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.data-table-container .data-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.data-table-container .data-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.data-table-container .data-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.data-table-container .data-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sort indicators in headers */
.data-table th[data-sortable] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}

.data-table th[data-sortable]:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.sort-indicator {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.3;
    transition: opacity var(--transition), color var(--transition);
}

.sort-indicator.active {
    opacity: 1;
    color: var(--accent);
}

/* Expand row — smooth reveal */
.expand-row td {
    padding: 16px 20px;
    background: var(--bg-sunken, var(--bg-tertiary));
    border-bottom: 1px solid var(--border);
    animation: expandIn 0.25s ease;
}

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

/* Group header */
.group-header td {
    font-weight: 600;
    font-size: 11px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 16px;
    border-bottom: 2px solid var(--border);
}

/* Truncated cell */
.cell-truncated {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Muted row (dismissed/expired) */
.row-muted td {
    opacity: 0.45;
}

.row-muted:hover td {
    opacity: 0.7;
}

/* Loading overlay — animated shimmer */
.data-table-loading {
    position: relative;
    min-height: 120px;
    pointer-events: none;
}

.data-table-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 25%,
        var(--accent-light) 50%,
        transparent 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    opacity: 0.5;
    border-radius: var(--radius-lg);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Auto-refresh toggle — compact inline style for pagination bar */
.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    user-select: none;
}

/* Page size selector */
.page-size-select {
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    box-sizing: border-box;
}

.page-size-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ═══════════════════════════════════════════════════════════════
   DATA LIST — card grid with filter + pagination
   ═══════════════════════════════════════════════════════════════ */
.data-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.data-list-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
    .data-list-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .data-list-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════
   METRIC CARD (enhanced) — data-card.js
   ═══════════════════════════════════════════════════════════════ */
.metric-card-enhanced {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-card-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.metric-card-value-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.metric-card-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.metric-card-change {
    font-size: 12px;
    font-weight: 500;
}

.change-success { color: var(--success); }
.change-danger { color: var(--danger); }
.change-warning { color: var(--warning); }
.change-neutral { color: var(--text-muted); }

.metric-card-clickable {
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   STATUS CARD — data-card.js
   ═══════════════════════════════════════════════════════════════ */
.status-card {
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.status-card-header {
    display: flex;
    align-items: center;
}

.status-card-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.003em;
}

.status-card-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.status-card-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   STAT CARD — data-card.js
   ═══════════════════════════════════════════════════════════════ */
.stat-card {
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-card-substats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.stat-card-substat {
    text-align: center;
}

.stat-card-substat-value {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.stat-card-substat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   ENHANCED SELECT — select.js
   ═══════════════════════════════════════════════════════════════ */
.select-container {
    position: relative;
    display: inline-block;
}

.select-native {
    width: 100%;
    padding: 0 28px 0 12px;
    height: 34px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    cursor: pointer;
}

.select-native:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.select-trigger {
    width: 100%;
    padding: 0 28px 0 12px;
    height: 34px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.select-trigger:hover {
    border-color: var(--border-strong);
}

.select-trigger:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    animation: dropdownIn 0.15s ease;
}

.select-search {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

.select-search-input {
    width: 100%;
    padding: 0 10px;
    height: 28px;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-sizing: border-box;
    outline: none;
}

.select-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.select-search-input::placeholder {
    color: var(--text-muted);
}

.select-options {
    max-height: 160px;
    overflow-y: auto;
    padding: 4px;
}

.select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 6px;
    transition: background 0.15s ease;
    color: var(--text-primary);
}

.select-option:hover,
.select-option.focused {
    background: var(--bg-hover, var(--accent-light));
}

.select-option.selected {
    color: var(--accent);
    font-weight: 500;
}

.select-no-results {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.select-no-results:hover {
    background: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   DATE RANGE PICKER — date-picker.js
   ═══════════════════════════════════════════════════════════════ */
.date-picker-input {
    cursor: pointer;
}

.date-range-picker {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.date-range-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-range-separator {
    font-size: 14px;
    color: var(--text-muted);
    padding-bottom: 6px;
    user-select: none;
}

.date-range-presets {
    display: flex;
    gap: 4px;
    padding-bottom: 2px;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   WIZARD — multi-step form wizard
   ═══════════════════════════════════════════════════════════════ */
.wizard-container {
    display: flex;
    flex-direction: column;
}

.wizard-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.wizard-step.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.wizard-step.completed {
    background: var(--success-bg);
    color: var(--success);
}

.wizard-step.pending {
    color: var(--text-muted);
}

.wizard-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.wizard-step.active .wizard-step-number {
    background: var(--accent);
    color: #fff;
}

.wizard-step.completed .wizard-step-number {
    background: var(--success);
    color: #fff;
}

.wizard-step.pending .wizard-step-number {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.wizard-step-title {
    font-size: 12px;
}

.wizard-step-line {
    flex: 1;
    height: 2px;
    min-width: 16px;
    background: var(--border);
    border-radius: 1px;
    transition: background 0.2s ease;
}

.wizard-step-line.completed {
    background: var(--success);
}

.wizard-body {
    min-height: 200px;
    margin-bottom: 16px;
}

.wizard-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.wizard-footer-left {
    display: flex;
    gap: 8px;
}

.wizard-footer-right {
    display: flex;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   CODE EDITOR — monospace textarea with line numbers
   ═══════════════════════════════════════════════════════════════ */
.code-editor {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-family: var(--font-mono, 'SF Mono', Menlo, 'Fira Code', monospace);
}

.code-editor > .code-editor-gutter,
.code-editor > .code-editor-textarea {
    /* Side-by-side layout handled by inner wrapper */
}

/* Inner row: gutter + textarea */
.code-editor {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: 1fr auto;
}

.code-editor-gutter {
    grid-row: 1;
    grid-column: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
    user-select: none;
    min-width: 40px;
    overflow: hidden;
    white-space: pre;
    box-sizing: border-box;
}

.code-editor-textarea {
    grid-row: 1;
    grid-column: 2;
    padding: 8px 12px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 200px;
    outline: none;
    tab-size: 2;
    white-space: pre;
    overflow-x: auto;
    box-sizing: border-box;
    font-family: inherit;
}

.code-editor-textarea::placeholder {
    color: var(--text-muted);
}

.code-editor-readonly .code-editor-textarea {
    background: var(--bg-secondary);
    cursor: default;
}

.code-editor-status {
    grid-row: 2;
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════
   FILE UPLOAD — drag-and-drop zone
   ═══════════════════════════════════════════════════════════════ */
.file-upload-container {
    width: 100%;
}

.file-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.file-upload-zone:hover,
.file-upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}

.file-upload-zone .upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--text-muted);
    line-height: 1;
}

.file-upload-zone .upload-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.file-upload-zone .upload-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.file-upload-info {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-primary);
}

.file-upload-name {
    font-weight: 500;
}

.file-upload-size {
    color: var(--text-muted);
}

.file-upload-error {
    margin-top: 8px;
    font-size: 12px;
    color: var(--danger);
}

/* ═══════════════════════════════════════════════════════════════
   BLOCKED REQUESTS — page-specific styles
   ═══════════════════════════════════════════════════════════════ */

.br-spinner-center { margin: 0 auto 12px; }
.br-detail-pad { padding: 8px 0; }
.br-score-muted { color: var(--text-muted); }
.br-score-warning { color: var(--warning); }
.br-score-danger { color: var(--danger); }
.br-status-dismissed { opacity: 0.5; }
.br-fp-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
}
.br-fp-green { background: var(--success); }
.br-fp-yellow { background: var(--warning); }
.br-fp-red { background: var(--danger); }
.br-form-label { display: block; margin-bottom: 4px; }
.br-input-full { width: 100%; }
.br-textarea-reason { width: 100%; min-height: 80px; resize: vertical; }
.br-factor-list { margin: 8px 0; padding-left: 20px; }
.br-factor-item { margin-bottom: 4px; font-size: 13px; }
.input-standalone {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

/* ─── Keyboard Shortcuts Help ─────────────────────────────── */
.shortcuts-help { padding: 4px 0; }

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}

.shortcuts-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-light);
}

.shortcut-key { width: 120px; text-align: right; padding-right: 16px; }
.shortcut-desc { color: var(--text-secondary); font-size: 0.85rem; }

kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 0 var(--border);
    white-space: nowrap;
}

/* ─── Page Layout ─────────────────────────────────────────── */
.page-layout { min-height: 0; }

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-title { flex: 1; min-width: 0; }

.page-header-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.page-subtitle {
    margin-top: 2px;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    border-radius: var(--radius);
    z-index: 10;
}

/* Form layout */
.page-form-area {
    max-width: 640px;
}

.page-form-footer {
    max-width: 640px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ─── Split Panel ─────────────────────────────────────────── */
.split-panel {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.split-horizontal { flex-direction: row; }
.split-vertical { flex-direction: column; }

.split-pane {
    overflow: auto;
    min-width: 0;
    min-height: 0;
}

.split-divider {
    flex-shrink: 0;
    background: var(--border);
    transition: background 180ms ease;
    position: relative;
}

.split-divider:hover,
.split-divider:focus-visible {
    background: var(--accent);
}

.split-divider:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.split-horizontal > .split-divider {
    width: 4px;
    cursor: col-resize;
}

.split-vertical > .split-divider {
    height: 4px;
    cursor: row-resize;
}

/* Divider handle dot */
.split-divider::after {
    content: '';
    position: absolute;
    background: var(--text-muted);
    border-radius: 2px;
}

.split-horizontal > .split-divider::after {
    top: 50%;
    left: 50%;
    width: 2px;
    height: 20px;
    transform: translate(-50%, -50%);
}

.split-vertical > .split-divider::after {
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    transform: translate(-50%, -50%);
}

/* ═══════════════════════════════════════════════════════════════
   CONNTRACK TABLE — scrollable container, sticky header
   ═══════════════════════════════════════════════════════════════ */
/* ─── Conntrack Table Scroll — premium container ───────── */
.ct-table-scroll {
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    transition: box-shadow var(--transition-slow);
}

.ct-table-scroll:hover {
    box-shadow: var(--shadow-md);
}

.ct-table-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.ct-table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.ct-table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.ct-table-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.ct-table-scroll .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-secondary);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
}

.ct-table-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.ct-page-size {
    width: auto;
    min-width: 80px;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ct-page-size:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ─── DataSource Status Indicators (ARC-FE-01) ─────────── */

.ds-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all var(--transition);
}

.ds-status-hidden {
    display: none;
}

.ds-status-loading {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.ds-status-refreshing {
    background: var(--accent-light);
    color: var(--accent);
}

.ds-status-stale {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.ds-status-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.ds-status-icon {
    flex-shrink: 0;
}

.ds-status-msg {
    flex: 1;
}

.ds-retry-btn {
    flex-shrink: 0;
    margin-left: auto;
}

.ds-error-msg {
    font-size: 0.75rem;
    opacity: 0.8;
}

.ds-spinner-sm {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--accent-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: ds-spin 0.7s linear infinite;
}

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

/* Chart parent needs relative positioning for overlay */
.ds-chart-has-overlay {
    position: relative;
}

/* Chart overlay — glass pill centered */
.ds-chart-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 5;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    box-shadow: var(--shadow-sm);
}

.ds-chart-overlay.ds-status-loading {
    background: var(--bg-glass, rgba(255,255,255,0.8));
    color: var(--text-muted);
}

.ds-chart-overlay.ds-status-stale {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.ds-chart-overlay.ds-status-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

/* Card group loading state — gentle fade */
.ds-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.ds-stale {
    opacity: 0.85;
    transition: opacity var(--transition-slow);
}

.ds-error {
    opacity: 0.6;
    transition: opacity var(--transition-slow);
}

/* ═══════════════════════════════════════════════════════════════
   DATATABLE V2 — Additional styles for standardized tables
   ═══════════════════════════════════════════════════════════════ */

/* ─── Compact table variant ──────────────────────────────── */
.data-table.compact th {
    padding: 6px 10px;
    font-size: 10px;
}

.data-table.compact td {
    padding: 5px 10px;
    font-size: 12px;
}

/* ─── Simple table container ─────────────────────────────── */
.simple-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius);
}

/* Inside scroll parent: disable overflow so sticky headers work */
.ct-table-scroll .simple-table-container {
    overflow-x: visible;
    overflow-y: visible;
}

/* ─── Row selection ──────────────────────────────────────── */
.data-table tbody tr.selected td {
    background: var(--accent-medium, rgba(59, 130, 246, 0.1));
}

.data-table .select-column {
    width: 40px;
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
}

.data-table .select-column input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent, #3b82f6);
}

/* ─── Keyboard focus indicator ───────────────────────────── */
.data-table tbody tr.keyboard-focus td {
    box-shadow: inset 0 0 0 2px var(--accent, #3b82f6);
}

/* ─── Column resize handle ───────────────────────────────── */
.column-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background var(--transition);
    z-index: 3;
}

.column-resize-handle:hover,
.column-resize-handle.active {
    background: var(--accent, #3b82f6);
}

/* ─── Virtual scroll ─────────────────────────────────────── */
.virtual-scroll-container {
    width: 100%;
    border-radius: var(--radius);
}

.virtual-spacer {
    width: 100%;
    pointer-events: none;
}

/* ─── Multi-select dropdown ──────────────────────────────── */
.multi-select-container {
    position: relative;
}

.multi-select-display {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 120px;
    user-select: none;
}

.multi-select-display::after {
    content: '\25BC';
    font-size: 9px;
    margin-left: 8px;
    opacity: 0.5;
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.multi-select-dropdown.hidden {
    display: none;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background var(--transition);
}

.multi-select-option:hover {
    background: var(--accent-light);
}

.multi-select-option input[type="checkbox"] {
    accent-color: var(--accent, #3b82f6);
}

/* ─── Interface Selector (Network Zones) ──────────────────── */
.interface-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    max-height: 200px;
    overflow-y: auto;
}

.interface-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm, 4px);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.interface-option:hover {
    background: var(--bg-hover);
}

.interface-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.interface-option.interface-down {
    opacity: 0.5;
}

/* ── Chart container (behavior detection, dashboards) ── */
.chart-container {
    position: relative;
    height: 220px;
}
.chart-canvas {
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   IPS TIMELINE CHART — ips-logging.js (TCVN 4.3.2.9c)
   ═══════════════════════════════════════════════════════════════ */
.timeline-chart {
    padding: 8px 4px;
    border-radius: var(--radius);
    background: var(--card-bg);
}
.timeline-bar-fill {
    background: var(--accent);
    min-height: 2px;
    transition: height 0.2s ease;
}
.timeline-bar:hover .timeline-bar-fill {
    background: var(--accent-hover, var(--accent));
    opacity: 0.85;
}

/* Severity row highlights for live feed */
.severity-row-critical td { border-left: 3px solid var(--danger); }
.severity-row-high td:first-child { border-left: 3px solid var(--danger); }
.severity-row-medium td:first-child { border-left: 3px solid var(--warning); }
