/* Shared controls for the redesign (flag new_ui), from Valentina's mockup v6:
   buttons, link buttons, chips, color dots and the mobile reorder utility.
   Every redesigned view uses these instead of its own button CSS. The app's
   global `button` rule paints every button blue; these selectors are written
   to beat it (and its :hover:not(:disabled)) without !important.

   <button class="ui-btn">Send client update</button>   one per screen (black)
   <button class="ui-btn ghost sm">Open in action plan</button>
   <button class="ui-link">Copy</button>                underlined text action
   <span class="ui-chip"><i class="ui-dot s0"></i>ChatGPT</span>
   <span class="ui-tchip">Correlational</span>

   Series colors: .s0 accent (the lead AI), .s1 to .s5 the chart palette (--ui-s1..5). */
body.new-ui .ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 9px;
  border: 1px solid var(--ui-ink); background: var(--ui-ink); color: var(--ui-bg);
  font: 500 14px var(--ui-font); white-space: nowrap; box-shadow: none;
}
body.new-ui .ui-btn:hover:not(:disabled) { background: var(--ui-ink); filter: brightness(1.25); }
body.new-ui .ui-btn.ghost { background: var(--ui-card); color: var(--ui-ink); border-color: var(--ui-line); }
body.new-ui .ui-btn.ghost:hover:not(:disabled) { background: var(--ui-card); border-color: var(--ui-ink-3); filter: none; }
body.new-ui .ui-btn.sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
body.new-ui .ui-btn.lg { height: 44px; padding: 0 20px; }
body.new-ui .ui-btn svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
body.new-ui .ui-link {
  background: none; border: 0; padding: 0; border-radius: 0; box-shadow: none;
  color: var(--ui-ink); font: inherit; font-size: 14px; font-weight: 400; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--ui-line); text-underline-offset: 4px;
}
body.new-ui .ui-link:hover:not(:disabled) { background: none; text-decoration-color: var(--ui-ink); }
body.new-ui :is(.ui-btn, .ui-link):focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }

body.new-ui .ui-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-card);
  font-size: 12.5px; color: var(--ui-ink-2); white-space: nowrap;
}
body.new-ui .ui-tchip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--ui-line); background: var(--ui-paper-2); font-size: 12px; color: var(--ui-ink); white-space: nowrap;
}
body.new-ui .ui-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--ui-rival); }
body.new-ui .ui-dot.s0 { background: var(--ui-accent); }
body.new-ui .ui-dot.s1 { background: var(--ui-s1); }
body.new-ui .ui-dot.s2 { background: var(--ui-s2); }
body.new-ui .ui-dot.s3 { background: var(--ui-s3); }
body.new-ui .ui-dot.s4 { background: var(--ui-s4); }
body.new-ui .ui-dot.s5 { background: var(--ui-s5); }
/* An AI's own color (.ai-<key>); an AI without one is grey. */
body.new-ui .ui-dot[class*="ai-"] { background: var(--ui-ink-3); }
body.new-ui .ui-dot.ai-chatgpt { background: var(--ui-ai-chatgpt); }
body.new-ui .ui-dot.ai-gemini { background: var(--ui-ai-gemini); }
body.new-ui .ui-dot.ai-claude { background: var(--ui-ai-claude); }
body.new-ui .ui-dot.ai-perplexity { background: var(--ui-ai-perplexity); }
body.new-ui .ui-dot.ai-mistral { background: var(--ui-ai-mistral); }
body.new-ui .ui-dot.ai-grok { background: var(--ui-ai-grok); }

/* Phone order (David): on a phone the page becomes one column and its cards
   follow .ui-order-m-N instead of the desktop source order. Grids inside
   .ui-reorder dissolve so their cards can be reordered, except .ui-keep
   (the headline numbers stay two by two). */
@media (max-width: 900px) {
  body.new-ui .ui-reorder { display: flex; flex-direction: column; gap: 12px; }
  body.new-ui .ui-reorder > .ui-g12:not(.ui-keep), body.new-ui .ui-reorder .ui-stack { display: contents; }
  body.new-ui .ui-reorder > .ui-g12.ui-keep { margin: 0; }
  body.new-ui .ui-order-m-1 { order: 1; } body.new-ui .ui-order-m-2 { order: 2; }
  body.new-ui .ui-order-m-3 { order: 3; } body.new-ui .ui-order-m-4 { order: 4; }
  body.new-ui .ui-order-m-5 { order: 5; } body.new-ui .ui-order-m-6 { order: 6; }
  body.new-ui .ui-order-m-7 { order: 7; } body.new-ui .ui-order-m-8 { order: 8; }
  body.new-ui :is(.ui-btn.sm) { height: 40px; }
  body.new-ui .ui-card-h .ui-link, body.new-ui .ui-tbl .r .ui-link { min-height: 44px; display: inline-flex; align-items: center; }
}
