@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500;1,600&family=IBM+Plex+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap");

/* ============================================================
   RaapNexus Studio — design tokens
   Layering model: canvas -> surface -> raised card -> modal
   ============================================================ */
:root {
    --void: #070604;
    --ink: #100e0b;
    --panel: rgba(22, 18, 13, 0.66);
    --panel-solid: #17140f;
    --cream: #f6eee3;
    --mute: #b7aa97;
    --mute-2: #8a7e6d;
    --line: rgba(232, 201, 138, 0.14);
    --line-strong: rgba(232, 201, 138, 0.3);
    --line-soft: rgba(232, 201, 138, 0.08);
    --gold: #d8b56a;
    --gold-2: #f0d59a;
    --gold-deep: #9a7540;
    --ember: #c45c3a;
    --ok: #7dba8a;
    --warn: #e0b15a;
    --serif: "Cormorant Garamond", "Palatino Linotype", Georgia, serif;
    --sans: "Manrope", "Segoe UI", system-ui, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;

    /* Motion physics */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --spring: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-fast: 0.18s;
    --dur: 0.32s;
    --dur-slow: 0.6s;

    /* Elevation ramp — multi-layer shadows + hairline strokes */
    --elev-1:
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.28),
        0 0 0 1px var(--line-soft);
    --elev-2:
        0 2px 4px rgba(0, 0, 0, 0.4),
        0 18px 50px rgba(0, 0, 0, 0.42),
        0 0 0 1px var(--line);
    --elev-3:
        0 4px 10px rgba(0, 0, 0, 0.45),
        0 30px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--line);
    --elev-4:
        0 10px 24px rgba(0, 0, 0, 0.5),
        0 48px 110px rgba(0, 0, 0, 0.6),
        0 0 0 1px var(--line-strong);
    --shadow: var(--elev-3);

    /* Inner highlight for glass surfaces */
    --inner-stroke: inset 0 1px 0 rgba(246, 238, 227, 0.06);
    --focus-ring:
        0 0 0 2px rgba(7, 6, 4, 0.9),
        0 0 0 5px rgba(216, 181, 106, 0.45),
        0 0 24px rgba(216, 181, 106, 0.18);

    --nav-height: 64px;

    /* Page layout — wider canvas, tighter side gutters */
    --page-max: min(1560px, calc(100vw - 2.5rem));
    --page-gutter: 1.25rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--void);
    color: var(--cream);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

::selection { background: rgba(216, 181, 106, 0.32); color: #fff8ea; }

/* Slim, warm custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(216, 181, 106, 0.25) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(216, 181, 106, 0.3), rgba(154, 117, 64, 0.3));
    border-radius: 999px;
    border: 2px solid rgba(7, 6, 4, 0.8);
}
*::-webkit-scrollbar-thumb:hover { background: rgba(216, 181, 106, 0.5); }

/* Global keyboard focus treatment */
:focus { outline: none; }
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 10px;
    transition: box-shadow var(--dur-fast) var(--spring);
}

/* ============================================================
   Canvas atmosphere
   ============================================================ */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(900px 520px at 12% -10%, rgba(216, 181, 106, 0.18), transparent 60%),
        radial-gradient(700px 480px at 92% 110%, rgba(196, 92, 58, 0.16), transparent 55%),
        radial-gradient(500px 360px at 70% 8%, rgba(240, 213, 154, 0.06), transparent 50%),
        linear-gradient(180deg, #120f0b 0%, var(--void) 42%, #0b0907 100%);
}

