/* SignalOne portal — mobile-first layout shared by every signed-in page. */

.app-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: #012f33;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 80;
}

.app-banner[hidden] {
    display: none !important;
}

.app-banner img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    flex: 0 0 auto;
}

.app-banner-copy {
    flex: 1;
    min-width: 0;
}

.app-banner-copy strong,
.app-banner-copy span {
    display: block;
}

.app-banner-copy strong {
    font-size: 0.95rem;
}

.app-banner-copy span {
    font-size: 0.8rem;
    opacity: 0.85;
}

.app-banner-dismiss,
.app-banner-open {
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.app-banner-dismiss {
    font-size: 1.4rem;
    line-height: 1;
    padding: 0.25rem;
}

.app-banner-open {
    background: #fff;
    color: #012f33;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-weight: 650;
    font-size: 0.9rem;
}

.portal-bottom-nav {
    display: none;
}

.portal-content h1 {
    font-size: 1.75rem;
    letter-spacing: -0.03em;
}

.portal-content h2 {
    font-size: 1.2rem;
}

.portal-content p {
    font-size: 1rem;
}

.portal-network-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.portal-network-card h2 {
    margin-bottom: 0.25rem;
}

.portal-network-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.65rem 1.1rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
}

.network-page {
    max-width: 720px;
}

.network-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.network-top h1 {
    margin: 0;
}

.network-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-button,
.segmented button,
.btn,
.device-row,
.client-row {
    font: inherit;
}

.icon-button {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-primary);
    text-decoration: none;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--bg-secondary);
    border-radius: 14px;
    margin-bottom: 1rem;
}

.segmented button {
    min-height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
}

