/* forus-design.css — P0 дизайн-слой FORUS ERP
 * Токены палитры (light/dark) + переиспользуемые компоненты.
 * Подключать в <head> после Google Fonts. Классы с префиксом fui- не конфликтуют с Tailwind.
 * Цвета согласованы с tailwind brand (зелёный #16A34A) и Inter.
 */

:root {
  --fui-bg: #F6F8FB;
  --fui-panel: #FFFFFF;
  --fui-panel-2: #F1F5F9;
  --fui-text: #0F172A;
  --fui-muted: #64748B;
  --fui-border: #E2E8F0;
  --fui-radius: 8px;

  --fui-green: #16A34A;
  --fui-blue: #2563EB;
  --fui-amber: #D97706;
  --fui-red: #DC2626;
  --fui-violet: #7C3AED;
  --fui-slate: #64748B;
}

html.dark {
  --fui-bg: #0B1220;
  --fui-panel: #0F172A;
  --fui-panel-2: #1E293B;
  --fui-text: #E2E8F0;
  --fui-muted: #94A3B8;
  --fui-border: #1E293B;
}

/* ── Числа: выравнивание по разрядам во всех таблицах и KPI ───────────── */
table td, table th, .fui-num, .fui-kpi__value { font-variant-numeric: tabular-nums; }

/* ── Status / sort pills (цвет + текст, не только цвет) ───────────────── */
.fui-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
  border: 1px solid transparent;
}
.fui-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

.fui-pill--green  { color: #15803D; background: rgba(22,163,74,.12); }
.fui-pill--blue   { color: #1D4ED8; background: rgba(37,99,235,.12); }
.fui-pill--amber  { color: #B45309; background: rgba(217,119,6,.14); }
.fui-pill--red    { color: #B91C1C; background: rgba(220,38,38,.12); }
.fui-pill--slate  { color: #475569; background: rgba(100,116,139,.14); }
.fui-pill--violet { color: #6D28D9; background: rgba(124,58,237,.12); }
/* Брак — контурная красная плашка, визуально отделена от 3 сорта (slate) */
.fui-pill--brak   { color: #B91C1C; background: transparent; border-color: rgba(220,38,38,.5); }
.fui-pill--brak::before { background: #DC2626; }

html.dark .fui-pill--green  { color: #86EFAC; background: rgba(22,163,74,.18); }
html.dark .fui-pill--blue   { color: #93C5FD; background: rgba(37,99,235,.18); }
html.dark .fui-pill--amber  { color: #FCD34D; background: rgba(217,119,6,.20); }
html.dark .fui-pill--red    { color: #FCA5A5; background: rgba(220,38,38,.18); }
html.dark .fui-pill--slate  { color: #CBD5E1; background: rgba(148,163,184,.18); }
html.dark .fui-pill--violet { color: #C4B5FD; background: rgba(124,58,237,.20); }
html.dark .fui-pill--brak   { color: #FCA5A5; border-color: rgba(220,38,38,.55); }

/* ── Кнопки ───────────────────────────────────────────────────────────── */
.fui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--fui-radius);
  font-size: 14px; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; transition: background .12s, transform .06s, border-color .12s;
}
.fui-btn:active { transform: scale(.98); }
.fui-btn[disabled], .fui-btn.is-disabled { opacity: .5; pointer-events: none; }
.fui-btn--primary   { background: var(--fui-green); color: #fff; }
.fui-btn--primary:hover { background: #15803D; }
.fui-btn--secondary { background: var(--fui-panel); color: var(--fui-text); border-color: var(--fui-border); }
.fui-btn--secondary:hover { background: var(--fui-panel-2); }
.fui-btn--danger    { background: transparent; color: var(--fui-red); border-color: rgba(220,38,38,.4); }
.fui-btn--danger:hover { background: rgba(220,38,38,.08); }
.fui-btn--ghost     { background: transparent; color: var(--fui-muted); }
.fui-btn--ghost:hover { background: var(--fui-panel-2); color: var(--fui-text); }
.fui-btn--lg { height: 48px; padding: 0 20px; font-size: 16px; }   /* Production Floor */

/* ── Карточки / KPI ───────────────────────────────────────────────────── */
.fui-card { background: var(--fui-panel); border: 1px solid var(--fui-border); border-radius: var(--fui-radius); padding: 16px; }
.fui-kpi  { background: var(--fui-panel-2); border-radius: var(--fui-radius); padding: 14px 16px; }
.fui-kpi__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--fui-muted); }
.fui-kpi__value { font-size: 24px; font-weight: 700; color: var(--fui-text); margin-top: 4px; }
.fui-kpi__delta { font-size: 12px; font-weight: 600; margin-top: 2px; }
.fui-kpi__delta--up   { color: var(--fui-green); }
.fui-kpi__delta--down { color: var(--fui-red); }

/* ── Empty / loading / error states ──────────────────────────────────── */
.fui-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 16px; text-align: center; color: var(--fui-muted); }
.fui-empty svg { width: 32px; height: 32px; opacity: .5; }
.fui-empty__title { font-size: 14px; font-weight: 600; color: var(--fui-text); }
.fui-empty__sub { font-size: 13px; color: var(--fui-muted); max-width: 360px; }

.fui-error { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 16px; text-align: center; }
.fui-error__msg { font-size: 14px; color: var(--fui-text); }

/* Skeleton: пульс прозрачности (без градиентов — соответствует industrial-flat) */
.fui-skel { background: var(--fui-panel-2); border-radius: 6px; animation: fui-pulse 1.4s ease-in-out infinite; }
.fui-skel-row { height: 14px; margin: 10px 0; }
@keyframes fui-pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
