/* Noe — component styles
   ════════════════════════════════════════════════════════════════════
   The reusable-primitive CSS, lifted and adapted from the production
   noe/static/style.css. Every metric reads from the --btn-* / --chip-*
   tokens so variants stay locked to one footprint. Components in
   components/**/*.jsx apply these class names; consuming projects get
   this CSS for free via styles.css.
   ──────────────────────────────────────────────────────────────────── */

/* ═══ Buttons ═══════════════════════════════════════════════════════ */
.noe-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--btn-h); padding: 0 var(--btn-pad-x);
  border-radius: var(--btn-radius);
  font-family: var(--font-sans); font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight); line-height: 1; letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap; border: 1px solid transparent;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease,
              color var(--dur-fast) ease, filter var(--dur-fast) ease;
}
.noe-btn:disabled { opacity: .5; cursor: not-allowed; }
.noe-btn svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* Primary — near-black filled, the dominant action. */
.noe-btn--primary { background: #000; color: #fff; border-color: #000; }
.noe-btn--primary:hover:not(:disabled) { filter: brightness(1.18); }

/* Accent — terracotta filled (brand-forward primary). */
.noe-btn--accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.noe-btn--accent:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Secondary — panel + hairline, neutral actions. */
.noe-btn--secondary { background: var(--panel); color: var(--text-2); border-color: var(--border); }
.noe-btn--secondary:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }

/* Ghost — transparent until hover. */
.noe-btn--ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.noe-btn--ghost:hover:not(:disabled) { background: var(--bg-2); color: var(--text); }

/* Danger — destructive outline. */
.noe-btn--danger { background: var(--panel); color: #b13a31; border-color: #f0c4bf; }
.noe-btn--danger:hover:not(:disabled) { background: #fbe9e8; }

/* Size + shape modifiers */
.noe-btn--sm { height: var(--btn-h-sm); padding: 0 var(--btn-pad-x-sm); font-size: var(--btn-font-size-sm); }
.noe-btn--block { display: flex; width: 100%; }

/* Icon button — square tap target. */
.noe-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--btn-icon-size); height: var(--btn-icon-size); padding: 0;
  border-radius: var(--btn-radius); cursor: pointer; line-height: 1;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.noe-iconbtn svg { width: 17px; height: 17px; }
.noe-iconbtn--bordered { background: var(--panel); border-color: var(--border); }
.noe-iconbtn--bordered:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.noe-iconbtn--ghost:hover:not(:disabled) { background: var(--bg-2); color: var(--text); }
.noe-iconbtn--circle { border-radius: 50%; }
.noe-iconbtn:disabled { opacity: .45; cursor: not-allowed; }

/* ═══ Chips / pills ═════════════════════════════════════════════════ */
.noe-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--chip-bg); color: var(--chip-text);
  font-family: var(--font-sans); font-size: var(--chip-font-size);
  font-weight: var(--chip-font-weight); line-height: var(--chip-line-height);
  letter-spacing: 0.005em;
  padding: var(--chip-pad-y) var(--chip-pad-x);
  border-radius: var(--chip-radius); border: 1px solid transparent;
  max-width: var(--chip-max-width); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.noe-chip svg { width: 11px; height: 11px; flex: 0 0 auto; }
.noe-chip--mono { font-family: var(--font-mono); }

/* Channel variants */
.noe-chip--whatsapp { background: var(--chip-whatsapp-bg); color: var(--chip-whatsapp-fg); border-color: var(--chip-whatsapp-bd); }
.noe-chip--email    { background: var(--chip-email-bg);    color: var(--chip-email-fg);    border-color: var(--chip-email-bd); }
.noe-chip--telegram { background: var(--chip-telegram-bg); color: var(--chip-telegram-fg); border-color: var(--chip-telegram-bd); }
.noe-chip--meli     { background: var(--chip-meli-bg);     color: var(--chip-meli-fg);     border-color: var(--chip-meli-bd); }
.noe-chip--facebook { background: var(--chip-facebook-bg); color: var(--chip-facebook-fg); border-color: var(--chip-facebook-bd); }
.noe-chip--teams    { background: var(--chip-teams-bg);    color: var(--chip-teams-fg);    border-color: var(--chip-teams-bd); }
.noe-chip--hostex   { background: var(--chip-hostex-bg);   color: var(--chip-hostex-fg);   border-color: var(--chip-hostex-bd); }

/* Semantic variants */
.noe-chip--counterpart { background: var(--chip-counterpart-bg); color: var(--chip-counterpart-fg); }
.noe-chip--person      { background: var(--chip-person-bg);      color: var(--chip-person-fg); }
.noe-chip--tag         { background: var(--chip-tag-bg);         color: var(--chip-tag-fg); }
.noe-chip--project     { background: var(--surface-recessed);    color: var(--text-2); }
.noe-chip--accent      { background: var(--accent-soft);         color: var(--accent); border-color: color-mix(in oklch, var(--accent) 22%, var(--border-soft)); }

/* State variants */
.noe-chip--state-todo    { background: var(--state-todo-bg);    color: var(--state-todo-fg);    border-color: var(--state-todo-bd); }
.noe-chip--state-await   { background: var(--state-await-bg);   color: var(--state-await-fg);   border-color: var(--state-await-bd); }
.noe-chip--state-drafts  { background: var(--state-drafts-bg);  color: var(--state-drafts-fg);  border-color: var(--state-drafts-bd); }
.noe-chip--state-reply   { background: var(--state-reply-bg);   color: var(--state-reply-fg);   border-color: var(--state-reply-bd); }
.noe-chip--state-blocked { background: var(--state-blocked-bg); color: var(--state-blocked-fg); border-color: var(--state-blocked-bd); }
.noe-chip--state-done    { background: var(--state-done-bg);    color: var(--state-done-fg);    border-color: var(--state-done-bd); }

