/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #0c0c12;
    --surface:    #13131e;
    --surface2:   #1a1a28;
    --border:     #26263a;
    --text:       #e2e2f0;
    --muted:      #6b6b88;
    --accent:     #7c6eff;
    --accent-dim: #3d3680;
    --green:      #22c55e;
    --red:        #ef4444;
    --yellow:     #eab308;

    /* platform colours */
    --yt:  #ff0000;
    --fb:  #1877f2;
    --tw:  #9146ff;
    --x:   #e7e9ea;
    --li:  #0a66c2;
    --ig:  #e1306c;
    --tt:  #69c9d0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ── TYPOGRAPHY ──────────────────────────────────────────── */
h1 { font-size: 1.25rem; font-weight: 700; color: #fff; }
h2 {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 18px;
}

/* ── INPUTS ──────────────────────────────────────────────── */
label {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 5px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="url"] {
    width: 100%;
    padding: 9px 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.18s;
    font-family: inherit;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); opacity: 0.6; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    font-family: inherit;
    white-space: nowrap;
}
.btn:hover  { opacity: 0.85; }
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--green);  color: #fff; }
.btn-danger  { background: var(--red);    color: #fff; }
.btn-ghost   { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-sm      { padding: 6px 13px; font-size: 0.8rem; }
.btn-full    { width: 100%; }

/* ── CARD ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 24px;
}

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(124,110,255,0.08) 0%, transparent 60%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
}

.login-logo {
    font-size: 2rem;
    margin-bottom: 6px;
}

.login-card h1 { margin-bottom: 4px; }

.login-card p {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.form-group { margin-bottom: 16px; }

.error-msg {
    color: var(--red);
    font-size: 0.78rem;
    min-height: 18px;
    margin-bottom: 10px;
}

/* ── DASHBOARD LAYOUT ────────────────────────────────────── */
.dash-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: rgba(13,13,20,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.dash-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px 60px;
    display: grid;
    gap: 18px;
}

/* ── STATUS BADGE ────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.badge-live    { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.badge-offline { background: rgba(107,107,136,0.12); color: var(--muted); border: 1px solid var(--border); }

.badge .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge-live .dot { animation: blink 1.4s infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.25} }

/* ── SOURCE ROW ──────────────────────────────────────────── */
.source-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.source-row > .url-wrap { flex: 1; }

/* ── PLATFORM GRID ───────────────────────────────────────── */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.platform-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
}

.p-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.save-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── SATELLITES STATUS ───────────────────────────────────── */
.sat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.sat-live    { background: rgba(34,197,94,0.15);   color: #4ade80;  border: 1px solid rgba(34,197,94,0.25); }
.sat-offline { background: rgba(107,107,136,0.1);  color: #555570;  border: 1px solid var(--border); }
.sat-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── LOG BOX ─────────────────────────────────────────────── */
.log-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    height: 130px;
    overflow-y: auto;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.76rem;
    color: #8888aa;
    line-height: 1.7;
    scroll-behavior: smooth;
}
.log-box .log-line { display: block; }
.log-box .log-ts   { color: #444460; margin-right: 6px; }
.log-box .log-ok   { color: #4ade80; }
.log-box .log-warn { color: #eab308; }
.log-box .log-err  { color: #f87171; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── PLATFORM STATUS GRID ────────────────────────────────── */
.platform-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.ps-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    transition: border-color 0.2s, background 0.2s;
}

.ps-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ps-name {
    font-size: 0.82rem;
    font-weight: 600;
    flex: 1;
    color: var(--text);
}

.ps-state {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}

/* States */
.ps-live        { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.07); }
.ps-live .ps-state        { background: rgba(34,197,94,0.15); color: #4ade80; }

.ps-connecting  { border-color: rgba(234,179,8,0.3); background: rgba(234,179,8,0.05); }
.ps-connecting .ps-state  { background: rgba(234,179,8,0.15); color: #facc15; }

.ps-idle        { border-color: var(--border); }
.ps-idle .ps-state        { background: var(--surface2); color: var(--muted); }

.ps-nokey       { opacity: 0.4; }
.ps-nokey .ps-state       { background: var(--surface2); color: var(--muted); }

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 999;
    white-space: nowrap;
    pointer-events: none;
}
.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-error {
    border-color: rgba(239,68,68,0.4);
    color: #fca5a5;
}