.atmosphere {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.atmosphere .grain {
    position: absolute;
    inset: 0;
    opacity: 0.18;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/><feColorMatrix values='0 0 0 0 0.95  0 0 0 0 0.88  0 0 0 0 0.72  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.atmosphere .grid {
    position: absolute;
    inset: 0;
    opacity: 0.07;
    background-image:
        linear-gradient(rgba(246, 238, 227, 0.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(246, 238, 227, 0.35) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(ellipse at 50% 0%, black 10%, transparent 70%);
}

.navbar, main { position: relative; }
main { z-index: 1; }

a {
    color: var(--gold-2);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--cream); }

/* ============================================================
   Navigation — floating glass bar
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(22px) saturate(1.3);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    background: linear-gradient(180deg, rgba(7, 6, 4, 0.82), rgba(7, 6, 4, 0.35));
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.nav-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 1.05rem var(--page-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--cream);
    text-decoration: none;
    transition: transform var(--dur) var(--spring);
}
.brand:hover { transform: translateY(-1px); }

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: linear-gradient(145deg, var(--gold-2), var(--gold-deep));
    color: #1a140d;
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow:
        0 8px 20px rgba(216, 181, 106, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -6px 12px rgba(122, 88, 40, 0.35);
    transition: box-shadow var(--dur) var(--spring), transform var(--dur) var(--spring);
}
.brand:hover .brand-mark {
    box-shadow:
        0 12px 28px rgba(216, 181, 106, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 -6px 12px rgba(122, 88, 40, 0.35);
    transform: rotate(-3deg);
}

.brand-word {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-word b {
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--mute);
}

.brand-word span {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--gold);
    font-weight: 500;
}

.nav-links { display: flex; gap: 0.35rem; align-items: center; }
.nav-links a {
    color: var(--mute);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition:
        color var(--dur-fast) var(--ease),
        background var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring);
}
.nav-links a:hover {
    color: var(--cream);
    background: rgba(216, 181, 106, 0.07);
    border-color: var(--line);
    transform: translateY(-1px);
}

/* ============================================================
   Layout shells
   ============================================================ */
.container {
    max-width: var(--page-max);
    margin: 2.6rem auto 4.5rem;
    padding: 0 var(--page-gutter);
}
.container-sm { max-width: 440px; margin: 2.4rem auto 3rem; padding: 0 1.15rem; }
.container-ready { max-width: 1080px; margin: 2.2rem auto 4rem; padding: 0 1.25rem; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
    max-width: 1080px;
    margin: 0 auto;
    padding: 6.5rem 2rem 5rem;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 3.5rem;
    align-items: center;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 1.35rem;
}

.kicker::before {
    content: "";
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
}

.display {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(3.1rem, 6vw, 5.4rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--cream);
    margin-bottom: 1.25rem;
}

.display em {
    font-style: italic;
    color: var(--gold-2);
    background: linear-gradient(120deg, var(--gold-2), #fff3d4 55%, var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lede {
    font-size: 1.05rem;
    color: var(--mute);
    max-width: 28rem;
    margin-bottom: 2.2rem;
}

.cta-row { display: flex; gap: 0.85rem; flex-wrap: wrap; }

.hero-panel {
    position: relative;
    min-height: 380px;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    background:
        linear-gradient(160deg, rgba(216, 181, 106, 0.12), transparent 42%),
        linear-gradient(180deg, rgba(23, 20, 15, 0.9), rgba(10, 8, 6, 0.95));
    box-shadow: var(--elev-3), var(--inner-stroke);
    animation: rise var(--dur-slow) var(--spring);
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: auto -20% -30% 20%;
    height: 70%;
    background: radial-gradient(circle, rgba(216, 181, 106, 0.28), transparent 65%);
    filter: blur(8px);
}

.orbits {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(232, 201, 138, 0.22);
}

.ring:nth-child(1) { width: 140px; height: 140px; }
.ring:nth-child(2) { width: 220px; height: 220px; animation: spin 28s linear infinite; border-style: dashed; }
.ring:nth-child(3) { width: 300px; height: 300px; animation: spin 42s linear infinite reverse; }

.jewel {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 35% 30%, #fff3d4, var(--gold) 42%, var(--gold-deep));
    color: #1a140d;
    font-family: var(--serif);
    font-style: italic;
    font-size: 2.4rem;
    box-shadow:
        0 20px 50px rgba(216, 181, 106, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -10px 22px rgba(122, 88, 40, 0.4);
    z-index: 1;
    animation: floaty 6s ease-in-out infinite;
}

.hero-caption {
    position: absolute;
    left: 1.4rem;
    right: 1.4rem;
    bottom: 1.3rem;
    z-index: 2;
    color: var(--mute);
    font-size: 0.82rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes rise {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes popIn {
    from { opacity: 0; transform: translateY(22px) scale(0.96); }
    to { opacity: 1; transform: none; }
}
@keyframes shimmer {
    from { background-position: -400px 0; }
    to { background-position: 400px 0; }
}

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.02em; color: var(--cream); }
h1 { font-size: clamp(2.3rem, 4vw, 3.35rem); line-height: 1; margin-bottom: 0.4rem; }
h2 { font-size: 1.7rem; margin-bottom: 0.55rem; }
h3 { font-size: 1.35rem; }
p { color: var(--mute); margin-bottom: 1rem; }
.text-muted { color: var(--mute); }
.text-center { text-align: center; }
.text-sm { font-size: 0.84rem; }

code {
    font-family: var(--mono);
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--line);
    color: var(--gold-2);
    padding: 0.18rem 0.4rem;
    border-radius: 7px;
    word-break: break-all;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ============================================================
   Surfaces — layered glass cards
   ============================================================ */
.card, .panel {
    position: relative;
    background:
        radial-gradient(120% 90% at 20% -10%, rgba(216, 181, 106, 0.06), transparent 55%),
        var(--panel);
    backdrop-filter: blur(24px) saturate(1.25);
    -webkit-backdrop-filter: blur(24px) saturate(1.25);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--elev-3), var(--inner-stroke);
    padding: 1.7rem;
    margin-bottom: 1.4rem;
    animation: rise 0.7s var(--spring);
}

.card::before, .panel::before, .modal-content::before {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
    opacity: 0.55;
    pointer-events: none;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1.5rem;
    margin-bottom: 1.8rem;
    width: 100%;
}

.page-head p { margin: 0; max-width: 36rem; }

/* ============================================================
   Buttons — tactile, layered, spring physics
   ============================================================ */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
    color: #1a140d;
    border: 0;
    padding: 0.72rem 1.25rem;
    font-family: var(--sans);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    overflow: hidden;
    box-shadow:
        0 1px 0 rgba(255, 248, 224, 0.5) inset,
        0 -8px 14px rgba(122, 88, 40, 0.28) inset,
        0 2px 6px rgba(0, 0, 0, 0.3),
        0 10px 24px rgba(216, 181, 106, 0.22);
    transition:
        transform var(--dur) var(--spring),
        box-shadow var(--dur) var(--spring),
        filter var(--dur-fast) var(--ease);
    will-change: transform;
}
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.35) 50%, transparent 62%);
    background-size: 300% 100%;
    background-position: 130% 0;
    transition: background-position 0.7s var(--ease);
    pointer-events: none;
}
.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
    color: #1a140d;
    box-shadow:
        0 1px 0 rgba(255, 248, 224, 0.6) inset,
        0 -8px 14px rgba(122, 88, 40, 0.28) inset,
        0 4px 10px rgba(0, 0, 0, 0.32),
        0 18px 36px rgba(216, 181, 106, 0.32);
}
.btn:hover::after { background-position: -30% 0; }
.btn:active {
    transform: translateY(0) scale(0.985);
    transition-duration: 0.08s;
    box-shadow:
        0 1px 0 rgba(255, 248, 224, 0.35) inset,
        0 6px 10px rgba(122, 88, 40, 0.4) inset,
        0 2px 6px rgba(0, 0, 0, 0.3);
}
.btn:focus-visible { box-shadow: var(--focus-ring); }

