/* cloudkeep — single stylesheet for the landing page and the gateway SPA.
   Kept deliberately small: tokens, primitives (btn/card/field/badge), then
   the three SPA views. */

/* ---------- reset + tokens ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #0d1117; --surface: #161b22; --surface-2: #1c2128;
    --border: #30363d; --border-soft: #21262d;
    --text: #e6edf3; --text-muted: #8b949e; --danger: #f85149;
    --radius: 6px; --container: 1100px;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
html, body { height: 100%; }
body {
    background: var(--bg); color: var(--text);
    font: 14px/1.5 var(--mono);
    min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: var(--border); }
a:hover { text-decoration-color: var(--text); }
h1, h2, h3 { font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
main { flex: 1; padding: 40px 0; }
.site-header { border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
              border: 1px solid var(--border); border-radius: 5px; background: var(--surface); font-size: 12px; }
.brand-name { font-size: 13px; }
.site-footer { border-top: 1px solid var(--border); padding: 16px 0; color: var(--text-muted); font-size: 12px; }
.section-header { padding-bottom: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--border-soft); }
.section-header--row { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 15px; }
.hero { margin-bottom: 48px; }
.hero-title { font-size: 28px; margin-bottom: 8px; }
.hero-tagline { color: var(--text-muted); }

/* ---------- primitives ---------- */
.btn { font: 13px var(--mono); color: var(--text); background: var(--surface-2);
       border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--text-muted); }
.btn:disabled { color: var(--text-muted); cursor: not-allowed; }
.btn--card { flex: 1; text-align: center; text-decoration: none; display: block; }
.btn--ghost { background: transparent; padding: 4px 10px; font-size: 12px; }
.btn--danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card:hover { border-color: var(--text-muted); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-title { font-size: 14px; overflow-wrap: anywhere; }
.card-body { color: var(--text-muted); font-size: 13px; }
.card-err { font-size: 12px; color: var(--text-muted); border: 1px solid var(--border);
            border-radius: var(--radius); background: var(--surface-2); padding: 6px 8px; margin-top: 8px; }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card > .btn--card { margin-top: 12px; }   /* landing page: button without an actions row */

.badge { font-size: 11px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 10px;
         color: var(--text-muted); white-space: nowrap; }
.badge--active { color: var(--text); border-color: var(--text-muted); }
.badge--pending { background: var(--surface-2); }
.badge--down { background: var(--surface-2); border-style: dashed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--text-muted); }
.field-input { font: 13px var(--mono); color: var(--text); background: var(--bg);
               border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 10px; }
.field-input:focus { outline: none; border-color: var(--text-muted); }
.form-error { color: var(--text); font-size: 12px; border: 1px solid var(--text-muted);
              border-radius: var(--radius); background: var(--surface-2); padding: 8px 10px; }
.empty { color: var(--text-muted); font-size: 13px; padding: 24px 0; }

.slider { appearance: none; -webkit-appearance: none; height: 4px; border-radius: 2px;
          background: var(--surface-2); border: 1px solid var(--border); }
.slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 16px; height: 16px;
                                border-radius: 50%; background: var(--text); cursor: pointer; }
.slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%;
                            background: var(--text); border: none; cursor: pointer; }

/* ---------- login ---------- */
#view-login { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.auth-card { width: 100%; max-width: 320px; background: var(--surface); border: 1px solid var(--border);
             border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-title { font-size: 16px; margin-bottom: 6px; }

/* ---------- dashboard ---------- */
.resbar { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.builder { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
           padding: 20px; margin-bottom: 24px; display: flex; flex-direction: column; gap: 16px; max-width: 520px; }

/* ---------- viewer (full-bleed) ---------- */
body[data-view="viewer"] { height: 100vh; overflow: hidden; }
body[data-view="viewer"] .site-header, body[data-view="viewer"] main { display: none !important; }
.view-viewer { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px;
              border-bottom: 1px solid var(--border); flex-shrink: 0; }
.viewer-status { flex: 1; font-size: 12px; color: var(--text-muted); }
.viewer-screen { flex: 1; min-height: 0; background: #000; overflow: hidden; position: relative; }
.viewer-screen > :first-child { width: 100% !important; height: 100% !important; }

@media (max-width: 600px) { main { padding: 28px 0; } .hero-title { font-size: 22px; } }
