:root {
  --fc-bg: #f8f9f0;
  --fc-card: #ffffff;
  --fc-text: #1b1b1b;
  --fc-mute: #6f766c;
  --fc-line: #e4e8dc;
  --fc-primary: #2d6a4f;
  --fc-primary-soft: #eaf3e6;
  --fc-accent: #52b788;
  --fc-danger: #d9583a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 10% 0%, #eef5ea 0, transparent 28%), var(--fc-bg);
  color: var(--fc-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-wrap {
  min-height: 100vh;
}

.top-chrome,
.stage {
  max-width: 1440px;
  margin: 0 auto;
}

.top-chrome {
  padding: 20px 24px 8px;
  gap: 16px;
  flex-wrap: wrap;
}

.stage {
  padding: 0 24px 40px;
  width: 100%;
}

.foodcast-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--fc-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b7e4c7;
  flex: 0 0 auto;
}

.brand-title {
  font-weight: 700;
  line-height: 1;
}

.tiny-muted,
.muted {
  color: var(--fc-mute);
}

.tiny-muted {
  font-size: 11px;
}

.mode-toggle {
  display: inline-flex;
  padding: 4px;
  background: #eef2e6;
  border-radius: 999px;
  max-width: 100%;
  overflow-x: auto;
}

.mode-toggle button {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--fc-mute);
  font-size: 12px;
  font-weight: 600;
}

.mode-toggle button.active {
  background: #fff;
  color: var(--fc-text);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .08);
}

.device-desktop {
  min-height: 780px;
  width: 100%;
  border: 1px solid var(--fc-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, .55);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(45, 106, 79, .12);
}

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: #fff;
  border-right: 1px solid var(--fc-line);
}

.sidebar-head,
.sidebar-foot,
.topbar,
.mobile-head,
.bottom-nav {
  border-color: var(--fc-line) !important;
}

.nav-button {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: #394037;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}

.sidebar nav {
  gap: 2px !important;
  align-content: start;
  grid-auto-rows: max-content;
}

.nav-button:hover,
.ghost-btn:hover,
.icon-btn:hover {
  background: #f5f7ef;
}

.nav-button.active {
  color: var(--fc-primary);
  background: var(--fc-primary-soft);
}

.nav-dot {
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: var(--fc-primary);
}

.badge-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--fc-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar {
  height: 56px;
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(8px);
}

.search-input {
  width: min(340px, 40vw);
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fc-text);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: transparent;
  position: relative;
}

.content {
  min-width: 0;
  flex: 1;
}