.btn-outline {
    background:
        linear-gradient(180deg, rgba(246, 238, 227, 0.04), transparent),
        rgba(0, 0, 0, 0.1);
    color: var(--cream);
    border: 1px solid var(--line-strong);
    box-shadow: var(--inner-stroke);
}
.btn-outline::after { display: none; }
.btn-outline:hover {
    background: rgba(246, 238, 227, 0.07);
    color: var(--cream);
    border-color: rgba(232, 201, 138, 0.5);
    box-shadow: var(--inner-stroke), 0 10px 26px rgba(0, 0, 0, 0.35);
}
.btn-outline:active { background: rgba(246, 238, 227, 0.04); }

.btn-link {
    background: none;
    border: 0;
    color: var(--gold-2);
    cursor: pointer;
    font-family: var(--sans);
    font-size: inherit;
    padding: 0;
    text-decoration: none;
    box-shadow: none;
    transition: color var(--dur-fast) var(--ease), transform var(--dur) var(--spring);
}
.btn-link::after { display: none; }
.btn-link:hover { color: var(--cream); transform: none; box-shadow: none; filter: none; }
.btn-link:active { transform: scale(0.97); }

.btn-danger { color: #e7a197; }
.btn-danger:hover { color: #ffc9c1; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.78rem; }

/* ============================================================
   Forms — glass inputs with glow focus
   ============================================================ */
.form-group { margin-bottom: 1.15rem; }
label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--mute);
    margin-bottom: 0.45rem;
}

