/* =========================================================
   Base + UI primitives
   Angular: src/styles.scss (reset, typography) and
   libs/shared/ui (button, input, chip, avatar styles).
   ========================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: var(--fw-regular) var(--fs-base)/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -.005em; }
h1 { font-size: var(--fs-h1); font-weight: var(--fw-semibold); }
h2 { font-size: var(--fs-h2); font-weight: var(--fw-semibold); }
h3 { font-size: var(--fs-base); font-weight: var(--fw-semibold); }
b, strong { font-weight: var(--fw-medium); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.ico { display: inline-grid; width: 16px; height: 16px; flex: none; }
.ico svg { width: 100%; height: 100%; }

/* ---------- button (app-button / native button with class) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 6px 12px; border-radius: var(--radius-sm); font-weight: var(--fw-medium); font-size: var(--fs-base);
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s; white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -6px rgba(37, 99, 235, .6); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 4px 9px; font-size: var(--fs-sm); }

/* icon-only button (table row actions, topbar) */
.icon-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm); border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--muted); position: relative; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.lg { width: 36px; height: 36px; }
.icon-btn.lg svg { width: 18px; height: 18px; }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-weak); }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: 7px 10px; width: 100%; font-size: var(--fs-base); transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
select.input {
  appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
textarea.input { resize: vertical; min-height: 80px; }

/* ---------- chip (app-status-chip) ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 7px; border-radius: 999px; font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap; line-height: 1.6; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip.plain { padding: 2px 8px; }
.chip.gray { background: var(--gray-weak); color: var(--gray); }
.chip.blue { background: var(--blue-weak); color: var(--blue); }
.chip.green { background: var(--good-weak); color: var(--good); }
.chip.amber { background: var(--warn-weak); color: var(--warn); }
.chip.red { background: var(--bad-weak); color: var(--bad); }
.chip.purple { background: var(--info-weak); color: var(--info); }
.chip.pulse::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .6); } 70% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
.kbd { font-size: var(--fs-xs); font-weight: var(--fw-medium); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--muted); background: var(--surface); }

/* ---------- avatar (app-avatar) ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: var(--fw-medium); font-size: var(--fs-sm); flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.av-0 { background: #dbeafe; color: #1d4ed8; } .av-1 { background: #dcfce7; color: #15803d; } .av-2 { background: #fae8ff; color: #a21caf; }
.av-3 { background: #ffedd5; color: #c2410c; } .av-4 { background: #e0f2fe; color: #0369a1; } .av-5 { background: #fee2e2; color: #b91c1c; }
:root[data-theme="dark"] .av-0 { background: rgba(59,130,246,.2); color: #93c5fd; }
:root[data-theme="dark"] .av-1 { background: rgba(34,197,94,.2); color: #86efac; }
:root[data-theme="dark"] .av-2 { background: rgba(217,70,239,.2); color: #f0abfc; }
:root[data-theme="dark"] .av-3 { background: rgba(249,115,22,.2); color: #fdba74; }
:root[data-theme="dark"] .av-4 { background: rgba(14,165,233,.2); color: #7dd3fc; }
:root[data-theme="dark"] .av-5 { background: rgba(239,68,68,.2); color: #fca5a5; }
.person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.person b { display: block; font-weight: var(--fw-medium); white-space: nowrap; }
.person span { display: block; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
