/*
 * Nalar Platform — Primitive component styles.
 * Must be loaded AFTER nalar-tokens.css. All colors/spacings reference
 * CSS vars from tokens file — never raw hex.
 *
 * Dark surface text rule (important):
 *   `body.nx-shell h1|h2|h3` in tokens sets color: var(--nx-ink) (~black).
 *   That selector beats a parent wrapper's `color: #fff` due to specificity,
 *   so headings inside dark-gradient wrappers (.nx-hero, .nx-auth-showcase,
 *   .nx-sidebar) would render as dark-on-dark. The rule below restores
 *   white headings on ALL dark surfaces in one place.
 */
body.nx-shell .nx-hero           h1, body.nx-shell .nx-hero           h2, body.nx-shell .nx-hero           h3,
body.nx-shell .nx-auth-showcase  h1, body.nx-shell .nx-auth-showcase  h2, body.nx-shell .nx-auth-showcase  h3,
body.nx-shell .nx-sidebar        h1, body.nx-shell .nx-sidebar        h2, body.nx-shell .nx-sidebar        h3,
body.nx-shell .edge-page-hero    h1, body.nx-shell .edge-page-hero    h2, body.nx-shell .edge-page-hero    h3 {
    color: inherit;   /* wrapper sets #fff — inherit it instead of overriding */
}

