/* =========================================================================
   Resto installer — dark canvas, orange accent.

   Deliberately standalone: the wizard runs before `npm run build` has
   necessarily happened and before there is a database to read branding
   from, so it ships its own tokens rather than leaning on the app bundle.
   Values mirror resources/css/_resto.css so the installer and the
   platform read as one product.
   ========================================================================= */

:root {
    --accent: #f97316;
    --accent-soft: rgba(249, 115, 22, 0.12);
    --accent-line: rgba(249, 115, 22, 0.34);
    --accent-glow: rgba(249, 115, 22, 0.22);

    --ink: #0b0f16;
    --surface: #131926;
    --surface-2: #0f1522;
    --field: #0d1320;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.16);

    --text: #e9edf5;
    --muted: rgba(233, 237, 245, 0.62);
    --faint: rgba(233, 237, 245, 0.42);

    --ok: #34d399;
    --warn: #fbbf24;
    --bad: #f87171;

    --radius: 1rem;
    --radius-sm: 0.65rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    padding: clamp(1rem, 4vw, 3rem) 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(760px 420px at 12% -8%, rgba(249, 115, 22, 0.18), transparent 60%),
        radial-gradient(680px 460px at 96% 6%, rgba(249, 115, 22, 0.08), transparent 62%),
        var(--ink);
    color: var(--text);
    font-family: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

/* Faint grid, kept behind everything and out of the way of hit testing. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(1000px 620px at 50% 0%, #000 25%, transparent 78%);
    -webkit-mask-image: radial-gradient(1000px 620px at 50% 0%, #000 25%, transparent 78%);
}

code {
    font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
    font-size: 0.86em;
    padding: 0.08em 0.35em;
    border-radius: 0.3rem;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: #fdba74;
}

/*
 * Step panes (and the step forms) are transparent wrappers: their children
 * have to be flex items of .su-main so the action row can push itself to the
 * bottom. `display: contents` beats `hidden`, hence the !important below.
 */
.su-pane {
    display: contents;
}

[hidden] {
    display: none !important;
}

/* --- Shell ---------------------------------------------------------------- */

.su-shell {
    position: relative;
    width: 100%;
    max-width: 66rem;
    display: grid;
    grid-template-columns: 17.5rem 1fr;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
    overflow: hidden;
}

/* --- Left rail: brand + stepper ------------------------------------------- */

.su-rail {
    padding: 2rem 1.6rem;
    background:
        linear-gradient(180deg, rgba(249, 115, 22, 0.07), transparent 42%),
        var(--surface-2);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.su-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.su-brand small {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.su-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.su-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0.35rem;
}

/* Connector between the step bullets. */
.su-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 1.22rem;
    top: 2.45rem;
    bottom: -0.35rem;
    width: 2px;
    border-radius: 2px;
    background: var(--line);
}

.su-step.is-done:not(:last-child)::after {
    background: var(--accent-line);
}

.su-step-dot {
    flex: none;
    width: 1.85rem;
    height: 1.85rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--faint);
    transition: all 0.18s ease;
}

.su-step-label {
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.25;
}

.su-step-label span {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--faint);
}

.su-step.is-done .su-step-dot {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
}

.su-step.is-active .su-step-dot {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 5px var(--accent-glow);
}

.su-step.is-active .su-step-label {
    color: var(--text);
}

.su-rail-foot {
    margin-top: auto;
    font-size: 0.72rem;
    color: var(--faint);
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

/* --- Right pane: the actual step ------------------------------------------ */

.su-main {
    padding: clamp(1.5rem, 3vw, 2.5rem);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.su-eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.su-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 2.4vw, 1.7rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.su-lede {
    margin: 0 0 1.6rem;
    color: var(--muted);
    max-width: 42rem;
}

.su-section-title {
    margin: 1.75rem 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}

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

.su-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.1rem;
}

.su-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.su-field.is-wide {
    grid-column: 1 / -1;
}

.su-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.su-hint {
    font-size: 0.76rem;
    color: var(--faint);
}

.su-input,
.su-select {
    width: 100%;
    padding: 0.68rem 0.85rem;
    background: var(--field);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    appearance: none;
}

.su-input::placeholder {
    color: rgba(233, 237, 245, 0.28);
}

.su-input:focus,
.su-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: #0b111d;
}

.su-input[readonly] {
    color: var(--muted);
    font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
    font-size: 0.82rem;
}

.su-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e9edf5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='.55'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
}

.su-select option {
    background: var(--surface);
    color: var(--text);
}

.su-input-group {
    display: flex;
    gap: 0.5rem;
}

.su-input-group .su-input {
    flex: 1;
}

.su-error {
    font-size: 0.78rem;
    color: var(--bad);
}

