repeater/cmd/repeater/static/style.css
Pierre-Olivier Mercier 70140bc289 station: Identify devices by MAC OUI vendor lookup
Embed the IEEE OUI registry (~1MB pre-processed text file) and resolve
the vendor for every station MAC. Locally administered MACs (U/L bit
set, used by iOS/Android private addresses and virtual interfaces) are
skipped so we don't return spurious matches against randomized prefixes.

The vendor name shows up in the device card as a secondary line, and
falls back to the title position when no DHCP hostname is available —
"Apple" with the IP and MAC is far more useful than "Sans nom".

The lookup table loads lazily (sync.Once) on the first call so the
~40k-entry parse only runs when the station discovery code is exercised.
2026-05-01 22:32:57 +08:00

881 lines
16 KiB
CSS

/* ========================================
Travel Router — Minimal Control Panel
======================================== */
:root {
--accent: #d95030;
--accent-soft: #d9503018;
--green: #2a9d6a;
--green-soft: #2a9d6a14;
--amber: #c48820;
--amber-soft: #c4882014;
--red: #c23b22;
--red-soft: #c23b2214;
--blue: #3678c2;
--bg: #f7f6f3;
--surface: #ffffff;
--border: #e8e6e1;
--border-light: #f0eeea;
--text: #1a1a1a;
--text-secondary: #888580;
--text-tertiary: #b0ada8;
--radius: 10px;
--radius-sm: 6px;
--font: 'DM Sans', system-ui, sans-serif;
--font-display: 'Outfit', system-ui, sans-serif;
}
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: var(--font);
background: var(--bg);
color: var(--text);
min-height: 100vh;
padding: 2rem;
-webkit-font-smoothing: antialiased;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
/* ---- Header ---- */
.header {
margin-bottom: 2.5rem;
}
.header-content {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1.25rem;
}
.header-left {
display: flex;
align-items: center;
gap: 0.875rem;
}
.logo-mark {
width: 36px;
height: 36px;
border-radius: 10px;
background: var(--accent);
flex-shrink: 0;
}
.header h1 {
font-family: var(--font-display);
font-size: 1.5rem;
font-weight: 600;
letter-spacing: -0.025em;
line-height: 1.1;
}
.header-subtitle {
font-size: 0.8125rem;
color: var(--text-secondary);
font-weight: 400;
margin-top: 0.125rem;
}
.connection-info {
display: flex;
gap: 0.625rem;
flex-wrap: wrap;
}
.status-badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.4rem 0.875rem;
border-radius: 100px;
font-size: 0.8125rem;
font-weight: 450;
background: var(--surface);
border: 1px solid var(--border);
color: var(--text-secondary);
}
.status-dot {
width: 7px;
height: 7px;
border-radius: 50%;
flex-shrink: 0;
}
.status-dot.active {
background: var(--green);
box-shadow: 0 0 0 3px var(--green-soft);
}
.status-dot.offline {
background: var(--text-tertiary);
}
.status-dot.connecting,
.status-dot.disconnecting {
background: var(--amber);
animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
/* ---- Stats ---- */
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1px;
background: var(--border);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
margin-bottom: 1.5rem;
}
.stat-card {
background: var(--surface);
padding: 1.25rem 1.5rem;
transition: background 0.2s;
}
.stat-card:hover {
background: #fdfcfa;
}
.stat-label {
font-size: 0.6875rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-tertiary);
font-weight: 500;
margin-bottom: 0.375rem;
}
.stat-value {
font-family: var(--font-display);
font-size: 1.5rem;
font-weight: 600;
letter-spacing: -0.02em;
color: var(--text);
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.stat-value.mono {
font-variant-numeric: tabular-nums;
}
/* ---- Grid / Cards ---- */
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
gap: 1.5rem;
margin-bottom: 1.5rem;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1.5rem;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.25rem;
}
.card-header h2 {
font-family: var(--font-display);
font-size: 1rem;
font-weight: 600;
letter-spacing: -0.01em;
display: flex;
align-items: center;
gap: 0.5rem;
}
.icon { color: var(--text-secondary); }
/* ---- Forms ---- */
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.375rem;
color: var(--text-secondary);
font-weight: 500;
font-size: 0.8125rem;
}
.form-group input,
.form-group select {
width: 100%;
padding: 0.625rem 0.875rem;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
font-size: 0.875rem;
font-family: var(--font);
background: var(--bg);
color: var(--text);
transition: border-color 0.15s, box-shadow 0.15s;
outline: none;
}
.form-group input:focus,
.form-group select:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group input::placeholder {
color: var(--text-tertiary);
}
/* ---- Buttons ---- */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.375rem;
padding: 0.6rem 1.25rem;
border: none;
border-radius: var(--radius-sm);
font-size: 0.8125rem;
font-weight: 500;
font-family: var(--font);
cursor: pointer;
transition: all 0.15s;
width: 100%;
}
.btn svg { flex-shrink: 0; }
.btn-primary {
background: var(--text);
color: #fff;
}
.btn-primary:hover {
background: #333;
}
.btn-secondary {
background: var(--bg);
color: var(--text-secondary);
border: 1px solid var(--border);
}
.btn-secondary:hover {
background: var(--border-light);
color: var(--text);
}
.btn-danger {
background: var(--red);
color: #fff;
}
.btn-danger:hover {
opacity: 0.9;
}
.btn:active {
transform: scale(0.98);
}
.btn:disabled {
opacity: 0.4;
cursor: not-allowed;
transform: none;
}
.btn-icon {
background: transparent;
border: none;
padding: 0.375rem;
border-radius: var(--radius-sm);
cursor: pointer;
color: var(--text-tertiary);
transition: all 0.15s;
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn-icon:hover {
background: var(--bg);
color: var(--text);
}
.button-group {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.5rem;
}
/* ---- Toggle ---- */
.toggle-switch {
position: relative;
width: 40px;
height: 22px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.toggle-switch label {
position: absolute;
cursor: pointer;
inset: 0;
background: var(--border);
transition: 0.2s;
border-radius: 100px;
}
.toggle-switch label:before {
content: "";
position: absolute;
height: 16px;
width: 16px;
left: 3px;
bottom: 3px;
background: #fff;
transition: 0.2s;
border-radius: 50%;
}
.toggle-switch input:checked + label {
background: var(--green);
}
.toggle-switch input:checked + label:before {
transform: translateX(18px);
}
/* ---- WiFi List ---- */
.wifi-list {
max-height: 280px;
overflow-y: auto;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
}
.wifi-item {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border-light);
cursor: pointer;
transition: background 0.12s;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.875rem;
}
.wifi-item:hover {
background: var(--bg);
}
.wifi-item:last-child {
border-bottom: none;
}
.wifi-item.selected {
background: var(--accent-soft);
border-left: 3px solid var(--accent);
}
.wifi-item.connected {
background: var(--green-soft);
border-left: 3px solid var(--green);
}
.wifi-item.connected .wifi-ssid {
color: var(--green);
font-weight: 600;
}
.wifi-item.connecting {
background: var(--amber-soft);
border-left: 3px solid var(--amber);
animation: pulse-item 1.5s ease-in-out infinite;
}
.wifi-item.connecting .wifi-ssid {
color: var(--amber);
font-weight: 600;
}
.wifi-item.disconnecting {
background: var(--red-soft);
border-left: 3px solid var(--red);
animation: pulse-item 1.5s ease-in-out infinite;
}
.wifi-item.disconnecting .wifi-ssid {
color: var(--red);
font-weight: 600;
}
@keyframes pulse-item {
0%, 100% { opacity: 1; }
50% { opacity: 0.6; }
}
.wifi-item.loading {
justify-content: center;
color: var(--text-tertiary);
cursor: default;
padding: 1.5rem;
}
.wifi-info { flex: 1; min-width: 0; }
.wifi-ssid {
font-weight: 500;
color: var(--text);
margin-bottom: 0.125rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.wifi-details {
font-size: 0.75rem;
color: var(--text-tertiary);
display: flex;
gap: 0.75rem;
}
.wifi-signal {
display: flex;
align-items: center;
gap: 0.375rem;
flex-shrink: 0;
}
.signal-bars {
display: flex;
gap: 2px;
align-items: flex-end;
height: 14px;
}
.signal-bar {
width: 3px;
background: var(--border);
border-radius: 1px;
}
.signal-bar:nth-child(1) { height: 25%; }
.signal-bar:nth-child(2) { height: 50%; }
.signal-bar:nth-child(3) { height: 75%; }
.signal-bar:nth-child(4) { height: 100%; }
.signal-bar.active {
background: var(--green);
}
/* ---- Devices ---- */
.devices-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 0.75rem;
min-height: 120px;
}
.device-card {
background: var(--bg);
border-radius: var(--radius-sm);
padding: 1rem;
text-align: center;
border: 1px solid transparent;
transition: border-color 0.15s;
}
.device-card:hover {
border-color: var(--border);
}
.device-icon {
width: 32px;
height: 32px;
margin: 0 auto 0.5rem;
color: var(--text-secondary);
}
.device-name {
font-weight: 500;
color: var(--text);
font-size: 0.8125rem;
margin-bottom: 0.125rem;
}
.device-type {
font-size: 0.6875rem;
color: var(--text-tertiary);
text-transform: uppercase;
letter-spacing: 0.06em;
margin-bottom: 0.125rem;
}
.device-vendor {
font-size: 0.75rem;
color: var(--text-secondary);
margin-bottom: 0.375rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.device-info {
font-size: 0.75rem;
color: var(--text-secondary);
font-variant-numeric: tabular-nums;
}
.device-mac {
font-size: 0.6875rem;
color: var(--text-tertiary);
letter-spacing: 0.02em;
margin-top: 0.125rem;
}
.device-metrics {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem 0.75rem;
margin-top: 0.625rem;
padding-top: 0.625rem;
border-top: 1px solid var(--border-light);
}
.device-metric {
display: inline-flex;
align-items: center;
gap: 0.3125rem;
font-size: 0.6875rem;
color: var(--text-secondary);
font-variant-numeric: tabular-nums;
}
.device-metric-label {
color: var(--text-tertiary);
text-transform: uppercase;
letter-spacing: 0.05em;
font-size: 0.625rem;
}
.device-metric-value {
color: var(--text);
font-weight: 500;
}
.device-metric .signal-bars {
transform: scale(0.85);
transform-origin: left center;
}
.device-placeholder {
grid-column: 1 / -1;
text-align: center;
padding: 2.5rem 1rem;
color: var(--text-tertiary);
font-size: 0.875rem;
}
.device-count {
background: var(--bg);
color: var(--text-secondary);
padding: 0.2rem 0.625rem;
border-radius: 100px;
font-size: 0.75rem;
font-weight: 600;
border: 1px solid var(--border);
font-variant-numeric: tabular-nums;
}
/* ---- Logs ---- */
.log-container {
background: #1c1c1e;
color: #a8a8a8;
padding: 1rem;
border-radius: var(--radius-sm);
font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
font-size: 0.75rem;
max-height: 360px;
overflow-y: auto;
line-height: 1.7;
min-height: 160px;
}
.log-entry {
margin-bottom: 0.25rem;
display: flex;
gap: 0.625rem;
}
.log-timestamp {
color: #555;
flex-shrink: 0;
}
.log-source {
color: var(--accent);
font-weight: 500;
flex-shrink: 0;
min-width: 72px;
}
.log-message {
color: #c8c8c8;
word-break: break-word;
}
.log-controls {
display: flex;
gap: 0.25rem;
}
.log-placeholder {
text-align: center;
padding: 2.5rem 1rem;
color: #555;
font-size: 0.8125rem;
font-family: var(--font);
}
/* ---- Hotspot ---- */
.hotspot-details {
background: var(--bg);
border-radius: var(--radius-sm);
border: 1px solid var(--border-light);
overflow: hidden;
}
.hotspot-info-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.625rem 1rem;
border-bottom: 1px solid var(--border-light);
}
.hotspot-info-item:last-child {
border-bottom: none;
}
.info-label {
font-size: 0.8125rem;
color: var(--text-secondary);
}
.info-value {
font-size: 0.8125rem;
font-weight: 500;
color: var(--text);
}
/* ---- Toast ---- */
.toast {
position: fixed;
bottom: 1.5rem;
right: 1.5rem;
max-width: 360px;
background: var(--surface);
border-radius: var(--radius);
box-shadow: 0 8px 30px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
padding: 0.875rem 1rem;
display: flex;
gap: 0.625rem;
align-items: center;
transform: translateY(calc(100% + 2rem));
transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
z-index: 1000;
border: 1px solid var(--border);
}
.toast.show {
transform: translateY(0);
}
.toast-icon {
width: 28px;
height: 28px;
border-radius: var(--radius-sm);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.toast.success .toast-icon { background: var(--green-soft); color: var(--green); }
.toast.error .toast-icon { background: var(--red-soft); color: var(--red); }
.toast.warning .toast-icon { background: var(--amber-soft); color: var(--amber); }
.toast.info .toast-icon { background: #3678c218; color: var(--blue); }
.toast-content { flex: 1; min-width: 0; }
.toast-title {
font-weight: 500;
font-size: 0.8125rem;
color: var(--text);
}
.toast-message {
font-size: 0.75rem;
color: var(--text-secondary);
margin-top: 0.0625rem;
}
.toast-close {
background: transparent;
border: none;
color: var(--text-tertiary);
cursor: pointer;
padding: 0.25rem;
border-radius: var(--radius-sm);
display: flex;
transition: color 0.15s;
}
.toast-close:hover { color: var(--text); }
/* ---- Loading ---- */
.loading-overlay {
position: fixed;
inset: 0;
background: rgba(247, 246, 243, 0.85);
backdrop-filter: blur(8px);
display: none;
align-items: center;
justify-content: center;
z-index: 2000;
flex-direction: column;
gap: 1rem;
}
.loading-overlay.show { display: flex; }
.loading-overlay p {
color: var(--text-secondary);
font-size: 0.875rem;
font-weight: 500;
}
.spinner {
width: 32px;
height: 32px;
border: 2.5px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* ---- Scrollbars ---- */
.wifi-list::-webkit-scrollbar,
.log-container::-webkit-scrollbar {
width: 6px;
}
.wifi-list::-webkit-scrollbar-track,
.log-container::-webkit-scrollbar-track {
background: transparent;
}
.wifi-list::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 3px;
}
.log-container::-webkit-scrollbar-thumb {
background: #333;
border-radius: 3px;
}
/* ---- Responsive ---- */
@media (max-width: 1024px) {
.grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
body { padding: 1rem; }
.header-content {
flex-direction: column;
align-items: flex-start;
}
.stats-grid {
grid-template-columns: repeat(2, 1fr);
}
.grid { grid-template-columns: 1fr; }
.button-group { grid-template-columns: 1fr; }
.toast {
left: 1rem;
right: 1rem;
max-width: none;
}
}
@media (max-width: 480px) {
.stats-grid {
grid-template-columns: 1fr 1fr;
}
.stat-value {
font-size: 1.25rem;
}
.devices-grid {
grid-template-columns: 1fr;
}
}