/*
 * Edelman Home components · v1.1
 * Opt-in classes built on tokens.css. Nothing here styles bare elements, so
 * loading it never changes an app until a page uses an .eh- class.
 *   <link rel="stylesheet" href="https://edelman-api.vercel.app/ui/components.css">
 * Live examples: https://edelman-api.vercel.app/ui
 */

/* ---------- Buttons ---------- */
.eh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 16px;
  font: 500 var(--eh-text-md)/1 var(--eh-sans);
  color: var(--eh-navy); background: var(--eh-white);
  border: 1px solid var(--eh-rule-strong); border-radius: var(--eh-radius-control);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--eh-fast) var(--eh-ease), border-color var(--eh-fast) var(--eh-ease), box-shadow var(--eh-fast) var(--eh-ease);
}
.eh-btn:hover { border-color: var(--eh-bronze); background: var(--eh-paper); }
.eh-btn:focus-visible { outline: none; box-shadow: var(--eh-focus); }
.eh-btn:disabled { opacity: .55; cursor: not-allowed; }
.eh-btn--primary { color: var(--eh-on-navy); background: var(--eh-navy); border-color: var(--eh-navy); }
.eh-btn--primary:hover { background: var(--eh-navy-soft); border-color: var(--eh-navy-soft); }
.eh-btn--brass { color: var(--eh-navy); background: var(--eh-brass-light); border-color: var(--eh-brass); }
.eh-btn--ghost { background: transparent; border-color: transparent; }
.eh-btn--ghost:hover { background: var(--eh-brass-tint); border-color: transparent; }
.eh-btn--danger { color: var(--eh-danger); border-color: var(--eh-danger-line); }
.eh-btn--danger:hover { background: var(--eh-danger-bg); }
.eh-btn--sm { min-height: 30px; padding: 0 12px; font-size: var(--eh-text-sm); }
.eh-btn--block { display: flex; width: 100%; }

/* ---------- Pills (status) ---------- */
.eh-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--eh-radius-pill);
  font: 500 var(--eh-text-xs)/1.4 var(--eh-sans); letter-spacing: .01em;
  color: var(--eh-ink-soft); background: var(--eh-cream-2); border: 1px solid var(--eh-rule-strong);
  white-space: nowrap;
}
.eh-pill::before { content: ""; width: 6px; height: 6px; border-radius: 6px; background: currentColor; opacity: .85; }
.eh-pill--plain::before { display: none; }
.eh-pill--ok { color: var(--eh-ok); background: var(--eh-ok-bg); border-color: var(--eh-ok-line); }
.eh-pill--warn { color: var(--eh-warn); background: var(--eh-warn-bg); border-color: var(--eh-warn-line); }
.eh-pill--danger { color: var(--eh-danger); background: var(--eh-danger-bg); border-color: var(--eh-danger-line); }
.eh-pill--info { color: var(--eh-info); background: var(--eh-info-bg); border-color: var(--eh-info-line); }
.eh-pill--vendor { color: var(--eh-vendor); background: var(--eh-vendor-bg); border-color: var(--eh-vendor-line); }
.eh-pill--brass { color: var(--eh-brass-deep); background: var(--eh-brass-tint); border-color: var(--eh-brass-light); }

/* ---------- Panels ---------- */
.eh-card {
  background: var(--eh-white); border: 1px solid var(--eh-rule);
  border-radius: var(--eh-radius-panel); box-shadow: var(--eh-shadow-panel);
  padding: var(--eh-space-5);
}
.eh-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: var(--eh-space-3); }
.eh-card__title { font: 600 var(--eh-text-xl)/1.15 var(--eh-serif); color: var(--eh-navy); margin: 0; }
.eh-eyebrow { font: 500 var(--eh-text-xs)/1.2 var(--eh-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--eh-brass-deep); }
.eh-title { font: 600 var(--eh-text-2xl)/1.1 var(--eh-serif); color: var(--eh-navy); margin: 0; }

/* ---------- KPI ---------- */
.eh-kpi { display: grid; gap: 2px; }
.eh-kpi__label { font: 500 var(--eh-text-xs)/1.3 var(--eh-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--eh-ink-faint); }
.eh-kpi__value { font: 600 1.75rem/1.1 var(--eh-serif); color: var(--eh-navy); font-variant-numeric: tabular-nums; }
.eh-kpi__delta { font: 500 var(--eh-text-sm)/1.3 var(--eh-sans); color: var(--eh-ink-soft); }
.eh-kpi__delta--up { color: var(--eh-ok); }
.eh-kpi__delta--down { color: var(--eh-danger); }

