/* ==========================================================================
   NX BASE - design tokens, app shell, and the components every page shares.
   Page specific styles live in the other nx-*.css files.
   ========================================================================== */
:root {
    --bg: #070b13;
    --bg-2: #0b1120;
    --surface: #111a2c;
    --surface-2: #17223a;
    --surface-3: #1f2d4a;
    --line: rgba(150, 168, 210, .14);
    --line-strong: rgba(150, 168, 210, .26);

    --text: #eef2fb;
    --muted: #93a0bf;
    --faint: #5f6c8b;

    --accent: #f1f5f9;
    --accent-2: #cbd5e1;
    --accent-ink: #0b0f17;
    --accent-soft: rgba(255, 255, 255, .09);
    --accent-glow: rgba(255, 255, 255, .16);

    --amber: #ffbe4d;
    --amber-soft: rgba(255, 190, 77, .14);
    --sky: #8ab4ff;
    --sky-soft: rgba(138, 180, 255, .14);
    --up: #34d399;
    --up-soft: rgba(52, 211, 153, .14);
    --down: #ff6b81;
    --down-soft: rgba(255, 107, 129, .14);

    --hero: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .09) 0%, rgba(255, 255, 255, 0) 52%),
            linear-gradient(160deg, #1b2a4b 0%, #0f1a33 72%);

    --r-lg: 24px;
    --r-md: 18px;
    --r-sm: 14px;

    --font-display: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;

    --tab-h: 70px;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font: 400 15px/1.5 var(--font-body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
small { font-size: .8em; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.nx-num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- app shell ---------- */
.nx-app {
    position: relative;
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    background:
        radial-gradient(90% 40% at 100% 0%, rgba(138, 180, 255, .07), transparent 70%),
        radial-gradient(80% 36% at 0% 0%, rgba(255, 255, 255, .03), transparent 70%),
        var(--bg);
}

@media (min-width: 700px) {
    body { background: #04070d; }
    .nx-app { box-shadow: 0 0 0 1px var(--line), 0 40px 120px rgba(0, 0, 0, .6); }
}

.nx-main { padding: 4px 16px 28px; }
.nx-tabbar-spacer { height: calc(var(--tab-h) + var(--safe-b) + 12px); }

/* ---------- page header ---------- */
.nx-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(7, 11, 19, .84);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.nx-bar-title { text-align: center; font-size: 1.02rem; font-weight: 600; }
.nx-bar-sub { display: block; margin-top: 2px; font: 500 .68rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }

.nx-back,
.nx-iconbtn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 1.1rem;
    transition: background .18s ease, border-color .18s ease;
}
.nx-back:active, .nx-iconbtn:active { background: var(--surface-2); }

/* ---------- cards ---------- */
.nx-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 18px;
}

.nx-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    background: var(--hero);
    padding: 20px;
}

.nx-sec {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 26px 2px 12px;
}
.nx-sec h2 { font-size: 1.05rem; }
.nx-sec small { color: var(--muted); font-size: .76rem; }

/* ---------- buttons ---------- */
.nx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 54px;
    padding: 0 22px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
    color: var(--accent-ink);
    font: 700 .98rem var(--font-display);
    letter-spacing: -.005em;
    box-shadow: 0 12px 26px -10px var(--accent-glow);
    transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease;
}
.nx-btn:active { transform: scale(.985); }
.nx-btn[disabled], .nx-btn:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.nx-btn--block { display: flex; width: 100%; }
.nx-btn--ghost {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: none;
}