/* ── Shell layout: sidebar + topbar + content ────────────────────────── */
.nx-shell-root {
    --nx-sidebar-w: 248px;    /* single source for sidebar width — toggle follows this via calc() */
    display: grid;
    /* `minmax(0, 1fr)` — NOT bare `1fr` — is required. Grid's default min
     * is `auto` (content-based), so wide children (tables, toolbars) push
     * the column wider than viewport and the whole page scrolls
     * horizontally. `min 0` lets the column shrink so internal scroll
     * containers (`.table-responsive`, `overflow-x:auto` toolbars) can do
     * their job instead of bulging the layout. */
    grid-template-columns: var(--nx-sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
    position: relative;       /* anchor for the sidebar-toggle that lives outside <aside> */
    transition: grid-template-columns var(--nx-dur-sidebar) var(--nx-ease);
}

html[data-sidebar="mini"] .nx-shell-root { --nx-sidebar-w: 76px; grid-template-columns: var(--nx-sidebar-w) minmax(0, 1fr); }

.nx-sidebar {
    background: linear-gradient(180deg, var(--nx-navy-900) 0%, var(--nx-navy-700) 50%, var(--nx-navy-600) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 24px 16px 20px;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}
/* Mini state: drop the scroll clip so hover tooltips (which extend to the
 * right of each nav item) can escape the sidebar bounds. Per CSS spec,
 * `overflow-y: auto` forces the x-axis to clip too — and that hides the
 * ::after tooltip. Icon-only nav items fit vertically without scroll in
 * mini mode, so losing overflow-y: auto here has no practical downside.
 *
 * `z-index: 50` raises the sidebar's stacking context above `.nx-topbar`
 * (z:5) and all content cards (z:auto). Without this, sticky-positioned
 * `.nx-sidebar` creates a stacking context at z:0 and any tooltip inside
 * it — no matter how high its own z-index — renders BEHIND cards painted
 * later in DOM order. Scoped to mini so full-mode layering is untouched. */
html[data-sidebar="mini"] .nx-sidebar {
    overflow: visible;
    z-index: 50;
}

.nx-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 8px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 18px;
}
/* Logo icon — no wrapper box, just the SVG at brand size. The asset at
 * img/logo-nalar-icon.white.svg is pre-filled white so it renders crisp on
 * the navy gradient without needing a background tile. `aspect-ratio: 1/1`
 * plus `object-fit: contain` keeps the mark from squashing even when the
 * sidebar width changes.
 *
 * Scoped through `.nx-sidebar` (specificity 0,2,0) so CP pages — which load
 * nexadash.css AFTER nalar-components.css with an `img { max-width: 100%;
 * height: auto }` reset — can't accidentally shrink or stretch the logo.
 * `max-width: none` defends against that same nexadash reset. */
.nx-sidebar .nx-sidebar-brand__logo {
    width: 40px; height: 40px;
    max-width: none; max-height: none;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}
.nx-sidebar-brand__wordmark {
    font-family: var(--nx-font-display);
    line-height: 1.05;
    color: #fff;
    /* NalarCore / NALAR.ai sits next to a 40px logo — wordmark at 24px reads
     * at proper brand weight. Bumped from 19px per product feedback
     * ("terlalu kecil, perbesar menjadi lebih proporsional"). */
}
.nx-sidebar-brand__wordmark strong {
    font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
}
.nx-sidebar-brand__wordmark span {
    font-size: 24px; font-weight: 500; color: rgba(255, 255, 255, 0.92);
}

/* Mini sidebar state
 * - hide the full wordmark; emit the mini label ("NALAR.ai"/"CORE"/"EDGE")
 *   under the logo via `data-mini` on the brand container. The Blade
 *   template sets this per-surface with the exact intended casing, so CSS
 *   does NOT text-transform it. */
html[data-sidebar="mini"] .nx-sidebar-brand__wordmark { display: none; }
html[data-sidebar="mini"] .nx-sidebar-brand {
    flex-direction: column; gap: 4px; justify-content: center;
    padding-bottom: 18px;
}
/* Mini wordmark reads data-mini off the brand container. Short labels
 * ("CORE"/"EDGE") render at a bolder 13px; the longer user label
 * ("NALAR.ai") drops to 12px with tighter letter-spacing so it fits inside
 * the 76px collapsed sidebar. Per-surface overrides below. */
html[data-sidebar="mini"] .nx-sidebar-brand::after {
    content: attr(data-mini);
    font-family: var(--nx-font-display);
    font-size: 13px; font-weight: 800;
    letter-spacing: 0.06em;
    color: #fff;
    text-align: center;
}
html[data-surface="user"][data-sidebar="mini"] .nx-sidebar-brand::after {
    font-size: 12px;
    letter-spacing: 0;
}

.nx-sidebar-section {
    padding: 14px 8px 6px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}
html[data-sidebar="mini"] .nx-sidebar-section {
    font-size: 0;                       /* hide text in mini */
    padding: 14px 0 4px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin: 10px 18px 6px;
}

/* ── Nav items ────────────────────────────────────────────────────────────
 * Menu text is pure #fff — legacy bootstrap/nexadash CSS loaded AFTER this
 * file (via @push('page-styles')) can override plain `.nx-nav-item`, so we
 * scope through `.nx-sidebar` to bump specificity to 0,2,0 which no legacy
 * link rule matches. Fix for "text menu sidebar masih biru, ganti jadi putih".
 */
.nx-sidebar .nx-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin: 2px 0;
    border-radius: var(--nx-r-md);
    color: #fff;
    font-size: 13.5px; font-weight: 500;
    transition: background var(--nx-dur-hover) var(--nx-ease),
                color var(--nx-dur-hover) var(--nx-ease);
    position: relative;
    text-decoration: none;
}
.nx-sidebar .nx-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.nx-sidebar .nx-nav-item.is-active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}
.nx-sidebar .nx-nav-item.is-active::before {
    content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px;
    width: 3px; background: #fff; border-radius: 0 2px 2px 0;
    opacity: 0.9;
}
.nx-sidebar .nx-nav-item__icon {
    width: 20px; height: 20px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
}
.nx-sidebar .nx-nav-item.is-active .nx-nav-item__icon { color: #fff; }

/* Mini state: icon-only + CSS-driven tooltip on hover.
 * The tooltip reads `data-label` off the nav item; the Blade component
 * (components/nx/nav-item.blade.php) now emits it alongside the visible
 * text so tooltip content is always in sync with the label. */
html[data-sidebar="mini"] .nx-sidebar .nx-nav-item {
    justify-content: center;
    gap: 0; padding: 11px 0;
}
html[data-sidebar="mini"] .nx-sidebar .nx-nav-item > span:not(.nx-nav-item__icon):not(.nx-nav-item__badge) {
    display: none;
}
html[data-sidebar="mini"] .nx-sidebar .nx-nav-item__icon { width: 22px; height: 22px; }
html[data-sidebar="mini"] .nx-sidebar .nx-nav-item.is-active::before {
    left: auto; right: 0; border-radius: 2px 0 0 2px;
    top: 6px; bottom: 6px;
}
html[data-sidebar="mini"] .nx-sidebar .nx-nav-item[data-label]::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: var(--nx-navy-900);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--nx-r-sm);
    white-space: nowrap;
    box-shadow: var(--nx-shadow-card);
    opacity: 0; pointer-events: none;
    transition: opacity var(--nx-dur-hover) var(--nx-ease),
                transform var(--nx-dur-hover) var(--nx-ease);
    z-index: 100;
}
html[data-sidebar="mini"] .nx-sidebar .nx-nav-item[data-label]:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Toggle sits on the seam between sidebar (navy) and main content (white).
 * Anchored to .nx-shell-root (outer grid container), not inside <aside>, so
 * the sidebar's `overflow-y: auto` can scroll nav content without clipping
 * this button. The `left` calc keeps it centered on the seam even when the
 * sidebar collapses to mini width. */