/* ---------- Tables ---------- */
.eh-table-wrap { overflow-x: auto; border: 1px solid var(--eh-rule); border-radius: var(--eh-radius-inset); background: var(--eh-white); }
.eh-table { width: 100%; border-collapse: collapse; font: 400 var(--eh-text-md)/1.4 var(--eh-sans); color: var(--eh-ink); }
.eh-table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; padding: 10px 12px;
  font: 500 var(--eh-text-xs)/1.2 var(--eh-sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--eh-ink-soft); background: var(--eh-cream-2); border-bottom: 1px solid var(--eh-rule-strong);
  white-space: nowrap;
}
.eh-table td { padding: 10px 12px; border-bottom: 1px solid var(--eh-rule); vertical-align: top; }
.eh-table tr:last-child td { border-bottom: 0; }
.eh-table tbody tr:hover td { background: var(--eh-paper); }
.eh-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eh-table--compact th, .eh-table--compact td { padding: 6px 10px; }

/* ---------- Fields ---------- */
.eh-field { display: grid; gap: 6px; }
.eh-label { font: 500 var(--eh-text-sm)/1.2 var(--eh-sans); color: var(--eh-ink-soft); }
.eh-input, .eh-select, .eh-textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  font: 400 var(--eh-text-md)/1.4 var(--eh-sans); color: var(--eh-ink);
  background: var(--eh-paper); border: 1px solid var(--eh-field-line, #8F8872); border-radius: var(--eh-radius-control);
}
.eh-input:focus, .eh-select:focus, .eh-textarea:focus { outline: none; border-color: var(--eh-brass-deep); box-shadow: var(--eh-focus); background: var(--eh-white); }
.eh-hint { font-size: var(--eh-text-xs); color: var(--eh-ink-faint); }

/* ---------- Empty, loading, notes ---------- */
.eh-empty {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: var(--eh-space-8) var(--eh-space-5); color: var(--eh-ink-soft);
  border: 1px dashed var(--eh-rule-strong); border-radius: var(--eh-radius-inset); background: var(--eh-paper);
}
.eh-empty__title { font: 600 var(--eh-text-lg)/1.3 var(--eh-serif); color: var(--eh-navy); font-size: 1.25rem; }
.eh-skeleton {
  display: block; min-height: 1em; border-radius: 6px;
  background: linear-gradient(90deg, var(--eh-cream-2) 0%, var(--eh-paper) 50%, var(--eh-cream-2) 100%);
  background-size: 200% 100%; animation: eh-shimmer 1.4s ease-in-out infinite;
}
@keyframes eh-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .eh-skeleton { animation: none; } }
.eh-note { padding: 10px 14px; border-radius: var(--eh-radius-inset); font: 400 var(--eh-text-sm)/1.45 var(--eh-sans); border: 1px solid; }
.eh-note--ok { color: var(--eh-ok); background: var(--eh-ok-bg); border-color: var(--eh-ok-line); }
.eh-note--warn { color: var(--eh-warn); background: var(--eh-warn-bg); border-color: var(--eh-warn-line); }
.eh-note--danger { color: var(--eh-danger); background: var(--eh-danger-bg); border-color: var(--eh-danger-line); }
.eh-note--info { color: var(--eh-info); background: var(--eh-info-bg); border-color: var(--eh-info-line); }

/* ---------- Eddie moments ---------- */
/* Eddie's face as a background, so any app can place her without an image file.
   Keep her small and occasional: empty screens, waiting, a job well done, a first-time tip. */
:root { --eh-eddie: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='66 26 268 268'%3E%3Cpath d='M200 30 C214 84 318 160 318 270 A118 118 0 0 1 82 270 C82 160 186 84 200 30 Z' fill='%23111A45'/%3E%3Cellipse cx='146' cy='170' rx='18' ry='54' transform='rotate%2822 146 170%29' fill='%23F4F0E4' opacity='.16'/%3E%3Cg%3E%3Cpath d='M200 270 L176 256 L176 284 Z' fill='%23BAB399'/%3E%3Cpath d='M200 270 L224 256 L224 284 Z' fill='%23BAB399'/%3E%3Crect x='195' y='263' width='10' height='14' rx='3' fill='%23F4F0E4'/%3E%3C/g%3E%3Ccircle cx='136' cy='226' r='10' fill='%23BAB399' opacity='.35'/%3E%3Ccircle cx='264' cy='226' r='10' fill='%23BAB399' opacity='.35'/%3E%3Cg class='ed-eyes'%3E%3Cellipse cx='164' cy='188' rx='21' ry='27' fill='%23F4F0E4'/%3E%3Cellipse cx='236' cy='188' rx='21' ry='27' fill='%23F4F0E4'/%3E%3Ccircle cx='168' cy='193' r='10' fill='%23111A45'/%3E%3Ccircle cx='172' cy='187' r='3.5' fill='%23fff'/%3E%3Ccircle cx='240' cy='193' r='10' fill='%23111A45'/%3E%3Ccircle cx='244' cy='187' r='3.5' fill='%23fff'/%3E%3C/g%3E%3Cg stroke='%23BAB399' stroke-width='5' fill='none' stroke-linecap='round'%3E%3Cpath d='M146 152 Q164 142 182 152'/%3E%3Cpath d='M218 152 Q236 142 254 152'/%3E%3C/g%3E%3Cpath d='M170 232 Q200 262 230 232 Q200 246 170 232 Z' fill='%23F4F0E4'/%3E%3C/svg%3E"); }
.eh-eddie { display: inline-block; flex: none; width: 56px; height: 56px; background: var(--eh-eddie) center / contain no-repeat; }
.eh-eddie--sm { width: 32px; height: 32px; }
.eh-eddie--lg { width: 88px; height: 88px; }
.eh-eddie--bob { animation: eh-bob 1.8s ease-in-out infinite; }
@keyframes eh-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes eh-hop { 0% { transform: translateY(6px) scale(.9); opacity: 0; } 60% { transform: translateY(-4px) scale(1.04); opacity: 1; } 100% { transform: none; } }

/* Empty screen with Eddie: <div class="eh-empty eh-empty--eddie"><span class="eh-empty__title">All caught up</span>Nothing waiting on you.</div> */
.eh-empty--eddie::before { content: ""; width: 68px; height: 68px; margin-bottom: 4px; background: var(--eh-eddie) center / contain no-repeat; }

/* Waiting: <div class="eh-loading" role="status">Fetching today's orders</div> */
.eh-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: var(--eh-space-6) var(--eh-space-4); font: 400 var(--eh-text-md)/1.4 var(--eh-sans); color: var(--eh-ink-soft); }
.eh-loading::before { content: ""; flex: none; width: 36px; height: 36px; background: var(--eh-eddie) center / contain no-repeat; animation: eh-bob 1.4s ease-in-out infinite; }
.eh-loading--inline { display: inline-flex; padding: 0; }