/* Switch rows — used for debug mode, fresh install, starter content. */
.su-switch {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.su-switch:hover {
    border-color: var(--line-strong);
}

.su-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.su-switch-track {
    flex: none;
    margin-top: 0.15rem;
    width: 2.4rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--line-strong);
    position: relative;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.su-switch-track::after {
    content: '';
    position: absolute;
    top: 0.15rem;
    left: 0.17rem;
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 50%;
    background: var(--faint);
    transition: transform 0.18s ease, background 0.18s ease;
}

.su-switch input:checked + .su-switch-track {
    background: var(--accent);
    border-color: var(--accent);
}

.su-switch input:checked + .su-switch-track::after {
    transform: translateX(1rem);
    background: #fff;
}

.su-switch input:focus-visible + .su-switch-track {
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.su-switch-text strong {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
}

.su-switch-text span {
    font-size: 0.78rem;
    color: var(--faint);
}

/* --- Check list (requirements) -------------------------------------------- */

.su-checks {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.su-checks li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.95rem;
    background: var(--surface-2);
    font-size: 0.86rem;
}

.su-checks li + li {
    border-top: 1px solid var(--line);
}

.su-checks .su-check-name {
    font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
    font-size: 0.82rem;
    color: var(--text);
}

.su-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.su-pill--ok {
    color: var(--ok);
    background: rgba(52, 211, 153, 0.11);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.su-pill--warn {
    color: var(--warn);
    background: rgba(251, 191, 36, 0.11);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.su-pill--bad {
    color: var(--bad);
    background: rgba(248, 113, 113, 0.11);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.su-checks-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
    align-items: start;
}

/* --- Notices -------------------------------------------------------------- */

.su-note {
    display: flex;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--muted);
}

.su-note svg {
    flex: none;
    margin-top: 0.15rem;
}

.su-note--accent {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--text);
}

.su-note--bad {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.09);
    color: #fecaca;
}

.su-note--ok {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.09);
    color: #bbf7e0;
}

.su-note[hidden] {
    display: none;
}

/* --- Summary table (review) ----------------------------------------------- */

.su-summary {
    display: grid;
    gap: 1rem;
}

.su-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    overflow: hidden;
}

.su-card h3 {
    margin: 0;
    padding: 0.7rem 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.015);
}

.su-rows {
    display: grid;
}

.su-row {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
}

.su-row + .su-row {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.su-row dt {
    color: var(--faint);
}

.su-row dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

/* --- Install progress ----------------------------------------------------- */

.su-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
    margin-bottom: 1.1rem;
}

.su-progress span {
    display: block;
    height: 100%;
    width: 8%;
    border-radius: 999px;
    background: linear-gradient(90deg, #fb923c, var(--accent));
    transition: width 0.4s ease;
}

.su-progress.is-running span {
    background-size: 200% 100%;
    background-image: linear-gradient(90deg, #fb923c, #f97316, #fb923c);
    animation: su-sheen 1.4s linear infinite;
}

@keyframes su-sheen {
    to {
        background-position: -200% 0;
    }
}

.su-log {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.su-log li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    animation: su-rise 0.28s ease both;
}

.su-log li b {
    font-weight: 600;
}

.su-log li em {
    font-style: normal;
    color: var(--faint);
    margin-left: auto;
    font-size: 0.78rem;
    text-align: right;
}

.su-log-icon {
    flex: none;
    width: 1.3rem;
    height: 1.3rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(52, 211, 153, 0.14);
    color: var(--ok);
}

@keyframes su-rise {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

.su-spinner {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: su-spin 0.7s linear infinite;
}

@keyframes su-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success state after a completed install. */
.su-done-mark {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1.1rem;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    margin-bottom: 1.1rem;
}

.su-creds {
    display: grid;
    gap: 0.55rem;
    padding: 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 0.85rem;
}

.su-creds div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.su-creds span:first-child {
    color: var(--faint);
}

.su-creds span:last-child {
    font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
    overflow-wrap: anywhere;
    text-align: right;
}

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

.su-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1.75rem;
}

.su-actions .su-spacer {
    margin-left: auto;
}

.su-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.66rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease,
        border-color 0.18s ease, color 0.18s ease;
}

.su-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.su-btn--primary {
    background: linear-gradient(180deg, #fb923c, var(--accent));
    color: #1a0d02;
    box-shadow: 0 10px 26px -12px rgba(249, 115, 22, 0.9);
}

.su-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -12px rgba(249, 115, 22, 0.95);
}

.su-btn--ghost {
    border-color: var(--line-strong);
    color: var(--muted);
    background: transparent;
}

.su-btn--ghost:hover {
    color: var(--text);
    border-color: var(--accent-line);
    background: rgba(249, 115, 22, 0.06);
}

.su-btn--quiet {
    padding: 0.66rem 0.9rem;
    border-color: var(--line-strong);
    color: var(--muted);
    background: var(--field);
}

.su-btn--quiet:hover {
    color: var(--text);
    border-color: var(--accent-line);
}

.su-btn[disabled],
.su-btn.is-busy {
    opacity: 0.6;
    pointer-events: none;
    transform: none;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 62rem) {
    .su-shell {
        grid-template-columns: 1fr;
    }

    .su-rail {
        border-right: none;
        border-bottom: 1px solid var(--line);
        gap: 1.25rem;
    }

    .su-steps {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.25rem;
        scrollbar-width: none;
    }

    .su-steps::-webkit-scrollbar {
        display: none;
    }

    .su-step {
        flex-direction: column;
        gap: 0.4rem;
        text-align: center;
        padding: 0.25rem 0.6rem;
    }

    .su-step:not(:last-child)::after {
        left: auto;
        right: -0.6rem;
        top: 1.25rem;
        bottom: auto;
        width: 1.2rem;
        height: 2px;
    }

    .su-step-label span {
        display: none;
    }

    .su-rail-foot {
        display: none;
    }
}

@media (max-width: 40rem) {
    .su-grid,
    .su-checks-split {
        grid-template-columns: minmax(0, 1fr);
    }

    .su-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.1rem;
    }

    .su-actions {
        flex-wrap: wrap;
    }

    .su-actions .su-btn {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* Utilities that replace what would otherwise be inline styles in Blade. */
.su-mt-0 { margin-top: 0; }
.su-mt { margin-top: 1.25rem; }
.su-mb { margin-bottom: 1.1rem; }
.su-w-100 { width: 100%; }