input[type="text"], input[type="password"], input[type="url"], select {
    width: 100%;
    padding: 0.82rem 0.95rem;
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--cream);
    background: rgba(0, 0, 0, 0.38);
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
    transition:
        border-color var(--dur-fast) var(--ease),
        box-shadow var(--dur) var(--spring),
        background var(--dur-fast) var(--ease);
}
input::placeholder { color: #6f675c; }
input:hover, select:hover { border-color: rgba(232, 201, 138, 0.24); }
input:focus, select:focus {
    border-color: var(--gold);
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.3),
        0 0 0 4px rgba(216, 181, 106, 0.14),
        0 0 24px rgba(216, 181, 106, 0.1);
    background: rgba(0, 0, 0, 0.5);
}

.hint { font-size: 0.78rem; color: var(--mute-2); margin-top: 0.4rem; }
.check { display: flex; align-items: center; gap: 0.6rem; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.check label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 0.86rem; font-weight: 500; color: var(--mute); cursor: pointer; }

/* ============================================================
   Alerts, badges, status
   ============================================================ */
.alert {
    padding: 1rem 1.1rem;
    border-radius: 14px;
    margin-bottom: 1.4rem;
    font-size: 0.88rem;
    border: 1px solid transparent;
    box-shadow: var(--inner-stroke);
    animation: rise 0.5s var(--spring);
}
.alert-error { background: rgba(196, 92, 58, 0.14); color: #f3b3a6; border-color: rgba(196, 92, 58, 0.35); }
.alert-success { background: rgba(125, 186, 138, 0.12); color: #cfe8d4; border-color: rgba(125, 186, 138, 0.28); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(216, 181, 106, 0.12), rgba(216, 181, 106, 0.05));
    border: 1px solid var(--line);
    color: var(--gold-2);
    box-shadow: var(--inner-stroke);
}
.badge-ok {
    color: var(--ok);
    background: linear-gradient(180deg, rgba(125, 186, 138, 0.16), rgba(125, 186, 138, 0.06));
    border-color: rgba(125, 186, 138, 0.32);
}

.status-text {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--mute);
}
.status-text::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mute-2);
    box-shadow: 0 0 0 3px rgba(138, 126, 109, 0.15);
    transition: background var(--dur-fast), box-shadow var(--dur-fast);
}
.status-text.good { color: var(--ok); }
.status-text.good::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(125, 186, 138, 0.18), 0 0 12px rgba(125, 186, 138, 0.5); }
.status-text.bad { color: #e7a197; }
.status-text.bad::before { background: var(--ember); box-shadow: 0 0 0 3px rgba(196, 92, 58, 0.2), 0 0 12px rgba(196, 92, 58, 0.5); }
.status-text.warn { color: var(--warn); }
.status-text.warn::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(224, 177, 90, 0.2), 0 0 12px rgba(224, 177, 90, 0.45); }

/* ============================================================
   Connection cards — 3-column grid
   ============================================================ */
.panel-flush {
    padding: 1rem;
    background:
        radial-gradient(120% 80% at 50% -20%, rgba(216, 181, 106, 0.04), transparent 55%),
        var(--panel);
}

.connection-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    padding: 1.35rem 1.25rem 1.15rem;
    border-radius: 20px;
    border: 1px solid var(--line);
    background:
        radial-gradient(120% 90% at 20% -15%, rgba(216, 181, 106, 0.08), transparent 58%),
        linear-gradient(180deg, rgba(246, 238, 227, 0.02), transparent 45%),
        rgba(0, 0, 0, 0.28);
    box-shadow: var(--elev-2), var(--inner-stroke);
    overflow: hidden;
    transition:
        border-color var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring),
        background var(--dur-fast) var(--ease),
        box-shadow var(--dur) var(--spring);
    animation: rise 0.55s var(--spring) both;
}
.app-card:nth-child(2) { animation-delay: 0.06s; }
.app-card:nth-child(3) { animation-delay: 0.12s; }
.app-card:nth-child(4) { animation-delay: 0.18s; }
.app-card:nth-child(5) { animation-delay: 0.24s; }
.app-card:nth-child(6) { animation-delay: 0.3s; }

.app-card:hover {
    border-color: var(--line-strong);
    background:
        radial-gradient(120% 90% at 20% -15%, rgba(216, 181, 106, 0.14), transparent 58%),
        linear-gradient(180deg, rgba(216, 181, 106, 0.04), transparent 55%),
        rgba(216, 181, 106, 0.05);
    transform: translateY(-4px);
    box-shadow: var(--elev-3), var(--inner-stroke);
}

.app-card[data-connection-card] {
    cursor: pointer;
}

.app-card[data-connection-card]:hover .app-card-title h3 {
    color: var(--gold);
}

.app-card-accent {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), var(--gold-2), transparent);
    opacity: 0.75;
}