/* ---------- forms ---------- */
.nx-field { display: grid; gap: 8px; margin-bottom: 16px; }
.nx-label { font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.nx-label em { font-style: normal; color: var(--accent); }
.nx-hint { font-size: .76rem; color: var(--faint); line-height: 1.45; }

.nx-control { position: relative; display: flex; align-items: center; }
.nx-control input,
.nx-input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    background: var(--surface-2);
    border: 1.5px solid transparent;
    border-radius: 16px;
    color: var(--text);
    font-size: 1rem;
    outline: 0;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.nx-control input::placeholder, .nx-input::placeholder { color: var(--faint); }
.nx-control input:focus, .nx-input:focus {
    border-color: var(--accent);
    background: var(--surface-3);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.nx-control .lead {
    position: absolute;
    left: 16px;
    color: var(--faint);
    font-size: 1.05rem;
    pointer-events: none;
    transition: color .18s ease;
}
.nx-control:focus-within .lead { color: var(--accent); }
.nx-control.has-lead input { padding-left: 46px; }
.nx-control.has-trail input { padding-right: 54px; }
.nx-trail {
    position: absolute;
    right: 6px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
}

input:-webkit-autofill,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    -webkit-box-shadow: 0 0 0 100px var(--surface-3) inset;
    transition: background-color 9999s ease 0s;
}

.nx-err,
.errorlist {
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    color: var(--down);
    font-size: .78rem;
    line-height: 1.4;
}
.nx-err small, .errorlist li { display: block; }

.nx-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: .86rem;
    line-height: 1.45;
    background: var(--down-soft);
    border: 1px solid rgba(255, 107, 129, .3);
    color: #ffc2cb;
}
.nx-alert--ok { background: var(--up-soft); border-color: rgba(52, 211, 153, .3); color: #b5f3da; }

/* ---------- pills ---------- */
.nx-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}
.nx-pill--ok   { background: var(--up-soft);    color: var(--up); }
.nx-pill--warn { background: var(--amber-soft); color: var(--amber); }
.nx-pill--bad  { background: var(--down-soft);  color: var(--down); }
.nx-pill--info { background: var(--sky-soft);   color: var(--sky); }

/* ---------- empty state ---------- */
.nx-empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 38px 20px;
    text-align: center;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--r-lg);
    color: var(--muted);
}
.nx-empty .nx-empty-ic {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.7rem;
}
.nx-empty strong { color: var(--text); font: 600 1rem var(--font-display); }
.nx-empty span { font-size: .85rem; max-width: 260px; }

/* ---------- bottom tab bar ---------- */
.nx-tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 60;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px 10px calc(8px + var(--safe-b));
    background: rgba(9, 14, 26, .9);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
}

.nx-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 0 4px;
    color: var(--faint);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .03em;
    transition: color .18s ease;
}
.nx-tab img { width: 30px; height: 30px; object-fit: contain; opacity: .88; filter: saturate(.75) brightness(.95); transition: opacity .18s ease, transform .18s ease, filter .18s ease; }
.nx-tab.is-active { color: var(--accent); }
.nx-tab.is-active img { opacity: 1; transform: translateY(-2px) scale(1.06); filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .55)); }
.nx-tab.is-active::before {
    content: "";
    position: absolute;
    top: -9px;
    width: 26px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--accent);
    box-shadow: 0 2px 12px var(--accent-glow);
}

/* ---------- system messages (bottom sheet) ---------- */
.nx-notice-layer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: rgba(3, 6, 12, .66);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: nxFade .2s ease;
}
.nx-notice {
    width: 100%;
    max-width: 398px;
    padding: 12px 20px 20px;
    text-align: center;
    border: 1px solid var(--line-strong);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
    animation: nxRise .28s cubic-bezier(.2, .8, .2, 1);
}
.nx-notice::before { content: ""; display: block; width: 38px; height: 4px; margin: 0 auto 16px; border-radius: 4px; background: var(--line-strong); }
.nx-notice-icon {
    width: 58px; height: 58px;
    display: grid; place-items: center;
    margin: 0 auto 12px;
    border-radius: 20px;
    background: var(--sky-soft); color: var(--sky);
    font-size: 1.8rem;
}
.nx-notice--success .nx-notice-icon { background: var(--up-soft); color: var(--up); }
.nx-notice--error .nx-notice-icon, .nx-notice--danger .nx-notice-icon { background: var(--down-soft); color: var(--down); }
.nx-notice--warning .nx-notice-icon { background: var(--amber-soft); color: var(--amber); }
.nx-notice p { margin: 0 4px 18px; color: var(--text); font-size: .95rem; line-height: 1.5; }

@keyframes nxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nxRise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