/* z-index must exceed `.nx-sidebar` in mini mode (z:50 — raised so tooltips
 * can escape) because the toggle button straddles the sidebar's right edge
 * via `left: calc(var(--nx-sidebar-w) - 12px)`. Without this, the sidebar's
 * stacking context paints over the left half of the toggle. 60 sits above
 * the sidebar but below modals/dialogs if any are added later. */
.nx-sidebar-toggle {
    position: absolute;
    top: 34px;
    left: calc(var(--nx-sidebar-w) - 12px);
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--nx-surface); color: var(--nx-navy-700);
    border: 1px solid var(--nx-line-strong);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 60;
    box-shadow: var(--nx-shadow-card);
    transition: left var(--nx-dur-sidebar) var(--nx-ease),
                transform var(--nx-dur-hover) var(--nx-ease),
                box-shadow var(--nx-dur-hover) var(--nx-ease);
    padding: 0;
}
.nx-sidebar-toggle:hover {
    transform: scale(1.08);
    box-shadow: var(--nx-shadow-raised);
    color: var(--nx-surface-primary);
}
.nx-sidebar-toggle svg {
    width: 12px; height: 12px;
    transition: transform var(--nx-dur-sidebar) var(--nx-ease);
}
html[data-sidebar="mini"] .nx-sidebar-toggle svg { transform: rotate(180deg); }

/* ── Topbar ──────────────────────────────────────────────────────────── */
/* Horizontal padding matches `.nx-main` (32px) so the surface tag on the left
 * lines up flush with the first card/content column underneath. Right padding
 * stays 32px too for symmetry with the user avatar cluster. */