.app-card.is-inactive {
    opacity: 0.72;
    filter: saturate(0.85);
}
.app-card.is-inactive .app-card-accent {
    background: linear-gradient(90deg, transparent, var(--mute-2), transparent);
}

.app-card-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.app-card-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.app-card-title h3 {
    margin: 0;
    font-size: 1.22rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--mute-2);
}
.app-card-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mute-2);
}
.app-card-status.live { color: var(--ok); }
.app-card-status.live::before {
    background: var(--ok);
    box-shadow: 0 0 10px rgba(125, 186, 138, 0.55);
}
.app-card-status.paused { color: var(--warn); }
.app-card-status.paused::before { background: var(--warn); }

.app-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.app-card-url {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--mute);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

.app-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-soft);
}

.app-card-foot .btn-sm {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.app-card-menu {
    position: relative;
    margin-left: auto;
}
.app-card-menu summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.app-card-menu summary::-webkit-details-marker { display: none; }
.app-card-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 34px;
    padding: 0 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.18);
    color: var(--mute);
    font-size: 1rem;
    letter-spacing: 0.15em;
    line-height: 1;
    transition:
        color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        background var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring);
}
.app-card-more:hover {
    color: var(--cream);
    border-color: var(--line-strong);
    background: rgba(216, 181, 106, 0.08);
}
.app-card-menu-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.45rem);
    z-index: 5;
    min-width: 148px;
    padding: 0.45rem;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: linear-gradient(180deg, #1d1913, #120f0b);
    box-shadow: var(--elev-3);
    display: grid;
    gap: 0.15rem;
}
.app-card-menu-panel form { margin: 0; }
.app-card-menu-panel .btn-link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
}
.app-card-menu-panel .btn-link:hover {
    background: rgba(246, 238, 227, 0.05);
}

/* Compact horizontal rows (modals, file lists) */
.ledger {
    display: grid;
    gap: 0.8rem;
}

.app-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.1rem;
    align-items: center;
    padding: 1.15rem 1.25rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(246, 238, 227, 0.015), transparent 55%),
        rgba(0, 0, 0, 0.22);
    box-shadow: var(--inner-stroke);
    transition:
        border-color var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring),
        background var(--dur-fast) var(--ease),
        box-shadow var(--dur) var(--spring);
}
.app-row:hover {
    border-color: var(--line-strong);
    background:
        linear-gradient(180deg, rgba(216, 181, 106, 0.05), transparent 70%),
        rgba(216, 181, 106, 0.04);
    transform: translateY(-2px);
    box-shadow: var(--inner-stroke), 0 16px 38px rgba(0, 0, 0, 0.35);
}