.screen {
  padding: 32px;
  animation: fade .18s ease-out;
  width: 100%;
  min-width: 0;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.fc-card {
  background: var(--fc-card);
  border: 1px solid var(--fc-line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(45, 70, 40, .04);
  min-width: 0;
}

.fc-card.tight {
  border-radius: 10px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.primary-btn {
  max-width: 100%;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--fc-primary);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  white-space: normal;
  min-width: 0;
}

.primary-btn:hover {
  background: #245941;
}

.link-youtube {
  border: 2px solid #cf00001e;
  border-radius: 30px;
  padding: 2px 20px;
  text-decoration: none;
  color: rgba(0, 0, 0, 0.26);
  align-items: center;
  font-weight: 700;
}

.link-youtube:hover {
  background-color: #d80000b2;
  color: #ffffffd7;
}

.ghost-btn {
  max-width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  background: transparent;
  color: #394037;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: normal;
  min-width: 0;
  flex-shrink: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eef5ea;
  color: var(--fc-primary);
  border: 1px solid #d7e8d1;
  border-radius: 999px;
  max-width: 100%;
}

.action-card {
  border-color: #cfe4c7;
  background: linear-gradient(180deg, #ffffff 0%, #f4faf0 100%);
}

.alert-card {
  display: grid;
  gap: 12px;
}

.alert-actions,
.filter-bar,
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alert-detail,
.impact-box,
.producer-detail,
.response-time {
  border: 1px solid var(--fc-line);
  border-radius: 10px;
  background: #f8faf4;
  padding: 10px 12px;
}

.filter-bar {
  padding: 4px;
  border: 1px solid var(--fc-line);
  border-radius: 10px;
  background: #eef2e6;
}

.filter-bar button {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 8px;
  background: transparent;
  color: #394037;
  font-size: 12px;
  font-weight: 700;
}

.filter-bar button.active {
  background: #fff;
  color: var(--fc-primary);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .08);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric-grid div {
  border: 1px solid var(--fc-line);
  border-radius: 8px;
  padding: 8px;
  background: #fbfcf8;
}

.metric-grid span {
  display: block;
  color: var(--fc-mute);
  font-size: 10px;
  line-height: 1.2;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.field-error {
  color: var(--fc-danger);
  min-height: 16px;
  margin-top: 4px;
}

.response-time {
  color: var(--fc-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.crop-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex: 0 0 auto;
}

.badge {
  white-space: normal;
  text-align: center;
}

.progress-mini {
  height: 6px;
  background: #eef2e6;
  border-radius: 999px;
  overflow: hidden;
}

.progress-mini span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.form-control,
.form-select {
  height: 42px;
  border-color: var(--fc-line);
  background-color: #fff;
}

textarea.form-control {
  min-height: 128px;
  height: auto;
  resize: vertical;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--fc-primary);
  box-shadow: 0 0 0 .2rem rgba(45, 106, 79, .12);
}

.contact-form .form-text {
  margin-top: 4px;
}

.contact-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
}

.contact-check .form-check-input {
  margin: 2px 0 0;
  border-color: #b8c4b2;
  flex: 0 0 auto;
}

.contact-check .form-check-input:checked {
  background-color: var(--fc-primary);
  border-color: var(--fc-primary);
}

.contact-info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--fc-line);
  border-radius: 10px;
  background: #f8faf4;
}

.contact-info-row > span {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--fc-primary-soft);
  color: var(--fc-primary);
  flex: 0 0 auto;
}

.contact-note,
.contact-success {
  border: 1px solid #d7e8d1;
  border-radius: 10px;
  background: #eef5ea;
}

.contact-note {
  padding: 14px;
}

.contact-success {
  color: var(--fc-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.map-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8;
  border-radius: 12px;
  overflow: hidden;
  background: #eef5ea;
}

.map-point {
  position: absolute;
  transform: translate(-50%, -50%);
}

.map-point-btn {
  padding: 0;
  background: transparent;
}

.map-point-btn:focus-visible .map-pin {
  outline: 3px solid #fff;
  box-shadow: 0 0 0 5px rgba(45, 106, 79, .25);
}

.map-pin {
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--fc-accent);
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .14);
}

.map-pin.me {
  width: 32px;
  height: 32px;
  background: var(--fc-primary);
  outline: 2px solid #fff;
}

.map-pin:not(.me) {
  width: 22px;
  height: 22px;
}

.map-label {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #1b1b1b;
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
}

.map-point:hover .map-label {
  opacity: 1;
}

.search-box {
  min-height: 42px;
  border: 1px solid var(--fc-line);
  border-radius: 9px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--fc-mute);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fc-text);
}

.toggle {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #dadfd0;
  position: relative;
  transition: background .15s ease;
  flex: 0 0 auto;
}

.toggle span {
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
  transition: transform .15s ease;
}

.toggle.active {
  background: var(--fc-primary);
}

.toggle.active span {
  transform: translateX(20px);
}

.notification-card .toggle-row:last-child {
  border-bottom: 0 !important;
}

.toggle-row > div {
  min-width: 0;
}

.history-card .history-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--fc-line);
}

.history-card .history-row:last-child {
  border-bottom: 0;
}

.history-date {
  color: var(--fc-mute);
  font-size: 12px;
}

.history-crop {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}

.history-crop span {
  color: var(--fc-mute);
  font-size: 12px;
}

.device-phone {
  width: min(390px, 100%);
  height: min(844px, calc(100dvh - 112px));
  min-height: 620px;
  border: 1px solid var(--fc-line);
  border-radius: 34px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 70px rgba(45, 106, 79, .18);
}

.notch {
  height: 28px;
  background: #1b1b1b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: .2px;
}

.mobile-content {
  flex: 1;
  overflow: auto;
  background: var(--fc-bg);
}

.mobile-content .screen {
  padding: 16px;
}

.mobile-content h1 {
  font-size: 25px;
}

