/* serviris dashboard — grouped-list UI in the iOS Settings idiom. */

:root {
    --bg: #f2f2f7;
    --bg-elevated: #ffffff;
    --card: #ffffff;
    --label: #000000;
    --label-2: rgba(60, 60, 67, 0.6);
    --label-3: rgba(60, 60, 67, 0.3);
    --separator: rgba(60, 60, 67, 0.2);
    --fill: rgba(120, 120, 128, 0.12);
    --blue: #007aff;
    --green: #34c759;
    --orange: #ff9500;
    --red: #ff3b30;
    --gray: #8e8e93;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.04);
    --radius: 14px;
    color-scheme: light;
}

/* Light only, by request -- the admin panel is deliberately not theme-aware. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--label);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 17px;
    line-height: 1.4;
}

.wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px 64px;
}

/* ---------- header ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid transparent;
    transition: border-color 0.2s ease;
}

.topbar.scrolled { border-bottom-color: var(--separator); }

.topbar-inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.linkbtn {
    background: none;
    border: none;
    color: var(--blue);
    font: inherit;
    font-size: 17px;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 8px;
}

.linkbtn:hover { opacity: 0.7; }
.linkbtn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

h1.display {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 20px 0 2px;
}

.subtitle {
    color: var(--label-2);
    font-size: 15px;
    margin: 0 0 20px;
}

/* ---------- segmented control ---------- */

.segmented {
    display: flex;
    background: var(--fill);
    border-radius: 9px;
    padding: 2px;
    margin: 0 0 24px;
    position: relative;
}

.segmented button {
    flex: 1;
    appearance: none;
    border: none;
    background: transparent;
    color: var(--label);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 7px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.segmented button[aria-selected="true"] {
    background: var(--bg-elevated);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    font-weight: 600;
}

/* ---------- hero ---------- */

.hero {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.hero-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, var(--blue), color-mix(in srgb, var(--blue) 70%, #000));
    color: #fff;
    flex: none;
}

.hero-icon svg { width: 26px; height: 26px; }
.hero-text { min-width: 0; flex: 1; }

.hero-name {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-meta {
    color: var(--label-2);
    font-size: 14px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- grouped list ---------- */

.group { margin-bottom: 28px; }

.group-title {
    font-size: 13px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--label-2);
    padding: 0 16px 7px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 16px;
    position: relative;
}

.row + .row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 0;
    height: 0.5px;
    background: var(--separator);
}

.row-label { flex: none; color: var(--label); }

.row-value {
    margin-left: auto;
    color: var(--label-2);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.row-value strong {
    color: var(--label);
    font-weight: 600;
}

/* Meter rows stack a bar under the label/value pair. */
.row.meter { flex-wrap: wrap; }
.row.meter .track {
    flex-basis: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--fill);
    overflow: hidden;
    margin-top: 2px;
}

.row.meter .track > i {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--blue);
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}

.track > i.warn { background: var(--orange); }
.track > i.crit { background: var(--red); }

/* ---------- status pills / dots ---------- */

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: none;
    background: var(--gray);
    display: inline-block;
}

.dot.ok { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }
.dot.warn { background: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 22%, transparent); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    color: var(--label-2);
}

.badge {
    font-size: 13px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--green) 16%, transparent);
    color: var(--green);
}

.badge.bad {
    background: color-mix(in srgb, var(--red) 16%, transparent);
    color: var(--red);
}

/* ---------- charts ---------- */

.chart-card { padding: 16px; }

.chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}

.chart-name { font-size: 15px; font-weight: 500; }

.chart-now {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
}

.chart svg { display: block; width: 100%; height: 64px; }

.chart + .chart {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 0.5px solid var(--separator);
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--label-3);
    margin-top: 2px;
}

/* ---------- offline / empty ---------- */

.notice {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 20px;
    text-align: center;
    color: var(--label-2);
    font-size: 15px;
}

.notice .big {
    font-size: 17px;
    color: var(--label);
    font-weight: 600;
    margin-bottom: 4px;
}

.skeleton {
    color: var(--label-3);
    text-align: center;
    padding: 48px 0;
    font-size: 15px;
}

/* ---------- login ---------- */

.login-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 34px 28px 28px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, var(--blue), color-mix(in srgb, var(--blue) 65%, #000));
    color: #fff;
}

.login-mark svg { width: 30px; height: 30px; }

.login-card h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin: 0 0 4px;
}