.app-glyph {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 1.45rem;
    font-style: italic;
    color: #1a140d;
    background: linear-gradient(145deg, var(--gold-2), var(--gold-deep));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -8px 14px rgba(122, 88, 40, 0.35),
        0 6px 16px rgba(216, 181, 106, 0.18);
    transition: transform var(--dur) var(--spring), box-shadow var(--dur) var(--spring);
}
.app-row:hover .app-glyph {
    transform: scale(1.06) rotate(-2deg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -8px 14px rgba(122, 88, 40, 0.35),
        0 10px 26px rgba(216, 181, 106, 0.32);
}
.app-card:hover .app-glyph {
    transform: scale(1.08) rotate(-3deg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -8px 14px rgba(122, 88, 40, 0.35),
        0 12px 28px rgba(216, 181, 106, 0.35);
}

.app-row h3 { margin: 0 0 0.15rem; font-size: 1.28rem; }
.app-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.app-meta code { font-size: 0.72rem; }
.app-actions { display: flex; gap: 0.7rem; align-items: center; }

.empty-state {
    padding: 4.2rem 1.5rem;
    text-align: center;
    color: var(--mute);
}
.empty-state .jewel { margin: 0 auto 1.2rem; width: 74px; height: 74px; font-size: 2rem; }

/* ============================================================
   Modal — above navbar, scroll-safe for tall forms
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding:
        calc(var(--nav-height) + 1.5rem + env(safe-area-inset-top, 0px))
        1.25rem
        calc(2rem + env(safe-area-inset-bottom, 0px));
    align-items: flex-start;
    justify-content: center;
}
.modal.active { display: flex; }

body.modal-open { overflow: hidden; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 4, 3, 0.78);
    backdrop-filter: blur(14px) saturate(0.9);
    -webkit-backdrop-filter: blur(14px) saturate(0.9);
    animation: fadeIn var(--dur) var(--ease);
}

.modal-content {
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 520px;
    flex-shrink: 0;
    margin: 0 auto;
    background:
        radial-gradient(140% 80% at 15% -10%, rgba(216, 181, 106, 0.08), transparent 55%),
        linear-gradient(180deg, #1d1913, #120f0b);
    border: 1px solid var(--line-strong);
    border-radius: 24px;
    padding: 0;
    box-shadow: var(--elev-4), var(--inner-stroke);
    animation: popIn 0.45s var(--spring);
    overflow: hidden;
}

.modal-content.modal-form { max-width: 560px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.35rem 1.5rem 1.1rem;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(29, 25, 19, 0.98), rgba(29, 25, 19, 0.92));
}

.modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
    max-height: calc(100vh - var(--nav-height) - 8rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-body .form-group:last-child { margin-bottom: 0; }

.modal-footer {
    padding: 0 1.5rem 1.35rem;
    border-top: 1px solid var(--line-soft);
    background: linear-gradient(0deg, rgba(18, 15, 11, 0.95), transparent);
}

.modal-footer .btn { width: 100%; }

.modal-header h3 { margin: 0; font-size: 1.85rem; line-height: 1.1; }
.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.2);
    color: var(--mute);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition:
        color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring),
        background var(--dur-fast) var(--ease);
}
.modal-close:hover {
    color: var(--cream);
    border-color: var(--gold);
    background: rgba(216, 181, 106, 0.08);
    transform: rotate(90deg);
}

/* ============================================================
   Utilities
   ============================================================ */
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1.1rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* Skeleton shimmer for async panels */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(246, 238, 227, 0.05);
    border-radius: 10px;
    min-height: 0.9em;
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(246, 238, 227, 0.08), transparent);
    background-size: 400px 100%;
    animation: shimmer 1.4s linear infinite;
}

/* ============================================================
   Radio chips — tactile segmented control
   ============================================================ */
.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.radio-chip { position: relative; }
.radio-chip input { position: absolute; opacity: 0; }
.radio-chip label {
    display: block;
    margin: 0;
    padding: 0.7rem 0.4rem;
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--mute);
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: var(--inner-stroke);
    transition:
        color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        background var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring),
        box-shadow var(--dur) var(--spring);
}
.radio-chip label:hover {
    border-color: var(--gold);
    color: var(--cream);
    transform: translateY(-1px);
}
.radio-chip label:active { transform: scale(0.98); }
.radio-chip input:checked + label {
    color: #1a140d;
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
    border-color: transparent;
    box-shadow:
        inset 0 1px 0 rgba(255, 248, 224, 0.5),
        inset 0 -6px 10px rgba(122, 88, 40, 0.3),
        0 6px 16px rgba(216, 181, 106, 0.25);
}
.radio-chip input:focus-visible + label { box-shadow: var(--focus-ring); }

/* ============================================================
   Sign-in card
   ============================================================ */
.sign-card { padding: 1.35rem 1.3rem 1.2rem; }
.sign-head { margin-bottom: 1rem; }
.sign-head .kicker { margin-bottom: 0.4rem; }
.sign-head h2 { font-size: clamp(1.7rem, 5vw, 2.05rem); margin-bottom: 0.35rem; line-height: 1.05; }
.sign-head p { margin: 0; font-size: 0.9rem; }
.sign-fields { display: grid; gap: 0; }
.sign-card .form-group { margin-bottom: 0.8rem; }
.life-group { margin-bottom: 0.95rem; }
.life-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
}
.life-bar .radio-chip label {
    padding: 0.55rem 0.1rem;
    font-size: 0.78rem;
    border-radius: 10px;
}
.sign-go {
    position: sticky;
    bottom: 0.8rem;
    min-height: 48px;
    margin-top: 0.15rem;
    z-index: 3;
    box-shadow:
        0 1px 0 rgba(255, 248, 224, 0.5) inset,
        0 -8px 14px rgba(122, 88, 40, 0.28) inset,
        0 12px 28px rgba(216, 181, 106, 0.28),
        0 0 0 6px rgba(7, 6, 4, 0.55);
}

/* ============================================================
   Key reveal
   ============================================================ */
