/* FAK-MS design tokens & shared components */
:root {
  --brand: #0f766e;
  --brand-600: #0d9488;
  --brand-700: #115e59;
  --brand-50: #f0fdfa;
  --brand-100: #ccfbf1;
  --red: #dc2626;
  --red-50: #fef2f2;
  --amber: #b45309;
  --amber-50: #fffbeb;
  --green: #15803d;
  --green-50: #f0fdf4;
  --blue: #1d4ed8;
  --blue-50: #eff6ff;
  --gray-25: #fcfcfd;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: var(--gray-900);
  --muted: var(--gray-500);
  --border: var(--gray-200);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .06);
  --focus: 0 0 0 3px rgba(13, 148, 136, .25);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; font-size: .92em; }
[hidden] { display: none !important; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }

/* ---------- Brand mark ---------- */
.mark {
  width: 36px; height: 36px; border-radius: 10px; background: #fff; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), 0 2px 6px rgba(0,0,0,.12); position: relative; flex-shrink: 0;
}
.mark::before, .mark::after { content: ""; position: absolute; background: var(--red); border-radius: 2px; }
.mark::before { width: 8px; height: 22px; }
.mark::after { width: 22px; height: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--gray-800); font: 600 13.5px/1 var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg.lucide { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--gray-700); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--gray-300);
  background: #fff; color: var(--text); font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand-600); box-shadow: var(--focus); }
.input-icon { position: relative; }
.input-icon > svg.lucide { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- Badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--gray-100); color: var(--gray-700); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.no-dot::before { display: none; }
.badge.compliant, .badge.ok, .badge.delivered, .badge.pass { background: var(--green-50); color: var(--green); }
.badge.low_stock, .badge.low, .badge.retrying, .badge.pending, .badge.pass_with_actions, .badge.high, .badge.medium { background: var(--amber-50); color: var(--amber); }
.badge.expired, .badge.dead, .badge.fail, .badge.critical { background: var(--red-50); color: var(--red); }
.badge.decommissioned, .badge.resolved { background: var(--gray-100); color: var(--gray-500); }
.badge.acknowledged, .badge.info, .badge.low-sev { background: var(--blue-50); color: var(--blue); }

/* ---------- Item tone palette (icons) ---------- */
.tone-rose { --tone: #e11d48; --tone-bg: #fff1f2; }
.tone-red { --tone: #dc2626; --tone-bg: #fef2f2; }
.tone-orange { --tone: #ea580c; --tone-bg: #fff7ed; }
.tone-amber { --tone: #d97706; --tone-bg: #fffbeb; }
.tone-emerald { --tone: #059669; --tone-bg: #ecfdf5; }
.tone-teal { --tone: #0d9488; --tone-bg: #f0fdfa; }
.tone-cyan { --tone: #0891b2; --tone-bg: #ecfeff; }
.tone-sky { --tone: #0284c7; --tone-bg: #f0f9ff; }
.tone-blue { --tone: #2563eb; --tone-bg: #eff6ff; }
.tone-indigo { --tone: #4f46e5; --tone-bg: #eef2ff; }
.tone-violet { --tone: #7c3aed; --tone-bg: #f5f3ff; }
.tone-slate { --tone: #475569; --tone-bg: #f1f5f9; }
.item-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--tone-bg, var(--gray-100)); color: var(--tone, var(--gray-600));
}
.item-ico svg.lucide { width: 20px; height: 20px; }
.item-ico.sm { width: 30px; height: 30px; border-radius: 9px; }
.item-ico.sm svg.lucide { width: 16px; height: 16px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 1000; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 92vw;
  background: var(--gray-900); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-weight: 500; animation: toast-in .2s ease-out;
}
.toast.error { background: #991b1b; }
.toast.success svg.lucide { color: #5eead4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--gray-100), var(--gray-50), var(--gray-100)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
