/* NX Filigree 0.2.0 | self-contained, opt-in visual theme for NX Core.
   Design tokens are NX-owned; Aurora rules remain unmodified. */
body.theme-nx-filigree-light {
  color-scheme:light;
  --nx-fg-bg:#f4f7fb;--nx-fg-surface:#ffffff;--nx-fg-surface-secondary:#f8fafc;
  --nx-fg-border:#d7e0ea;--nx-fg-border-subtle:#e6ecf3;
  --nx-fg-text:#17283e;--nx-fg-text-secondary:#52667f;--nx-fg-text-tertiary:#586e86;
  --nx-fg-accent:#315e99;--nx-fg-success:#18734a;--nx-fg-warning:#955c0a;
  --nx-fg-danger:#ae3641;--nx-fg-focus:#2563a5;--nx-fg-track:#dce6f0;--nx-fg-thumb:#315e99;
  --bg:var(--nx-fg-bg);--panel:var(--nx-fg-surface);--panel-solid:var(--nx-fg-surface);
  --text:var(--nx-fg-text);--muted:var(--nx-fg-text-secondary);
  --accent:var(--nx-fg-accent);--accent2:#5389bf;--line:var(--nx-fg-border);
  --radius:14px;--blur:0px;--shadow:0 2px 12px rgba(18,47,75,.045);
  --nx-tab-bg-inactive:#edf2f7;--nx-tab-bg-hover:#e3ebf3;
  --nx-tab-bg-active:#fff;--nx-tab-text:var(--nx-fg-text);--nx-tab-border:var(--nx-fg-border);
}
body.theme-nx-filigree-dark {
  color-scheme:dark;
  --nx-fg-bg:#101924;--nx-fg-surface:#1a2634;--nx-fg-surface-secondary:#223141;
  --nx-fg-border:#42566b;--nx-fg-border-subtle:#34475b;
  --nx-fg-text:#f3f7fc;--nx-fg-text-secondary:#b8c9da;--nx-fg-text-tertiary:#9fb1c5;
  --nx-fg-accent:#9ac1f2;--nx-fg-success:#6bdbab;--nx-fg-warning:#f5c77a;
  --nx-fg-danger:#ff98a0;--nx-fg-focus:#b7d8ff;--nx-fg-track:#465c73;--nx-fg-thumb:#b7d8ff;
  --bg:var(--nx-fg-bg);--panel:var(--nx-fg-surface);--panel-solid:var(--nx-fg-surface);
  --text:var(--nx-fg-text);--muted:var(--nx-fg-text-secondary);
  --accent:var(--nx-fg-accent);--accent2:#b2d3f6;--line:var(--nx-fg-border);
  --radius:14px;--blur:0px;--shadow:0 2px 14px rgba(0,0,0,.075);
  --nx-tab-bg-inactive:#273749;--nx-tab-bg-hover:#34485c;
  --nx-tab-bg-active:#1a2634;--nx-tab-text:var(--nx-fg-text);--nx-tab-border:var(--nx-fg-border);
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) {
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) :is(.app-window,.login-card) {
  background:var(--nx-fg-surface);border:1px solid var(--nx-fg-border);
  box-shadow:var(--shadow);backdrop-filter:none;
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) .app-window.window-focused {
  border-color:var(--nx-fg-accent);box-shadow:0 2px 14px rgba(0,0,0,.08);
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) :is(.window-titlebar,.topbar,.taskbar) {
  backdrop-filter:none;box-shadow:none;
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) .app-window > .window-titlebar {
  background:var(--nx-fg-surface-secondary);border-bottom:1px solid var(--nx-fg-border-subtle);
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) .app-window.window-focused > .window-titlebar {
  background:var(--nx-fg-surface-secondary);box-shadow:inset 0 -1px var(--nx-fg-border-subtle);
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) :is(.settings-card,.choice,.settings-home-card) {
  box-shadow:none;border:1px solid var(--nx-fg-border);border-radius:12px;
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) :is(.primary-button,button.primary) {
  color:var(--nx-fg-surface);background:var(--nx-fg-accent);border-radius:9px;
  box-shadow:none;font-weight:600;
}
body.theme-nx-filigree-dark :is(.primary-button,button.primary) {color:#122234}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) :is(button,input,select,textarea):focus-visible {
  outline:2px solid var(--nx-fg-focus);outline-offset:3px;
}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) select {color-scheme:inherit}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) .dashboard-hero h2 {
  font-weight:650;letter-spacing:-.025em;
}
/* Reusable Filigree components; suitable for independently installed NX modules */
.nx-filigree {
  --fg-space-1:4px;--fg-space-2:8px;--fg-space-3:12px;
  --fg-space-4:16px;--fg-space-6:24px;--fg-space-8:32px;
  --fg-radius-sm:8px;--fg-radius-md:12px;--fg-radius-lg:16px;
  color:var(--nx-fg-text,#17283e);
  font-size:14px;line-height:1.5;
  font-variant-numeric:tabular-nums;
}
.nx-filigree .fg-card {
  min-width:0;background:var(--nx-fg-surface,#fff);
  border:1px solid var(--nx-fg-border,#d7e0ea);
  border-radius:var(--fg-radius-lg);padding:16px;box-shadow:none;
}
.nx-filigree .fg-card + .fg-card {margin-top:12px}
.nx-filigree .fg-header {display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:16px}
.nx-filigree .fg-kicker {display:block;color:var(--nx-fg-text-tertiary,#697c94);font-size:12px;font-weight:600;letter-spacing:.045em}
.nx-filigree .fg-title {font-size:18px;line-height:1.35;letter-spacing:-.02em;font-weight:650;margin:4px 0 0}
.nx-filigree .fg-caption {font-size:12px;color:var(--nx-fg-text-secondary,#52667f);line-height:1.55}
.nx-filigree .fg-icon {display:inline-flex;align-items:center;justify-content:center;flex:none;width:20px;height:20px;color:var(--nx-fg-text-secondary,#52667f)}
.nx-filigree .fg-icon svg {width:100%;height:100%;stroke:currentColor;stroke-width:1.65;fill:none;stroke-linecap:round;stroke-linejoin:round}
.nx-filigree .fg-utility {border:1px solid var(--nx-fg-border,#d7e0ea);border-radius:9px;background:var(--nx-fg-surface-secondary,#f8fafc);width:44px;height:44px;display:grid;place-items:center;color:var(--nx-fg-text,#17283e)}
.nx-filigree .fg-divider {border:0;border-top:1px solid var(--nx-fg-border-subtle,#e6ecf3);margin:16px 0}
.nx-filigree .fg-subtle-tile,.nx-filigree .fg-metric {
  background:var(--nx-fg-surface-secondary,#f8fafc);border:1px solid var(--nx-fg-border-subtle,#e6ecf3);
  padding:12px;border-radius:var(--fg-radius-md);min-width:0;
}
.nx-filigree .fg-metrics {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.nx-filigree .fg-metric-label {display:block;color:var(--nx-fg-text-secondary,#52667f);font-size:12px}
.nx-filigree .fg-metric-value {display:block;font-size:26px;font-weight:650;line-height:1.22;letter-spacing:-.035em;margin:6px 0 3px;overflow-wrap:anywhere}
.nx-filigree .fg-metric[data-status="positive"] .fg-metric-value {color:var(--nx-fg-success,#18734a)}
.nx-filigree .fg-metric[data-status="negative"] .fg-metric-value {color:var(--nx-fg-danger,#ae3641)}
.nx-filigree .fg-metric-message {min-height:18px;margin:0;font-size:12px;color:var(--nx-fg-text-secondary,#52667f)}
.nx-filigree .fg-metric[data-status="negative"] .fg-metric-message {color:var(--nx-fg-danger,#ae3641)}
.nx-filigree .fg-field {display:block;margin:0 0 15px;min-width:0}
.nx-filigree .fg-field-head {display:flex;gap:12px;align-items:center;justify-content:space-between;margin-bottom:8px}
.nx-filigree .fg-field-title {color:var(--nx-fg-text-secondary,#52667f);font-size:13px;font-weight:550}
.nx-filigree .fg-number-wrap {display:flex;align-items:center;gap:6px}
.nx-filigree .fg-currency {font-size:12px;color:var(--nx-fg-text-tertiary,#697c94)}
.nx-filigree .fg-number {
  width:88px;height:44px;padding:4px 8px;text-align:right;border:1px solid var(--nx-fg-border,#d7e0ea);
  border-radius:8px;background:var(--nx-fg-surface,#fff);color:var(--nx-fg-text,#17283e);
  font-family:inherit;font-size:14px;font-weight:600;line-height:1.2;font-variant-numeric:tabular-nums;
}
.nx-filigree .fg-range {display:block;width:100%;height:44px;accent-color:var(--nx-fg-thumb,#315e99);cursor:pointer;touch-action:pan-y}
.nx-filigree .fg-range-bounds {display:flex;justify-content:space-between;font-size:11px;color:var(--nx-fg-text-tertiary,#697c94);margin-top:1px}
.nx-filigree .fg-status {display:inline-flex;gap:5px;align-items:center;font-size:12px;color:var(--nx-fg-success,#18734a)}
.nx-filigree .fg-status[data-status="negative"] {color:var(--nx-fg-danger,#ae3641)}
.nx-filigree .fg-flow {display:flex;align-items:stretch;flex-wrap:wrap;gap:8px}
.nx-filigree .fg-flow-node {flex:1 1 150px;display:flex;gap:9px;align-items:center;padding:12px;border:1px solid var(--nx-fg-border-subtle,#e6ecf3);border-radius:12px}
.nx-filigree .fg-flow-node strong {display:block;font-size:13px}
.nx-filigree .fg-step-list {list-style:none;padding:0;margin:0}
.nx-filigree .fg-step-list li {display:flex;gap:9px;align-items:flex-start;padding:7px 0;color:var(--nx-fg-text-secondary,#52667f)}
.nx-filigree .fg-step-list li svg {flex:none}
.nx-filigree .fg-demo-note {padding-top:8px;font-size:11px;color:var(--nx-fg-text-tertiary,#697c94)}
.nx-filigree .fg-price-main {display:flex;justify-content:space-between;gap:16px;align-items:baseline;margin:12px 0}
.nx-filigree .fg-price-main strong {font-size:28px;line-height:1.2}
.nx-filigree .fg-preview-intro {margin:0 0 16px;color:var(--nx-fg-text-secondary,#52667f)}
.nx-filigree .fg-sr-only {position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important}
.fg-theme-selector-preview {position:relative;overflow:hidden;border-radius:9px;background:#fff;border:1px solid #d7e0ea;height:58px}
.fg-theme-selector-preview::before {content:"";position:absolute;top:8px;left:9px;right:9px;height:10px;border:1px solid #d7e0ea;border-radius:4px}
.fg-theme-selector-preview::after {content:"";position:absolute;left:9px;bottom:9px;width:46%;height:22px;border:1px solid #d7e0ea;border-radius:6px;background:linear-gradient(180deg,#fff,#f8fafc);box-shadow:54px 0 0 -1px #f1f5f9}
.fg-theme-selector-preview.dark {background:#1a2634;border-color:#42566b}
.fg-theme-selector-preview.dark::before,.fg-theme-selector-preview.dark::after {border-color:#42566b}
.fg-theme-selector-preview.dark::after {background:#223141;box-shadow:54px 0 0 -1px #223141}
.filigree-preview-shell {margin-top:16px;min-width:0}
.filigree-preview-shell[hidden] {display:none!important}
:is(body.theme-nx-filigree-light,body.theme-nx-filigree-dark) .theme-choice {grid-template-columns:repeat(2,minmax(0,1fr))}
@media (max-width:640px) {
  .nx-filigree .fg-metrics {grid-template-columns:1fr}
  .nx-filigree .fg-field-head {align-items:flex-start}
  .nx-filigree .fg-metric-value {font-size:23px}
  .nx-filigree .fg-flow {flex-direction:column}
}
@media (prefers-reduced-motion:reduce) {
  .nx-filigree *, .nx-filigree *::before, .nx-filigree *::after {scroll-behavior:auto!important;transition:none!important;animation:none!important}
}
@media (forced-colors:active) {
  .nx-filigree .fg-card,.nx-filigree .fg-subtle-tile,.nx-filigree .fg-metric {border:1px solid CanvasText}
  .nx-filigree .fg-range {forced-color-adjust:auto}
}


/* NX Design Studio: isolated preview host, never modifies saved theme */
.fg-studio-launch{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:14px;padding:13px 15px;border-radius:10px;border:1px solid var(--line);background:var(--panel-solid);color:var(--text);font:600 14px inherit;cursor:pointer}
.fg-studio-launch:hover{border-color:var(--accent)}
.nx-design-studio-backdrop{position:fixed;inset:0;z-index:50000;background:rgba(7,15,26,.72);display:grid;place-items:center;padding:16px}
.nx-design-studio-window{width:min(1160px,100%);height:min(900px,95vh);border-radius:16px;background:var(--panel-solid);color:var(--text);border:1px solid var(--line);display:flex;flex-direction:column;overflow:hidden;box-shadow:0 18px 70px rgba(0,0,0,.25)}
.nx-design-studio-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:17px 22px;border-bottom:1px solid var(--line)}
.nx-design-studio-head h2{margin:2px 0;font-size:23px}.nx-design-studio-head h2 small{font-size:12px;color:var(--muted);font-weight:400}
.nx-design-studio-head p{margin:3px 0;color:var(--muted);font-size:13px}
.nx-design-studio-head button[data-studio-close]{width:44px;height:44px;border-radius:9px;border:1px solid var(--line);background:transparent;color:var(--text);font-size:24px;cursor:pointer}
.nx-design-studio-toolbar,.nx-design-studio-foot{padding:12px 22px;display:flex;gap:16px;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);font-size:12px;color:var(--muted)}
.nx-design-studio-toolbar select{min-height:42px;margin-left:8px;border-radius:8px;border:1px solid var(--line);padding:6px 12px;background:var(--panel-solid);color:var(--text)}
.nx-design-studio-content{min-height:0;flex:1;overflow:auto}
.nx-design-studio-canvas{min-height:100%;background:var(--nx-fg-bg);color:var(--nx-fg-text);padding:22px;--panel:var(--nx-fg-surface);--panel-solid:var(--nx-fg-surface);--text:var(--nx-fg-text);--muted:var(--nx-fg-text-secondary);--line:var(--nx-fg-border);--accent:var(--nx-fg-accent)}
.fg-studio-showcase{max-width:900px;margin:auto}
.fg-studio-overview{display:grid;grid-template-columns:1.25fr 1fr;gap:14px;margin-bottom:14px}
.fg-studio-showcase .fg-studio-demo-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:16px}
.fg-studio-showcase .fg-studio-demo-row label{font-size:12px}
.fg-studio-showcase input:not([type=range]),.fg-studio-showcase select{background:var(--nx-fg-surface-secondary);color:var(--nx-fg-text);border:1px solid var(--nx-fg-border);border-radius:8px;min-height:44px;padding:0 10px;max-width:180px}
.fg-studio-showcase .fg-studio-action{padding:11px 14px;min-height:44px;background:var(--nx-fg-accent);color:#fff;border:1px solid var(--nx-fg-accent);border-radius:9px;cursor:pointer}
.fg-studio-showcase .fg-studio-action.secondary{background:transparent;color:var(--nx-fg-text);border-color:var(--nx-fg-border)}
.nx-design-studio-foot{border-bottom:0;border-top:1px solid var(--line)}
.nx-design-studio-foot button{padding:9px 16px;border-radius:8px;background:var(--panel);color:var(--text);border:1px solid var(--line);cursor:pointer}
.nx-picker-description{display:block;color:var(--text);font-size:12px;padding:5px 0}
@media(max-width:680px){.fg-studio-overview{grid-template-columns:1fr}.nx-design-studio-window{height:98vh}.nx-design-studio-toolbar{align-items:flex-start;flex-direction:column}.nx-design-studio-canvas{padding:12px}}
/* Calm accent on interactive previews; color independent of previous Aurora blue */
.theme-nx-filigree-light{--nx-fg-accent:#ae541e;--nx-fg-thumb:#ae541e}
.theme-nx-filigree-dark{--nx-fg-accent:#f0a16c;--nx-fg-thumb:#f0a16c}
.theme-nx-filigree-dark .fg-studio-action:not(.secondary){color:#24170e}

/* Keep header controls legible above the Mac desktop wallpaper. */
body.shell-mac.theme-nx-filigree-light .topbar {
  background-color: var(--nx-topbar-bg, var(--nx-fg-surface)) !important;
}
body.shell-mac.theme-nx-filigree-light .global-search .search-pill {
  border-color: var(--nx-fg-text-secondary);
}

/* Leave space for the global search beside the wordmark on tablets. */
@media (min-width: 700px) and (max-width: 800px) {
  body.theme-nx-filigree-light .topbar-center {
    display: flex;
    min-width: 0;
  }
  body.theme-nx-filigree-light .topbar-center .global-search {
    width: 100%;
    --nx-search-bg: var(--nx-fg-surface);
    --nx-search-text: var(--nx-fg-text);
  }
  body.theme-nx-filigree-light .global-search .search-pill::placeholder {
    color: var(--nx-fg-text-secondary);
  }
}

/* Keep the full search field and the wordmark readable on narrow Mac desktops. */
@media (max-width: 699px) {
  body.shell-mac.theme-nx-filigree-light {
    --topbar-h: 96px;
  }
  body.shell-mac.theme-nx-filigree-light .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 44px;
    gap: 0 6px;
    padding-block: 2px 4px;
  }
  body.shell-mac.theme-nx-filigree-light .topbar .brand-pill {
    min-width: 0;
    overflow: hidden;
  }
  body.shell-mac.theme-nx-filigree-light .bdl-brand > span {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: start;
  }
  body.shell-mac.theme-nx-filigree-light .taskbar {
    background-color: var(--nx-taskbar-bg, var(--nx-fg-surface)) !important;
  }
  body.shell-mac.theme-nx-filigree-light .topbar-actions {
    grid-column: 2;
    grid-row: 1;
  }
  body.shell-mac.theme-nx-filigree-light .topbar-center {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    min-width: 0;
  }
  body.shell-mac.theme-nx-filigree-light .global-search {
    width: 100%;
    --nx-search-bg: var(--nx-fg-surface);
    --nx-search-text: var(--nx-fg-text);
  }
  body.shell-mac.theme-nx-filigree-light .global-search .search-pill {
    height: 44px;
    font-size: 16px;
  }
  body.shell-mac.theme-nx-filigree-light .global-search-results {
    top: 100%;
  }
  body.shell-mac.theme-nx-filigree-light .global-search .search-pill::placeholder {
    color: var(--nx-fg-text-secondary);
  }
  body.shell-mac.theme-nx-filigree-light #desktopIcons {
    top: calc(var(--topbar-h) + 8px);
  }
}