.device-phone .row {
  --bs-gutter-x: 0.875rem;
  --bs-gutter-y: 0.875rem;
}

.device-phone .row > [class*="col-sm"],
.device-phone .row > [class*="col-md"],
.device-phone .row > [class*="col-lg"],
.device-phone .row > [class*="col-xl"],
.device-phone .row > [class*="col-xxl"] {
  flex: 0 0 auto;
  width: 100%;
}

.device-phone .screen > header {
  margin-bottom: 18px !important;
}

.device-phone .screen > header.d-flex {
  flex-direction: column;
  align-items: stretch !important;
}

.device-phone .screen > header .primary-btn,
.device-phone .screen > header .ghost-btn {
  width: 100%;
}

.device-phone .fc-card {
  border-radius: 10px;
}

.device-phone .fc-card.p-4,
.device-phone .fc-card.p-md-5 {
  padding: 1rem !important;
}

.device-phone .display-6 {
  font-size: 2rem;
  line-height: 1.05;
}

.device-phone .section-title {
  align-items: flex-start;
  flex-direction: column;
}

.device-phone .section-title > :last-child {
  flex-shrink: 1;
}

.device-phone svg.chart {
  min-width: 0;
}

.device-phone .fc-card:has(svg.chart) {
  overflow-x: hidden;
}

.device-phone .fc-card.tight.d-flex,
.device-phone .fc-card .d-flex.align-items-center.justify-content-between {
  flex-wrap: wrap;
}

.device-phone .fc-card.tight > .ghost-btn {
  width: calc(100% - 48px);
  justify-content: center;
  margin-left: 48px;
}

.device-phone .map-box {
  aspect-ratio: 4 / 3;
}

  .device-phone .map-label {
    display: none;
  }

  .device-phone .metric-grid {
    grid-template-columns: 1fr;
  }

  .device-phone .alert-actions .ghost-btn,
  .device-phone .filter-bar button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .device-phone .contact-form .primary-btn {
  width: 100%;
}

.device-phone .contact-info-row {
  padding: 10px;
}

.device-phone .bottom-nav button span:last-child {
  white-space: normal;
  line-height: 1.05;
}

.device-phone .notification-card .toggle-row {
  align-items: flex-start !important;
  gap: 12px;
  padding: 14px !important;
}

.device-phone .history-card .history-row {
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 14px;
}

.device-phone .history-date {
  grid-column: 1 / -1;
}

.device-phone .history-crop {
  flex-direction: column;
  gap: 2px;
}

.device-phone .row.g-0.px-3,
.device-phone .row.g-0.align-items-center.px-3,
.device-phone .row.g-0.px-3.py-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 8px;
}

.device-phone .row.g-0.px-3 > [class*="col-"],
.device-phone .row.g-0.align-items-center.px-3 > [class*="col-"],
.device-phone .row.g-0.px-3.py-3 > [class*="col-"] {
  width: auto;
  max-width: none;
  flex: none;
}

.device-phone .row.g-0.px-3 > [class*="col-"]:first-child,
.device-phone .row.g-0.align-items-center.px-3 > [class*="col-"]:first-child,
.device-phone .row.g-0.px-3.py-3 > [class*="col-"]:first-child {
  grid-column: 1 / -1;
}

.device-phone .row.g-0.px-3.py-2 {
  display: none;
}

.bottom-nav {
  height: 68px;
  background: #fff;
}

.bottom-nav button {
  background: transparent;
  color: var(--fc-mute);
  font-size: 10px;
  min-width: 0;
  padding: 0 2px;
}

