/* Deliberately small and hand-written: this admin UI is a handful of pages on a home server,
   and a CSS framework would be more bytes than the whole application. */
:root {
    --bg: #14161a;
    --panel: #1d2025;
    --panel-2: #252931;
    --line: #333842;
    --text: #e6e8eb;
    --muted: #9aa3ad;
    --accent: #4ea1ff;
    --ok: #3ecf8e;
    --warn: #f0b429;
    --bad: #f45b5b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }

header.top {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem 1.25rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

header.top .brand { font-weight: 600; letter-spacing: 0.01em; }
header.top nav { display: flex; gap: 1rem; flex-wrap: wrap; }
header.top nav a { color: var(--muted); text-decoration: none; }
header.top nav a:hover, header.top nav a.active { color: var(--text); }
header.top .spacer { flex: 1; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

h1 { font-size: 1.35rem; margin: 0 0 0.35rem; }
h2 { font-size: 1.05rem; margin: 1.75rem 0 0.6rem; }
p.lede { color: var(--muted); margin: 0 0 1.5rem; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

label { display: block; margin: 0.75rem 0 0.25rem; color: var(--muted); font-size: 0.9rem; }
input[type=text], input[type=password], input[type=email], input[type=number], select {
    width: 100%;
    max-width: 420px;
    padding: 0.5rem 0.6rem;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
}
input[type=checkbox] { margin-right: 0.4rem; }
.field-inline { display: flex; align-items: center; margin: 0.6rem 0; color: var(--muted); }

button, .button {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    margin: 0.75rem 0.4rem 0 0;
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 6px;
    color: #08111c;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
button.secondary, .button.secondary { background: var(--panel-2); color: var(--text); border-color: var(--line); }
button.danger { background: var(--bad); color: #1a0a0a; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.pill.ok { background: rgba(62, 207, 142, 0.15); color: var(--ok); }
.pill.warn { background: rgba(240, 180, 41, 0.15); color: var(--warn); }
.pill.bad { background: rgba(244, 91, 91, 0.15); color: var(--bad); }
.pill.idle { background: var(--panel-2); color: var(--muted); }

.alert { padding: 0.7rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; }
.alert.ok { border-color: var(--ok); background: rgba(62, 207, 142, 0.08); }
.alert.bad { border-color: var(--bad); background: rgba(244, 91, 91, 0.08); }
.alert.warn { border-color: var(--warn); background: rgba(240, 180, 41, 0.08); }

.metrics { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.metric { min-width: 8.5rem; }
.metric .value { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.metric .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85em; }
form.inline { display: inline; }
.login-wrap { max-width: 380px; margin: 12vh auto; }

/* Language picker: two small inline buttons rather than a dropdown, because with two languages a
   select would be more clicks for the same result. */
form.lang { display: inline-flex; gap: 0.25rem; align-items: center; margin: 0; }
form.lang .lang-option {
    margin: 0;
    padding: 0.2rem 0.5rem;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}
form.lang .lang-option:hover { color: var(--text); }
form.lang .lang-option.current {
    background: var(--panel-2);
    color: var(--text);
    border-color: var(--accent);
}

/* Charge strategy picker: radio cards rather than a dropdown, because the difference between
   "pure solar" and "fast solar" needs its description visible at the point of choosing. */
.strategy-options { display: grid; gap: 0.5rem; margin: 0.75rem 0 0; }
.strategy-option {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "radio name" "radio description";
    gap: 0 0.6rem;
    align-items: start;
    margin: 0;
    padding: 0.6rem 0.75rem;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
}
.strategy-option:hover { border-color: var(--muted); }
.strategy-option.current { border-color: var(--accent); }
.strategy-option input[type=radio] { grid-area: radio; margin: 0.25rem 0 0; }
.strategy-option .strategy-name { grid-area: name; font-weight: 600; }
.strategy-option .strategy-description { grid-area: description; color: var(--muted); font-size: 0.88rem; }

/* Collapsed by default, for settings that exist but should not compete with the normal path -
   notably setting the device API token by hand when the web password already yields it. */
details.advanced { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.5rem; }
details.advanced > summary {
    cursor: pointer; color: var(--muted); font-size: 0.9rem; list-style: revert;
}
details.advanced > summary:hover { color: var(--text); }
