
:root {
  --blue: #2369d8;
  --blue-light: #eaf2ff;
  --green: #24866a;
  --purple: #6546a5;
  --orange: #c17a25;
  --red: #d8233b;
  --background: #f4f6f9;
  --surface: #ffffff;
  --text: #202938;
  --muted: #778195;
  --border: #e3e8ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px;
  color: var(--text);
  background: var(--background);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.app {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.7px;
}

h2 {
  margin-bottom: 0;
  font-size: 23px;
}

h3 {
  margin-bottom: 5px;
  font-size: 17px;
}

.subtitle,
.card-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
}

.status,
.period-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: #505b6d;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.tab:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.tab.active {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.tab.highlight-tab {
  background: #fffaf0;
  border-color: var(--orange);
  color: var(--orange);
}

.tab.highlight-tab:hover,
.tab.highlight-tab.active {
  background: var(--orange);
  color: white;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(24, 39, 75, 0.025);
}

.kpis,
.stage-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi {
  display: flex;
  min-height: 145px;
  flex-direction: column;
  justify-content: center;
}

.kpi-label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.2;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.kpi.highlight {
  border-top: 3px solid var(--blue);
}

.kpi.highlight strong {
  color: var(--blue);
}

.kpi.highlight-orange {
  border-top: 3px solid var(--orange);
}

.kpi.highlight-orange strong {
  color: var(--orange);
}

.kpi-foot {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-card,
.table-card {
  margin-bottom: 16px;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.card-heading p {
  font-size: 12px;
}

/* Chuyển đổi biểu đồ */
.chart-toggles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chart-btn {
  background: #f0f4f8;
  border: 1px solid #e3e8ef;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: #555;
  font-weight: 600;
  transition: all 0.2s;
}

.chart-btn:hover {
  background: #e3e8ef;
}

.chart-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--blue);
}

.chart-wrap {
  width: 100%;
  overflow: hidden;
  margin-top: 10px;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 210px;
}

.controls {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.growth-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stage-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-card label {
  display: block;
  min-height: 24px;
  margin-bottom: 14px;
  font-weight: 600;
}

.control-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 16px;
}

.control-value strong,
.control-value input[type="number"] {
  color: var(--blue);
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  font-weight: bold;
}

.control-value input[type="number"] {
  width: 90px;
  max-width: 100%;
  border: none;
  background: #f4f6f9;
  border-radius: 4px;
  padding: 0 5px;
  font-family: inherit;
  margin: 0;
  outline: none;
  border-bottom: 2px solid transparent;
}

.control-value input[type="number"]:focus,
.control-value input[type="number"]:hover {
  border-bottom: 2px solid var(--blue);
  background: #eaf2ff;
}

.control-value input[type="number"]::-webkit-outer-spin-button,
.control-value input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.control-value span {
  color: var(--muted);
  font-size: 12px;
}

input[type="range"] {
  display: block;
  width: 100%;
  accent-color: var(--blue);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.table-scroll {
  max-height: 430px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: #4d586a;
  font-weight: 600;
}

th:first-child,
td:first-child {
  text-align: left;
}

tbody tr:hover {
  background: #f8faff;
}

tfoot td {
  background: var(--blue-light);
  font-weight: 700;
}

.text-danger {
  color: var(--red) !important;
  font-weight: bold;
}

.footnote {
  padding: 4px 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

/* BỔ SUNG RIÊNG CHO DASHBOARD 06 */
.planning-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 12px;
}

.choice-option {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  min-height: auto !important;
  margin: 0 !important;
  font-weight: 500 !important;
  cursor: pointer;
}

.choice-option input {
  accent-color: var(--blue);
}

.helper-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.planning-options .control-value input[type="number"] {
  width: min(150px, 100%);
  font-size: 22px;
}

#pGrassGrowCostCard.is-disabled,
#pGrassPriceCard.is-disabled {
  opacity: 0.48;
}

@media (max-width: 1000px) {
  body {
    padding: 16px;
  }

  .growth-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planning-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    padding: 16px;
  }

  .kpis,
  .stage-kpis {
    gap: 10px;
  }
}

@media (max-width: 650px) {
  body {
    padding: 12px;
  }

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab {
    padding: 10px;
    text-align: left;
    font-size: 12px;
  }

  .kpis,
  .stage-kpis,
  .growth-controls,
  .stage-controls,
  .planning-options {
    grid-template-columns: 1fr;
  }

  .kpi {
    min-height: 115px;
  }

  .chart-wrap svg {
    min-height: 190px;
  }

  footer {
    flex-direction: column;
  }
}