.login-card p.hint {
    color: var(--label-2);
    font-size: 14px;
    margin: 0 0 22px;
}

.field {
    width: 100%;
    background: var(--fill);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 12px 14px;
    font: inherit;
    font-size: 16px;
    color: var(--label);
    margin-bottom: 10px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.field::placeholder { color: var(--label-3); }
.field:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--bg-elevated);
}

.primary {
    width: 100%;
    appearance: none;
    border: none;
    border-radius: 10px;
    background: var(--blue);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 14px;
    margin-top: 6px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.06s ease;
}

.primary:hover { opacity: 0.9; }
.primary:active { transform: scale(0.985); }
.primary[disabled] { opacity: 0.5; cursor: default; }

.error {
    color: var(--red);
    font-size: 14px;
    min-height: 20px;
    margin: 10px 0 0;
}

.footnote {
    text-align: center;
    color: var(--label-3);
    font-size: 12px;
    margin-top: 26px;
}

/* ---------- wi-fi ---------- */

.row.tappable {
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease;
}

.row.tappable:hover { background: rgba(120, 120, 128, 0.06); }
.row.tappable:active { background: rgba(120, 120, 128, 0.12); }

.row-sub {
    display: block;
    font-size: 13px;
    color: var(--label-2);
    margin-top: 1px;
}

.row-main { min-width: 0; }

.row-main .name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Signal strength: four bars, filled to the measured level. */
.bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    flex: none;
}

.bars i {
    width: 3px;
    border-radius: 1px;
    background: var(--label-3);
    display: block;
}

.bars i:nth-child(1) { height: 4px; }
.bars i:nth-child(2) { height: 7px; }
.bars i:nth-child(3) { height: 10px; }
.bars i:nth-child(4) { height: 14px; }
.bars i.on { background: var(--label); }
.bars.good i.on { background: var(--green); }
.bars.weak i.on { background: var(--orange); }

.lock {
    width: 12px;
    height: 12px;
    flex: none;
    color: var(--label-2);
}

.wifi-current {
    background: linear-gradient(150deg, var(--blue), color-mix(in srgb, var(--blue) 72%, #1b3fa0));
    color: #fff;
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.wifi-current .eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.75;
}

.wifi-current .ssid {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wifi-current .detail {
    font-size: 14px;
    opacity: 0.85;
    margin-top: 3px;
}

.wifi-current.disconnected {
    background: linear-gradient(150deg, #8e8e93, #636366);
}

.searchbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--fill);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 10px;
}

.searchbar svg { width: 15px; height: 15px; color: var(--label-2); flex: none; }

.searchbar input {
    border: none;
    background: none;
    outline: none;
    font: inherit;
    font-size: 16px;
    color: var(--label);
    width: 100%;
}

.searchbar input::placeholder { color: var(--label-3); }

.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.btn {
    appearance: none;
    border: none;
    border-radius: 9px;
    background: var(--fill);
    color: var(--blue);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 14px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.06s ease;
}

.btn:hover { opacity: 0.75; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn.filled { background: var(--blue); color: #fff; }
.btn.danger { color: var(--red); }

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--label-3);
    border-top-color: var(--blue);
    border-radius: 50%;
    display: inline-block;
    vertical-align: -2px;
    animation: spin 0.7s linear infinite;
}

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

/* ---------- sheet (password prompt) ---------- */

.scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 50;
    animation: fade 0.18s ease;
}

@keyframes fade { from { opacity: 0; } }

.sheet {
    background: var(--bg-elevated);
    border-radius: 18px;
    width: 100%;
    max-width: 340px;
    padding: 22px 20px 18px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: pop 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pop { from { transform: scale(0.94); opacity: 0; } }

.sheet h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.sheet p { margin: 0 0 16px; font-size: 14px; color: var(--label-2); }
.sheet .row-btns { display: flex; gap: 8px; margin-top: 12px; }
.sheet .row-btns .btn { flex: 1; }

.banner {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.banner.ok { background: color-mix(in srgb, var(--green) 14%, transparent); color: #1c7a3e; }
.banner.err { background: color-mix(in srgb, var(--red) 14%, transparent); color: #b3271f; }
.banner.info { background: color-mix(in srgb, var(--blue) 12%, transparent); color: #0a4b9a; }

@media (max-width: 420px) {
    h1.display { font-size: 28px; }
    .wrap { padding: 0 14px 48px; }
    .topbar-inner { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