.key-display {
    background:
        linear-gradient(180deg, rgba(216, 181, 106, 0.12), transparent 40%),
        rgba(0, 0, 0, 0.42);
    border: 1px solid var(--line-strong);
    color: var(--cream);
    padding: 1.15rem 1.2rem;
    border-radius: 16px;
    margin: 0.2rem 0 0.4rem;
    box-shadow: var(--inner-stroke), inset 0 2px 8px rgba(0, 0, 0, 0.3);
}
.key-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--mute);
    margin-bottom: 0.45rem;
}
.key-display code {
    display: block;
    background: none;
    border: 0;
    padding: 0;
    color: var(--gold-2);
    font-size: clamp(0.72rem, 2.2vw, 0.9rem);
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-all;
    box-shadow: none;
}
.key-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-top: 0.95rem;
}
.key-display .btn-link { color: var(--mute); }
.key-display .btn-link:hover { color: var(--cream); }

/* ============================================================
   Ready page — host tiles
   ============================================================ */
.ready-card { padding: 1.8rem 1.7rem 1.5rem; }
.ready-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.35rem;
}
.ready-head .kicker { margin-bottom: 0.55rem; }
.ready-head h2 { margin-bottom: 0.4rem; font-size: clamp(1.7rem, 4vw, 2.2rem); }
.ready-head p { max-width: 34rem; }
.ready-section { margin-top: 1.6rem; }
.section-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--gold);
    margin-bottom: 0.85rem;
}

.host-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.host-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.15rem 1.15rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        radial-gradient(120% 90% at 20% -15%, rgba(216, 181, 106, 0.07), transparent 58%),
        linear-gradient(180deg, rgba(246, 238, 227, 0.015), transparent 55%),
        rgba(0, 0, 0, 0.22);
    min-height: 100%;
    box-shadow: var(--elev-2), var(--inner-stroke);
    overflow: hidden;
    transition:
        border-color var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring),
        background var(--dur-fast) var(--ease),
        box-shadow var(--dur) var(--spring);
}
.host-tile::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), var(--gold-2), transparent);
    opacity: 0.65;
}
.host-tile:hover {
    border-color: var(--line-strong);
    background:
        linear-gradient(180deg, rgba(216, 181, 106, 0.06), transparent 70%),
        rgba(216, 181, 106, 0.05);
    transform: translateY(-3px);
    box-shadow: var(--inner-stroke), 0 20px 44px rgba(0, 0, 0, 0.38);
}
.host-tile-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.15rem;
}
.host-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    color: #1a140d;
    background: linear-gradient(145deg, var(--gold-2), var(--gold-deep));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -6px 10px rgba(122, 88, 40, 0.32);
    transition: transform var(--dur) var(--spring);
}
.host-tile:hover .host-mark { transform: scale(1.08) rotate(-3deg); }
.host-tile h3 { margin: 0; font-size: 1.35rem; }
.host-tile p {
    margin: 0 0 0.55rem;
    font-size: 0.84rem;
    color: var(--mute);
    flex: 1;
}
.host-tile .btn { width: 100%; margin-top: auto; min-height: 44px; }

/* ============================================================
   Guides & tabs
   ============================================================ */
.guide {
    margin-top: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.15rem 1rem;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: var(--inner-stroke);
    transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.guide:hover { border-color: var(--line-strong); }
.guide[open] { background: rgba(0, 0, 0, 0.26); }
.guide summary {
    cursor: pointer;
    list-style: none;
    padding: 0.85rem 0;
    font-weight: 600;
    color: var(--cream);
    transition: color var(--dur-fast) var(--ease);
}
.guide summary:hover { color: var(--gold-2); }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after {
    content: "+";
    float: right;
    color: var(--gold);
    font-weight: 500;
    transition: transform var(--dur) var(--spring);
}
.guide[open] summary::after { content: "–"; }
.guide .instructions { padding-bottom: 0.7rem; animation: rise 0.35s var(--spring); }

.tabs {
    display: flex;
    gap: 1.4rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1rem;
}
.tab {
    position: relative;
    background: none;
    border: 0;
    padding: 0.45rem 0 0.7rem;
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mute-2);
    cursor: pointer;
    margin-bottom: -1px;
    transition: color var(--dur-fast) var(--ease);
}
.tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--gold), var(--gold-2));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur) var(--spring);
}
.tab:hover { color: var(--cream); }
.tab.active { color: var(--gold-2); }
.tab.active::after { transform: scaleX(1); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: rise 0.4s var(--spring); }
.instructions { padding-left: 1.15rem; font-size: 0.88rem; color: var(--mute); }
.instructions li { margin-bottom: 0.55rem; }
.instructions a { border-bottom: 1px solid rgba(232, 201, 138, 0.4); transition: border-color var(--dur-fast); }
.instructions a:hover { border-bottom-color: var(--cream); }