.nx-topbar {
    height: 64px;
    background: var(--nx-surface);
    border-bottom: 1px solid var(--nx-line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; position: sticky; top: 0; z-index: 5;
    gap: 16px;
}

/* Surface tag — moved from sidebar brand per product feedback. Identifies
 * which Nalar surface the user is on ("Control Plane · Super Admin" etc.)
 * and sits at the left of the topbar. `padding-inline: 0` on the tag itself
 * so the visible text left-edge (not the pill's border) is what aligns with
 * content below — the topbar's 32px padding provides the gutter. */
.nx-topbar__surface-tag {
    font-family: var(--nx-font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nx-muted);
    padding: 0;
    background: transparent;
    white-space: nowrap;
}
.nx-topbar__search {
    flex: 1; max-width: 420px; margin-right: 24px;
    position: relative;
}
.nx-topbar__search input {
    width: 100%; height: 38px; padding: 0 14px 0 38px;
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-r-lg);
    background: var(--nx-surface-alt);
    font-family: var(--nx-font-body); font-size: 13px;
    color: var(--nx-ink);
    transition: border var(--nx-dur-hover) var(--nx-ease), background var(--nx-dur-hover) var(--nx-ease);
}
.nx-topbar__search input:focus {
    outline: none;
    border-color: var(--nx-surface-primary);
    background: var(--nx-surface);
    box-shadow: 0 0 0 3px rgba(29, 105, 214, 0.12);
}
.nx-topbar__search svg {
    position: absolute; left: 12px; top: 11px;
    width: 16px; height: 16px; color: var(--nx-muted);
}
.nx-topbar__user {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 8px;
    border-radius: var(--nx-r-lg);
}
.nx-topbar__user__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--nx-surface-primary-soft);
    color: var(--nx-surface-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px;
}

/* ── Page content area ──────────────────────────────────────────────── */
.nx-main   { padding: 28px 32px 48px; }
.nx-main-narrow { max-width: 960px; margin: 0 auto; }

/* ── Page head ──────────────────────────────────────────────────────── */
.nx-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.nx-page-head__title { font-size: 24px; font-weight: 700; font-family: var(--nx-font-display); margin: 0; color: var(--nx-ink); letter-spacing: -0.01em; }
.nx-page-head__subtitle { color: var(--nx-muted); font-size: 14px; margin: 4px 0 0; }
.nx-page-head__actions { display: flex; gap: 10px; align-items: center; }

/* ── Hero banner ────────────────────────────────────────────────────── */
.nx-hero {
    background: linear-gradient(135deg, var(--nx-navy-800) 0%, var(--nx-navy-600) 55%, var(--nx-primary) 100%);
    color: #fff; border-radius: var(--nx-r-xl);
    padding: 28px 32px;
    box-shadow: var(--nx-shadow-raised);
    position: relative; overflow: hidden;
}
.nx-hero::after {
    content: "";
    position: absolute; right: -80px; top: -80px;
    width: 260px; height: 260px; border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 148, 246, 0.35), transparent 70%);
}
.nx-hero__kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--nx-accent-blue); margin-bottom: 8px; position: relative; }
.nx-hero__title { font-size: 26px; font-weight: 800; font-family: var(--nx-font-display); line-height: 1.35; margin: 0 0 10px; position: relative; }
.nx-hero__copy { color: rgba(255, 255, 255, 0.82); font-size: 14px; line-height: 1.65; max-width: 560px; position: relative; }
.nx-hero__actions { display: flex; gap: 10px; margin-top: 18px; position: relative; }

/* ── Legacy CP hero alignment ────────────────────────────────────────────
 * Control Plane pages still render the old `.edge-page-hero` markup from
 * edge-admin-nuxt.css. Rather than migrating ~10 blade files to <x-nx.hero>,
 * we override the legacy styles so they look visually identical to
 * `.nx-hero` above. Specificity `body.nx-shell ...` (0,2,1+) beats the
 * legacy `.edge-page-hero` rules (0,1,0+) even though edge-admin-nuxt.css
 * loads AFTER nalar-components.css in the CP layout.
 *
 * Delete this block once all CP pages migrate to <x-nx.hero>.
 */