.bottom-nav button span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav .nav-pill {
  width: 40px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav button.active {
  color: var(--fc-primary);
  font-weight: 700;
}

.bottom-nav button.active .nav-pill {
  background: #eef5ea;
}

svg.chart {
  width: 100%;
  height: auto;
  min-width: 520px;
}

.fc-card:has(svg.chart) {
  overflow-x: auto;
}

.section-title > * {
  min-width: 0;
}

.section-title > :last-child {
  flex-shrink: 0;
}

.alert-list,
.table-card {
  min-width: 0;
}

@media (max-width: 1100px) {
  .device-desktop {
    min-height: auto;
  }

  .sidebar {
    width: 208px;
    flex-basis: 208px;
  }

  .screen {
    padding: 24px;
  }
}

@media (max-width: 800px) {
  .top-chrome,
  .stage {
    padding-left: 12px;
    padding-right: 12px;
  }

  .top-chrome {
    padding-top: 12px;
  }

  .top-chrome > .d-flex:first-child {
    min-width: 0;
  }

  .mode-toggle {
    width: 100%;
  }

  .mode-toggle button {
    flex: 1 1 0;
  }

  .device-desktop {
    flex-direction: column;
    border-radius: 18px;
  }

  .sidebar {
    width: 100%;
    flex-basis: auto;
    border-right: 0;
    border-bottom: 1px solid var(--fc-line);
  }

  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 10px !important;
  }

  .nav-button {
    justify-content: center;
    padding: 0;
  }

  .nav-button .nav-label,
  .nav-dot,
  .sidebar-foot,
  .topbar {
    display: none !important;
  }

  .screen {
    padding: 18px;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title > :last-child {
    flex-shrink: 1;
  }

  .fc-card {
    border-radius: 10px;
  }

  .display-6 {
    font-size: 1.8rem;
  }

  .fc-card.tight.d-flex,
  .fc-card .d-flex.align-items-center.justify-content-between {
    flex-wrap: wrap;
  }

  .fc-card.tight > .ghost-btn {
    margin-left: 48px;
  }

  header .primary-btn,
  header .ghost-btn {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .top-chrome,
  .stage {
    padding-left: 0;
    padding-right: 0;
  }

  .top-chrome {
    padding: 10px 12px 8px;
  }

  .stage {
    padding-bottom: 0;
  }

  .device-desktop,
  .device-phone {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .device-phone {
    height: calc(100dvh - 86px);
    min-height: 520px;
  }

  .notch {
    display: none;
  }

  .mobile-content .screen,
  .screen {
    padding: 14px;
  }

  .mobile-content h1,
  .screen h1 {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  .fc-card.p-4,
  .fc-card.p-md-5 {
    padding: 1rem !important;
  }

  .fc-card.tight > .ghost-btn {
    width: calc(100% - 48px);
    justify-content: center;
  }

  .fc-card .d-flex.align-items-center.justify-content-between > .badge,
  .fc-card .d-flex.align-items-center.justify-content-between > .chip {
    margin-top: 4px;
  }

  .primary-btn {
    min-height: 42px;
    height: auto;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .ghost-btn {
    min-height: 34px;
    height: auto;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .nav-button {
    height: 38px;
  }

  .bottom-nav {
    height: 64px;
  }

  .bottom-nav .nav-pill {
    width: 34px;
  }

  svg.chart {
    min-width: 460px;
  }

  .map-box {
    aspect-ratio: 4 / 3;
  }

  .map-label {
    display: none;
  }

  .toggle {
    margin-left: 12px;
  }

  .toggle-row {
    align-items: flex-start !important;
    gap: 12px;
  }

  .history-card .history-row {
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    padding: 14px;
  }

  .history-date {
    grid-column: 1 / -1;
  }

  .history-crop {
    flex-direction: column;
    gap: 2px;
  }

  .row.g-0.px-3,
  .row.g-0.align-items-center.px-3,
  .row.g-0.px-3.py-3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: 8px;
  }

  .row.g-0.px-3 > [class*="col-"],
  .row.g-0.align-items-center.px-3 > [class*="col-"],
  .row.g-0.px-3.py-3 > [class*="col-"] {
    width: auto;
    max-width: none;
    flex: none;
  }

  .row.g-0.px-3 > [class*="col-"]:first-child,
  .row.g-0.align-items-center.px-3 > [class*="col-"]:first-child,
  .row.g-0.px-3.py-3 > [class*="col-"]:first-child {
    grid-column: 1 / -1;
  }

  .row.g-0.px-3.py-2 {
    display: none;
  }
}

@media (max-width: 380px) {
  .mode-toggle button {
    padding: 0 8px;
    font-size: 11px;
  }

  .bottom-nav button {
    font-size: 9px;
  }

  .crop-avatar {
    border-radius: 10px;
  }

  svg.chart {
    min-width: 420px;
  }
}
