:root {
  --blue: #006491;
  --blue-dark: #004d70;
  --blue-light: #e6f2f8;
  --red: #e31837;
  --red-dark: #b8122a;
  --red-light: #fbebee;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: white;
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-logo {
  height: 32px;
  width: auto;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-title span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.header-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 28px auto 60px;
  padding: 0 20px;
}

/* Hero card */
.hero-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.hero-card h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--blue);
  margin-bottom: 6px;
}

.hero-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* Search Box & Controls */
.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 15px;
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  background: white;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 100, 145, 0.15);
}

/* Quick Tags / Chips */
.quick-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-tags-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.tag-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-btn:hover {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

.tag-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

/* Dropdown Autocomplete */
.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  margin-top: 4px;
  display: none;
}

.dropdown-list.show {
  display: block;
}

.dropdown-item {
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg);
  transition: background 0.1s;
}

.dropdown-item:hover, .dropdown-item.selected {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}

.dropdown-item span.count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: normal;
}

/* Selected Insums Badge List */
.selected-insumos-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  margin-top: 10px;
}

.selected-insumo-chip {
  background: var(--blue);
  color: white;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.selected-insumo-chip button {
  background: none;
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.1s;
}

.selected-insumo-chip button:hover {
  opacity: 1;
}

.btn-clear-all {
  background: transparent;
  border: 1px solid #fca5a5;
  color: var(--red);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-clear-all:hover {
  background: var(--red-light);
}

/* Results Actions Bar */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.results-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.results-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.results-count {
  background: var(--red-light);
  color: var(--red);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-action {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-action:hover {
  background: var(--bg);
  border-color: var(--text-muted);
}

.btn-primary-action {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.btn-primary-action:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
}

/* Category Cards Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  align-items: start;
}

.category-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.category-card:hover {
  box-shadow: var(--shadow-md);
}

.category-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-icon {
  font-size: 18px;
}

.category-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue);
}

.category-badge {
  background: white;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
}

.items-list {
  padding: 12px 18px;
  list-style: none;
}

.item-row {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-main);
  border-bottom: 1px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.item-row:last-child {
  border-bottom: none;
}

.item-bullet {
  color: var(--red);
  margin-right: 8px;
  font-weight: bold;
}

.item-reasons {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

/* Empty State */
.empty-state {
  background: white;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 14px;
  max-width: 480px;
  margin: 0 auto;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px;
  border-top: 1px solid var(--border);
  background: white;
  margin-top: 40px;
}

@media (max-width: 640px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .categories-grid {
    grid-template-columns: 1fr;
  }
}