body.nx-shell .edge-page-hero {
    background: linear-gradient(135deg, var(--nx-navy-800) 0%, var(--nx-navy-600) 55%, var(--nx-primary) 100%);
    border-radius: var(--nx-r-xl);
    padding: 28px 32px;
    box-shadow: var(--nx-shadow-raised);
}
body.nx-shell .edge-page-hero::before { display: none; }
body.nx-shell .edge-page-hero::after {
    content: "";
    position: absolute; right: -80px; top: -80px; left: auto; bottom: auto;
    width: 260px; height: 260px; border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 148, 246, 0.35), transparent 70%);
}
body.nx-shell .edge-page-hero h1,
body.nx-shell .edge-page-hero h2,
body.nx-shell .edge-page-hero h3,
body.nx-shell .edge-page-hero .edge-page-title {
    font-size: 26px;
    font-weight: 800;
    font-family: var(--nx-font-display);
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin: 0 0 10px;
}
body.nx-shell .edge-page-hero .edge-page-copy {
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.65;
    max-width: 560px;
}
/* Strip the kicker pill (background/padding) so it reads as plain
 * letter-spaced accent-blue text, matching `.nx-hero__kicker`. The legacy
 * markup often nests an svg icon inside — hide it so the line stays clean. */
body.nx-shell .edge-page-hero .edge-kicker {
    display: block;
    padding: 0;
    background: transparent;
    border-radius: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--nx-accent-blue);
    margin-bottom: 8px;
}
body.nx-shell .edge-page-hero .edge-kicker svg { display: none; }

/* ── Card ───────────────────────────────────────────────────────────── */
.nx-card {
    background: var(--nx-surface);
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-r-xl);
    box-shadow: var(--nx-shadow-card);
    padding: 20px 22px;
}
.nx-card--strong { box-shadow: var(--nx-shadow-raised); }
.nx-card__head {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 12px; margin-bottom: 16px;
    border-bottom: 1px solid var(--nx-line);
}
.nx-card__title { font-size: 15px; font-weight: 700; font-family: var(--nx-font-display); color: var(--nx-ink); }
.nx-card__foot { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--nx-line); }

