/* NOVA — Mode IA (Andoris) surface, part 1 of 3: tokens, stage, buttons,
   conversation nav (+ memory card) and landing. Part 2 (nova-andoris-2.css):
   thread, composer, motion, canvas panel + lists. Part 3 (nova-andoris-3.css):
   canvas detail views, automations, responsive. All three are linked from
   index.html / admin.html AFTER /ui/tokens.css (the Andoris token layer), so
   equal-specificity rules here win. Contract selectors in ui/tokens/*.css stay
   untouched; this layer only retunes the --ui-* / --d* ramps to the Nova
   palette and restyles on top. Colour always comes from tokens so the
   dark/light switch flips everything. */

/* ═══════════ Token ramps ═══════════ */
[data-theme="andoris-dark"] {
  --ui-bg: #09090a;
  --ui-bg-elev: #131314;
  --ui-bg-sunken: #070708;
  --ui-line: rgba(255, 255, 255, 0.11);
  --ui-line-strong: rgba(255, 255, 255, 0.24);
  --ui-text: #ededee;
  --ui-text-muted: #b3b3b4;
  --ui-accent: #4fdde1;
  --ui-accent-ink: #181819;
  --ui-accent-soft: rgba(79, 221, 225, 0.13);
  --ui-focus: 0 0 0 2px rgba(79, 221, 225, 0.32);
  --andoris-amber: var(--warn);
  --ia-panel: linear-gradient(180deg, rgba(15, 15, 16, 0.9), rgba(8, 8, 9, 0.95));
  --ia-canvas: linear-gradient(180deg, #111112, #0a0a0b);
  --ia-bubble: linear-gradient(180deg, rgba(23, 182, 164, 0.17), rgba(10, 90, 77, 0.24));
  --ia-bubble-line: rgba(79, 221, 225, 0.26);
  --ia-code: #060607;
  --ia-hint: #8a9294;
  --ia-kicker: #99999a;
}
[data-theme="andoris-light"] {
  --ui-radius-sm: 8px;
  --ui-radius-md: 12px;
  --ui-radius-lg: 16px;
  --ui-radius-pill: 999px;
  --ui-pad-2: 8px;
  --ui-pad-3: 12px;
  --ui-pad-4: 16px;
  --ui-pad-5: 24px;
  --ui-font: "TASA Orbiter Text", ui-sans-serif, system-ui, sans-serif;
  --ui-font-display: "TASA Orbiter Display", "TASA Orbiter Text", ui-sans-serif, system-ui, sans-serif;
  --ui-transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --ui-bg: #f2f2f3;
  --ui-bg-elev: #ffffff;
  --ui-bg-sunken: #ebebec;
  --ui-line: #dbdbdc;
  --ui-line-strong: #b5b5b6;
  --ui-text: #151516;
  --ui-text-muted: #454b4e;
  --ui-accent: #0a5a4d;
  --ui-accent-ink: #ffffff;
  --ui-accent-soft: rgba(23, 182, 164, 0.12);
  --ui-focus: 0 0 0 3px rgba(23, 182, 164, 0.3);
  --d0: #f2f2f3;
  --d1: #ffffff;
  --d2: #ffffff;
  --d3: #e4e4e5;
  --dline: #dbdbdc;
  --dink: #151516;
  --dmuted: #454b4e;
  --andoris-amber: #8a5a00;
  --ia-panel: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(249, 249, 250, 0.92));
  --ia-canvas: linear-gradient(180deg, #fafafb, #f4f4f5);
  --ia-bubble: linear-gradient(180deg, #f0f0f1, #e7e7e8);
  --ia-bubble-line: rgba(23, 182, 164, 0.38);
  --ia-code: #151516;
  --ia-hint: #5f6568;
  --ia-kicker: #596164;
}
body.andoris-app[data-andoris-theme="light"] {
  --d0: #f2f2f3;
  --d3: #e4e4e5;
  --dline: #dbdbdc;
}
html[data-andoris-theme="dark"] {
  --d0: #080809;
  --d1: #0e0e0f;
  --d2: #151516;
  --d3: #1d1d1e;
  --dline: rgba(255, 255, 255, 0.13);
  --dink: #ededee;
  --dmuted: #b3b3b4;
}

/* ═══════════ Stage + panels ═══════════ */
body.andoris-app #tab-andoris {
  background-color: var(--ui-bg);
  /* --nv-aurora is two radial layers: aurora, aurora, dots */
  background-image: var(--nv-aurora), var(--nv-dots);
  background-size: auto, auto, 26px 26px;
  background-attachment: fixed, fixed, scroll;
  background-position: 0 0, 0 0, -1px -1px;
}
body.andoris-app .andoris-thread {
  background: transparent;
}
[data-theme] .andoris-nav {
  background: var(--ia-panel);
  border-right: 1px solid var(--nv-glass-line);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.andoris-split::after {
  background: var(--nv-glass-line);
}
.andoris-split:hover::after,
.andoris-split:focus-visible::after,
.andoris-shell.is-resizing .andoris-split::after {
  background: var(--nv-signal);
  box-shadow: 0 0 12px rgba(79, 221, 225, 0.55);
}

/* ═══════════ Buttons (Mode IA family → Nova look) ═══════════ */
[data-theme] .andoris-btn {
  min-height: 36px;
  border: 1px solid var(--nv-btn-line);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--nv-btn-from), var(--nv-btn-to));
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  transition: border-color 0.18s, box-shadow 0.18s var(--nv-ease), color 0.18s, background 0.18s;
}
[data-theme] .andoris-btn:hover:not(:disabled) {
  border-color: var(--nv-hover-line);
  color: var(--nv-accent-ink);
  box-shadow: 0 0 0 2px var(--nv-ring);
}
[data-theme] .andoris-btn--ghost {
  background: transparent;
  color: var(--ui-text-muted);
  box-shadow: none;
}
[data-theme] .andoris-btn--accent,
[data-theme] .andoris-btn--accent:hover:not(:disabled) {
  border-color: var(--nv-pri-line);
  background: linear-gradient(180deg, var(--nv-pri-from), var(--nv-pri-to));
  color: var(--nv-pri-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 22px -12px var(--nv-pri-glow);
}
[data-theme] .andoris-btn--accent:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--nv-pri-hi-from), var(--nv-pri-hi-to));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36), 0 0 0 2px var(--nv-ring), 0 14px 28px -12px var(--nv-pri-glow);
}
[data-theme] :is(.andoris-btn, .andoris-icon-btn, .andoris-convo-open, .andoris-auto-foot):focus-visible {
  outline: 2px solid var(--nv-teal);
  outline-offset: 2px;
}
[data-theme] .andoris-icon-btn {
  border-radius: 10px;
  color: var(--ui-text-muted);
}
[data-theme] .andoris-icon-btn:hover {
  border-color: var(--nv-hover-line);
  background: var(--nv-well);
  color: var(--nv-accent-ink);
}

