/* =========================================================================
   theme.css — AdalatIQ's shared design tokens and components
   (ADALATIQ_LAWYER_WORKSPACE_DESIGN.md, Part A)

   Tokens keep the names the pages already used (--orange, --text-dark ...),
   with the landing page's values, so existing pages look exactly the same.
   Components are prefixed "ui-" so they never collide with a page's own
   class names. Behaviour for the interactive ones (select, modal, toast,
   popover/menu) is in ui.js.
   ========================================================================= */

:root {
  /* colour */
  --orange: #E8682A;
  --orange-dark: #d45a20;      /* hover */
  --orange-light: #FFF3EC;     /* soft */
  --orange-soft: #FFF3EC;
  --navy: #1e2a3a;
  --text-dark: #1a2332;
  --text-mid: #4a5568;
  --text-light: #718096;
  --bg-cream: #fdf6ee;
  --bg-white: #ffffff;
  --border: #e8e0d8;
  --border-strong: #d6cabd;
  --green: #2f7d5b;
  --green-soft: #e3f2ea;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --amber: #a15c07;
  --amber-soft: #fdf3e1;

  /* type */
  --font: 'Inter', 'Noto Sans Devanagari', 'Noto Sans Bengali', 'Noto Sans Tamil', 'Noto Sans Telugu', 'Noto Naskh Arabic', 'Noto Sans Gurmukhi', 'Noto Sans Gujarati', 'Noto Sans Kannada', 'Noto Sans Malayalam', 'Noto Sans Oriya', system-ui, sans-serif;
  /* article reading and writing only */
  --font-serif: 'Source Serif 4', 'Noto Serif Devanagari', 'Noto Serif Bengali', 'Noto Serif Tamil', 'Noto Serif Telugu', 'Noto Naskh Arabic', Georgia, 'Times New Roman', serif;
  --text-xs: 12px;
  --text-sm: 13.5px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 22px;

  /* space (4 / 8 scale) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* shape */
  --radius-sm: 8px;    /* inputs, buttons */
  --radius-md: 14px;   /* cards */
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgba(26, 35, 50, 0.05), 0 1px 3px rgba(26, 35, 50, 0.07);
  --shadow-2: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --focus-ring: 0 0 0 3px rgba(232, 104, 42, 0.35);

  /* layout + motion */
  --max-w: 1100px;
  --chat-radius: 18px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 160ms;

  /* Blogs pages (adalatiq-blog-home.html design). Tokens that already exist
     are reused (--orange, --navy, --text-dark = ink, --text-mid = ink-2,
     --bg-white = surface, --green); these are the design's other values. */
  --orange-strong: #c9551b;    /* hover */
  --orange-wash: #fff1e8;      /* focus ring, highlighted text */
  --ink-3: #6b7486;            /* quiet text */
  --bg-page: #fdf8f2;
  --line: #ece3d9;
  --line-2: #f3ece4;
  --chip: #f6efe7;
  --shadow-soft: 0 1px 2px rgba(30, 42, 58, .05), 0 8px 24px rgba(30, 42, 58, .06);
  --font-ui: "Inter", "Noto Sans Devanagari", "Noto Sans Bengali", "Noto Sans Tamil", "Noto Sans Telugu", "Noto Naskh Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-read: "Source Serif 4", "Noto Serif Devanagari", "Noto Serif Bengali", "Noto Serif Tamil", "Noto Serif Telugu", "Noto Naskh Arabic", Georgia, "Times New Roman", serif;
}

/* Dark mode: only on the Blogs pages for now (body.ins-body), so the rest of
   the site keeps its light look. Same values as the design. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.ins-body {
    --orange: #f2803f; --orange-strong: #ff9a5c; --orange-wash: #3a2416;
    --navy: #0f1622; --text-dark: #eef0f5; --text-mid: #c3c8d3; --ink-3: #98a0b1;
    --bg-page: #141922; --bg-white: #1b2230; --line: #2b3444; --line-2: #222a38;
    --green: #5cc393; --chip: #232c3b; --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --border: #2b3444; --orange-dark: #ff9a5c; --orange-light: #3a2416; --text-light: #98a0b1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] body.ins-body {
  --orange: #f2803f; --orange-strong: #ff9a5c; --orange-wash: #3a2416;
  --navy: #0f1622; --text-dark: #eef0f5; --text-mid: #c3c8d3; --ink-3: #98a0b1;
  --bg-page: #141922; --bg-white: #1b2230; --line: #2b3444; --line-2: #222a38;
  --green: #5cc393; --chip: #232c3b; --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --border: #2b3444; --orange-dark: #ff9a5c; --orange-light: #3a2416; --text-light: #98a0b1;
  color-scheme: dark;
}

/* Components size by their border box, whatever the host page sets. */
[class^="ui-"], [class*=" ui-"], [class^="ui-"]::before, [class^="ui-"]::after,
[class*=" ui-"]::before, [class*=" ui-"]::after { box-sizing: border-box; }

