/* Hope Squad Inventory — design system.
   Plain CSS layered on top of Tailwind (Play CDN). The Play CDN only
   processes @apply inside <style type="text/tailwindcss">, so this file
   must stay plain CSS. Shared design tokens live on :root. */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --color-bg: #f6f7fb;
  --color-surface: #ffffff;
  --color-border: #e5e9f0;
  --color-border-strong: #d3dae6;
  --color-ink: #0f172a;
  --color-ink-soft: #46536b;
  --color-ink-faint: #7b879c;

  --color-brand: #4f46e5;
  --color-brand-strong: #4338ca;
  --color-brand-soft: #eef2ff;
  --color-brand-ring: rgb(99 102 241 / 0.18);

  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.04), 0 1px 3px 0 rgb(15 23 42 / 0.06);
  --shadow-md: 0 4px 10px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.05);
}

/* ---------- Base ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: #c9d2e0 transparent;
}

::selection {
  background: #c7d2fe;
  color: #1e1b4b;
}

body {
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle entrance for page content (re-rendered on every navigation). */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

main,
.flash {
  animation: fade-up 0.25s ease both;
}

@media (prefers-reduced-motion: reduce) {
  main,
  .flash {
    animation: none;
  }
}

/* ---------- Top navigation ---------- */

.nav-shell {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgb(255 255 255 / 0.82);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--color-border);
}

/* Tab row: individual, generously spaced links (no enclosing dock), so the
   items breathe and the active page reads at a glance. */
.nav-track {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-track::-webkit-scrollbar {
  display: none;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #5b6779;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-pill:hover {
  background: #eef1f6;
  color: var(--color-ink);
}

.nav-pill-active,
.nav-pill-active:hover {
  background: var(--color-brand-soft);
  color: var(--color-brand-strong);
  font-weight: 600;
}

/* Rows inside the mobile menu: taller, larger type, full width. */
.nav-pill-mobile {
  justify-content: flex-start;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border-radius: 0.625rem;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  border: 1px solid #c7d2fe;
  color: var(--color-brand-strong);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Cards ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-ink);
}

/* Stat tiles on the dashboard / item detail. */
.stat-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  flex: none;
}

.stat-icon-indigo {
  background: #eef2ff;
  color: #4f46e5;
  box-shadow: inset 0 0 0 1px #e0e7ff;
}

.stat-icon-slate {
  background: #f1f5f9;
  color: #475569;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

.stat-icon-amber {
  background: #fffbeb;
  color: #d97706;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.stat-icon-green {
  background: #ecfdf5;
  color: #059669;
  box-shadow: inset 0 0 0 1px #a7f3d0;
}

/* ---------- Buttons ---------- */

/* Every variant carries the full base styles, so a button rendered with just
   `btn-primary` (no `btn` class in the markup) still looks right. */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.625rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.06s ease;
  cursor: pointer;
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-ghost:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Compact size for actions inside table rows. */
.btn-sm {
  padding: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
  border-radius: 0.4375rem;
}

.btn-primary {
  background: linear-gradient(180deg, #6259e6, var(--color-brand));
  color: #fff;
  box-shadow: 0 1px 2px rgb(79 70 229 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.16);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #5349db, var(--color-brand-strong));
  box-shadow: 0 2px 8px -1px rgb(79 70 229 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.16);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgb(79 70 229 / 0.3);
}

.btn-secondary {
  background: #fff;
  color: #3c475c;
  border-color: var(--color-border-strong);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #b6c2d4;
  color: var(--color-ink);
}

.btn-secondary:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn-danger {
  background: #fff;
  color: #be123c;
  border-color: #fecdd3;
}

.btn-danger:hover {
  background: #fff1f2;
  border-color: #fda4af;
}

.btn-danger:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: transparent;
  color: #5b6779;
}

.btn-ghost:hover {
  background: #eef1f6;
  color: var(--color-ink);
}

/* ---------- Forms ---------- */

.label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-ink-soft);
  margin-bottom: 0.3125rem;
}

.input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 0.4375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input::placeholder {
  color: #9aa7bb;
}

.input:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px var(--color-brand-ring);
}

.input:disabled {
  background: #f1f5f9;
  color: #7b879c;
  cursor: not-allowed;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b879c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  padding-right: 2.25rem;
}

input[type="checkbox"].check {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-border-strong);
  accent-color: var(--color-brand);
}

/* ---------- Tables ---------- */

.table {
  width: 100%;
  font-size: 0.875rem;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid #f0f3f8;
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color 0.12s ease;
}

.table tbody tr:hover {
  background: rgb(246 248 252 / 0.85);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tfoot td {
  border-top: 1px solid var(--color-border);
  border-bottom: none;
  background: #f8fafc;
  font-weight: 600;
  color: var(--color-ink);
}

/* ---------- Badges ----------
   Each variant is self-contained so `<span class="badge badge-ok">` and
   legacy `<span class="badge-ok">` both render identically. */

.badge,
.badge-ok,
.badge-warn,
.badge-muted,
.badge-danger,
.badge-indigo {
  display: inline-block;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.badge-warn {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.badge-muted {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.badge-danger {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

.badge-indigo {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

/* ---------- Alerts & callouts ---------- */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid;
  box-shadow: var(--shadow-sm);
}

.flash-ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.flash-err {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.flash-warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* Inline info note inside cards (e.g. the count page explainer). */
.info-box {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--color-ink-soft);
}

/* ---------- Misc ---------- */

/* Meta list (item detail facts). */
.meta dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
}

.meta dd {
  font-size: 0.875rem;
  color: var(--color-ink);
}

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--color-ink-faint);
  font-size: 0.875rem;
}

/* ---------- Print ---------- */

@media print {
  .nav-shell,
  form,
  .no-print,
  footer {
    display: none !important;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border-color: #cbd5e1;
    break-inside: avoid;
  }

  .table tbody tr:hover {
    background: none;
  }
}
