/* SimpleSpace admin/installer design system — self-contained, no external assets. */

:root {
    --ink: #191C26;
    --muted: #666F83;
    --sky: #F6F7FB;
    --paper: #FFFFFF;
    --haze: #E5E8F0;
    --nebula: #4640D6;
    --nebula-deep: #3A35C2;
    --jade: #17966B;
    --ember: #C63B3B;
    --radius: 14px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background:
        radial-gradient(52rem 30rem at 50% -8rem, rgba(70, 64, 214, .07), transparent 60%),
        var(--sky);
    min-height: 100vh;
}

/* ---- Layout shells ---- */

.page-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.shell {
    width: 100%;
    max-width: 34rem;
}

.shell--narrow { max-width: 25rem; }

.app-shell {
    max-width: 56rem;
    margin: 0 auto;
    padding: 0 1.25rem 3rem;
}

/* ---- Brand ---- */

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 0 1.1rem;
    text-decoration: none;
    color: var(--ink);
}

.brand-word {
    font-size: 1.05rem;
    font-weight: 300;
    letter-spacing: -.02em;
}

.brand-word b { font-weight: 650; }

.orbit {
    position: relative;
    width: 22px;
    height: 22px;
    flex: none;
}

.orbit::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    opacity: .85;
}

.orbit::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    margin: -2.5px 0 0 -2.5px;
    border-radius: 50%;
    background: var(--nebula);
    transform: rotate(0deg) translateX(10px);
    animation: orbit 6s linear infinite;
}

@keyframes orbit {
    to { transform: rotate(360deg) translateX(10px); }
}

/* ---- Card ---- */

.card {
    background: var(--paper);
    border: 1px solid var(--haze);
    border-radius: var(--radius);
    padding: 2rem 2.1rem 2.1rem;
    box-shadow: 0 1px 2px rgba(20, 22, 40, .04), 0 12px 32px -18px rgba(20, 22, 40, .18);
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: 0 0 1rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.steps { display: inline-flex; gap: .3rem; }

.steps i {
    width: 26px;
    height: 3px;
    border-radius: 2px;
    background: var(--haze);
}

.steps i.on { background: var(--nebula); }
.steps i.done { background: var(--jade); }

.card h1 {
    margin: 0 0 .35rem;
    font-size: 1.55rem;
    font-weight: 650;
    letter-spacing: -.022em;
    line-height: 1.2;
}

.lead {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: .95rem;
}

/* ---- Environment checks ---- */

.checks {
    list-style: none;
    margin: 0 0 1.6rem;
    padding: 0;
    border-top: 1px solid var(--haze);
}

.check {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem .15rem;
    border-bottom: 1px solid var(--haze);
}

.check-dot {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    color: #fff;
    background: var(--jade);
    animation: pop .45s cubic-bezier(.22, 1, .36, 1) both;
}

.check.is-fail .check-dot { background: var(--ember); }

.check-label { font-size: .93rem; font-weight: 550; }

.check-detail {
    margin-left: auto;
    font-family: var(--mono);
    font-size: .76rem;
    color: var(--muted);
    text-align: right;
}

@keyframes pop {
    0% { transform: scale(.4); opacity: 0; }
    60% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---- Forms ---- */

.group { margin: 0 0 1.5rem; }

.group-title {
    margin: 0 0 .8rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
    padding-bottom: .45rem;
    border-bottom: 1px solid var(--haze);
}

.field { margin: 0 0 .95rem; }

.field label {
    display: block;
    margin: 0 0 .3rem;
    font-size: .84rem;
    font-weight: 550;
}

.field input {
    width: 100%;
    padding: .62rem .78rem;
    font: inherit;
    font-size: .95rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--haze);
    border-radius: 9px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--nebula);
    box-shadow: 0 0 0 3px rgba(70, 64, 214, .14);
}

.hint {
    margin: .3rem 0 0;
    font-size: .78rem;
    color: var(--muted);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

@media (max-width: 520px) {
    .grid-2 { grid-template-columns: 1fr; }
    .card { padding: 1.5rem 1.25rem; }
    .check-detail { display: none; }
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .68rem 1.2rem;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    color: #fff;
    background: var(--nebula);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(20, 22, 40, .18);
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}

.btn:hover {
    background: var(--nebula-deep);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -8px rgba(70, 64, 214, .55);
}

.btn:active { transform: translateY(0) scale(.98); }

.btn:focus-visible {
    outline: 2px solid var(--nebula);
    outline-offset: 2px;
}

.btn--full { width: 100%; }

.btn--ghost {
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--haze);
    box-shadow: none;
}

.btn--ghost:hover {
    background: var(--sky);
    box-shadow: none;
}

.linkbtn { background: none; border: 0; color: var(--ember); font: inherit; cursor: pointer; padding: 0; margin-left: .6rem; }

/* ---- Alerts ---- */