.segmented button[aria-selected="true"] {
    background: #fff;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.banner-note,
.banner-error {
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.banner-note {
    background: #e7f6f7;
    color: var(--supporting);
}

.banner-error {
    background: #fdecea;
    color: #9f2d22;
}

.section-label {
    margin: 1rem 0 0.4rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.device-row,
.client-row,
.plain-card,
.detail-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.device-row,
.client-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    border: 0;
    padding: 0.75rem;
    cursor: pointer;
    color: inherit;
}

.device-photo {
    width: 84px;
    height: 64px;
    object-fit: contain;
    background: #fff;
    flex: 0 0 auto;
}

.device-copy,
.client-copy {
    flex: 1;
    min-width: 0;
}

.device-copy strong,
.client-copy strong {
    display: block;
}

.device-meta,
.muted {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.device-copy .device-meta { display: block; }

.status-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.92rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c7c7cc;
    flex: 0 0 auto;
}

.status-dot.on { background: var(--success); }
.status-dot.off { background: #ff3b30; }
.status-dot.reboot { background: #ff9f0a; }

.signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.signal-bars i {
    display: block;
    width: 4px;
    border-radius: 1px;
    background: #d2d2d7;
}

.signal-bars i.on { background: var(--primary); }
.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 7px; }
.signal-bars i:nth-child(3) { height: 11px; }
.signal-bars i:nth-child(4) { height: 15px; }

.detail-hero {
    background: #fff;
    border-radius: 16px;
    padding: 1rem 1rem 0.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.75rem;
}

.detail-hero img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.detail-card {
    padding: 0.25rem 1rem;
    margin-bottom: 0.75rem;
}

.kv {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--bg-secondary);
    font-size: 0.98rem;
}

.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-secondary); }
.kv b { font-weight: 600; text-align: right; }
.kv .fsan {
    font-weight: 500;
    font-size: 0.8rem;
    color: #aeaeb2;
}

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-bottom: 0.25rem;
    color: var(--primary);
    background: none;
    border: 0;
    padding: 0;
    font-weight: 600;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: 100%;
    border-radius: 12px;
    border: 0;
    padding: 0.75rem 1rem;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-quiet {
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-top: 0.5rem;
}
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-speed.is-running,
.btn:disabled.btn-speed.is-running {
    opacity: 1;
    cursor: wait;
    color: #fff;
    background-image: linear-gradient(100deg, #018692 0%, #018692 28%, #ff7746 50%, #018692 72%, #018692 100%);
    background-size: 220% 100%;
    background-color: #018692;
    animation: speed-run 1.8s linear infinite;
}

@keyframes speed-run {
    from { background-position: 100% 0; }
    to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .btn-speed.is-running,
    .btn:disabled.btn-speed.is-running {
        animation: none;
        background-image: none;
        background-color: #ff7746;
    }
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }

.speed-figure {
    font-size: clamp(1.45rem, 4.6vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    white-space: nowrap;
}

.speed-grid .plain-card { padding: 0.85rem 0.75rem; }

.speed-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.plain-card { padding: 1rem; }

.wifi-group { margin-bottom: 1.15rem; }
.wifi-group .section-label { margin-top: 0; }
.wifi-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.wifi-row,
.wifi-add {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 0;
    border-top: 1px solid var(--bg-secondary);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    padding: 0.9rem 1rem;
    min-height: 56px;
    cursor: pointer;
}
.wifi-card > :first-child { border-top: 0; }
.wifi-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}
.wifi-copy strong {
    font-size: 1.02rem;
    font-weight: 650;
    word-break: break-word;
}
.wifi-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.wifi-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.wifi-badge.b24 { color: #1a57c7; background: #d1e6ff; }
.wifi-badge.b5 { color: #732ecc; background: #e6d1ff; }
.wifi-badge.wpa { color: #fff; background: #1e8c5c; }
.wifi-badge.priority { color: #fff; background: #eb7314; }
.wifi-badge.isolated { color: #fff; background: #1a7ab8; }
.wifi-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid #c7c7cc;
    border-top: 2px solid #c7c7cc;
    transform: rotate(45deg);
    flex: 0 0 auto;
}
.wifi-empty {
    margin: 0;
    padding: 0.95rem 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.wifi-add {
    color: var(--primary);
    font-weight: 650;
    justify-content: flex-start;
}
.wifi-add::before {
    content: "+";
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
}
.wifi-current {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.85rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.text-button {
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    font-weight: 650;
    padding: 0;
    min-height: 44px;
    cursor: pointer;
}
.revealed-wpa {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.sheet form .btn + .btn { margin-top: 0.5rem; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.field span { font-weight: 600; font-size: 0.92rem; }
.field input,
.field select {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}
.field input:focus,
.field select:focus { outline: 2px solid rgba(1, 134, 146, 0.35); border-color: var(--primary); }

.check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    margin-bottom: 0.85rem;
}

.sheet {
    border: 0;
    border-radius: 20px 20px 0 0;
    padding: 0;
    width: 100%;
    max-width: 720px;
    margin: auto auto 0;
    box-shadow: var(--shadow-lg);
}

.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }

.sheet form,
.sheet .sheet-body { padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); }

.sheet h2 { font-size: 1.25rem; margin-bottom: 0.75rem; }

.empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 1rem;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 0;
}

@media (max-width: 860px) {
    .portal-logo img { height: 28px; width: auto; }
    .portal-header-container { gap: 0.75rem; }
    .portal-user a { white-space: nowrap; font-size: 0.95rem; }
    .portal-nav { display: none; }
    .portal-user span { display: none; }
    .portal-header { padding: 0.65rem 0; }
    .portal-content {
        padding: 1rem 16px calc(5.25rem + env(safe-area-inset-bottom));
    }
    .portal-bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        justify-content: space-around;
        gap: 0.25rem;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom));
    }
    .portal-bottom-nav a {
        flex: 1;
        min-height: 48px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1rem;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 0.72rem;
        font-weight: 600;
    }
    .portal-bottom-nav a.active { color: var(--primary); }
    .portal-bottom-nav svg { width: 22px; height: 22px; }
}

@media (min-width: 861px) {
    .sheet {
        border-radius: 20px;
        margin: auto;
        max-width: 440px;
    }
}
