:root {
    --bg: #0b0f14;
    --fg: #eaeef3;
    --muted: #9aa6b2;
    --card: #121821;
    --acc: #4da3ff;
    --err: #ff6b6b;
    --line: #1c2633;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

header,
footer {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

footer {
    border-top: 1px solid var(--line);
    border-bottom: none;
    color: var(--muted);
}

.logo {
    height: 24px;
    vertical-align: middle;
    margin-right: 8px;
}

h1 {
    display: inline-block;
    font-size: 18px;
    margin: 0;
}

.view {
    padding: 16px;
}

.card {
    max-width: 360px;
    margin: 40px auto;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
}

label {
    display: block;
    margin: 8px 0 4px;
    color: var(--muted);
}

input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
    color: var(--fg);
}

button {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111926;
    color: var(--fg);
    cursor: pointer;
}

button:hover {
    border-color: var(--acc);
}

.error {
    color: var(--err);
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

#gateway-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tab {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    cursor: pointer;
    background: #0f151d;
    color: var(--muted);
}

.tab.active {
    color: var(--fg);
    border-color: var(--acc);
    background: #152130;
    box-shadow: 0 0 0 1px var(--acc) inset;
}

.gateway-header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 10px;
    color: var(--muted);
}

#device-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#device-table th,
#device-table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

#device-table thead th {
    position: sticky;
    top: 0;
    background: #0d141c;
    z-index: 1;
    text-align: left;
    color: var(--muted);
}

tr.clickable {
    cursor: pointer;
}

.badge {
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
}

#device-detail {
    margin-top: 16px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.pagination {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

#login form input {
    margin-bottom: 10px;
}

#login form button[type="submit"] {
    display: block;
    width: 100%;
    margin-top: 12px;
}