/* ═══════════ Nav: new, filter, list, foot ═══════════ */
.andoris-nav-actions [data-andoris="new"] {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(79, 221, 225, 0.2);
  background: linear-gradient(180deg, rgba(79, 221, 225, 0.16), rgba(23, 182, 164, 0.07));
  color: var(--ui-accent);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 26px -14px rgba(79, 221, 225, 0.6);
}
.andoris-nav-actions [data-andoris="new"]:hover {
  border-color: rgba(79, 221, 225, 0.75);
  background: linear-gradient(180deg, rgba(79, 221, 225, 0.24), rgba(23, 182, 164, 0.1));
  color: var(--ui-accent);
  box-shadow: 0 0 0 2px rgba(79, 221, 225, 0.14), 0 14px 32px -14px rgba(79, 221, 225, 0.75);
}
.andoris-nav-actions [data-andoris="new"] svg {
  color: currentColor;
}
[data-theme="andoris-light"] .andoris-nav-actions [data-andoris="new"],
[data-theme="andoris-light"] .andoris-nav-actions [data-andoris="new"]:hover {
  color: var(--nv-deep);
  border-color: rgba(23, 182, 164, 0.5);
  background: linear-gradient(180deg, rgba(23, 182, 164, 0.14), rgba(79, 221, 225, 0.06));
}
[data-theme="andoris-light"] .andoris-nav-actions [data-andoris="new"]:hover {
  border-color: var(--nv-teal);
  box-shadow: 0 0 0 2px var(--nv-ring), 0 12px 26px -16px rgba(10, 90, 77, 0.6);
}
.andoris-nav-actions .andoris-theme-switch {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--nv-btn-line);
  background: linear-gradient(180deg, var(--nv-btn-from), var(--nv-btn-to));
  color: var(--nv-accent-ink);
}