.alert {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    margin: 0 0 1.1rem;
    padding: .7rem .9rem;
    font-size: .88rem;
    color: #8C2F33;
    background: #FCF1F1;
    border: 1px solid #F0D4D4;
    border-radius: 10px;
}

/* ---- Success ---- */

.success-dot {
    width: 52px;
    height: 52px;
    margin: 0 0 1.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    background: var(--jade);
    animation: pop .55s cubic-bezier(.22, 1, .36, 1) both;
}

/* ---- Dashboard chrome ---- */

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 0 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--haze);
}

.topbar .brand { margin: 0; }

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .8rem;
    font-size: .85rem;
    color: var(--muted);
}

.topbar-user form { margin: 0; }

.empty {
    text-align: center;
    padding: 3.4rem 2rem;
}

.empty h1 {
    margin: 0 0 .4rem;
    font-size: 1.35rem;
    letter-spacing: -.02em;
}

.empty p {
    margin: 0 auto;
    max-width: 26rem;
    color: var(--muted);
    font-size: .93rem;
}

/* ---- Motion choreography ---- */

.reveal { animation: rise .55s cubic-bezier(.22, 1, .36, 1) both; }

.d1 { animation-delay: .08s; }
.d2 { animation-delay: .16s; }

.stagger > * { animation: rise .5s cubic-bezier(.22, 1, .36, 1) both; }
.stagger > *:nth-child(1) { animation-delay: .14s; }
.stagger > *:nth-child(2) { animation-delay: .20s; }
.stagger > *:nth-child(3) { animation-delay: .26s; }
.stagger > *:nth-child(4) { animation-delay: .32s; }
.stagger > *:nth-child(5) { animation-delay: .38s; }
.stagger > *:nth-child(6) { animation-delay: .44s; }

.stagger > * .check-dot { animation-delay: inherit; }

@keyframes rise {
    from { opacity: 0; transform: translateY(12px) scale(.995); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .reveal, .stagger > *, .check-dot, .success-dot { animation: none; }
    .orbit::after { animation: none; }
    .btn { transition: none; }
}

/* ---- Admin content tools (Phase 2) ---- */

.table { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 .6rem .5rem 0; border-bottom: 1px solid var(--haze); }
.table td { padding: .65rem .6rem .65rem 0; border-bottom: 1px solid var(--haze); }

.chip { display: inline-block; padding: .12rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.chip--published { background: #E7F5EF; color: #116A4C; }
.chip--draft { background: #F1F2F7; color: var(--muted); }

textarea.code { width: 100%; font-family: var(--mono); font-size: .82rem; line-height: 1.5; padding: .9rem; border: 1px solid var(--haze); border-radius: 9px; background: #FBFBFE; color: var(--ink); resize: vertical; }
textarea.code:focus { outline: none; border-color: var(--nebula); box-shadow: 0 0 0 3px rgba(70, 64, 214, .14); }

.toolbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.notice { margin: 0 0 1.1rem; padding: .6rem .9rem; font-size: .88rem; color: #116A4C; background: #E7F5EF; border: 1px solid #CBE8DC; border-radius: 10px; }

/* ---- Admin shell (Phase 3) ---- */
body.admin { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: var(--sky); }
.sidebar { background: #fff; border-right: 1px solid var(--haze); padding: 1.3rem 1rem; display: flex; flex-direction: column; gap: 1.4rem; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { margin: 0 .3rem; }
.sidenav { display: flex; flex-direction: column; gap: .15rem; }
.sidenav a { padding: .5rem .65rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 550; }
.sidenav a:hover { background: var(--sky); color: var(--ink); }
.sidenav a.on { background: rgba(70,64,214,.1); color: var(--nebula); }
.sidenav-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; font-size: .78rem; color: var(--muted); }
.sidenav-foot span { overflow: hidden; text-overflow: ellipsis; }
.btn--sm { padding: .4rem .7rem; font-size: .82rem; }
.admin-main { padding: 2rem 2.2rem; min-width: 0; }
.admin-head { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.6rem; }
.admin-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.admin-head .spacer { margin-left: auto; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 0 0 1.8rem; }
.stat { background: #fff; border: 1px solid var(--haze); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.stat .n { font-size: 1.8rem; font-weight: 650; letter-spacing: -.02em; }
.stat .l { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 720px) { body.admin { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; } .sidenav { flex-direction: row; flex-wrap: wrap; } .sidenav-foot { margin: 0; flex-direction: row; align-items: center; } }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.media-tile { margin: 0; background: #fff; border: 1px solid var(--haze); border-radius: 10px; overflow: hidden; }
.media-tile img { width: 100%; height: 120px; object-fit: cover; display: block; }
.media-tile figcaption { padding: .5rem .6rem; font-size: .74rem; color: var(--muted); display: flex; justify-content: space-between; gap: .4rem; align-items: center; word-break: break-all; }

.navrow { display: flex; gap: .6rem; margin-bottom: .5rem; }
.navrow input { flex: 1; }