/* ── KPI card ───────────────────────────────────────────────────────── */
.nx-kpi { display: flex; gap: 14px; align-items: flex-start; }
.nx-kpi__icon {
    width: 44px; height: 44px; border-radius: var(--nx-r-md);
    background: var(--nx-surface-primary-soft);
    color: var(--nx-surface-primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.nx-kpi__icon svg { width: 22px; height: 22px; }
.nx-kpi__body { flex: 1; }
.nx-kpi__label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nx-muted); margin-bottom: 4px; }
.nx-kpi__value { font-family: var(--nx-font-display); font-size: 22px; font-weight: 800; color: var(--nx-ink); letter-spacing: -0.02em; }
.nx-kpi__delta { font-size: 12px; font-weight: 600; margin-top: 2px; }
.nx-kpi__delta--up   { color: var(--nx-success); }
.nx-kpi__delta--down { color: var(--nx-danger); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.nx-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--nx-font-body); font-weight: 600;
    padding: 10px 18px; border-radius: var(--nx-r-md);
    border: 1px solid transparent;
    cursor: pointer; text-decoration: none; font-size: 13.5px;
    transition: background var(--nx-dur-hover) var(--nx-ease), border-color var(--nx-dur-hover) var(--nx-ease), box-shadow var(--nx-dur-hover) var(--nx-ease);
    white-space: nowrap;
}
.nx-btn--sm { padding: 6px 12px; font-size: 12.5px; }
.nx-btn--primary { background: var(--nx-surface-primary); color: #fff; }
.nx-btn--primary:hover { background: var(--nx-surface-primary-600); color: #fff; }
.nx-btn--ghost { background: var(--nx-surface); color: var(--nx-ink); border-color: var(--nx-line-strong); }
/* Inverse: tombol terang DI ATAS hero/area berwarna (primary di atas primary = tak terbaca) */
.nx-btn--inverse { background: #ffffff; color: var(--nx-surface-primary); border-color: transparent; font-weight: 600; }
.nx-btn--inverse:hover { background: var(--nx-surface-alt); color: var(--nx-surface-primary-600); }

/* FIX KRITIS: <a class="nx-btn"> kena warna link global `body.nx-shell a` (spesifisitas 0,1,2 >
   .nx-btn 0,1,0) → teks tombol salah warna (primary biru di atas biru). Pakai dobel-class
   a.nx-btn.nx-btn--VARIANT (0,2,1) agar menang atas rule link global. */
a.nx-btn.nx-btn--primary, a.nx-btn.nx-btn--primary:visited, a.nx-btn.nx-btn--primary:hover { color: #ffffff; }
a.nx-btn.nx-btn--inverse, a.nx-btn.nx-btn--inverse:visited { color: var(--nx-surface-primary); }
/* ghost/danger anchor: pakai var(--nx-ink)/danger (kontras 17.85 light / 13.87 dark — terverifikasi
   sehat di dark+core; angka rendah sebelumnya artefak CSS-stale). */
a.nx-btn.nx-btn--ghost,  a.nx-btn.nx-btn--ghost:visited  { color: var(--nx-ink); }
a.nx-btn.nx-btn--danger, a.nx-btn.nx-btn--danger:visited { color: var(--nx-danger); }
a.nx-btn.nx-btn--danger:hover { color: #ffffff; }
.nx-btn--ghost:hover { background: var(--nx-surface-alt); border-color: var(--nx-surface-primary); color: var(--nx-ink); }
.nx-btn--danger { background: var(--nx-danger-soft); color: var(--nx-danger); border-color: var(--nx-danger-soft); }
.nx-btn--danger:hover { background: var(--nx-danger); color: #fff; }
.nx-btn--google {
    background: var(--nx-surface);
    color: var(--nx-ink-soft);
    border: 1px solid var(--nx-line-strong);
    width: 100%;
}
.nx-btn--google:hover { background: var(--nx-surface-alt); border-color: var(--nx-muted); color: var(--nx-ink); }

/* ── Badge ──────────────────────────────────────────────────────────── */
.nx-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: var(--nx-r-pill);
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.nx-badge--ok   { background: var(--nx-success-soft); color: var(--nx-success); }
.nx-badge--warn { background: var(--nx-warning-soft); color: var(--nx-warning); }
.nx-badge--err  { background: var(--nx-danger-soft);  color: var(--nx-danger); }
.nx-badge--info { background: var(--nx-info-soft);    color: var(--nx-info); }
.nx-badge--idle { background: var(--nx-line); color: var(--nx-muted); }
.nx-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Form field ─────────────────────────────────────────────────────── */
.nx-field { margin-bottom: 14px; }
.nx-field__label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--nx-ink-soft); }
.nx-field__control,
.nx-field input,
.nx-field select,
.nx-field textarea {
    width: 100%;
    border: 1px solid var(--nx-line-strong);
    background: var(--nx-surface);
    border-radius: var(--nx-r-md);
    padding: 10px 14px;
    font-size: 14px; font-family: var(--nx-font-body);
    color: var(--nx-ink);
    transition: border-color var(--nx-dur-hover) var(--nx-ease), box-shadow var(--nx-dur-hover) var(--nx-ease);
    box-sizing: border-box;
}
.nx-field__control:focus,
.nx-field input:focus,
.nx-field select:focus,
.nx-field textarea:focus {
    outline: none;
    border-color: var(--nx-surface-primary);
    box-shadow: 0 0 0 3px rgba(29, 105, 214, 0.15);
}
.nx-field__hint { color: var(--nx-muted); font-size: 12px; margin-top: 4px; }
.nx-field__error { color: var(--nx-danger); font-size: 12px; margin-top: 4px; font-weight: 500; }
.nx-field--error .nx-field__control,
.nx-field--error input,
.nx-field--error select,
.nx-field--error textarea { border-color: var(--nx-danger); }

/* ── nx-input ─ kelas form generik (CP + dashboard). Selaras nx-field__control
   + polish: focus ring, hover, chevron dropdown kustom, ikon search, checkbox brand.
   Berlaku di light & dark karena pakai token --nx-* (ADR-020 P5 polish). ───────── */
.nx-input {
    width: 100%;
    border: 1px solid var(--nx-line-strong);
    background: var(--nx-surface);
    border-radius: var(--nx-r-md);
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--nx-font-body);
    color: var(--nx-ink);
    transition: border-color var(--nx-dur-hover) var(--nx-ease), box-shadow var(--nx-dur-hover) var(--nx-ease);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}
.nx-input::placeholder { color: var(--nx-muted); opacity: 1; }
.nx-input:hover { border-color: var(--nx-surface-primary); }
.nx-input:focus {
    outline: none;
    border-color: var(--nx-surface-primary);
    box-shadow: 0 0 0 3px rgba(29, 105, 214, 0.15);
}
.nx-input:disabled { background: var(--nx-surface-alt); color: var(--nx-muted); cursor: not-allowed; }

/* Dropdown: chevron kustom (bukan panah native polos) */
select.nx-input {
    padding-right: 38px;
    cursor: pointer;
    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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Search: ikon kaca pembesar di kiri (otomatis untuk input pencarian name=q) */
.nx-input--search,
.nx-input[name="q"],
.nx-input[type="search"] {
    padding-left: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 13px center;
}

/* Checkbox / radio mengikuti warna brand (tidak abu-abu default) */
.nx-card input[type="checkbox"],
.nx-card input[type="radio"],
.nx-input-check {
    accent-color: var(--nx-surface-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Tabel di dalam card: hover baris (feedback) — light & dark via token */
.nx-card table tbody tr { transition: background var(--nx-dur-hover) var(--nx-ease); }
.nx-card table tbody tr:hover { background: var(--nx-surface-alt); }

/* ── Checklist item ─────────────────────────────────────────────────── */
.nx-check-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--nx-line);
}
.nx-check-item:last-child { border-bottom: 0; }
.nx-check-item__num {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12.5px;
    flex-shrink: 0;
}
.nx-check-item--done    .nx-check-item__num { background: var(--nx-success); color: #fff; }
.nx-check-item--active  .nx-check-item__num { background: var(--nx-surface-primary); color: #fff; }
.nx-check-item--pending .nx-check-item__num { background: var(--nx-line); color: var(--nx-muted); }
.nx-check-item__body { flex: 1; }
.nx-check-item__title { font-weight: 600; color: var(--nx-ink); margin: 0; font-size: 14px; }
.nx-check-item__copy  { color: var(--nx-muted); font-size: 13px; margin: 2px 0 0; }

/* ── Table ──────────────────────────────────────────────────────────── */
.nx-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.nx-table th {
    text-align: left; padding: 12px 16px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--nx-muted);
    border-bottom: 1px solid var(--nx-line);
    background: var(--nx-surface-alt);
}
.nx-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--nx-line);
    color: var(--nx-ink-soft);
    vertical-align: middle;
}
.nx-table tr:last-child td { border-bottom: 0; }
.nx-table tbody tr:hover { background: var(--nx-surface-alt); }

/* ── Alert (flash messages) ────────────────────────────────────────── */
.nx-alert {
    padding: 12px 16px;
    border-radius: var(--nx-r-md);
    font-size: 13.5px;
    border: 1px solid transparent;
    margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px;
}
.nx-alert--ok   { background: var(--nx-success-soft); color: var(--nx-success); border-color: rgba(34, 197, 94, 0.35); }
.nx-alert--warn { background: var(--nx-warning-soft); color: var(--nx-warning); border-color: rgba(245, 158, 11, 0.35); }
.nx-alert--err  { background: var(--nx-danger-soft);  color: var(--nx-danger);  border-color: rgba(239, 68, 68, 0.35); }
.nx-alert--info { background: var(--nx-info-soft);    color: var(--nx-info);    border-color: rgba(29, 105, 214, 0.35); }

/* ── Auth split layout ──────────────────────────────────────────────── */
.nx-auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--nx-shell-bg);
}
.nx-auth-showcase {
    background: linear-gradient(135deg, var(--nx-navy-900) 0%, var(--nx-navy-700) 50%, var(--nx-navy-600) 100%);
    color: #fff;
    padding: 48px 56px;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.nx-auth-showcase::before,
.nx-auth-showcase::after {
    content: ""; position: absolute; border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 148, 246, 0.35), transparent 70%);
}
.nx-auth-showcase::before { width: 380px; height: 380px; top: -120px; right: -120px; }
.nx-auth-showcase::after  { width: 260px; height: 260px; bottom: -60px; left: -60px;  }

