/* My phone — a user-facing settings page.
   Same variables as the rest of the platform (.assets/auth.css), and the
   same retro treatment as the launcher (/.assets/chrome.css, index.css):
   square corners, hard 2px borders, offset drop-shadows instead of blur.
   Still a single readable column, generous spacing, and controls big
   enough to use on a phone, which is quite plausibly what someone is
   reading this on. */

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-text);
    font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* No card here has its own classed link the way the launcher's app-cards
   do, so a plain rule is safe — nothing outranks it by accident (see the
   .root a specificity bug fixed in index.css). */
a { color: var(--auth-accent-hover); text-decoration: underline; }
a:visited { color: var(--auth-accent-hover); }

/* header.top below still styles pair.php and signal_setup.php, which keep
   their own plain header — only index.php (My phone) uses the shared
   .i-top chrome from /.assets/chrome.css instead. */
header.top {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 14px 20px;
    background: var(--auth-card);
    border-bottom: 1px solid var(--auth-border);
}

header.top h1 { margin: 0; font-size: 1.15rem; flex: 1; }

main { max-width: 660px; margin: 0 auto; padding: 22px 18px 80px; }

.muted { color: var(--auth-muted); }
.empty { color: var(--auth-muted); text-align: center; padding: 50px 10px; }

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

.phone {
    background: var(--auth-card);
    border: 2px solid var(--auth-border-strong);
    border-radius: 0;
    box-shadow: 3px 3px 0 var(--auth-border-strong);
    padding: 16px 18px;
    margin-bottom: 20px;
}

.phone h2 { margin: 0 0 2px; font-size: 1.2rem; display: flex; align-items: center; gap: 9px; }
.phone .sub { color: var(--auth-muted); font-size: .9rem; }

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

.pairing-list { list-style: none; margin: 0 0 12px; padding: 0; }
.pairing-list li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--auth-border);
    font-size: .92rem;
}
.pairing-list li:last-child { border-bottom: none; }

.facts { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; font-size: .88rem; }
.facts span { color: var(--auth-muted); }
.facts b { font-weight: 600; color: var(--auth-text); }

/* ---------- Setting groups ---------- */

section.group {
    background: var(--auth-card);
    border: 2px solid var(--auth-border-strong);
    border-radius: 0;
    box-shadow: 3px 3px 0 var(--auth-border-strong);
    padding: 16px 18px;
    margin-bottom: 20px;
}

section.group h3 { margin: 0 0 4px; font-size: 1.02rem; font-family: var(--i-mono, ui-monospace, monospace); text-transform: uppercase; letter-spacing: .03em; }
section.group .help { color: var(--auth-muted); font-size: .9rem; margin: 0 0 14px; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
/* :not(.toggle) is load-bearing, not decorative: without it this rule's
   specificity (class+element) beats .toggle's display:flex (class only)
   below, silently turning the checkbox's flex row back into a block — its
   track span then has no meaningful width as a plain inline element, so
   the box collapses and its checkmark ends up sitting on the label text. */
.field > label:not(.toggle) { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 5px; }
.field .fhelp { color: var(--auth-muted); font-size: .84rem; margin-top: 4px; }

input[type=text], input[type=url], input[type=password], select {
    width: 100%;
    font: inherit;
    padding: 10px 12px;
    border-radius: 0;
    border: 2px solid var(--auth-border-strong);
    background: var(--auth-input-bg);
    color: var(--auth-text);
}

input:focus, select:focus { outline: 2px solid var(--auth-accent); outline-offset: -1px; }
input:disabled, select:disabled { opacity: .5; }

/* A switch reads as a setting; a bare checkbox reads as a form. */
.toggle { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

/* A classic Mac OS 9 (Platinum) checkbox: a sunken white square with a
   two-tone bevel — darker on the top/left inner edge, lighter on the
   bottom/right, so it reads as a shallow well — and a black check mark
   drawn on top when checked. Fixed light-mode colours on purpose: this is
   meant to look like a piece of OS chrome sitting on the page, not a
   themed app control, so it does not follow --auth-* into dark mode.
   No moving parts, unlike the sliding thumb this replaces, so there is no
   travel distance to mis-measure. */
.toggle .track {
    flex: none;
    width: 18px; height: 18px;
    margin-top: 2px;
    background: white;
    border-top: 2px solid #6b6b6b;
    border-left: 2px solid #6b6b6b;
    border-bottom: 2px solid #f2f2f2;
    border-right: 2px solid #f2f2f2;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,.4);
    position: relative;
}

.toggle .track::after {
    content: "";
    display: none;
    position: absolute;
    left: 5px; top: 2px;
    width: 5px; height: 9px;
    border: solid #1a1a1a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.toggle input:checked + .track::after { display: block; }
.toggle input:focus-visible + .track { outline: 2px solid var(--auth-accent); outline-offset: 2px; }
.toggle .label { font-weight: 600; font-size: .95rem; }

/* Fields that only make sense once the feature is on. */
.dependent { padding-left: 28px; margin-top: 12px; }
.dependent.off { display: none; }

/* A fold for the fields most people never touch. */
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; color: var(--auth-muted); font-size: .9rem; margin-bottom: 10px; }

/* ---------- Actions ---------- */

.actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--auth-bg) 65%, transparent);
    padding: 16px 0 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}