.andoris-nav .andoris-list-filter-wrap {
  height: 40px;
  margin: 2px 0 4px;
  padding: 0 12px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--nv-well);
  color: var(--faint);
  transition: border-color 0.18s, box-shadow 0.18s var(--nv-ease);
}
.andoris-nav .andoris-list-filter-wrap:hover {
  border-color: var(--nv-hover-line);
}
.andoris-nav .andoris-list-filter-wrap:focus-within {
  border-color: var(--nv-teal);
  box-shadow: 0 0 0 3px var(--nv-ring);
}
.andoris-list-filter-wrap input.andoris-list-filter[type="search"] {
  font-size: 13px;
  color: var(--ui-text) !important;
}
.andoris-list-filter-wrap input.andoris-list-filter[type="search"]::placeholder {
  color: var(--faint) !important;
}

.andoris-nav .andoris-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -4px;
  padding: 0 4px 12px;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
}
.andoris-nav-kicker,
.andoris-nav .andoris-list-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
  padding: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ia-kicker);
}
.andoris-nav .andoris-list-heading {
  padding: 0 10px;
}
.andoris-nav .andoris-list-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--ui-line-strong), transparent);
}
.andoris-nav .andoris-list-heading:first-child {
  margin-top: 6px;
}
.andoris-list button.andoris-convo-open {
  height: 36px;
  padding-left: 12px;
  border-radius: 10px;
  color: var(--ui-text-muted);
  font-size: 13.5px;
  transition: background 0.16s var(--nv-ease), color 0.16s, box-shadow 0.16s;
}
.andoris-convo:hover .andoris-convo-open {
  background: var(--nv-well);
  color: var(--ui-text);
}
.andoris-list button.andoris-convo-open[aria-current="true"],
[data-theme="andoris-light"] .andoris-list button.andoris-convo-open[aria-current="true"] {
  color: var(--ui-text);
  font-weight: 500;
  background: linear-gradient(100deg, rgba(79, 221, 225, 0.16), rgba(23, 182, 164, 0.06) 70%, transparent), var(--nv-well);
  box-shadow: inset 0 0 0 1px rgba(79, 221, 225, 0.24);
}
[data-theme="andoris-light"] .andoris-list button.andoris-convo-open[aria-current="true"] {
  background: linear-gradient(100deg, rgba(23, 182, 164, 0.16), rgba(23, 182, 164, 0.05) 70%, transparent), #fff;
  box-shadow: inset 0 0 0 1px rgba(23, 182, 164, 0.35), 0 4px 12px -8px rgba(10, 90, 77, 0.4);
}
.andoris-list button[aria-current="true"]::before {
  display: none;
}
.andoris-convo-pin-ic,
.andoris-convo-clock-ic {
  color: var(--nv-accent-ink);
}
.andoris-list button.andoris-convo-pin,
.andoris-list button.andoris-convo-del,
.andoris-convo:has(.andoris-convo-open[aria-current="true"]) > .andoris-convo-pin,
.andoris-convo:has(.andoris-convo-open[aria-current="true"]) > .andoris-convo-del,
[data-theme="andoris-light"] .andoris-convo:has(.andoris-convo-open[aria-current="true"]) > .andoris-convo-pin,
[data-theme="andoris-light"] .andoris-convo:has(.andoris-convo-open[aria-current="true"]) > .andoris-convo-del {
  top: 4px;
  bottom: 4px;
  height: auto;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  font-size: 16px;
}
.andoris-list button.andoris-convo-pin:hover,
.andoris-convo.is-pinned .andoris-convo-pin {
  color: var(--nv-accent-ink);
  background: var(--nv-tag-bg);
}
.andoris-list button.andoris-convo-del:hover {
  color: var(--error);
  background: var(--error-soft);
}
.andoris-list :is(.andoris-convo-pin, .andoris-convo-del):focus-visible {
  outline: 2px solid var(--nv-teal);
  outline-offset: -2px;
}
.andoris-nav .andoris-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--faint);
  list-style: none;
}