.nx-auth-showcase__brand { display: flex; align-items: center; gap: 14px; position: relative; }
.nx-auth-showcase__brand__icon {
    width: 48px; height: 48px; border-radius: var(--nx-r-md);
    background: rgba(255, 255, 255, 0.1);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.nx-auth-showcase__brand__icon svg { width: 28px; height: 28px; }
.nx-auth-showcase__brand__wordmark {
    font-family: var(--nx-font-display);
    font-size: 22px; font-weight: 800; letter-spacing: -0.02em;
}
.nx-auth-showcase__brand__wordmark span { font-weight: 400; color: rgba(255, 255, 255, 0.8); }
.nx-auth-showcase__brand__tag {
    font-family: var(--nx-font-body);
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--nx-accent-blue);
    margin-top: 2px;
}

.nx-auth-showcase__content { position: relative; max-width: 480px; }
.nx-auth-showcase__tagline {
    font-family: var(--nx-font-display);
    font-size: clamp(1.75rem, 2.8vw, 2.25rem); font-weight: 800;
    line-height: 1.15; letter-spacing: -0.02em;
    margin: 0 0 14px;
}
.nx-auth-showcase__copy { color: rgba(255, 255, 255, 0.8); font-size: 14px; line-height: 1.6; max-width: 440px; }