button {
    font: inherit;
    font-family: var(--i-mono, ui-monospace, monospace);
    font-weight: 700;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 11px 22px;
    border-radius: 0;
    border: 2px solid var(--auth-border-strong);
    background: var(--auth-surface);
    color: var(--auth-text);
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--auth-border-strong);
    transition: transform .05s, box-shadow .05s;
}
button:active { transform: translate(2px, 2px); box-shadow: none; }

button.primary { background: var(--auth-accent); border-color: var(--auth-accent); color: white; }
button:disabled { opacity: .5; cursor: default; }
button.link {
    background: none; border: 0; box-shadow: none;
    color: var(--auth-accent-hover); padding: 4px 0;
    font-family: inherit; font-weight: 500; font-size: 1rem;
    text-transform: none; letter-spacing: normal;
}
button.link:active { transform: none; }

/* ---------- Status ---------- */

.banner {
    border-radius: 0;
    padding: 11px 14px;
    margin-bottom: 16px;
    font-size: .9rem;
    border: 2px solid;
}

.banner.wait { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.4); }
.banner.ok   { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.4); }
.banner.err  { background: rgba(239,68,68,.10);  border-color: rgba(239,68,68,.4); color: var(--auth-error); }

.toast {
    position: fixed;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    background: var(--auth-card);
    border: 2px solid var(--auth-border-strong);
    border-radius: 0;
    padding: 11px 20px;
    box-shadow: 3px 3px 0 var(--auth-border-strong);
    font-size: .92rem;
    z-index: 90;
}

.toast.err { border-color: var(--auth-error); color: var(--auth-error); }

.picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

.picker button {
    padding: 9px 16px;
}

.picker button.on { background: var(--auth-accent); border-color: var(--auth-accent); color: white; }

/* ---------- Admin corner ----------
   Only ever present in the markup for an admin (see index.php) — this is not
   a visibility toggle on something an ordinary user's browser also received.
   Squared off, like the launcher's boxed icon tiles, instead of a circle. */

.admin-corner {
    position: fixed;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: 2px solid transparent;
    color: var(--auth-muted);
    text-decoration: none;
    font-size: 16px;
    opacity: .45;
    transition: opacity .15s, background .15s;
}

.admin-corner:hover { opacity: 1; background: var(--auth-surface); border-color: var(--auth-border-strong); }

/* ---------- Hotspot group: settings beside the app downloads ---------- */

.split { display: flex; gap: 18px; align-items: flex-start; }
.split .main { flex: 1; min-width: 0; }
.split .side {
    flex: none; width: 130px;
    display: flex; flex-direction: column; gap: 10px;
    border-left: 1px solid var(--auth-border); padding-left: 18px;
}
.dl {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 8px; text-align: center; text-decoration: none;
    border: 2px solid var(--auth-border-strong);
    color: var(--auth-text); background: var(--auth-input-bg);
}
a.dl:visited { color: var(--auth-text); }
a.dl:hover { box-shadow: 2px 2px 0 var(--auth-border-strong); }
.dl svg { width: 34px; height: 34px; }
.dl span { font-size: .8rem; color: var(--auth-muted); }
a.dl span { color: var(--auth-accent-hover); text-decoration: underline; }
.dl.soon { opacity: .55; }

@media (max-width: 520px) {
    .split { flex-direction: column; }
    .split .side { width: 100%; flex-direction: row; border-left: 0; padding-left: 0; }
    .split .side .dl { flex: 1; }
}
