:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --text: #0f172a;
  --muted: #475569;
  --border: #d9e2dc;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: #ccfbf1;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Header */
.site-header {
  background: #0d3b36;
  color: #f8fafc;
  padding: 20px 0;
  margin-bottom: 22px;
  border-bottom: 3px solid #14b8a6;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.profile-switcher {
  min-width: 280px;
  max-width: 440px;
  flex: 1 1 300px;
}

.profile-switcher label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #99f6e4;
  margin-bottom: 4px;
  font-weight: 600;
}

.profile-switcher select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2dd4bf;
  background: #115e59;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
}

.profile-desc {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: #cbd5e1;
}

/* Cards & Sections */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.22rem;
}

.section-sub {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.count-pill {
  background: var(--primary-soft);
  color: #115e59;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: 999px;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.btn-secondary:hover {
  background: #d1fae5;
}

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

.btn-ghost:hover {
  background: var(--surface-alt);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* RIC Matrix */
.ric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
}

.ric-card {
  background: var(--surface-alt);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.ric-card:hover {
  border-color: #14b8a6;
  transform: translateY(-1px);
}

.ric-card.active {
  border-color: var(--primary);
  background: #f0fdfa;
}

.ric-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #0f172a;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.ric-symbol {
  font-weight: 700;
  font-size: 0.95rem;
  display: block;
}

.ric-name-short {
  font-size: 0.76rem;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.ric-detail {
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  font-size: 0.9rem;
}

/* Stream Badges */
.stream-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.stream-recycle { background: #0f766e; }
.stream-glass { background: #0369a1; }
.stream-compost { background: #3f6212; }
.stream-ewaste { background: #6d28d9; }
.stream-hazardous { background: #b91c1c; }
.stream-landfill { background: #475569; }

/* Search & Items Grid */
.search-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.control-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.control-group input,
.control-group select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  background: #ffffff;
  color: var(--text);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.item-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.item-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.item-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.item-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.item-prep {
  margin: 0;
  font-size: 0.83rem;
}

.item-contam {
  margin: 0;
  font-size: 0.78rem;
  color: #92400e;
  background: #fef3c7;
  padding: 5px 8px;
  border-radius: 6px;
}

.item-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

/* Audit Estimator */
.audit-add-form {
  display: grid;
  grid-template-columns: 2fr 110px 1.5fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.kpi-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.kpi-value {
  display: block;
  font-size: 1.55rem;
  margin: 4px 0 2px;
  color: var(--primary);
}

.kpi-value.risk-high { color: #b91c1c; }
.kpi-value.risk-moderate { color: #b45309; }
.kpi-value.risk-low { color: #0f766e; }

.kpi-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.warnings-box {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.warning-item {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  border-left: 4px solid;
}

.warning-high {
  background: #fef2f2;
  border-color: #dc2626;
  color: #7f1d1d;
}

.warning-medium {
  background: #fffbeb;
  border-color: #d97706;
  color: #78350f;
}

.warning-watch {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0c4a6e;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.audit-table th,
.audit-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.audit-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-alt);
}

.mis-sort-flag {
  color: #b91c1c;
  font-weight: 700;
  font-size: 0.78rem;
}

.export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Printable Bin Labels */
.bin-labels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.bin-label-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #ffffff;
  break-inside: avoid;
}

.bin-label-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.bin-label-header h3 {
  margin: 0;
  font-size: 1rem;
}

.bin-label-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--text);
}

.bin-label-list li {
  margin-bottom: 3px;
}

.site-footer {
  padding: 18px 0 32px;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 760px) {
  .search-controls,
  .audit-add-form {
    grid-template-columns: 1fr;
  }
}

/* Print Stylesheet for Bin Labels & Quick Reference Card */
@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .no-print {
    display: none !important;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .print-section {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .bin-labels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .bin-label-card {
    border: 2px solid #000000;
  }
}