/* Foot tools: Faits mémorisés + Automations — one dock, not two floating rows */
.andoris-nav :is(.andoris-auto-foot, .andoris-nav-fold-ghost, .andoris-nav-actions, .andoris-list-filter-wrap) {
  flex: none;
}
.andoris-nav .andoris-auto-foot {
  margin-top: 0;
  padding: 10px 10px;
  border: 0;
  border-top: 1px solid var(--ui-line);
  border-radius: 0;
  color: var(--ui-text);
  transition: background 0.16s var(--nv-ease);
}
.andoris-nav .andoris-auto-foot:hover {
  background: var(--nv-well);
}
.andoris-nav .andoris-auto-foot:hover .andoris-auto-foot-h span:first-of-type {
  text-decoration: none;
  color: var(--nv-accent-ink);
}
.andoris-nav [data-andoris="autos"] {
  border-top: 0;
  padding-top: 4px;
}
.andoris-nav .andoris-auto-foot-h {
  font-size: 13px;
  font-weight: 600;
}
.andoris-nav .andoris-auto-foot-h svg {
  box-sizing: content-box;
  width: 15px;
  height: 15px;
  padding: 6px;
  border-radius: 9px;
  border: 1px solid var(--nv-tag-line);
  background: var(--nv-tag-bg);
  color: var(--nv-accent-ink);
}
.andoris-nav .andoris-auto-foot-h em {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--nv-tag-bg);
  color: var(--nv-accent-ink);
  text-align: center;
}
.andoris-nav .andoris-auto-foot-h em:empty {
  display: none;
}
.andoris-nav .andoris-auto-foot-next {
  padding-left: 38px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ia-kicker);
}
.andoris-nav .andoris-auto-foot-next b {
  color: var(--ui-text);
}
.andoris-nav .andoris-nav-fold-ghost {
  width: 36px;
  height: 36px;
  margin: 2px 0 0 4px;
  opacity: 1;
  color: var(--faint);
}

/* Folded rail (56px) */
.andoris-shell[data-nav-folded="true"] .andoris-nav .andoris-auto-foot {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
}
.andoris-shell[data-nav-folded="true"] .andoris-nav [data-andoris="memory"] {
  margin-top: auto;
}
.andoris-shell[data-nav-folded="true"] .andoris-nav .andoris-auto-foot-h {
  justify-content: center;
}
.andoris-shell[data-nav-folded="true"] .andoris-nav .andoris-nav-fold-ghost {
  margin: 4px 0 0;
}
.andoris-shell[data-nav-folded="true"] .andoris-nav-actions .andoris-theme-switch {
  display: none;
}

/* Faits mémorisés — floating card above the rail dock (was painted off-screen) */
[data-andoris="memory-overlay"]:not([hidden]) {
  position: absolute;
  left: 12px;
  bottom: 118px;
  z-index: 30;
  width: min(280px, calc(100vw - 24px));
  max-height: min(52vh, 440px);
  overflow: auto;
  padding: 14px 14px 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  background:
    linear-gradient(var(--nv-card), var(--nv-card)) padding-box,
    var(--nv-edge) border-box;
  box-shadow: 0 30px 70px -24px rgba(15, 15, 16, 0.6), var(--shadow-sm);
  color: var(--ui-text);
}
.andoris-shell[data-nav-folded="true"] ~ [data-andoris="memory-overlay"]:not([hidden]) {
  left: 64px;
  bottom: 60px;
}
[data-andoris="memory-overlay"] .andoris-nav-kicker {
  margin: 0 0 8px;
  padding: 0;
}
[data-andoris="memory-overlay"] ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.andoris-memory-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--ui-line);
}
.andoris-memory-row > div {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.andoris-memory-row strong {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nv-accent-ink);
}
.andoris-memory-row span {
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.andoris-memory-row .andoris-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}
.andoris-memory-row .andoris-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--error) 50%, transparent);
  color: var(--error);
  box-shadow: 0 0 0 3px var(--error-soft);
}
[data-andoris="memory-overlay"] .andoris-empty {
  padding: 6px 0;
  font-size: 13px;
  color: var(--faint);
}