/* ═══ Tier pill (triage filter) ═════════════════════════════════════ */
.noe-tierpill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  color: var(--text-2); cursor: pointer; user-select: none;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  transition: border-color var(--dur-fast) ease;
}
.noe-tierpill:hover { border-color: var(--border-strong); }
.noe-tierpill[aria-pressed="true"] { background: var(--text); color: var(--panel); border-color: var(--text); }
.noe-tierpill__dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.noe-tierpill__count { color: var(--muted-2); font-variant-numeric: tabular-nums; }
.noe-tierpill[aria-pressed="true"] .noe-tierpill__count { color: rgba(255,255,255,.6); }

/* ═══ Badge (status pill, uppercase) ════════════════════════════════ */
.noe-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-sans); font-size: var(--chip-font-size); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; line-height: 1;
  padding: var(--chip-pad-y) var(--chip-pad-x); border-radius: var(--chip-radius);
  border: 1px solid transparent;
}
.noe-badge--running { background: var(--accent-soft); color: var(--accent); }
.noe-badge--done    { background: #e3f1e6; color: var(--done); }
.noe-badge--error   { background: #fde2e2; color: var(--overdue); }
.noe-badge--neutral { background: var(--chip-bg); color: var(--chip-text); }
.noe-badge--warn    { background: #fff1d6; color: #b86b00; border-color: #f4d9a3; }

/* ═══ Inputs ════════════════════════════════════════════════════════ */
.noe-input, .noe-textarea, .noe-select {
  width: 100%; font-family: var(--font-sans); font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 10px; line-height: 1.4;
  outline: none; transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.noe-input::placeholder, .noe-textarea::placeholder { color: var(--text-4); }
.noe-input:focus, .noe-textarea:focus, .noe-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring);
}
.noe-textarea { resize: vertical; min-height: 90px; }
.noe-select { padding-right: 28px; color: var(--text-2); cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%2398937f' stroke-width='1.5'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.noe-field { display: flex; flex-direction: column; gap: 5px; }
.noe-field__label {
  font-size: var(--fs-mini); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted-2);
}
.noe-field__hint { font-size: var(--fs-mini); color: var(--muted-2); }

/* Search input — pill with ⌘K hint */
.noe-search { position: relative; display: flex; align-items: center; }
.noe-search input {
  width: 100%; height: 36px; padding: 0 36px 0 12px; font-size: 13.5px;
  font-family: var(--font-sans); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.noe-search input::placeholder { color: var(--text-3); }
.noe-search input:focus { border-color: var(--focus-border); box-shadow: 0 0 0 3px var(--focus-ring); }
.noe-search__kbd {
  position: absolute; right: 7px; pointer-events: none;
  font: 500 10.5px/1 var(--font-mono); padding: 2px 5px; border-radius: 5px;
  background: color-mix(in oklch, var(--bg) 60%, #fff); color: var(--text-3);
  border: 1px solid var(--border); box-shadow: inset 0 -1px 0 rgba(0,0,0,.025);
}

/* ═══ Avatar ════════════════════════════════════════════════════════ */
.noe-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; border-radius: 50%; overflow: hidden;
  font-family: var(--font-sans); font-weight: 600; letter-spacing: 0.01em;
  background: #f1ebde; color: #7a5a2f; object-fit: cover;
}
.noe-avatar--sm { width: 22px; height: 22px; font-size: 10px; }
.noe-avatar--md { width: 28px; height: 28px; font-size: 11px; }
.noe-avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.noe-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ═══ Banner ════════════════════════════════════════════════════════ */
.noe-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 12px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--muted);
}
.noe-banner--error { border-color: #f0c4bf; background: #fbe9e8; color: #b13a31; }
.noe-banner--accent { border-color: color-mix(in oklch, var(--accent) 22%, var(--border)); background: var(--accent-soft); color: var(--accent); }
.noe-banner button {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  font-size: 11px; text-decoration: underline; padding: 0; font-family: inherit;
}

/* ═══ Spinner ═══════════════════════════════════════════════════════ */
.noe-spinner {
  display: inline-block; border-radius: 50%; vertical-align: middle;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: noe-spin .8s linear infinite;
}
.noe-spinner--sm { width: 12px; height: 12px; }
.noe-spinner--md { width: 16px; height: 16px; }
@keyframes noe-spin { to { transform: rotate(360deg); } }

/* ═══ Card ══════════════════════════════════════════════════════════ */
.noe-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: var(--pad-card);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: var(--gap-card);
  transition: border-color var(--dur-fast) ease, box-shadow .15s ease, transform .05s ease;
}
.noe-card--interactive { cursor: pointer; }
.noe-card--interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); }
.noe-card--interactive:active { transform: translateY(1px); }
.noe-card__title {
  font-size: 13px; color: var(--text); font-weight: 400; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.noe-card__title b, .noe-card__title strong { font-weight: 700; color: var(--text); }
.noe-card__row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.noe-card__spacer { flex: 1; }
.noe-card__age { margin-left: auto; font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