/* The hidden attribute always wins over a component's display value. */
[class*="ui-"][hidden] { display: none !important; }

/* ── helpers ──────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ui-divider { height: 1px; background: var(--border); border: 0; margin: var(--space-5) 0; }

/* ── buttons ──────────────────────────────────────────────────────────── */
.ui-btn {
  --btn-bg: var(--bg-white); --btn-fg: var(--text-dark); --btn-border: var(--border);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4);
  font: 600 var(--text-sm)/1 var(--font); letter-spacing: 0.01em; white-space: nowrap; text-decoration: none;
  color: var(--btn-fg); background: var(--btn-bg); border: 1.5px solid var(--btn-border); border-radius: var(--radius-sm);
  cursor: pointer; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.ui-btn:hover { border-color: var(--border-strong); background: #fbf8f5; }
.ui-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ui-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.ui-btn--primary { --btn-bg: var(--orange); --btn-fg: #fff; --btn-border: var(--orange); }
.ui-btn--primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.ui-btn--secondary { --btn-bg: var(--bg-white); --btn-fg: var(--orange-dark); --btn-border: #f3c9b1; }
.ui-btn--secondary:hover { background: var(--orange-light); border-color: var(--orange); }
.ui-btn--ghost { --btn-bg: transparent; --btn-fg: var(--text-mid); --btn-border: transparent; }
.ui-btn--ghost:hover { background: rgba(26, 35, 50, 0.05); border-color: transparent; color: var(--text-dark); }
.ui-btn--danger { --btn-bg: var(--bg-white); --btn-fg: var(--red); --btn-border: #f3c4c4; }
.ui-btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.ui-btn--danger-solid { --btn-bg: var(--red); --btn-fg: #fff; --btn-border: var(--red); }
.ui-btn--danger-solid:hover { background: #991b1b; border-color: #991b1b; }
.ui-btn--sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.ui-btn--block { width: 100%; }
.ui-btn--icon { min-width: 40px; padding: 0; }
.ui-btn--sm.ui-btn--icon { min-width: 32px; }

.ui-btn:disabled, .ui-btn[aria-disabled="true"] {
  cursor: not-allowed; opacity: 0.5; box-shadow: none;
}
.ui-btn:disabled:hover { background: var(--btn-bg); border-color: var(--btn-border); }
.ui-btn.is-loading { color: transparent !important; pointer-events: none; }
.ui-btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent; animation: ui-spin 0.7s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* ── form fields ──────────────────────────────────────────────────────── */
.ui-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.ui-label { font: 600 var(--text-sm)/1.3 var(--font); color: var(--text-dark); display: flex; align-items: center; gap: 6px; }
.ui-label .ui-optional { font-weight: 500; color: var(--text-light); }
.ui-help { font-size: var(--text-xs); line-height: 1.5; color: var(--text-light); }
.ui-error-text { font-size: var(--text-xs); line-height: 1.5; color: var(--red); display: none; }
.ui-field.is-invalid .ui-error-text { display: block; }

.ui-input, .ui-textarea {
  width: 100%; font: 400 var(--text-md)/1.45 var(--font); color: var(--text-dark);
  background: var(--bg-white); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; appearance: none; -webkit-appearance: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.ui-input { min-height: 42px; }
.ui-textarea { min-height: 96px; resize: vertical; }
.ui-input::placeholder, .ui-textarea::placeholder { color: #a0a9b8; }
.ui-input:hover, .ui-textarea:hover { border-color: var(--border-strong); }
.ui-input:focus, .ui-textarea:focus { outline: none; border-color: var(--orange); box-shadow: var(--focus-ring); }
.ui-input:disabled, .ui-textarea:disabled, .ui-input[readonly] { background: #f7f3ee; color: var(--text-mid); cursor: not-allowed; }
.ui-field.is-invalid .ui-input, .ui-field.is-invalid .ui-textarea, .ui-field.is-invalid .ui-select__button { border-color: var(--red); }
.ui-counter { font-size: var(--text-xs); color: var(--text-light); text-align: end; font-variant-numeric: tabular-nums; }
.ui-counter.is-over { color: var(--amber); font-weight: 600; }

/* checkbox (declarations, filters) */
.ui-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: var(--text-sm); line-height: 1.55; color: var(--text-dark); }
.ui-check input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--bg-white); cursor: pointer;
  display: grid; place-content: center; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ui-check input::after {
  content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--dur) var(--ease);
}
.ui-check input:checked { background: var(--orange); border-color: var(--orange); }
.ui-check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.ui-check input:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* toggle switch */
.ui-toggle { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; font-size: var(--text-sm); color: var(--text-dark); }
.ui-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ui-toggle__track {
  position: relative; flex-shrink: 0; width: 40px; height: 24px; border-radius: var(--radius-pill);
  background: #d9d2ca; transition: background var(--dur) var(--ease);
}
.ui-toggle__track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform var(--dur) var(--ease);
}
.ui-toggle input:checked + .ui-toggle__track { background: var(--green); }
.ui-toggle input:checked + .ui-toggle__track::after { transform: translateX(16px); }
[dir="rtl"] .ui-toggle input:checked + .ui-toggle__track::after { transform: translateX(-16px); }
.ui-toggle input:focus-visible + .ui-toggle__track { box-shadow: var(--focus-ring); }
.ui-toggle input:disabled + .ui-toggle__track { opacity: 0.5; }

/* custom select (behaviour in ui.js: UI.select) */
.ui-select { position: relative; width: 100%; }
.ui-select__button {
  width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 9px 12px; text-align: start; cursor: pointer;
  font: 400 var(--text-md)/1.3 var(--font); color: var(--text-dark);
  background: var(--bg-white); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.ui-select__button:hover { border-color: var(--border-strong); }
.ui-select__button:focus-visible, .ui-select.is-open .ui-select__button { outline: none; border-color: var(--orange); box-shadow: var(--focus-ring); }
.ui-select__button .is-placeholder { color: #a0a9b8; }
.ui-select__button::after {
  content: ""; flex-shrink: 0; width: 8px; height: 8px; margin-top: -4px;
  border: solid var(--text-light); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
  transition: transform var(--dur) var(--ease);
}
.ui-select.is-open .ui-select__button::after { transform: rotate(-135deg); margin-top: 4px; }
.ui-select__list {
  position: absolute; z-index: 60; top: calc(100% + 6px); inset-inline: 0; max-height: 280px; overflow-y: auto;
  margin: 0; padding: 6px; list-style: none;
  background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  display: none;
}
.ui-select.is-open .ui-select__list { display: block; }
.ui-select__search { width: 100%; margin-bottom: 6px; }
.ui-select__option {
  padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: var(--text-sm); color: var(--text-dark);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
}
.ui-select__option[aria-selected="true"] { font-weight: 600; color: var(--orange-dark); }
.ui-select__option[aria-selected="true"]::after { content: "✓"; }
.ui-select__option.is-active, .ui-select__option:hover { background: var(--orange-light); }
.ui-select__option[hidden] { display: none; }
.ui-select.is-disabled .ui-select__button { opacity: 0.5; cursor: not-allowed; }

/* toggle chips (multi-select lists: practice areas, states) */
.ui-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ui-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; cursor: pointer;
  font: 500 var(--text-sm)/1.2 var(--font); color: var(--text-mid);
  background: var(--bg-white); border: 1.5px solid var(--border); border-radius: var(--radius-pill);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ui-chip:hover { border-color: var(--border-strong); color: var(--text-dark); }
.ui-chip[aria-checked="true"] { background: var(--orange-light); border-color: var(--orange); color: var(--orange-dark); font-weight: 600; }
.ui-chip[aria-checked="true"]::before { content: "✓"; font-size: 12px; }
.ui-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ui-field.is-invalid .ui-chip { border-color: #f0b4b4; }

/* ── tabs ─────────────────────────────────────────────────────────────── */
.ui-tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap;
  padding: 10px var(--space-3) 12px; margin-bottom: -1px;
  font: 600 var(--text-sm)/1 var(--font); color: var(--text-light); text-decoration: none;
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ui-tab:hover { color: var(--text-dark); }
.ui-tab[aria-selected="true"], .ui-tab.is-active { color: var(--text-dark); border-bottom-color: var(--orange); }
.ui-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
.ui-tab__count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill);
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  background: #f1ebe4; color: var(--text-mid);
}
.ui-tab[aria-selected="true"] .ui-tab__count, .ui-tab.is-active .ui-tab__count { background: var(--orange); color: #fff; }

/* ── badges ───────────────────────────────────────────────────────────── */
.ui-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px;
  font: 600 11.5px/1 var(--font); letter-spacing: 0.02em; white-space: nowrap;
  border-radius: var(--radius-pill); background: #f1ebe4; color: var(--text-mid);
}
.ui-badge--orange { background: var(--orange-light); color: var(--orange-dark); }
.ui-badge--green { background: var(--green-soft); color: var(--green); }
.ui-badge--red { background: var(--red-soft); color: var(--red); }
.ui-badge--amber { background: var(--amber-soft); color: var(--amber); }
.ui-badge--navy { background: #e6ebf2; color: var(--navy); }
.ui-badge svg { width: 12px; height: 12px; }
.ui-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); display: inline-block; }

/* ── cards ────────────────────────────────────────────────────────────── */
.ui-card {
  background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-5); box-shadow: var(--shadow-1);
}
.ui-card--flat { box-shadow: none; }
.ui-card--raised { box-shadow: var(--shadow-2); border-color: transparent; }
.ui-card--interactive { transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease); cursor: pointer; }
.ui-card--interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.ui-card__title { font: 700 var(--text-md)/1.3 var(--font); color: var(--text-dark); margin: 0 0 var(--space-2); }
.ui-card__meta { font-size: var(--text-xs); color: var(--text-light); }

/* ── banners (inline notices) ─────────────────────────────────────────── */
.ui-banner {
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm); font-size: var(--text-sm); line-height: 1.55;
  background: #eef2f7; color: var(--navy); border: 1px solid #d9e1ec;
}
.ui-banner--warning { background: var(--amber-soft); color: #7a4605; border-color: #f2dcb3; }
.ui-banner--error { background: var(--red-soft); color: var(--red); border-color: #f6cdcd; }
.ui-banner--success { background: var(--green-soft); color: var(--green); border-color: #c8e5d6; }
.ui-banner strong { display: block; margin-bottom: 2px; }

/* ── avatar ───────────────────────────────────────────────────────────── */
.ui-avatar {
  --size: 40px; width: var(--size); height: var(--size); flex-shrink: 0; border-radius: 50%; overflow: hidden;
  display: inline-grid; place-items: center; background: var(--orange-light); color: var(--orange-dark);
  font: 700 calc(var(--size) * 0.38)/1 var(--font); text-transform: uppercase;
}
.ui-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ui-avatar--sm { --size: 28px; }
.ui-avatar--lg { --size: 64px; }

/* ── empty state ──────────────────────────────────────────────────────── */
.ui-empty { text-align: center; padding: var(--space-7) var(--space-5); color: var(--text-mid); }
.ui-empty__icon {
  width: 56px; height: 56px; margin: 0 auto var(--space-4); border-radius: 50%;
  display: grid; place-items: center; background: var(--orange-light); color: var(--orange);
}
.ui-empty__icon svg { width: 26px; height: 26px; }
.ui-empty__title { font: 700 var(--text-lg)/1.3 var(--font); color: var(--text-dark); margin: 0 0 var(--space-2); }
.ui-empty__text { font-size: var(--text-sm); line-height: 1.6; max-width: 380px; margin: 0 auto var(--space-5); }

/* ── skeleton loader ──────────────────────────────────────────────────── */
.ui-skeleton {
  display: block; border-radius: 6px; height: 12px; margin-bottom: 10px;
  background: linear-gradient(90deg, #efe8e1 25%, #f7f2ed 37%, #efe8e1 63%);
  background-size: 400% 100%; animation: ui-shimmer 1.4s ease infinite;
}
.ui-skeleton--title { height: 20px; width: 55%; }
.ui-skeleton--text { width: 100%; }
.ui-skeleton--short { width: 40%; }
.ui-skeleton--block { height: 120px; border-radius: var(--radius-sm); }
.ui-skeleton--avatar { width: 40px; height: 40px; border-radius: 50%; }
@keyframes ui-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── modal dialog (behaviour in ui.js: UI.modal / UI.confirm) ─────────── */
.ui-modal-backdrop {
  position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center;
  padding: var(--space-4); background: rgba(20, 26, 36, 0.45); backdrop-filter: blur(2px);
  animation: ui-fade var(--dur) var(--ease);
}
.ui-modal {
  width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto;
  background: var(--bg-white); border-radius: var(--radius-md); box-shadow: var(--shadow-2);
  animation: ui-rise 200ms var(--ease);
}
.ui-modal--wide { max-width: 720px; }
.ui-modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) var(--space-2); }
.ui-modal__title { font: 700 var(--text-lg)/1.3 var(--font); color: var(--text-dark); margin: 0; text-transform: none; letter-spacing: normal; }
.ui-modal__body { padding: var(--space-2) var(--space-5) var(--space-4); font-size: var(--text-sm); line-height: 1.6; color: var(--text-mid); }
.ui-modal__footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5) var(--space-5); flex-wrap: wrap; }
@keyframes ui-fade { from { opacity: 0; } }
@keyframes ui-rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@media (max-width: 480px) {
  .ui-modal-backdrop { align-items: flex-end; padding: 0; }
  .ui-modal { max-width: none; border-radius: var(--radius-md) var(--radius-md) 0 0; max-height: 92dvh; }
  .ui-modal__footer .ui-btn { flex: 1; }
}

/* ── toasts (UI.toast) ────────────────────────────────────────────────── */
.ui-toast-region {
  position: fixed; z-index: 1300; inset-inline: 0; bottom: var(--space-5); display: flex; flex-direction: column;
  align-items: center; gap: var(--space-2); pointer-events: none; padding: 0 var(--space-4);
}
.ui-toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--space-3); max-width: 440px;
  padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  background: var(--navy); color: #fff; font-size: var(--text-sm); line-height: 1.45;
  animation: ui-rise 200ms var(--ease);
}
.ui-toast--success { background: var(--green); }
.ui-toast--error { background: var(--red); }
.ui-toast button { background: none; border: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

/* ── popover and menu (UI.popover / UI.menu) ──────────────────────────── */
.ui-popover {
  position: absolute; z-index: 1100; max-width: min(320px, calc(100vw - 32px));
  padding: var(--space-3) var(--space-4); background: var(--bg-white); color: var(--text-mid);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  font: 400 var(--text-sm)/1.55 var(--font); animation: ui-fade var(--dur) var(--ease);
}
.ui-popover[hidden] { display: none; }
.ui-info {
  width: 20px; height: 20px; flex-shrink: 0; display: inline-grid; place-items: center; padding: 0;
  border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg-white); color: var(--text-light);
  font: 700 11px/1 Georgia, serif; font-style: italic; cursor: pointer;
}
.ui-info:hover, .ui-info[aria-expanded="true"] { color: var(--orange-dark); border-color: var(--orange); }
.ui-info:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ui-menu {
  position: absolute; z-index: 1100; min-width: 200px; padding: 6px; margin: 0; list-style: none;
  background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  animation: ui-fade var(--dur) var(--ease);
}
.ui-menu[hidden] { display: none; }
.ui-menu__item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 9px 10px; border: 0; border-radius: 6px;
  background: none; text-align: start; text-decoration: none; cursor: pointer;
  font: 500 var(--text-sm)/1.2 var(--font); color: var(--text-dark);
}
.ui-menu__item:hover, .ui-menu__item:focus-visible { outline: none; background: var(--orange-light); }
.ui-menu__item--danger { color: var(--red); }
.ui-menu__item--danger:hover, .ui-menu__item--danger:focus-visible { background: var(--red-soft); }
.ui-menu__item:disabled { opacity: 0.45; cursor: not-allowed; background: none; }
.ui-menu__sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ── reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ui-btn, .ui-input, .ui-textarea, .ui-select__button, .ui-tab, .ui-toggle__track, .ui-toggle__track::after,
  .ui-check input, .ui-check input::after, .ui-card--interactive { transition: none; }
  .ui-skeleton, .ui-modal, .ui-modal-backdrop, .ui-toast, .ui-popover, .ui-menu { animation: none; }
  .ui-btn.is-loading::after { animation-duration: 2s; }
}