/* Done: <div class="eh-cheer" role="status"><div><strong>Order sent</strong>S2611343 is in Eclipse.</div></div> */
.eh-cheer {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1px solid var(--eh-brass-light); border-radius: var(--eh-radius-inset); background: var(--eh-brass-tint);
  font: 400 var(--eh-text-sm)/1.45 var(--eh-sans); color: var(--eh-ink-soft);
}
.eh-cheer::before { content: ""; flex: none; width: 40px; height: 40px; background: var(--eh-eddie) center / contain no-repeat; animation: eh-hop .5s var(--eh-ease) both; }
.eh-cheer strong { display: block; font: 600 1.15rem/1.2 var(--eh-serif); color: var(--eh-navy); }

/* First-time tip: <div class="eh-tip"><div><strong>Tip</strong>Tap a price to see the trade price.</div><button class="eh-btn eh-btn--ghost eh-btn--sm">Got it</button></div> */
.eh-tip {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--eh-rule); border-left: 3px solid var(--eh-brass); border-radius: var(--eh-radius-inset); background: var(--eh-white); box-shadow: var(--eh-shadow-panel);
  font: 400 var(--eh-text-sm)/1.45 var(--eh-sans); color: var(--eh-ink-soft);
}
.eh-tip::before { content: ""; flex: none; width: 40px; height: 40px; background: var(--eh-eddie) center / contain no-repeat; }
.eh-tip > div { flex: 1; min-width: 0; }
.eh-tip strong { display: block; font-weight: 500; color: var(--eh-navy); }
@media (prefers-reduced-motion: reduce) { .eh-eddie--bob, .eh-loading::before, .eh-cheer::before { animation: none; } }

/* ---------- Touch screens (iPad, phone) ---------- */
/* Bigger targets for fingers; 16 px fields stop iPhones zooming the page on focus. */
@media (pointer: coarse) {
  .eh-btn { min-height: 44px; padding: 0 18px; }
  .eh-btn--sm { min-height: 38px; padding: 0 14px; }
  .eh-input, .eh-select, .eh-textarea { min-height: 44px; font-size: 16px; }
  .eh-tab { padding: 14px 16px; }
  .eh-table td, .eh-table th { padding-top: 12px; padding-bottom: 12px; }
  .eh-table--compact td, .eh-table--compact th { padding-top: 9px; padding-bottom: 9px; }
}

/* ---------- Tabs ---------- */
.eh-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--eh-rule-strong); overflow-x: auto; }
.eh-tab {
  padding: 10px 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none;
  font: 500 var(--eh-text-md)/1 var(--eh-sans); color: var(--eh-ink-soft); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.eh-tab:hover { color: var(--eh-navy); }
.eh-tab[aria-selected="true"], .eh-tab.is-active { color: var(--eh-navy); border-bottom-color: var(--eh-brass); }

/* ---------- Layout helpers ---------- */
.eh-stack { display: grid; gap: var(--eh-space-4); }
.eh-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--eh-space-3); }
.eh-grid { display: grid; gap: var(--eh-space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
/* a wide table inside a stack or grid scrolls sideways instead of stretching the page */
.eh-stack > *, .eh-grid > * { min-width: 0; }
.eh-muted { color: var(--eh-ink-faint); }
.eh-num { font-variant-numeric: tabular-nums; }
