/*
 * Shared design tokens + base components for the "Warm Neutral" dashboard
 * redesign. Every page-level template links this file and should rely on
 * these custom properties / component classes instead of redefining its own
 * :root token block or local nav/button/input/badge/table/toast rules.
 */

:root {
  --bg: #faf8f5;            /* page background */
  --surface: #fffdfa;       /* cards, nav, modal, table surfaces */
  --surface-2: #f5f1ea;     /* secondary surface: table header row, hover row, input bg */
  --line: #ece7de;          /* all borders */
  --text: #2b2620;          /* primary text */
  --muted: #8a7f6c;         /* secondary text */
  --muted-2: #6b6152;       /* meta/tertiary text, slightly darker than --muted */
  --teal: #0d9488;          /* accent: links, primary buttons, active nav underline/text, focus rings, selected chip fill */
  --teal-deep: #0f766e;     /* hover/active state of accent */
  --teal-soft: #ccfbf1;     /* soft accent bg: avatar bg, selected chip bg, focus-ring glow */
  --red: #dc2626;           --red-soft: #fee2e2;      /* high priority / destructive */
  --urgent: #be123c;        --urgent-soft: #ffe4e6;   /* urgent priority */
  --amber: #d97706;         --amber-soft: #fef3c7;    /* medium priority */
  --green: #16a34a;         --green-soft: #dcfce7;    /* low priority / resolved */
  --purple: #7e22ce;        --purple-soft: #f3e8ff;   /* review status */
  --cyan: #0891b2;          --cyan-soft: #cffafe;     /* acknowledged status — deliberately distinct hue from --teal so "acknowledged" badges don't visually collide with interactive accent elements */
  --blue: #2563eb;          --blue-soft: #dbeafe;     /* "new" status — distinct from --teal for the same reason */
  --shadow: 0 4px 16px rgba(43, 38, 32, 0.06);
  --radius-xl: 14px;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }

a { color: var(--teal); }

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  height: 52px;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 28px;
  height: 28px;
  background: var(--teal);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-md);
  font-size: 0.8375rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--teal); background: var(--teal-soft); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
}

.user-avatar {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--teal-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--teal-deep);
  flex-shrink: 0;
}

.btn-signout {
  padding: 0.3rem 0.75rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-signout:hover { color: var(--red); border-color: var(--red-soft); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.2rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:disabled { opacity: 0.5; cursor: default; filter: none; }

.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.btn-primary:hover:not(:disabled) { background: var(--teal-deep); border-color: var(--teal-deep); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

/* ── Inputs ── */
input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder, textarea::placeholder { color: var(--muted); }

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

/* ── Section card ── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* ── Data table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table thead th {
  background: var(--surface-2);
  text-align: left;
  padding: 0.65rem 0.9rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.data-table tbody tr { border-bottom: 1px solid var(--line); transition: background 0.12s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }

.data-table td {
  padding: 0.75rem 0.9rem;
  font-size: 0.875rem;
  color: var(--text);
  vertical-align: middle;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-urgent { background: var(--urgent-soft); color: var(--urgent); }
.badge-high { background: var(--red-soft); color: var(--red); }
.badge-medium { background: var(--amber-soft); color: var(--amber); }
.badge-low { background: var(--green-soft); color: var(--green); }
.badge-new { background: var(--blue-soft); color: var(--blue); }
.badge-review { background: var(--purple-soft); color: var(--purple); }
.badge-acknowledged { background: var(--cyan-soft); color: var(--cyan); }
.badge-resolved { background: var(--green-soft); color: var(--green); }
.badge-ignored { background: var(--surface-2); color: var(--muted-2); border: 1px solid var(--line); }
.badge-plate { background: var(--teal-soft); color: var(--teal-deep); margin-left: 6px; }

/* ── Toast ── */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
}

.toast.show { display: block; animation: toast-slide-up 0.2s ease; }

@keyframes toast-slide-up {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