.invite-chip {
    margin-top: 0.7rem;
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.head-actions { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Knowledge pack modal
   ============================================================ */
.knowledge-modal { max-width: 440px; }
.knowledge-header { align-items: flex-start; }
.knowledge-header h3 { font-size: 1.55rem; line-height: 1.1; }
.knowledge-company {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--mute);
    font-weight: 500;
}
.knowledge-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.knowledge-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--gold-2);
    background: linear-gradient(180deg, rgba(216, 181, 106, 0.14), rgba(216, 181, 106, 0.06));
    border: 1px solid var(--line);
    box-shadow: var(--inner-stroke);
}
.knowledge-badge.empty { color: var(--mute); background: transparent; box-shadow: none; }
.knowledge-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.22);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
}
.knowledge-empty {
    padding: 1.35rem 1rem;
    text-align: center;
    font-size: 0.84rem;
    color: var(--mute-2);
    line-height: 1.45;
}
.knowledge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--line-soft);
    transition: background var(--dur-fast) var(--ease);
}
.knowledge-item:hover { background: rgba(216, 181, 106, 0.04); }
.knowledge-item:last-child { border-bottom: none; }
.knowledge-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}
.knowledge-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cream);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.knowledge-item-table {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.knowledge-item-id {
    flex-shrink: 0;
    font-size: 0.68rem;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--mute);
    border: 1px solid var(--line);
}
.knowledge-upload {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.55rem;
    align-items: stretch;
}
.knowledge-file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}
.knowledge-file-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    margin: 0;
    padding: 0.55rem 0.75rem;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.14);
    transition:
        border-color var(--dur-fast) var(--ease),
        background var(--dur-fast) var(--ease),
        transform var(--dur) var(--spring);
    min-width: 0;
}
.knowledge-file-label:hover {
    border-color: var(--gold);
    background: rgba(216, 181, 106, 0.06);
    transform: translateY(-1px);
}
.knowledge-file-prompt {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--mute);
}
.knowledge-file-name {
    font-size: 0.8rem;
    color: var(--cream);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.knowledge-upload .btn { align-self: stretch; padding-left: 1.1rem; padding-right: 1.1rem; }
.knowledge-footnote {
    margin: 0.65rem 0 0;
    font-size: 0.72rem;
    color: var(--mute-2);
    line-height: 1.4;
}
.knowledge-footnote code {
    font-size: 0.68rem;
    color: var(--mute);
}
.knowledge-toast {
    margin-top: 0.65rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    font-size: 0.8rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    color: var(--mute);
    box-shadow: var(--inner-stroke);
    animation: rise 0.35s var(--spring);
}
.knowledge-toast.good { color: var(--ok); border-color: rgba(125, 186, 138, 0.35); }
.knowledge-toast.bad { color: #e7a197; border-color: rgba(196, 92, 58, 0.35); }
.knowledge-toast.warn { color: var(--warn); border-color: rgba(224, 177, 90, 0.35); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
    .connection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .host-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    :root { --nav-height: 58px; }
    .modal {
        padding:
            calc(var(--nav-height) + 1rem + env(safe-area-inset-top, 0px))
            0.85rem
            calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }
    .modal-body {
        max-height: calc(100vh - var(--nav-height) - 6.5rem);
        padding: 1rem 1.1rem 1.15rem;
    }
    .modal-header { padding: 1.1rem 1.1rem 0.95rem; }
    .modal-footer { padding: 0 1.1rem 1.1rem; }
    .hero { grid-template-columns: 1fr; padding-top: 3.5rem; gap: 2rem; }
    .hero-panel { min-height: 280px; }
    .nav-inner { padding: 1rem 1rem; }
    .container { margin-top: 1.8rem; padding: 0 1rem; }
    :root { --page-max: calc(100vw - 1.5rem); }
    .page-head { flex-direction: column; align-items: start; }
    .connection-grid { grid-template-columns: 1fr; }
    .app-row { grid-template-columns: auto 1fr; }
    .host-grid { grid-template-columns: 1fr; }
    .ready-head { flex-direction: column; }
    .key-actions { flex-direction: column; align-items: stretch; }
    .key-actions .btn { width: 100%; }
    .radio-group { grid-template-columns: 1fr 1fr; }
    .app-card-foot .btn-sm { flex: 1 1 calc(50% - 0.25rem); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