.nx-auth-showcase__chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; position: relative; }
.nx-auth-showcase__chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--nx-r-pill);
    font-size: 11.5px; font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

.nx-auth-showcase__footer {
    font-size: 12px; color: rgba(255, 255, 255, 0.55);
    position: relative;
}

.nx-auth-form-wrap {
    display: flex; align-items: center; justify-content: center;
    padding: 48px 40px;
}
.nx-auth-card {
    width: 100%; max-width: 440px;
    background: var(--nx-surface);
    border-radius: var(--nx-r-2xl);
    padding: 40px;
    box-shadow: var(--nx-shadow-auth);
    border: 1px solid var(--nx-line);
}
.nx-auth-card__title {
    font-family: var(--nx-font-display);
    font-size: 22px; font-weight: 700; margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.nx-auth-card__subtitle {
    color: var(--nx-muted); font-size: 13.5px; margin: 0 0 24px;
}
.nx-auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 22px 0; color: var(--nx-muted); font-size: 11.5px;
}
.nx-auth-divider::before,
.nx-auth-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--nx-line);
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .nx-auth-split { grid-template-columns: 1fr; }
    .nx-auth-showcase {
        padding: 28px 28px 20px; min-height: 180px;
        flex-direction: row; align-items: center; gap: 20px;
    }
    .nx-auth-showcase__tagline { font-size: 1.25rem; margin: 0; }
    .nx-auth-showcase__copy,
    .nx-auth-showcase__chips,
    .nx-auth-showcase__footer { display: none; }
    .nx-auth-form-wrap { padding: 28px 20px; }
}

@media (max-width: 1023px) {
    .nx-shell-root { grid-template-columns: 76px 1fr; }
    html[data-sidebar="mini"] .nx-shell-root { grid-template-columns: 76px 1fr; }
}

@media (max-width: 767px) {
    .nx-shell-root { grid-template-columns: 1fr; }
    .nx-sidebar { display: none; }
    .nx-sidebar-toggle { display: none; }   /* no sidebar to toggle on mobile */
    .nx-main { padding: 16px; }
    .nx-page-head { flex-direction: column; align-items: stretch; }
    .nx-auth-card { padding: 28px 24px; }
}