/* ═══════════ Landing ═══════════ */
.andoris-landing-stage {
  position: relative;
}
.andoris-landing-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -40px;
  width: 460px;
  height: 320px;
  transform: translateX(-50%);
  background: none; /* landing glow removed */
  pointer-events: none;
}
.andoris-landing-cards {
  counter-reset: ia-card;
}
[data-theme] .andoris-landing-cards .andoris-autos-card {
  position: relative;
  overflow: hidden;
  align-items: stretch;
  min-height: 72px !important;
  padding: 12px 40px 12px 16px !important;
  border: 1px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(27, 27, 28, 0.85), rgba(15, 15, 16, 0.9)) padding-box,
    var(--nv-edge-dark) border-box;
  color: var(--dink);
  text-align: left;
  counter-increment: ia-card;
  transition: transform 0.22s var(--nv-ease), box-shadow 0.22s var(--nv-ease), background 0.22s;
}
[data-theme] .andoris-landing-cards .andoris-autos-card:hover {
  transform: translateY(-2px);
  background:
    linear-gradient(180deg, rgba(36, 36, 37, 0.9), rgba(19, 19, 20, 0.92)) padding-box,
    var(--nv-edge-dark) border-box;
  box-shadow: 0 0 0 1px rgba(79, 221, 225, 0.22), 0 22px 40px -22px rgba(79, 221, 225, 0.5);
}
[data-theme] .andoris-landing-cards .andoris-autos-card:focus-visible {
  outline: 2px solid var(--nv-teal);
  outline-offset: 2px;
}
/* instrument index 01…10, swapped for an arrow on hover */
[data-theme] .andoris-landing-cards .andoris-autos-card::before {
  content: counter(ia-card, decimal-leading-zero);
  position: absolute;
  top: 13px;
  right: 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ia-kicker);
  opacity: 0.8;
  transition: opacity 0.2s;
}
[data-theme] .andoris-landing-cards .andoris-autos-card::after {
  content: "→";
  position: absolute;
  top: 10px;
  right: 14px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--nv-cyan);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s, transform 0.2s var(--nv-ease);
}
[data-theme] .andoris-landing-cards .andoris-autos-card:hover::before {
  opacity: 0;
}
[data-theme] .andoris-landing-cards .andoris-autos-card:hover::after {
  opacity: 1;
  transform: none;
}
[data-theme] .andoris-landing-cards .andoris-autos-card-kicker {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ia-kicker);
}
.andoris-landing-cards .andoris-autos-card strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: -0.01em;
}
[data-theme="andoris-light"] .andoris-landing-stage::before {
  background: none;
}
[data-theme="andoris-light"] .andoris-landing-cards .andoris-autos-card {
  background:
    linear-gradient(180deg, #ffffff, #f8f8f9) padding-box,
    var(--nv-edge) border-box;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
[data-theme="andoris-light"] .andoris-landing-cards .andoris-autos-card:hover {
  background:
    linear-gradient(180deg, #ffffff, #f6f6f7) padding-box,
    var(--nv-edge) border-box;
  box-shadow: 0 0 0 1px rgba(23, 182, 164, 0.25), 0 22px 40px -22px rgba(10, 90, 77, 0.45);
}
[data-theme="andoris-light"] .andoris-landing-cards .andoris-autos-card::after {
  color: var(--nv-deep);
}
