Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Add ClamAV start action and UI posture fixes

Juan Denis32e6def0e6f9
diff --git a/backend/app/api/security.py b/backend/app/api/security.py
index e8eb1be5..547504c7 100644
--- a/backend/app/api/security.py
+++ b/backend/app/api/security.py
@@ -89,6 +89,15 @@ def update_definitions():
return jsonify(result), 200 if result['success'] else 400
+@security_bp.route('/clamav/start', methods=['POST'])
+@jwt_required()
+@admin_required
+def start_clamav():
+ """Start the ClamAV daemon (one-click posture fix)."""
+ result = SecurityService.start_clamav()
+ return jsonify(result), 200 if result['success'] else 400
+
+
@security_bp.route('/scan/file', methods=['POST'])
@jwt_required()
@admin_required
diff --git a/backend/app/services/security_service.py b/backend/app/services/security_service.py
index d88e4951..42b36b0e 100644
--- a/backend/app/services/security_service.py
+++ b/backend/app/services/security_service.py
@@ -210,6 +210,30 @@ class SecurityService:
except Exception as e:
return {'success': False, 'error': str(e)}
+ @classmethod
+ def start_clamav(cls) -> Dict:
+ """Start and enable the ClamAV daemon.
+
+ Debian ships the daemon as ``clamav-daemon``; RHEL and others call it
+ ``clamd`` — try both, mirroring :meth:`get_clamav_status`. ``install``
+ does not start the daemon, so this backs the "Start service" posture fix.
+ """
+ for service in ('clamav-daemon', 'clamd'):
+ try:
+ ServiceControl.enable(service, timeout=15)
+ result = ServiceControl.start(service, timeout=30)
+ except FileNotFoundError:
+ return {'success': False, 'error': 'systemctl not found (not a Linux host?)'}
+ except subprocess.TimeoutExpired:
+ return {'success': False, 'error': 'Starting ClamAV timed out'}
+ except Exception as e:
+ return {'success': False, 'error': str(e)}
+
+ if getattr(result, 'returncode', 1) == 0 and ServiceControl.is_active(service):
+ return {'success': True, 'message': f'{service} started'}
+
+ return {'success': False, 'error': 'Could not start the ClamAV service. Is ClamAV installed?'}
+
@classmethod
def scan_file(cls, file_path: str) -> Dict:
"""Scan a single file for malware."""
diff --git a/backend/tests/test_security_clamav.py b/backend/tests/test_security_clamav.py
new file mode 100644
index 00000000..55a9ead3
--- /dev/null
+++ b/backend/tests/test_security_clamav.py
@@ -0,0 +1,47 @@
+"""Proving tests for the ClamAV start endpoint.
+
+`install_clamav` does not start the daemon, so the Security Overview posture
+exposes a one-click "Start service" fix backed by POST /security/clamav/start.
+These tests pin its wiring without touching systemctl: ServiceControl is mocked,
+so they run on any OS (the service layer itself is Linux-only).
+"""
+from types import SimpleNamespace
+from unittest.mock import patch
+
+
+def _completed(returncode=0):
+ return SimpleNamespace(returncode=returncode, stdout='', stderr='')
+
+
+def test_start_clamav_success(client, auth_headers):
+ """A daemon that comes up active returns 200 + success."""
+ with patch('app.services.security_service.ServiceControl') as svc:
+ svc.enable.return_value = _completed()
+ svc.start.return_value = _completed()
+ svc.is_active.return_value = True
+
+ resp = client.post('/api/v1/security/clamav/start', headers=auth_headers)
+
+ assert resp.status_code == 200
+ body = resp.get_json()
+ assert body['success'] is True
+ svc.start.assert_called() # we actually attempted the start
+
+
+def test_start_clamav_failure_when_inactive(client, auth_headers):
+ """systemctl returns 0 but the unit never goes active -> 400, no false success."""
+ with patch('app.services.security_service.ServiceControl') as svc:
+ svc.enable.return_value = _completed()
+ svc.start.return_value = _completed(returncode=0)
+ svc.is_active.return_value = False
+
+ resp = client.post('/api/v1/security/clamav/start', headers=auth_headers)
+
+ assert resp.status_code == 400
+ assert resp.get_json()['success'] is False
+
+
+def test_start_clamav_requires_auth(client):
+ """Unauthenticated callers cannot start services."""
+ resp = client.post('/api/v1/security/clamav/start')
+ assert resp.status_code in (401, 422)
diff --git a/frontend/src/components/security/OverviewTab.jsx b/frontend/src/components/security/OverviewTab.jsx
index 9bc5d5e7..fc4e6d02 100644
--- a/frontend/src/components/security/OverviewTab.jsx
+++ b/frontend/src/components/security/OverviewTab.jsx
@@ -2,184 +2,227 @@ import React, { useState } from 'react';
import api from '../../services/api';
import { Button } from '@/components/ui/button';
import { Pill, ScoreGauge } from '@/components/ds';
+import {
+ ShieldCheck,
+ RefreshCw,
+ CheckCircle2,
+ AlertTriangle,
+ Circle,
+ Siren,
+ Bug,
+ Radar,
+} from 'lucide-react';
-const InstallClamAVButton = ({ onInstalled }) => {
- const [installing, setInstalling] = useState(false);
+const capitalize = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1) : s);
+
+// Status glyph per check state — paired with the label so state never relies on
+// color alone (color-blind operators), per the product a11y bar.
+const STATE_ICON = { pass: CheckCircle2, warn: AlertTriangle, unknown: Circle };
+const CHECK_PILL = { pass: 'green', warn: 'amber', unknown: 'gray' };
+
+const OverviewTab = ({ status, clamavStatus, clamavLoading, onRefresh, onNavigateTab }) => {
+ // One action runs at a time; `busyKey` names it so only that row spins and
+ // the rest disable (no double-submits against the same daemon).
+ const [busyKey, setBusyKey] = useState(null);
const [error, setError] = useState(null);
- async function handleInstall() {
- setInstalling(true);
+ const alerts = status?.recent_alerts || {};
+ const integrity = status?.file_integrity || {};
+ const integrityChanges = alerts.integrity_changes || 0;
+ const scanRunning = status?.scan_status === 'running';
+
+ async function runFix(key, fn) {
+ setBusyKey(key);
setError(null);
try {
- await api.installClamAV();
- onInstalled();
+ await fn();
+ await onRefresh?.();
} catch (err) {
- setError(err.message);
+ setError(err.message || 'That action failed. Check the server logs and try again.');
} finally {
- setInstalling(false);
+ setBusyKey(null);
}
}
- return (
- <div>
- <Button variant="default" onClick={handleInstall} disabled={installing}>
- {installing ? 'Installing...' : 'Install ClamAV'}
- </Button>
- {error && <p className="error-text" style={{ marginTop: '0.5rem' }}>{error}</p>}
- </div>
- );
-};
-
-const OverviewTab = ({ status, clamavStatus, clamavLoading, onRefreshClamav }) => {
- const alerts = status?.recent_alerts || {};
- const loading = clamavLoading;
- const integrityChanges = alerts.integrity_changes || 0;
- const integrity = status?.file_integrity || {};
-
- // Posture checks — real boolean signals already on this tab's props/state.
- // Checks that can't be evaluated yet (ClamAV still loading) stay 'unknown'
- // and are excluded from the score (client-side, mirrors WordPressDetail).
+ // Posture checks — real boolean signals from this tab's props. Each failing
+ // check carries a `fix`: a server action (re-pulls status on success) or a
+ // `nav` jump to the tab that resolves it. Checks that can't be evaluated yet
+ // (ClamAV still loading) stay 'unknown' and are excluded from the score.
const checks = [
{
+ key: 'clamav-install',
label: 'ClamAV antivirus installed',
state: clamavLoading ? 'unknown' : (clamavStatus?.installed ? 'pass' : 'warn'),
detail: clamavLoading ? 'checking…' : (clamavStatus?.installed ? 'installed' : 'not installed'),
+ fix: !clamavLoading && !clamavStatus?.installed
+ ? { label: 'Install ClamAV', run: () => api.installClamAV() }
+ : null,
},
{
+ key: 'clamav-service',
label: 'ClamAV service running',
- state: clamavLoading || !clamavStatus?.installed ? 'unknown' : (clamavStatus?.service_running ? 'pass' : 'warn'),
- detail: clamavLoading ? 'checking…' : (!clamavStatus?.installed ? 'n/a' : (clamavStatus?.service_running ? 'running' : 'stopped')),
+ state: clamavLoading || !clamavStatus?.installed
+ ? 'unknown'
+ : (clamavStatus?.service_running ? 'pass' : 'warn'),
+ detail: clamavLoading
+ ? 'checking…'
+ : (!clamavStatus?.installed ? 'n/a' : (clamavStatus?.service_running ? 'running' : 'stopped')),
+ fix: !clamavLoading && clamavStatus?.installed && !clamavStatus?.service_running
+ ? { label: 'Start service', run: () => api.startClamAV() }
+ : null,
},
{
+ key: 'integrity-enabled',
label: 'File integrity monitoring enabled',
state: integrity.enabled ? 'pass' : 'warn',
detail: integrity.enabled ? 'enabled' : 'disabled',
+ fix: integrity.enabled
+ ? null
+ : { label: 'Enable monitoring', run: () => api.updateSecurityConfig({ file_integrity: { enabled: true } }) },
},
{
+ key: 'integrity-baseline',
label: 'Integrity baseline initialized',
state: integrity.database_exists ? 'pass' : 'warn',
detail: integrity.database_exists ? 'initialized' : 'not initialized',
+ fix: integrity.database_exists
+ ? null
+ : { label: 'Initialize baseline', run: () => api.initializeIntegrityDatabase() },
},
{
+ key: 'integrity-clean',
label: 'No integrity changes (24h)',
state: integrityChanges > 0 ? 'warn' : 'pass',
detail: integrityChanges > 0 ? `${integrityChanges} detected` : 'clean',
+ fix: integrityChanges > 0
+ ? { label: 'Review changes', run: () => onNavigateTab?.('integrity'), nav: true }
+ : null,
},
{
+ key: 'alerts',
label: 'Security alerts configured',
state: status?.notifications_enabled ? 'pass' : 'warn',
detail: status?.notifications_enabled ? 'enabled' : 'disabled',
+ fix: status?.notifications_enabled
+ ? null
+ : {
+ label: 'Enable alerts',
+ run: () => api.updateSecurityConfig({
+ notifications: { on_malware_found: true, on_integrity_change: true, on_suspicious_activity: true },
+ }),
+ },
},
];
+
const scored = checks.filter((c) => c.state !== 'unknown');
const score = scored.length
? Math.round((scored.filter((c) => c.state === 'pass').length / scored.length) * 100)
: null;
const scoreColor = score >= 80 ? 'var(--green)' : score >= 50 ? 'var(--amber)' : 'var(--red)';
- const CHECK_PILL = { pass: 'green', warn: 'amber', unknown: 'gray' };
+ const warnCount = checks.filter((c) => c.state === 'warn').length;
+
+ // Live event counts — the at-a-glance readouts that used to be a page-wide
+ // KPI strip on every tab. They live here now, where they're relevant.
+ const kpis = [
+ { key: 'alerts', icon: Siren, value: alerts.total || 0, label: 'Alerts · 24h', tone: alerts.total > 0 ? 'amber' : 'green' },
+ { key: 'malware', icon: Bug, value: alerts.malware_detections || 0, label: 'Malware', tone: alerts.malware_detections > 0 ? 'red' : 'green' },
+ { key: 'scan', icon: Radar, value: capitalize(status?.scan_status) || 'Idle', label: 'Scan', tone: scanRunning ? 'cyan' : 'muted', text: true },
+ ];
+
+ const defsUpdated = clamavStatus?.last_update ? new Date(clamavStatus.last_update).toLocaleDateString() : null;
+ const busy = busyKey !== null;
return (
<div className="security-overview">
- <div className="card">
+ {error && <div className="alert alert-danger">{error}</div>}
+
+ <div className="card sec-posture-card">
<div className="card-header">
- <h3>Security Posture</h3>
- </div>
- <div className="card-body sec-posture">
- {score !== null ? (
- <ScoreGauge value={score} size={110} stroke={9} color={scoreColor} label="posture" />
- ) : (
- <p className="sec-hint sec-hint--lead">Refresh the checks below to compute a posture score.</p>
- )}
- <div className="sec-posture__checks">
- {checks.map((c) => (
- <div key={c.label} className="sec-posture__check">
- <span className="sec-posture__label">{c.label}</span>
- <span className="sec-posture__detail">{c.detail}</span>
- <Pill kind={CHECK_PILL[c.state]}>{c.state === 'unknown' ? 'pending' : c.state}</Pill>
- </div>
- ))}
- </div>
+ <h3><ShieldCheck size={13} /> Security posture</h3>
+ <Button variant="outline" size="sm" onClick={() => runFix('recheck', async () => {})} disabled={busy}>
+ <RefreshCw size={13} className={busyKey === 'recheck' ? 'sec-spin' : undefined} /> Re-check
+ </Button>
</div>
- </div>
-
- <div className="security-grid">
- <div className="card">
- <div className="card-header">
- <h3>ClamAV Antivirus</h3>
- <Button variant="outline" size="sm" onClick={onRefreshClamav}>Refresh</Button>
- </div>
- <div className="card-body">
- {loading ? (
- <div className="loading-sm">Loading...</div>
- ) : clamavStatus?.installed ? (
- <div className="sec-rows">
- <div className="sk-info-row">
- <span className="k">Version</span>
- <span className="v">{clamavStatus.version || 'Unknown'}</span>
- </div>
- <div className="sk-info-row">
- <span className="k">Service</span>
- <Pill kind={clamavStatus.service_running ? 'green' : 'amber'}>
- {clamavStatus.service_running ? 'Running' : 'Stopped'}
- </Pill>
- </div>
- <div className="sk-info-row">
- <span className="k">Last definition update</span>
- <span className="v">{clamavStatus.last_update ? new Date(clamavStatus.last_update).toLocaleString() : 'Unknown'}</span>
- </div>
- </div>
+ <div className="card-body">
+ <div className="sec-posture__top">
+ {score !== null ? (
+ <ScoreGauge value={score} size={104} stroke={9} color={scoreColor} label="posture" />
) : (
- <div className="not-installed">
- <p>ClamAV is not installed on this server.</p>
- <InstallClamAVButton onInstalled={onRefreshClamav} />
+ <div className="sec-posture__pending">
+ <RefreshCw size={18} className="sec-spin" />
+ <span>Computing…</span>
</div>
)}
- </div>
- </div>
- <div className="card">
- <div className="card-header">
- <h3>File Integrity Monitoring</h3>
- </div>
- <div className="card-body">
- <div className="sec-rows">
- <div className="sk-info-row">
- <span className="k">Status</span>
- <Pill kind={status?.file_integrity?.enabled ? 'green' : 'gray'}>
- {status?.file_integrity?.enabled ? 'Enabled' : 'Disabled'}
- </Pill>
- </div>
- <div className="sk-info-row">
- <span className="k">Database</span>
- <Pill kind={status?.file_integrity?.database_exists ? 'green' : 'amber'}>
- {status?.file_integrity?.database_exists ? 'Initialized' : 'Not Initialized'}
- </Pill>
- </div>
- <div className="sk-info-row">
- <span className="k">Changes detected (24h)</span>
- <span className={`v ${integrityChanges > 0 ? 'sec-v-amber' : ''}`}>{integrityChanges}</span>
+ <div className="sec-posture__summary">
+ <p className="sec-posture__verdict">
+ {score === null
+ ? 'Checking this server…'
+ : warnCount === 0
+ ? 'All hardening checks pass.'
+ : `${warnCount} ${warnCount === 1 ? 'check needs' : 'checks need'} attention.`}
+ </p>
+ <div className="sec-posture__kpis">
+ {kpis.map((k) => {
+ const Icon = k.icon;
+ return (
+ <div key={k.key} className={`sec-kpi sec-kpi--${k.tone}`}>
+ <Icon size={13} className="sec-kpi__icon" />
+ <span className={`sec-kpi__val${k.text ? ' sec-kpi__val--text' : ''}`}>{k.value}</span>
+ <span className="sec-kpi__label">{k.label}</span>
+ </div>
+ );
+ })}
</div>
</div>
</div>
- </div>
- <div className="card">
- <div className="card-header">
- <h3>Notifications</h3>
- </div>
- <div className="card-body">
- <div className="sec-rows">
- <div className="sk-info-row">
- <span className="k">Security alerts</span>
- <Pill kind={status?.notifications_enabled ? 'green' : 'gray'}>
- {status?.notifications_enabled ? 'Enabled' : 'Disabled'}
- </Pill>
- </div>
- </div>
- <p className="sec-hint">
- Configure notification channels in Settings → Notifications to receive security alerts via Discord, Slack, or Telegram.
- </p>
+ <div className="sec-posture__checks">
+ {checks.map((c) => {
+ const Icon = STATE_ICON[c.state];
+ const rowBusy = busyKey === c.key;
+ return (
+ <div key={c.key} className={`sec-posture__check sec-posture__check--${c.state}`}>
+ <Icon size={15} className="sec-posture__ico" />
+ <span className="sec-posture__label">{c.label}</span>
+ <span className="sec-posture__detail">{c.detail}</span>
+ {c.fix ? (
+ <Button
+ variant={c.fix.nav ? 'ghost' : 'outline'}
+ size="sm"
+ className="sec-posture__fix"
+ onClick={() => (c.fix.nav ? c.fix.run() : runFix(c.key, c.fix.run))}
+ disabled={busy}
+ >
+ {rowBusy ? 'Working…' : c.fix.label}
+ </Button>
+ ) : (
+ <Pill kind={CHECK_PILL[c.state]}>{c.state === 'unknown' ? 'pending' : c.state}</Pill>
+ )}
+ </div>
+ );
+ })}
</div>
+
+ <p className="sec-hint sec-posture__foot">
+ {clamavStatus?.installed && (
+ <>
+ Virus definitions {defsUpdated ? `updated ${defsUpdated}` : 'status unknown'}
+ {' · '}
+ <Button
+ variant="link"
+ size="sm"
+ className="sec-posture__inline"
+ onClick={() => runFix('defs', () => api.updateVirusDefinitions())}
+ disabled={busy}
+ >
+ {busyKey === 'defs' ? 'Updating…' : 'Update definitions'}
+ </Button>
+ {'. '}
+ </>
+ )}
+ Add alert delivery channels (Discord, Slack, Telegram) in Settings → Notifications.
+ </p>
</div>
</div>
</div>
diff --git a/frontend/src/pages/Security.jsx b/frontend/src/pages/Security.jsx
index cf8dcad5..8a2359ea 100644
--- a/frontend/src/pages/Security.jsx
+++ b/frontend/src/pages/Security.jsx
@@ -18,16 +18,12 @@ import {
SecurityConfigTab,
} from '../components/security';
import EmptyState from '../components/EmptyState';
-import { MetricCard } from '@/components/ds';
-import { Siren, Bug, ShieldCheck, Radar } from 'lucide-react';
const VALID_TABS = ['overview', 'firewall', 'fail2ban', 'ssh-keys', 'ip-lists', 'scanner', 'quarantine', 'integrity', 'audit', 'vulnerability', 'updates', 'events', 'settings'];
-const capitalize = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1) : s);
-
const Security = () => {
const { isAdmin } = useAuth();
- const [activeTab] = useTabParam('/security', VALID_TABS);
+ const [activeTab, setActiveTab] = useTabParam('/security', VALID_TABS);
const [status, setStatus] = useState(null);
const [clamav, setClamav] = useState(null);
const [clamavLoading, setClamavLoading] = useState(true);
@@ -60,6 +56,12 @@ const Security = () => {
}
}
+ // Re-pull both status feeds — passed to the Overview so a one-click fix
+ // (install ClamAV, enable integrity, …) reflects in the posture immediately.
+ async function reload() {
+ await Promise.all([loadStatus(), loadClamav()]);
+ }
+
if (loading) {
return (
<div className="sk-tabgroup__inner security-page">
@@ -68,42 +70,10 @@ const Security = () => {
);
}
- const alerts = status?.recent_alerts || {};
- const scanRunning = status?.scan_status === 'running';
-
return (
<div className="sk-tabgroup__inner security-page">
- <div className="sec-kpis" role="group" aria-label="Security overview">
- <MetricCard
- tone={alerts.total > 0 ? 'amber' : 'green'}
- icon={<Siren size={16} />}
- value={alerts.total || 0}
- label="Alerts (24h)"
- />
- <MetricCard
- tone={alerts.malware_detections > 0 ? 'red' : 'green'}
- icon={<Bug size={16} />}
- value={alerts.malware_detections || 0}
- label="Malware detected"
- />
- <MetricCard
- className="sec-kpi-text"
- tone={clamav?.installed ? 'green' : 'amber'}
- icon={<ShieldCheck size={16} />}
- value={clamav?.installed ? 'Active' : 'Not installed'}
- label="ClamAV"
- />
- <MetricCard
- className="sec-kpi-text"
- tone={scanRunning ? 'cyan' : 'accent'}
- icon={<Radar size={16} />}
- value={capitalize(status?.scan_status) || 'Idle'}
- label="Scan status"
- />
- </div>
-
<div className="tab-content">
- {activeTab === 'overview' && <OverviewTab status={status} clamavStatus={clamav} clamavLoading={clamavLoading} onRefreshClamav={loadClamav} />}
+ {activeTab === 'overview' && <OverviewTab status={status} clamavStatus={clamav} clamavLoading={clamavLoading} onRefresh={reload} onNavigateTab={setActiveTab} />}
{activeTab === 'firewall' && <FirewallTab />}
{activeTab === 'fail2ban' && <Fail2banTab />}
{activeTab === 'ssh-keys' && <SSHKeysTab />}
diff --git a/frontend/src/services/api/security.js b/frontend/src/services/api/security.js
index 1528d03b..dd348fee 100644
--- a/frontend/src/services/api/security.js
+++ b/frontend/src/services/api/security.js
@@ -184,6 +184,10 @@ export async function updateVirusDefinitions() {
return this.request('/security/clamav/update', { method: 'POST' });
}
+export async function startClamAV() {
+ return this.request('/security/clamav/start', { method: 'POST' });
+}
+
export async function scanFile(path) {
return this.request('/security/scan/file', {
method: 'POST',
diff --git a/frontend/src/styles/pages/_file-manager.scss b/frontend/src/styles/pages/_file-manager.scss
index 411404ed..6dc53221 100644
--- a/frontend/src/styles/pages/_file-manager.scss
+++ b/frontend/src/styles/pages/_file-manager.scss
@@ -1467,6 +1467,7 @@ $drawer-width: 520px;
border-bottom: 1px solid var(--border-soft);
> svg { flex-shrink: 0; }
+ > svg.is-accent { color: var(--accent-primary); }
.preview-drawer-title {
flex: 1;
@@ -1580,6 +1581,16 @@ $drawer-width: 520px;
flex-direction: column;
min-height: 0;
+ &.is-padded { padding: 16px; }
+
+ .meta-label {
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-medium;
+
+ &.is-spaced { margin-bottom: 6px; }
+ }
+
.preview-image-wrap {
flex: 1;
display: flex;
diff --git a/frontend/src/styles/pages/_security.scss b/frontend/src/styles/pages/_security.scss
index 4a7fbb0f..ba557ca5 100644
--- a/frontend/src/styles/pages/_security.scss
+++ b/frontend/src/styles/pages/_security.scss
@@ -8,26 +8,6 @@
.security-page {
- // ── KPI strip (page shell) ──────────────────────────────
- .sec-kpis {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- gap: $space-4;
- margin-bottom: $space-5;
-
- @media (max-width: $breakpoint-lg) { grid-template-columns: repeat(2, 1fr); }
- @media (max-width: $breakpoint-sm) { grid-template-columns: 1fr; }
- }
-
- // Text-valued KPIs ("Active" / "Not installed") read smaller than numerals
- .sec-kpi-text .sk-kpi__val {
- display: flex;
- align-items: center;
- min-height: 27px;
- font-size: 18px;
- line-height: 1.25;
- }
-
// ── card chrome (all tabs) ──────────────────────────────
.tab-content {
.card {
@@ -259,54 +239,162 @@
flex-direction: column;
gap: $space-4;
- .security-grid {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
- gap: $space-4;
+ .sec-posture-card .card-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
}
- // Posture ring + hardening checklist (ScoreGauge beside check rows)
- .sec-posture {
+ // ── Posture header: ScoreGauge + verdict + live readouts ──
+ .sec-posture__top {
display: flex;
align-items: center;
gap: $space-6;
+ padding-bottom: $space-4;
+ margin-bottom: $space-2;
+ border-bottom: 1px solid var(--border-soft);
- &__checks {
- flex: 1;
- min-width: 0;
+ @media (max-width: $breakpoint-sm) {
+ flex-direction: column;
+ align-items: flex-start;
+ gap: $space-4;
}
+ }
- &__check {
- display: flex;
- align-items: center;
- gap: $space-3;
- padding: 10px 0;
- border-top: 1px solid var(--border-soft);
- font-size: 13px;
+ .sec-posture__pending {
+ display: grid;
+ place-items: center;
+ gap: $space-2;
+ width: 104px;
+ height: 104px;
+ flex-shrink: 0;
+ font-size: 11.5px;
+ color: var(--text-faint);
- &:first-child { border-top: none; }
- }
+ svg { color: var(--text-faint); }
+ }
- &__label {
- flex: 1;
- min-width: 0;
+ .sec-posture__summary {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .sec-posture__verdict {
+ margin: 0 0 $space-3;
+ font-size: 14px;
+ font-weight: $font-weight-semibold;
+ color: var(--text);
+ }
+
+ // Live event readouts — relocated from the old page-wide KPI strip
+ .sec-posture__kpis {
+ display: flex;
+ flex-wrap: wrap;
+ gap: $space-2 $space-5;
+ }
+
+ .sec-kpi {
+ display: grid;
+ grid-template-columns: auto auto;
+ grid-template-rows: auto auto;
+ column-gap: 7px;
+ align-items: center;
+
+ &__icon { grid-row: 1 / span 2; color: var(--text-faint); }
+
+ &__val {
+ font-family: var(--mono);
+ font-size: 19px;
+ font-weight: $font-weight-semibold;
+ line-height: 1.1;
+ letter-spacing: -0.02em;
color: var(--text);
+
+ &--text { font-size: 14px; }
}
- &__detail {
+ &__label {
font-family: var(--mono);
- font-size: 11.5px;
+ font-size: 9.5px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
color: var(--text-faint);
- white-space: nowrap;
}
- @media (max-width: $breakpoint-md) {
- flex-direction: column;
- align-items: flex-start;
+ // Tone colors the numeral + glyph only (status, never decoration)
+ &--amber { .sec-kpi__val, .sec-kpi__icon { color: var(--amber); } }
+ &--red { .sec-kpi__val, .sec-kpi__icon { color: var(--red); } }
+ &--green .sec-kpi__icon { color: var(--green); }
+ &--cyan { .sec-kpi__val, .sec-kpi__icon { color: var(--cyan); } }
+ }
- &__checks { width: 100%; }
- }
+ // ── Hardening checklist with inline one-click fixes ──
+ .sec-posture__checks {
+ display: flex;
+ flex-direction: column;
+ }
+
+ .sec-posture__check {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+ min-height: 46px;
+ padding: 6px 0;
+ border-top: 1px solid var(--border-soft);
+ font-size: 13px;
+
+ &:first-child { border-top: none; }
+
+ &--pass .sec-posture__ico { color: var(--green); }
+ &--warn .sec-posture__ico { color: var(--amber); }
+ &--unknown .sec-posture__ico { color: var(--text-ghost); }
+ }
+
+ .sec-posture__ico { flex-shrink: 0; }
+
+ .sec-posture__label {
+ flex: 1;
+ min-width: 0;
+ color: var(--text);
+ }
+
+ .sec-posture__detail {
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-faint);
+ white-space: nowrap;
+ }
+
+ // Trailing control column — buttons share a min width so the edge stays tidy
+ .sec-posture__fix {
+ flex-shrink: 0;
+ min-width: 124px;
+ justify-content: center;
+ }
+
+ .sec-posture__foot {
+ margin-top: $space-4;
+ padding-top: $space-4;
+ border-top: 1px solid var(--border-soft);
}
+
+ // "Update definitions" sits inside the foot copy as a plain inline link
+ .sec-posture__inline {
+ height: auto;
+ padding: 0;
+ font-size: inherit;
+ vertical-align: baseline;
+ }
+}
+
+// Spinner for in-flight posture actions / pending score
+.sec-spin { animation: sec-spin 0.8s linear infinite; }
+
+@keyframes sec-spin { to { transform: rotate(360deg); } }
+
+@media (prefers-reduced-motion: reduce) {
+ .sec-spin { animation: none; }
}
// ── Scanner tab ──────────────────────────────────────────────