@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;500;600;700&display=swap');

:root {
  --bg: #eef4f1;
  --surface: #ffffff;
  --surface-2: #f7fbf8;
  --ink: #17231f;
  --muted: #617069;
  --line: #dbe5df;
  --primary: #167a55;
  --primary-strong: #0d5e40;
  --primary-soft: #e4f4ed;
  --blue: #2f6bb7;
  --blue-soft: #e8f0fb;
  --amber: #b7791f;
  --amber-soft: #fff4df;
  --red: #b64242;
  --red-soft: #faeaea;
  --sage-bg: #e2ede7;
  --shadow: 0 18px 42px rgba(28, 48, 40, 0.09);
  --shadow-soft: 0 8px 24px rgba(28, 48, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f7fbf8 0, var(--bg) 360px, #f7faf8 100%);
  color: var(--ink);
  font-family: Kanit, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] { display: none !important; }

.shell-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}

.demo-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 9px 12px;
  border: 1px solid #eadb9c;
  border-radius: 10px;
  background: #fff9df;
  color: #64551d;
  font-size: 13px;
}

.demo-notice[hidden] { display: none; }

.header-chal-tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 6px !important;
  padding: 4px 6px !important;
  margin: 0 !important;
  border: 1px solid #d5e5dc !important;
  border-radius: 10px !important;
  background: #f4faf7 !important;
  overflow-x: auto !important;
  scrollbar-width: thin;
}

.header-chal-tabs[hidden] {
  display: none !important;
}

.header-chal-tabs .tab {
  flex: 1 1 auto !important;
  min-width: max-content !important;
  min-height: 36px !important;
  padding: 6px 12px !important;
  font-size: 12.5px !important;
  white-space: nowrap !important;
  border-radius: 8px !important;
  text-align: center !important;
  transition: all 0.15s ease !important;
}

.header-chal-tabs .tab:hover:not(.active) {
  background: rgba(22, 122, 85, 0.08) !important;
  color: var(--primary-strong) !important;
}

.brand-block,
.session-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right-group {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 19px;
  line-height: 1.1;
}

.brand-block p,
.session-block span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.agency-line {
  margin: 0 0 3px;
  color: var(--primary) !important;
  font-size: 12px !important;
  font-weight: 700;
}

.shell-main {
  width: min(1460px, calc(100% - 56px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 22px;
  align-items: stretch;
}

.login-copy,
.panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-copy {
  position: relative;
  min-height: 520px;
  color: #fff;
}

.photo-panel {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(135deg, rgba(8, 44, 28, 0.85) 0%, rgba(14, 72, 48, 0.65) 50%, rgba(18, 48, 56, 0.88) 100%), url('/images/coconut-cover.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;


}

@keyframes organicGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.copy-content {
  position: relative;
  max-width: 620px;
  padding: 44px;
}

.agency-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-bottom: 18px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.copy-content h2 {
  margin-top: 10px;
  max-width: 560px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

.copy-content p:last-child {
  margin-top: 16px;
  max-width: 520px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 17px;
  line-height: 1.65;
}

.panel {
  padding: 24px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.agency-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--surface-2), var(--blue-soft));
}

.mini-emblem {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.agency-card strong,
.agency-card span {
  display: block;
}

.agency-card strong {
  font-size: 15px;
}

.agency-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.login-panel h2,
.section-head h2 {
  margin-top: 4px;
  font-size: 26px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-copy .eyebrow { color: #a7f3d0; }

.form-stack,
.entry-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.entry-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grades-container {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

@media (max-width: 1024px) {
  .grades-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grades-container {
    grid-template-columns: 1fr;
  }
}

.grade-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s, border-color 0.2s;
}

.grade-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.grade-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary-strong);
  margin-bottom: 2px;
  line-height: 1.4;
}

.grade-card-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grade-card-fields label {
  gap: 4px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input::placeholder {
  color: #a8b8b0 !important;
  opacity: 0.65;
  font-weight: 400;
}

input:focus,
select:focus {
  outline: 3px solid rgba(22, 122, 85, 0.16);
  border-color: var(--primary);
}

input[readonly] {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.button.ghost {
  background: #fff;
  color: var(--primary);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

/* Loading States */
button.loading {
  position: relative;
  color: transparent !important;
  background: linear-gradient(135deg, #c5d6cc, #a5bfb5) !important;
  cursor: wait;
  pointer-events: none;
}

button.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  margin-left: -10px;
  border: 3px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.wide { grid-column: 1 / -1; }
.divider {
  grid-column: 1 / -1;
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.tabs {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  min-width: 136px;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.view-btn {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.view-btn.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.status.error { color: var(--red); }
.status.success { color: var(--primary); }

.status.error-box {
  margin-top: 15px;
  padding: 12px 16px;
  border-left: 4px solid var(--red);
  background: #fdf2f2;
  color: var(--red);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.status.success-box {
  margin-top: 15px;
  padding: 12px 16px;
  border-left: 4px solid var(--primary);
  background: #f0fdf4;
  color: var(--primary-strong);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.completion-panel {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, var(--surface-2));
  box-shadow: var(--shadow-soft);
}

.completion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.completion-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.completion-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--primary);
  font-weight: 600;
}

.completion-summary strong {
  font-size: 24px;
}

.completion-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.plot-check {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.plot-check-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.bunch-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.bunch-check {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.bunch-check.done {
  border-color: rgba(22, 122, 85, 0.35);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.bunch-check.incomplete {
  border-color: rgba(217, 119, 6, 0.35);
  background: #fffbeb;
  color: #b45309;
}

.bunch-check.missing {
  background: #f1f5f3;
  color: var(--muted);
}

.bunch-check:hover {
  outline: 3px solid rgba(22, 122, 85, 0.12);
}

.completion-help {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.rounds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.rounds button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.rounds button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.stats,
.cards {
  display: grid;
  gap: 14px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.stat,
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.stat {
  background: linear-gradient(180deg, #fff, #f7fbf9);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 6px;
  font-size: clamp(25px, 4vw, 36px);
  font-weight: 600;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
}

.card h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 18px;
}

.rows {
  display: grid;
  gap: 8px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.row strong { color: var(--ink); }

.progress-container {
  margin-top: 14px;
}

.progress-bar-bg {
  height: 10px;
  border-radius: 999px;
  background: #e7eee9;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.progress-bar-fill.progress-green {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.progress-bar-fill.progress-yellow {
  background: linear-gradient(135deg, var(--amber), #d4902a);
}

.progress-bar-fill.progress-red {
  background: linear-gradient(135deg, var(--red), #c94040);
}

.progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
}

.progress-label {
  color: var(--muted);
}

.progress-pct {
  font-size: 15px;
  font-weight: 700;
}

.progress-pct.progress-green { color: var(--primary); }
.progress-pct.progress-yellow { color: var(--amber); }
.progress-pct.progress-red { color: var(--red); }

/* Old progress style - remove */
.progress {
  display: none;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.visual-panel {
  margin-bottom: 16px;
  padding: 20px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

#dashboardVisual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr);
  gap: 16px;
  margin-bottom: 16px;
}

.metric-compare-panel {
  grid-column: 1 / -1;
}

#dashboardVisual .visual-panel {
  margin-bottom: 0;
}

.visual-panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.bar-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 150px minmax(160px, 1fr) 72px;
  gap: 12px;
  align-items: center;
}

.bar-name,
.bar-total {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bar-total { text-align: right; }

.bar-track-wide {
  display: flex;
  min-width: 6px;
  height: 28px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.seg.quality,
.dot.quality,
.trend-bar .rate-green { background: var(--primary); }
.seg.below,
.dot.below,
.trend-bar .rate-yellow { background: var(--amber); }
.seg.damaged,
.dot.damaged,
.trend-bar .rate-red { background: var(--red); }

.dot.weight,
.metric-track .weight { background: var(--blue); }
.dot.circum,
.metric-track .circum { background: var(--primary); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.metric-compare {
  display: grid;
  gap: 14px;
}

.metric-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.metric-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.metric-bars {
  display: grid;
  gap: 8px;
}

.metric-bar-line {
  display: grid;
  grid-template-columns: 86px minmax(120px, 1fr) 84px;
  gap: 10px;
  align-items: center;
}

.metric-bar-line span,
.metric-bar-line strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.metric-bar-line strong {
  color: var(--ink);
  text-align: right;
}

.metric-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.metric-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bunch-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.bunch-visual .visual-panel:first-child {
  grid-column: 1 / -1;
}

.multi-trend {
  min-width: 0;
}

.multi-trend-chart {
  display: grid;
  gap: 10px;
}

.trend-line-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.trend-line-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.trend-line-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  height: 64px;
  align-items: end;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(0deg, var(--line) 1px, transparent 1px);
  background-size: 100% 20%;
}

.trend-point-wrap {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  height: 100%;
  position: relative;
}

.trend-point-wrap span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding-top: 4px;
}

.trend-bubble {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.trend-bubble.no-data {
  background: var(--line) !important;
  border-color: #fff;
  box-shadow: none;
}

.histogram-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.histogram-bars {
  display: grid;
  gap: 10px;
}

.histogram-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.histogram-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.histogram-row strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.histogram-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.histogram-track i {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
}

.bunch-bar-list {
  display: grid;
  gap: 13px;
}

.bunch-bar-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 74px;
  gap: 8px;
  align-items: center;
}

.bunch-bar-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.bunch-bar-row strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.bunch-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.bunch-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--blue), var(--primary));
}

.trend-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(46px, 1fr));
  gap: 10px;
  min-height: 250px;
  align-items: end;
}

.trend-item {
  display: grid;
  grid-template-rows: auto 180px auto auto;
  gap: 7px;
  justify-items: center;
}

.trend-value,
.trend-label,
.trend-total {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.trend-bar {
  display: flex;
  align-items: end;
  width: 38px;
  height: 180px;
  border-radius: 999px;
  background: #e7eee9;
  overflow: hidden;
}

.trend-bar span {
  display: block;
  width: 100%;
  min-height: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child { text-align: left; }

th {
  background: #edf5f1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.rate-green { color: var(--primary); }
.rate-yellow { color: var(--amber); }
.rate-red { color: var(--red); }

/* ===== Segmented Control ===== */
.segmented-control {
  display: inline-flex;
  gap: 0;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.segmented-control button {
  padding: 8px 18px;
  border: none;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.segmented-control button.active {
  background: var(--primary);
  color: #fff;
}

.segmented-control button:not(:last-child) {
  border-right: 1px solid var(--line);
}

/* ===== Summary Cards ===== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-card {
  padding: 16px;
  background: var(--sage-bg);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.summary-card .card-value {
  font-size: 22px;
  font-weight: 700;
}

.summary-card .card-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.summary-card .card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.summary-card .warn {
  color: var(--amber);
  font-weight: 600;
}

/* ===== Badge ===== */
.badge-warn {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff3cd;
  color: #856404;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}

/* ===== Comparison Bar Chart ===== */
.comp-bar-chart {
  display: grid;
  gap: 12px;
}

.comp-bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.comp-bar-row span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.comp-bar-row strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.comp-bar-track {
  height: 22px;
  border-radius: 999px;
  background: #e7eee9;
  overflow: hidden;
}

.comp-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.3s;
}

/* ===== Histogram Stats Row ===== */
.histogram-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

.histogram-stats strong {
  color: var(--ink);
}

/* ===== Section Head Right ===== */
.section-head-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 880px) {
  .shell-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-layout,
  .entry-grid,
  .stats,
  #dashboardVisual {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: 360px;
  }

  .copy-content {
    padding: 28px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bar-track-wide {
    width: 100% !important;
  }

  .trend-chart {
    grid-template-columns: repeat(3, minmax(46px, 1fr));
  }

  .metric-row,
  .metric-bar-line,
  .bunch-visual,
  .bunch-bar-row {
    grid-template-columns: 1fr;
  }

  .bunch-visual .visual-panel:first-child {
    grid-column: auto;
  }

  .multi-trend-chart {
    gap: 14px;
  }

  .trend-line-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .trend-line-name {
    text-align: center;
  }

  .histogram-grid {
    grid-template-columns: 1fr;
  }

  .histogram-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .histogram-row span {
    text-align: left;
  }

  .metric-bar-line strong,
  .bunch-bar-row strong {
    text-align: left;
  }

  .completion-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .completion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabs {
    width: 100%;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-width: max-content;
    white-space: nowrap;
  }
}

/* Custom highlight styles for entry quantity inputs */
.entry-grid input {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  border-left-width: 5px;
}

.entry-grid #quality {
  border-left-color: var(--primary);
}

.entry-grid #below {
  border-left-color: var(--amber);
}

.entry-grid #damaged {
  border-left-color: var(--red);
}

.entry-grid #total {
  border-left-color: var(--muted);
  background: var(--surface-2);
}


/* ===================================================
   SYSTEM MODE SWITCHER & CHALLENGE MODE STYLES
   =================================================== */

.mode-navigation-bar {
  background: transparent;
  border: none;
  padding: 0;
  position: static;
  box-shadow: none;
}

.mode-navigation-inner {
  max-width: 1460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.mode-switch-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mode-switcher-pill {
  display: flex;
  background: #eef5f1;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
  border: 1px solid #d5e5dc;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  position: relative;
  text-align: left;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.mode-btn.active {
  background: #ffffff;
  color: var(--primary-strong);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.mode-icon {
  font-size: 20px;
}

.mode-info {
  display: flex;
  flex-direction: column;
}

.mode-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.mode-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.badge-new-mode {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
  animation: pulse-badge 2s infinite ease-in-out;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.9; }
}

/* Challenge KPI Grid */
.chal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(28, 48, 40, 0.1);
}

.kpi-card.highlight {
  border-color: #a7f3d0;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.kpi-icon {
  font-size: 28px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.04);
}

.kpi-body {
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.kpi-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin-top: 3px;
}

.kpi-val small {
  font-size: 12px;
  font-weight: normal;
  color: var(--muted);
}

/* Challenge Table Elements */
.badge-plot {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.badge-prov {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.badge-standard {
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
}

.coord-tag {
  color: var(--muted);
  font-family: monospace;
  font-size: 11px;
}

.actions-cell {
  white-space: nowrap;
}

.btn-icon {
  background: transparent;
  border: 1px solid #dbe5df;
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  margin: 0 2px;
  font-size: 13px;
  transition: background 0.15s;
}

.btn-icon:hover {
  background: #eef5f1;
}

/* 20-Bunch x 12-Month Matrix Styles */
/* 7 Sample Points Selector Styles */
.point-tabs-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.point-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  transition: all 0.2s ease;
}

.point-tab-btn:hover {
  border-color: #0284c7;
  color: #0284c7;
  background: #f0f9ff;
}

.point-tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.28);
}

.point-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
}

.point-tab-btn.active .point-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.point-badge.complete {
  background: #dcfce7;
  color: #15803d;
}

.point-tab-btn.active .point-badge.complete {
  background: #22c55e;
  color: #ffffff;
}

.tree-tabs-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tree-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #d5e5dc;
  background: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s;
}

.tree-tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tree-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(22, 122, 85, 0.25);
}

.tree-badge {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  font-weight: 700;
  font-size: 11px;
}

.tree-tab-btn.active .tree-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.matrix-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.matrix-table {
  width: 100%;
  min-width: 660px;
  table-layout: fixed;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.matrix-table th, .matrix-table td {
  border-right: 1px solid #edf2f0;
  border-bottom: 1px solid #edf2f0;
  padding: 3px 1px;
  text-align: center;
}

.matrix-table th {
  background: #f3f8f5;
  color: var(--ink);
  font-weight: 700;
  font-size: 11px;
}

.matrix-sticky-col {
  position: sticky;
  left: 0;
  background: #f7fbf9;
  z-index: 2;
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  text-align: left !important;
  padding: 3px 5px !important;
  box-sizing: border-box;
}

/* Matrix Inputs: Remove all spinners and provide clear, readable digits */
.matrix-input::-webkit-outer-spin-button,
.matrix-input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  display: none !important;
}

.matrix-th-bunch {
  min-width: 26px !important;
  padding: 3px 1px !important;
  font-size: 10.5px !important;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap !important;
  transition: all 0.15s ease;
}

.matrix-th-bunch .th-bunch-sub {
  display: block;
  font-size: 8.5px;
  color: #64748b;
  font-weight: 600;
  line-height: 1;
}

.matrix-th-bunch .th-bunch-num {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.matrix-cell {
  padding: 2px 1px !important;
}

.month-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
}

.month-title-group strong {
  font-size: 11px;
  color: var(--ink);
}

.matrix-input {
  width: 100% !important;
  min-width: 22px !important;
  max-width: 36px !important;
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
  line-height: 24px !important;
  padding: 0 !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 4px !important;
  text-align: center !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  background: #ffffff !important;
  -webkit-appearance: none !important;
  -moz-appearance: textfield !important;
  appearance: textfield !important;
  transition: all 0.15s ease !important;
  display: block !important;
  vertical-align: middle !important;
}

.matrix-input::placeholder {
  color: #9ca3af !important;
  font-weight: 400 !important;
  opacity: 0.5 !important;
}

.matrix-input:hover {
  background: #f0fdf4 !important;
  border-color: #10b981 !important;
}

.matrix-input:focus {
  outline: none !important;
  border-color: #059669 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
  color: #047857 !important;
}

.matrix-input.has-val {
  background: #dcfce7 !important;
  color: #065f46 !important;
  font-weight: 800 !important;
  border-color: #10b981 !important;
}

.matrix-footer-row td {
  background: #e6f4ed;
  font-weight: 700;
  font-size: 10.5px;
  padding: 3px 1px !important;
  border-top: 2px solid var(--primary);
}

.matrix-footer-label {
  line-height: 1.15;
}

.matrix-grand-total {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: #047857;
}

/* Month-grouped chart (12 bars) under the matrix */
.month-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 6px 8px;
  background: #f8fafc;
  border-top: 2px solid #bbf7d0;
  overflow-x: hidden;
}

.month-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding: 4px 1px 2px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  min-width: 0;
}

.month-bar:hover,
.month-bar.highlight-month {
  background: #dcfce7;
  border-color: #10b981;
  transform: translateY(-2px);
}

.month-bar-val {
  font-size: 11px;
  font-weight: 800;
  color: #6b7280;
  min-height: 14px;
  line-height: 1.2;
}

.month-bar.has-val .month-bar-val {
  color: #065f46;
}

.month-bar-track {
  width: 100%;
  max-width: 28px;
  height: 52px;
  background: #e2e8f0;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.month-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.month-bar.highlight-month .month-bar-fill,
.month-bar:hover .month-bar-fill {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
}

.month-bar-name {
  font-size: 10.5px;
  color: #1f2937;
  white-space: nowrap;
}

.month-bar-chips {
  font-size: 8px;
  font-weight: 700;
  color: #047857;
  line-height: 1.1;
  min-height: 9px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Bidirectional hover highlight: month row + bunch headers */
.matrix-row-month.highlight-month-row td:not(.matrix-sticky-col) {
  background: #ecfdf5;
}

.matrix-row-month.highlight-month-row .matrix-sticky-col {
  background: #d1fae5 !important;
}

.matrix-th-bunch.highlight-bunch-th {
  background: #d1fae5 !important;
  color: #065f46 !important;
  border-bottom: 2px solid #059669 !important;
}


/* 21-Day Cycle Control & Helper Bar */
.cycle-helper-bar {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 1.5px solid #a7f3d0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.05);
}

.cycle-helper-left {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 620px;
}

.cycle-badge-icon {
  width: 44px;
  height: 44px;
  background: #dcfce7;
  color: #059669;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.cycle-helper-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #065f46;
}

.cycle-pill-tag {
  background: #059669;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.cycle-helper-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

.cycle-helper-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.cycle-control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cycle-control-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.cycle-date-input,
.cycle-num-input {
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #ffffff;
  font-weight: 600;
}

.cycle-num-input {
  width: 75px;
  text-align: center;
}

.forecast-view-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.f-view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.f-view-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.f-view-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(22, 122, 85, 0.2);
}

.badge-double-month {
  display: inline-block;
  margin-left: 2px;
  padding: 1px 3px;
  border-radius: 3px;
  background: #fef3c7;
  color: #92400e;
  font-size: 8.5px;
  font-weight: 700;
  vertical-align: middle;
  line-height: 1.1;
  white-space: nowrap;
}

.matrix-cell.cycle-spotlight {
  background: #f0fdf4 !important;
}

.matrix-cell.cycle-spotlight .matrix-input {
  border-color: #10b981 !important;
}

/* Timeline View Table (21-Day Harvest Schedule) */
.timeline-table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 16px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.timeline-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timeline-toolbar-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary-strong);
}

.timeline-toolbar-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.timeline-toolbar-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timeline-toolbar-legend .legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.timeline-toolbar-legend .legend-dot.green {
  background: #10b981;
}

.timeline-toolbar-legend .legend-dot.gray {
  background: #94a3b8;
}

.timeline-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}

.timeline-table th {
  background: #f3f8f5;
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 11px 12px;
  border-bottom: 2px solid #d5e5dc;
  border-right: 1px solid #edf2f0;
  white-space: nowrap;
}

.timeline-table th:last-child {
  border-right: none;
}

.timeline-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #edf2f0;
  border-right: 1px solid #edf2f0;
  vertical-align: middle;
  white-space: nowrap;
}

.timeline-table td:last-child {
  border-right: none;
}

.timeline-table tbody tr {
  transition: background 0.15s ease;
}

.timeline-table tbody tr:hover {
  background: #f0fdf4 !important;
}

.timeline-table tr.is-double-row {
  background: rgba(240, 253, 244, 0.55);
}

.timeline-table tr.is-cross-year-row {
  background: #fafaf9;
}

.timeline-date-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--ink);
  background: #f1f8f4;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.badge-cycle-single {
  display: inline-block;
  background: #f1f5f3;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #e2ede7;
}

.badge-interval {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: monospace;
}

.badge-status-inyear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}

.badge-status-cross {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}

.timeline-fruit-input {
  width: 70px !important;
  height: 32px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-align: center !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 6px !important;
  padding: 2px 4px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  background: #ffffff !important;
  transition: all 0.15s ease !important;
}

.timeline-fruit-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(22, 122, 85, 0.2) !important;
  background: #ffffff !important;
}

.timeline-fruit-input.has-val {
  background: #dcfce7 !important;
  color: #065f46 !important;
  font-weight: 800 !important;
  border-color: #10b981 !important;
}

.timeline-progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.timeline-progress-track {
  flex: 1;
  height: 8px;
  background: #eef4f1;
  border-radius: 4px;
  overflow: hidden;
}

.timeline-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.timeline-progress-text {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  width: 40px;
  text-align: right;
}

.timeline-footer-row {
  background: #f7faf8 !important;
  border-top: 2px solid #d5e5dc;
}

.timeline-footer-row td {
  padding: 12px 14px;
  font-size: 13px;
  border-top: 2px solid #cce8d9;
}

/* Monthly Mini Chart */
.monthly-bar-chart {
  display: flex;
  align-items: flex-end;
  height: 120px;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-top: 14px;
}

.mini-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.mini-bar-val {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  min-height: 14px;
}

.mini-bar-track {
  flex: 1;
  width: 100%;
  max-width: 24px;
  background: #eef4f1;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-end;
}

.mini-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--primary) 0%, #34d399 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.4s ease;
}

.mini-bar-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.mini-bar-bunch-tag {
  font-size: 9px;
  color: #047857;
  font-weight: 700;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 3px;
  padding: 1px 4px;
  margin-top: 2px;
  white-space: nowrap;
}

/* Macro Table & Benchmark */
.macro-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.macro-total-row {
  background: #f0fdf4;
  font-weight: 700;
}

.macro-bar-col {
  width: 140px;
}

.macro-bar-track {
  width: 100%;
  height: 8px;
  background: #eef4f1;
  border-radius: 4px;
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
}

.benchmark-card {
  padding: 18px 22px;
  border-radius: 12px;
  border: 1px solid #dbe5df;
  background: #ffffff;
  margin-top: 18px;
}

.benchmark-card.benchmark-pos {
  border-left: 5px solid var(--primary);
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.benchmark-card.benchmark-neg {
  border-left: 5px solid var(--amber);
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.benchmark-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Modal Styling */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-box {
  background: #ffffff;
  border-radius: 16px;
  width: min(800px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

/* Dropzone */
.dropzone-box {
  border: 2px dashed #b5d5c5;
  border-radius: 14px;
  padding: 36px 20px;
  text-align: center;
  background: #f7fbf8;
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone-box:hover {
  background: #edf7f1;
  border-color: var(--primary);
}

/* ============================================================
   DATA QC, AUDIT & ANOMALY DETECTION SYSTEM STYLES
   ============================================================ */

/* Tab Anomaly Counter Badge */
.badge-anomaly-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: #dc2626;
  color: #ffffff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.4);
  animation: pulse-badge 2s infinite ease-in-out;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Form Input Anomaly Highlights */
.input-anomaly-warn {
  border-color: #f59e0b !important;
  background-color: #fffbeb !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

.input-anomaly-error {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

/* Form Anomaly Alert Banner */
.anomaly-banner {
  margin: 12px 0 16px 0;
  background: #fff8f0;
  border: 1px solid #fed7aa;
  border-left: 5px solid #f97316;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.08);
}

.anomaly-banner.severe {
  background: #fff5f5;
  border-color: #fecaca;
  border-left-color: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
}

.anomaly-banner-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: #c2410c;
  margin-bottom: 8px;
}

.anomaly-banner.severe .anomaly-banner-head {
  color: #b91c1c;
}

.anomaly-banner-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #374151;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-quick-fix {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 10px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-quick-fix:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

/* KPI Cards Grid */
.audit-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.audit-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s;
}

.audit-kpi-card:hover {
  transform: translateY(-2px);
}

.audit-kpi-card .kpi-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f1f5f9;
}

.audit-kpi-card.kpi-card-green .kpi-icon { background: #dcfce7; }
.audit-kpi-card.kpi-card-orange .kpi-icon { background: #ffedd5; }
.audit-kpi-card.kpi-card-gray .kpi-icon { background: #f3f4f6; }
.audit-kpi-card.kpi-card-red .kpi-icon { background: #fee2e2; }

.audit-kpi-card .kpi-info {
  display: flex;
  flex-direction: column;
}

.audit-kpi-card .kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.audit-kpi-card .kpi-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.audit-kpi-card.kpi-card-green .kpi-val { color: var(--primary); }
.audit-kpi-card.kpi-card-orange .kpi-val { color: #d97706; }
.audit-kpi-card.kpi-card-red .kpi-val { color: #dc2626; }

.audit-kpi-card .kpi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Audit Section Panels */
.audit-section-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
}

.audit-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.audit-section-head h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: var(--ink);
}

.audit-section-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* Submission Matrix Table */
.audit-matrix-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.audit-matrix-table th {
  background: #f8faf9;
  padding: 10px 12px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.audit-matrix-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid #f1f5f3;
  vertical-align: middle;
}

.audit-matrix-table td:first-child {
  text-align: left;
  font-weight: 700;
}

/* Badges in Matrix */
.badge-status {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 60px;
}

.badge-status:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

.badge-status.badge-done {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-status.badge-inc {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.badge-status.badge-miss {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.badge-status-sub {
  font-size: 9px;
  font-weight: 500;
  opacity: 0.85;
}

.recorded-user-tag {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.flag-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.flag-clean-tag {
  color: #15803d;
  font-size: 12px;
  font-weight: 600;
}

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 6px;
}

.filter-pill {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Anomaly Alert Cards */
.anomaly-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.anomaly-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #fed7aa;
  border-left: 5px solid #f97316;
  border-radius: 10px;
  padding: 14px 18px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.anomaly-item-card.severe {
  border-color: #fecaca;
  border-left-color: #ef4444;
}

.anomaly-item-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.anomaly-card-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.anomaly-location-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.loc-pill {
  display: inline-block;
  padding: 2px 8px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.zero-suspect-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.anomaly-message-box {
  font-size: 13px;
  color: #1f2937;
  line-height: 1.5;
}

.anomaly-meta-line {
  font-size: 11px;
  color: var(--muted);
}

.btn-anomaly-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-anomaly-jump:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.anomaly-empty-state {
  text-align: center;
  padding: 36px 20px;
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: 12px;
  color: #166534;
}

.anomaly-empty-state h4 {
  margin: 8px 0 4px 0;
  font-size: 16px;
  color: #15803d;
}

.anomaly-empty-state p {
  margin: 0;
  font-size: 13px;
  color: #166534;
}

/* Modal Backdrop & Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 90%;
  animation: modal-pop 0.2s ease-out;
}

@keyframes modal-pop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Touch-friendly Stepper Buttons for Orchard Field Officers */
.stepper-wrap {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
}

.stepper-input {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  min-width: 50px;
}

.step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 42px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all 0.1s ease;
  touch-action: manipulation;
}

.step-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.step-btn:active {
  transform: scale(0.92);
  background: #cbd5e1;
}

.step-dec {
  color: #b91c1c;
}

.step-inc {
  color: var(--primary-strong);
}

.step-quick {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-color: #a7f3d0;
  font-size: 13px;
  font-weight: 700;
  min-width: 36px;
}

.step-quick:hover {
  background: #a7f3d0;
}

/* Offline Draft Banner */
.draft-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  gap: 12px;
}

/* Photo Attachment Panel (D1 Native Storage) */
.photo-attachment-panel {
  grid-column: 1 / -1;
  background: #f7faf8;
  border: 1px dashed #a7d7c5;
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.photo-attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.photo-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
}

.photo-count-badge {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.photo-head-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.photo-upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.photo-upload-label:hover {
  background: #e2ede7;
}

.photo-gallery-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 80px;
  align-items: center;
}

.photo-empty-hint {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 4px;
}

.photo-thumb-card {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #e2ede7;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: #ffffff;
}

.photo-thumb-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

.photo-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(220, 38, 38, 0.85);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.photo-thumb-card:hover .photo-thumb-del {
  opacity: 1;
}

.photo-thumb-del:hover {
  background: #b91c1c;
}

/* 21-Day Harvest & Survey Calendar Grid */
.calendar-cycles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.cal-cycle-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-cycle-card.highlight-round {
  border: 2px solid var(--primary);
  background: #f0fdf4;
}

.cal-cycle-card.cycle-past {
  opacity: 0.7;
  background: #f8fafc;
}

.cal-cycle-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cal-cycle-num {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.cal-cycle-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.cal-badge-round {
  background: #dcfce7;
  color: #15803d;
}

.cal-badge-harvest {
  background: #f1f5f9;
  color: #475569;
}

.cal-cycle-date {
  font-size: 13px;
  color: #1e293b;
  font-weight: 600;
}

.cal-cycle-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Executive Print Report Paper & Typography */
.printable-report-paper {
  background: #ffffff;
  color: #0f172a;
  font-family: Kanit, 'TH Sarabun New', sans-serif;
  line-height: 1.5;
}

.report-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.report-emblem-box {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(135deg, #167a55, #2f6bb7);
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(22, 122, 85, 0.2);
}

.report-title-box h2 {
  font-size: 17px;
  font-weight: 700;
  color: #0d5e40;
  margin: 0;
}

.report-title-box h3 {
  font-size: 15px;
  font-weight: 600;
  color: #17231f;
  margin: 2px 0 0;
}

.report-date-line {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 0;
}

.report-divider {
  height: 2px;
  background: linear-gradient(90deg, #167a55, #94a3b8);
  margin: 14px 0 18px;
}

.report-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #0d5e40;
  margin-bottom: 8px;
}

.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.report-kpi-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.report-kpi-item .label {
  font-size: 11px;
  color: #64748b;
  display: block;
}

.report-kpi-item .val {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 12px;
}

.report-table th,
.report-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
}

.report-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #1e293b;
}

.report-audit-block {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #166534;
  margin-top: 18px;
  margin-bottom: 24px;
}

.report-signatures {
  display: flex;
  justify-content: space-around;
  margin-top: 32px;
  padding-top: 10px;
}

.sig-col {
  text-align: center;
  font-size: 12px;
  color: #334155;
}

.sig-line {
  color: #94a3b8;
  margin-bottom: 6px;
}

.sig-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.sig-role {
  font-size: 11px;
  color: #64748b;
}

/* Print CSS Media Queries */
@media print {
  body * {
    visibility: hidden;
  }

  .printable-report-paper,
  .printable-report-paper * {
    visibility: visible;
  }

  .printable-report-paper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20mm;
    box-shadow: none;
    background: transparent;
  }

  .no-print,
  .modal-head,
  .modal-actions,
  .shell-header,
  .mode-navigation-bar {
    display: none !important;
  }

  @page {
    size: A4 portrait;
    margin: 10mm;
  }
}

/* ==========================================================================
   COCONUT KNOWLEDGE HUB & 3D ATLAS STYLES
   ========================================================================== */

.coconut-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #064e3b 0%, #065f46 45%, #047857 100%);
  border-radius: 18px;
  color: #ecfdf5;
  margin-bottom: 20px;
  box-shadow: 0 14px 34px rgba(6, 78, 59, 0.16);
  flex-wrap: wrap;
}

.coconut-header-copy {
  max-width: 720px;
}

.coconut-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #a7f3d0;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.coconut-header-banner h2 {
  font-size: 24px;
  color: #ffffff;
  margin: 4px 0 8px;
  font-weight: 700;
}

.coconut-header-banner p {
  font-size: 13.5px;
  color: #d1fae5;
  line-height: 1.6;
  margin: 0;
}

.coconut-header-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.coconut-stat-box {
  background: rgba(4, 46, 35, 0.45);
  border: 1px solid rgba(167, 243, 208, 0.25);
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
  min-width: 90px;
}

.coconut-stat-box strong {
  display: block;
  font-size: 24px;
  color: #ecfccb;
  line-height: 1.1;
}

.coconut-stat-box span {
  display: block;
  font-size: 11px;
  color: #a7f3d0;
  margin-top: 3px;
}

/* Sub-Navigation Pills */
.knowledge-subnav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.knowledge-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.knowledge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.knowledge-pill:hover {
  background: #f0fdf4;
  color: var(--primary);
  border-color: #86efac;
}

.knowledge-pill.active {
  background: #065f46;
  color: #ffffff;
  border-color: #065f46;
  box-shadow: 0 4px 12px rgba(6, 95, 70, 0.2);
}

.knowledge-pill .pill-icon {
  font-size: 15px;
}

/* 3D Atlas Container */
.coconut-atlas-container {
  position: relative;
  width: 100%;
  height: 780px;
  border-radius: 16px;
  overflow: hidden;
  background: #071813;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  border: 1px solid #1a3a2e;
}

.coconut-atlas-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.coconut-atlas-footer-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* 8 Knowledge Topics Grid */
.coconut-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.coconut-topic-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.coconut-topic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(22, 101, 52, 0.12);
  border-color: #86efac;
}

.topic-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.topic-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #dcfce7;
  color: #166534;
  display: grid;
  place-items: center;
  font-size: 24px;
  flex-shrink: 0;
}

.topic-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.topic-card-number {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  background: #f0fdf4;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #bbf7d0;
}

.topic-card-readtime {
  font-size: 11.5px;
  color: var(--muted);
}

.coconut-topic-card h4 {
  font-size: 16px;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.35;
  font-weight: 700;
}

.coconut-topic-card p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 16px;
  flex: 1;
}

.topic-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
  font-size: 12px;
}

.topic-badge-cat {
  background: #f1f5f9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.topic-btn-read {
  color: var(--primary);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 9 Stages Field Guide Cards */
.stages-guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.stage-guide-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  align-items: center;
  transition: all 0.2s ease;
}

.stage-guide-card:hover {
  border-color: #86efac;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.stage-guide-card.stage-highlight {
  background: linear-gradient(to right, #f0fdf4, #ffffff);
  border-color: #86efac;
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.08);
}

.stage-badge-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stage-no {
  font-size: 26px;
  font-weight: 800;
  color: #065f46;
  font-family: Georgia, serif;
}

.stage-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
}

.stage-tag.ready {
  background: #166534;
  color: #ffffff;
}

.stage-body-col h4 {
  font-size: 15px;
  color: var(--ink);
  margin: 0 0 6px;
  font-weight: 700;
}

.stage-meta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: #065f46;
  margin-bottom: 6px;
  font-weight: 500;
}

.stage-body-col p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

/* Article Markdown Renderer Styles */
.article-markdown-rendered {
  font-size: 14.5px;
  line-height: 1.8;
  color: #1e293b;
  max-width: 820px;
  margin: 0 auto;
}

.article-markdown-rendered h1 {
  font-size: 24px;
  color: #064e3b;
  margin: 0 0 16px;
  line-height: 1.3;
  padding-bottom: 10px;
  border-bottom: 2px solid #bbf7d0;
}

.article-markdown-rendered h2 {
  font-size: 18px;
  color: #065f46;
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.article-markdown-rendered h3 {
  font-size: 16px;
  color: #047857;
  margin: 22px 0 8px;
}

.article-markdown-rendered p {
  margin: 0 0 14px;
}

.article-markdown-rendered ul,
.article-markdown-rendered ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.article-markdown-rendered li {
  margin-bottom: 6px;
}

.article-markdown-rendered blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  background: #f0fdf4;
  border-left: 4px solid #16a34a;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: #166534;
}

.article-markdown-rendered hr {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
}

.article-markdown-rendered code {
  background: #f1f5f9;
  color: #0f766e;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: Consolas, monospace;
}

.article-markdown-rendered code.math-expr {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.article-markdown-rendered .markdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 13px;
}

.article-markdown-rendered .markdown-table th,
.article-markdown-rendered .markdown-table td {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.article-markdown-rendered .markdown-table th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.article-markdown-rendered .markdown-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

@media (max-width: 768px) {
  .coconut-header-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }
  .coconut-atlas-container {
    height: 520px;
  }
  .stage-guide-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .stage-badge-col {
    flex-direction: row;
  }
}

/* Challenge Tab Guide Cards (ด้านล่างสุดของแต่ละแท็บ: คืออะไร, บันทึกยังไง, ข้อมูลเอาไว้ทำไร) */
.tab-guide-box {
  margin-top: 32px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbf8 100%);
  border: 1px solid #cce5d6;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 4px 16px rgba(22, 101, 52, 0.04);
}

.tab-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e1efe6;
  padding-bottom: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab-guide-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #14532d;
  margin: 0;
}

.tab-guide-tag {
  background: #dcfce7;
  color: #15803d;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.tab-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 960px) {
  .tab-guide-grid {
    grid-template-columns: 1fr;
  }
}

.tab-guide-card {
  background: #ffffff;
  border: 1px solid #e2ece5;
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tab-guide-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 101, 52, 0.08);
  border-color: #86efac;
}

.tab-guide-card-icon {
  font-size: 26px;
  margin-bottom: 8px;
}

.tab-guide-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-guide-card p,
.tab-guide-card li {
  font-size: 12.5px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
}

.tab-guide-card ol,
.tab-guide-card ul {
  padding-left: 18px;
  margin: 6px 0 0 0;
}

.tab-guide-card li {
  margin-bottom: 5px;
}

.tab-guide-card strong {
  color: #111827;
}

/* =========================================================
   2D Inspection Overview Board (กระดาน 2D ตรวจสอบแปลง)
   ========================================================= */

.board2d-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  margin-bottom: 16px;
}

.board2d-toolbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.board2d-status-filter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.board2d-filter-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.board2d-status-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.board2d-status-pills .filter-pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.board2d-status-pills .filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.board2d-status-pills .filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.25);
}

.board2d-status-pills .filter-pill.pill-incomplete {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
  font-weight: 700;
}

.board2d-status-pills .filter-pill.pill-incomplete.active {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.board2d-status-pills .filter-pill.pill-notstarted {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}

.board2d-status-pills .filter-pill.pill-notstarted.active {
  background: #64748b;
  color: #ffffff;
  border-color: #64748b;
  box-shadow: 0 2px 6px rgba(100, 116, 139, 0.3);
}

.board2d-status-pills .filter-pill.pill-complete {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.board2d-status-pills .filter-pill.pill-complete.active {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.board2d-view-toggle {
  margin: 0;
  display: inline-flex;
}

.board2d-view-toggle button {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
}

.board2d-toolbar-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.board2d-search-box {
  flex: 1;
  min-width: 260px;
}

.board2d-search-box input {
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 13px;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.board2d-search-box input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.board2d-province-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board2d-province-box .prov-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.board2d-province-box select {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  background: #ffffff;
}

/* Matrix Table Styling */
.board2d-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow-x: auto;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  position: relative;
  max-width: 100%;
}

.board2d-matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  table-layout: auto;
}

.board2d-matrix-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  padding: 10px 8px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  font-size: 12px;
}

.board2d-matrix-table td {
  padding: 8px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

/* Sticky Column 1 (#) and Column 2 (Plot / Farmer) */
.board2d-matrix-table .col-sticky-1 {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 38px;
  min-width: 38px;
  max-width: 45px;
  background: #ffffff;
}

.board2d-matrix-table th.col-sticky-1 {
  background: #f8fafc;
  z-index: 6;
}

.board2d-matrix-table .col-sticky-2 {
  position: sticky;
  left: 38px;
  z-index: 5;
  min-width: 170px;
  max-width: 220px;
  background: #ffffff;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.04);
}

.board2d-matrix-table th.col-sticky-2 {
  background: #f8fafc;
  z-index: 6;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.04);
}

.board2d-row:hover td.col-sticky-1,
.board2d-row:hover td.col-sticky-2 {
  background: #f8fafc;
}

.board-row-incomplete {
  background: #fffdf5;
}

.board-row-incomplete:hover {
  background: #fffbeb;
}

.board-row-incomplete td.col-sticky-1,
.board-row-incomplete td.col-sticky-2 {
  background: #fffdf5;
}

.board-row-incomplete:hover td.col-sticky-1,
.board-row-incomplete:hover td.col-sticky-2 {
  background: #fffbeb;
}

/* Province Badges */
.prov-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  white-space: nowrap;
}

.prov-pill-ratchaburi {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.prov-pill-nakhon_pathom {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.prov-pill-samut_sakhon {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}

.prov-pill-samut_songkhram {
  background: #ccfbf1;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

/* Progress Bars */
.board-progress-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 110px;
}

.board-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.board-progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.board-progress-bar-fill.fill-green {
  background: linear-gradient(90deg, #10b981, #059669);
}

.board-progress-bar-fill.fill-orange {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.board-progress-bar-fill.fill-gray {
  background: #cbd5e1;
}

.board-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink);
}

/* Sample point columns & clean non-emoji buttons */
.col-pt {
  width: 52px;
  min-width: 50px;
  max-width: 58px;
  padding: 4px 2px !important;
}

.board-point-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 46px;
  padding: 4px 2px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #ffffff;
}

.board-point-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.board-point-btn .pt-badge-row {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1;
}

.board-point-btn .pt-sym {
  font-size: 11px;
  font-weight: 800;
}

.board-point-btn .pt-val {
  font-size: 11px;
  font-weight: 700;
}

.board-point-btn.pt-done {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.board-point-btn.pt-done:hover {
  background: #d1fae5;
  border-color: #10b981;
}

.board-point-btn.pt-partial {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
  box-shadow: 0 1px 2px rgba(245, 158, 11, 0.1);
}

.board-point-btn.pt-partial:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

.board-point-btn.pt-missing {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
}

.board-point-btn.pt-missing:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #475569;
}

.board-point-btn .pt-sub-tag {
  font-size: 8.5px;
  font-weight: 700;
  color: #d97706;
  white-space: nowrap;
  margin-top: 1px;
  line-height: 1;
}

/* Status Chips */
.status-chip {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  display: inline-block;
  white-space: nowrap;
}

.status-chip.chip-complete {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-chip.chip-incomplete {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-chip.chip-notstarted {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Missing Summary Box */
.board-summary-box {
  width: 100%;
  max-width: 220px;
  font-size: 11.5px;
  line-height: 1.35;
}

.summary-title-complete {
  color: #15803d;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.summary-check-icon {
  background: #10b981;
  color: #ffffff;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
}

.summary-box-notstarted {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-pending-label {
  color: #64748b;
  font-weight: 600;
}

.summary-sub-gray {
  color: #94a3b8;
  font-size: 10.5px;
}

.summary-box-incomplete {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-warn-header {
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-pending-count {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.summary-pts-count {
  color: #b45309;
  font-size: 10.5px;
  font-weight: 600;
}

.missing-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 220px;
}

.m-pill {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.m-pill.m-pill-empty {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.m-pill.m-pill-part {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #ffedd5;
}

.summary-cuts-pill {
  font-size: 10.5px;
  color: #475569;
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Action button */
.board-inspect-btn {
  padding: 4px 10px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  white-space: nowrap;
  border-radius: 6px !important;
}

/* 2D Garden Cards Grid */
.board2d-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.board2d-plot-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.board2d-plot-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.board2d-plot-card.card-status-complete {
  border-left: 4px solid #10b981;
}

.board2d-plot-card.card-status-incomplete {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}

.board2d-plot-card.card-status-not_started {
  border-left: 4px solid #94a3b8;
}

.plot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.plot-card-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--primary-strong);
}

.plot-card-meta {
  display: flex;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  flex-wrap: wrap;
}

.card-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
}

.card-status-badge.badge-green {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.card-status-badge.badge-amber {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.card-status-badge.badge-slate {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* 2D Botanical Garden Clusters */
.garden-cluster-map {
  background: #f9fbf9;
  border: 1px solid #e2ece5;
  border-radius: 10px;
  padding: 12px;
}

.garden-map-title {
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 8px;
}

.garden-clusters-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.garden-point-cluster {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 3px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.garden-point-cluster:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.garden-point-cluster.cluster-done {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.garden-point-cluster.cluster-partial {
  background: #fffbeb;
  border-color: #fde68a;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.garden-point-cluster.cluster-missing {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.cluster-label {
  font-size: 10px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 3px;
}

.cluster-trees-grid {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-bottom: 3px;
}

.tree-mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.tree-mini-dot.tree-dot-checked {
  background: #10b981;
}

.tree-mini-dot.tree-dot-missing {
  background: #f59e0b;
}

.cluster-status-text {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
}

.garden-map-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.green {
  background: #10b981;
}

.legend-dot.amber {
  background: #f59e0b;
}

/* Card Footer */
.plot-card-footer {
  margin-top: auto;
}

.card-progress-bar-wrap {
  margin-bottom: 8px;
}

.card-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.card-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.card-progress-fill.fill-green {
  background: #10b981;
}

.card-progress-fill.fill-orange {
  background: #f59e0b;
}

.card-progress-numbers {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.card-missing-alert {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: #92400e;
  line-height: 1.4;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .board2d-cards-grid {
    grid-template-columns: 1fr;
  }
  .garden-clusters-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .board2d-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ==========================================================================
   Form 1: Basic Plot & Farmer Information Styles (แบบฟอร์มที่ 1)
   ========================================================================== */

.form1-modal-box {
  width: min(880px, 96vw) !important;
  max-height: 92vh !important;
  border-radius: 18px !important;
  padding: 24px 28px !important;
}

.form1-modal-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.3px;
  border: 1px solid #bbf7d0;
}

.form1-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
}

.form1-section.system-section {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.form1-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary, #15803d);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.form1-grid-farmer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 768px) {
  .form-grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary, #15803d);
  box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.15);
  outline: none;
}

.coord-points-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .coord-points-grid {
    grid-template-columns: 1fr;
  }
}

.coord-point-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.coord-point-head {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
}

.coord-input-row {
  display: flex;
  gap: 10px;
}

.coord-input-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin: 0;
}

.form1-summary-bar {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #065f46;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   Official Form 1 Printable A4 Sheet Styles
   ========================================================================== */

.official-form-modal-box {
  width: min(860px, 96vw) !important;
  max-height: 94vh !important;
  background: #f1f5f9;
  padding: 20px !important;
}

.official-paper-sheet {
  background: #ffffff;
  max-width: 780px;
  margin: 0 auto;
  padding: 44px 50px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  color: #0f172a;
  font-size: 15px;
  line-height: 2.1;
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.official-header {
  text-align: center;
  margin-bottom: 28px;
}

.official-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
}

.official-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #334155;
  margin: 0;
}

.official-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.official-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 8px;
  row-gap: 6px;
}

.official-line .item-num {
  font-weight: 700;
  width: 20px;
}

.dotted-fill {
  border-bottom: 1.5px dotted #64748b;
  padding: 0 8px;
  font-weight: 600;
  color: #0f172a;
  display: inline-block;
  min-height: 22px;
}

@media print {
  body * {
    visibility: hidden;
  }
  #chalPlotOfficialFormModal,
  #chalPlotOfficialFormModal * {
    visibility: visible;
  }
  #chalPlotOfficialFormModal {
    position: absolute;
    inset: 0;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
  }
  .official-form-modal-box {
    box-shadow: none !important;
    background: transparent !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .official-paper-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 20mm 20mm !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  .no-print {
    display: none !important;
  }
}

/* ==========================================================================
   APP GLOBAL FOOTER & 3D BOTANICAL ATLAS WIDGET
   ========================================================================== */

.app-global-footer {
  margin-top: 36px;
  width: 100%;
}

.app-footer-card {
  background: linear-gradient(135deg, #063c2c 0%, #042f22 60%, #021e15 100%);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 20px;
  padding: 24px 28px 18px;
  color: #ecfdf5;
  box-shadow: 0 16px 38px rgba(3, 31, 23, 0.22);
  position: relative;
  overflow: hidden;
}

.app-footer-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

.footer-3d-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-3d-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 500px;
}

.footer-3d-badge-icon {
  width: 52px;
  height: 52px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(6, 78, 59, 0.3);
}

.footer-3d-content {
  flex: 1;
}

.footer-3d-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #6ee7b7;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.footer-3d-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.footer-3d-desc {
  margin: 0;
  font-size: 13px;
  color: #a7f3d0;
  line-height: 1.5;
  opacity: 0.9;
}

.footer-3d-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-btn-3d {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font-weight: 600 !important;
  padding: 10px 18px !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  transition: all 0.2s ease !important;
  cursor: pointer;
  white-space: nowrap;
}

.footer-btn-3d:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45) !important;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%) !important;
}

.footer-btn-sub {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ecfdf5 !important;
  border: 1px solid rgba(167, 243, 208, 0.25) !important;
  font-weight: 500 !important;
  padding: 10px 16px !important;
  border-radius: 10px !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  cursor: pointer;
  white-space: nowrap;
}

.footer-btn-sub:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: rgba(167, 243, 208, 0.45) !important;
  color: #ffffff !important;
}

.footer-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  font-size: 12.5px;
  color: #93c5ae;
  flex-wrap: wrap;
}

.footer-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-emblem {
  font-weight: 700;
  color: #d1fae5;
}

.footer-dot {
  opacity: 0.6;
}

.footer-meta-right {
  font-size: 12px;
  opacity: 0.85;
}

/* ============================================================================
   Form 1 Plot Map (Leaflet) — แผนที่พิกัดแปลงเกษตรกร (แบบที่ 1)
   Leaflet 1.9.4 + Leaflet.markercluster vendored in /vendor/leaflet/
   ========================================================================== */

.plot-map-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px dashed var(--line);
}

.plot-map-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  margin: 4px 0 14px;
  max-width: 920px;
}

.plot-map-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 30px rgba(9, 30, 22, 0.08);
}

.plot-map-container {
  position: relative;
  width: 100%;
  height: 500px;
  background: #dde9e3;
  font-family: inherit;
}

.plot-map-container .leaflet-container {
  font: inherit;
  background: #dde9e3;
}

/* Fullscreen toggle ------------------------------------------------------- */
.plot-map-container.pm-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 3000;
  border-radius: 0;
}

/* Base Leaflet controls restyle ------------------------------------------- */
.plot-map-container .leaflet-bar {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(9, 30, 22, 0.12);
}

.plot-map-container .leaflet-bar a {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  border-radius: 0;
}

.plot-map-container .leaflet-bar a:first-child { border-radius: 9px 9px 0 0; }
.plot-map-container .leaflet-bar a:last-child { border-radius: 0 0 9px 9px; border-bottom: none; }

.plot-map-container .leaflet-bar a:hover {
  background: #f1f6f3;
  color: var(--primary-strong);
}

.plot-map-container .leaflet-touch .leaflet-bar a {
  width: 30px;
  height: 30px;
  line-height: 30px;
}

.plot-map-container .leaflet-control-layers {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(9, 30, 22, 0.12);
  font-family: inherit;
  font-size: 12px;
}

.plot-map-container .leaflet-control-layers-expanded {
  padding: 8px 12px;
  color: var(--ink);
  max-height: 260px;
  max-width: 210px;
  overflow-y: auto;
}

/* Reset the app-wide `input, select` sizing so Leaflet's native
   radio/checkbox inputs stay small instead of ballooning to 44px. */
.plot-map-container .leaflet-control-layers input {
  width: auto;
  min-height: 0;
  height: 15px;
  margin: 0 6px 0 0;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  accent-color: var(--primary);
  flex: 0 0 auto;
  cursor: pointer;
}

.plot-map-container .leaflet-control-layers input:focus {
  outline: 2px solid rgba(22, 122, 85, 0.35);
  outline-offset: 1px;
}

.plot-map-container .leaflet-control-layers-expanded > span {
  display: flex;
  align-items: center;
}

.plot-map-container .leaflet-control-layers-expanded label {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 3px 0;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
}

.plot-map-container .leaflet-control-layers-expanded label:hover {
  background: var(--primary-soft);
}

/* Section headings inside the expanded panel (basemap / overlays). */
.plot-map-container .leaflet-control-layers-divider {
  border-top: 1px dashed var(--line);
  margin: 7px 0 5px;
}

.plot-map-container .leaflet-control-layers-expanded .leaflet-control-layers-separator {
  border-top: 1px dashed var(--line);
  margin: 7px 0 5px;
}

.plot-map-container .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85);
  font-size: 10px;
  color: var(--muted);
  border-radius: 8px 0 0 0;
}

.plot-map-container .leaflet-control-attribution a {
  color: var(--primary-strong);
}

.plot-map-container .leaflet-control-scale-line {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--line);
  color: var(--ink);
  font-size: 10px;
}

/* Shared custom-control chrome -------------------------------------------- */
.pm-control {
  border: none;
  background: transparent;
  box-shadow: none;
  margin: 0;
  padding: 0;
  font-family: inherit;
}

/* Plot pin markers -------------------------------------------------------- */
.pm-pin-wrap {
  background: transparent;
  border: none;
}

.pm-pin {
  position: relative;
  border-radius: 50%;
  background: var(--pin, #15803d);
  border: 2.5px solid #fff;
  box-shadow: 0 4px 10px rgba(9, 30, 22, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.pm-pin::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--pin, #15803d);
  border-right: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 0 0 3px 0;
}

.pm-pin-emoji {
  font-size: 15px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

.pm-pin-wrap:hover .pm-pin {
  transform: scale(1.14);
}

/* Hover tooltips ---------------------------------------------------------- */
.leaflet-tooltip.pm-tooltip {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.leaflet-tooltip-top.pm-tooltip::before {
  display: none;
}

/* Thin, unobtrusive tooltip for the province boundary lines. */
.leaflet-tooltip.pm-boundary-tooltip {
  background: rgba(15, 118, 110, 0.92);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  box-shadow: 0 3px 10px rgba(9, 30, 22, 0.25);
  pointer-events: none;
}

.leaflet-tooltip-top.pm-boundary-tooltip::before {
  border-top-color: rgba(15, 118, 110, 0.92);
}

.pm-tip {
  min-width: 205px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-top: 3px solid var(--pin, #15803d);
  border-radius: 12px;
  padding: 9px 12px;
  box-shadow: 0 10px 26px rgba(9, 30, 22, 0.18);
  font-size: 12px;
  color: var(--ink);
  pointer-events: none;
}

.pm-tip-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.pm-tip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pin, #15803d);
  flex: none;
}

.pm-tip-sub {
  color: var(--muted);
  font-size: 11px;
  margin: 2px 0 6px;
}

.pm-tip-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
}

.pm-tip-grid span { color: var(--muted); }
.pm-tip-grid b { text-align: right; font-weight: 600; }

/* Click popups ------------------------------------------------------------ */
.leaflet-popup.pm-popup {
  background: transparent;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(9, 30, 22, 0.22);
}

.leaflet-popup.pm-popup .leaflet-popup-content-wrapper {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  overflow: visible;
}

.leaflet-popup.pm-popup .leaflet-popup-content {
  margin: 0;
  width: auto !important;
  line-height: 1.45;
  font-family: inherit;
}

.leaflet-popup.pm-popup .leaflet-popup-tip-container {
  display: none;
}

.pm-popup .leaflet-popup-close-button {
  color: var(--muted);
  font: 20px/22px Tahoma, sans-serif;
  padding: 5px 7px 0 0;
}

.pm-popup .leaflet-popup-close-button:hover {
  color: var(--ink);
}

.pm-pop {
  width: 300px;
  max-width: calc(100vw - 60px);
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--pin, #15803d);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
}

.pm-pop-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.pm-pop-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pin, #15803d);
  margin-top: 4px;
  flex: none;
}

.pm-pop-head strong {
  font-size: 14px;
  color: var(--primary-strong);
}

.pm-pop-sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

.pm-pop-coord {
  font-size: 11px;
  background: #f1f6f3;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  margin: 8px 0;
  color: #33473e;
  font-variant-numeric: tabular-nums;
}

.pm-pop-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  font-size: 12px;
  max-height: 210px;
  overflow-y: auto;
}

.pm-pop-grid span { color: var(--muted); }
.pm-pop-grid b { text-align: right; font-weight: 600; word-break: break-word; }

.pm-pop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.pm-pop-actions button {
  flex: 1 1 44%;
  border: 1px solid var(--line);
  background: #f7fbf8;
  color: var(--primary-strong);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.pm-pop-actions button:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

/* Cluster icons ----------------------------------------------------------- */
.pm-cluster-wrap {
  background: transparent;
  border: none;
}

.pm-cluster {
  border-radius: 50%;
  background: var(--pin, #15803d);
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 14px rgba(9, 30, 22, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.pm-cluster:hover {
  transform: scale(1.08);
}

/* Permanent name labels (off by default, zoom ≥ 13) ----------------------- */
.pm-label-icon {
  background: transparent;
  border: none;
}

.pm-label-icon span {
  display: inline-block;
  transform: translate(-50%, -175%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pin, #15803d);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(9, 30, 22, 0.15);
  white-space: nowrap;
  pointer-events: none;
}

.pm-label-icon.pm-label-hidden {
  display: none;
}

/* Search control (top-left) ----------------------------------------------- */
.pm-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 10px;
  box-shadow: 0 4px 14px rgba(9, 30, 22, 0.12);
}

.pm-search-icon {
  font-size: 13px;
  line-height: 1;
}

.pm-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  width: 190px;
}

.pm-search input::placeholder {
  color: var(--muted);
}

/* Summary control (top-right) --------------------------------------------- */
.pm-summary {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 4px 14px rgba(9, 30, 22, 0.12);
  font-size: 12px;
  color: var(--ink);
  min-width: 158px;
}

.pm-summary-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--primary-strong);
  margin-bottom: 3px;
}

.pm-summary-line b {
  font-variant-numeric: tabular-nums;
}

.pm-summary-missing {
  color: #b45309;
  font-size: 11px;
  margin-top: 3px;
}

/* Legend (bottom-right) --------------------------------------------------- */
.pm-legend {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 4px 14px rgba(9, 30, 22, 0.12);
  font-size: 12px;
  color: var(--ink);
}

.pm-legend-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--primary-strong);
  margin-bottom: 4px;
}

.pm-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 1px 0;
}

.pm-legend-row.is-empty {
  opacity: 0.45;
}

.pm-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pin, #15803d);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  flex: none;
}

.pm-legend-count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Live coordinate readout (bottom-left) ----------------------------------- */
.pm-coords {
  background: rgba(12, 32, 25, 0.82);
  color: #eafff5;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.pm-coords-hint {
  opacity: 0.75;
}

/* View tools (bottom-right) ----------------------------------------------- */
.pm-view-tools {
  display: flex;
  gap: 6px;
}

.pm-tool-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--primary-strong);
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(9, 30, 22, 0.12);
  transition: background 0.15s ease, color 0.15s ease;
}

.pm-tool-btn:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

/* Empty state overlay ----------------------------------------------------- */
.pm-empty {
  position: absolute;
  inset: 0;
  z-index: 800;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: rgba(238, 244, 241, 0.88);
  border-radius: 14px;
  pointer-events: none;
}

.pm-empty.visible {
  display: flex;
}

.pm-empty span {
  display: block;
  font-size: 40px;
  margin-bottom: 6px;
}

.pm-empty p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.pm-empty small {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

/* Mobile ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .plot-map-container {
    height: 340px;
  }

  .pm-search input {
    width: 130px;
  }

  .pm-summary,
  .pm-legend {
    font-size: 11px;
    padding: 6px 10px;
  }

  .pm-pop {
    width: 240px;
  }

  .pm-tip {
    min-width: 170px;
  }
}

/* ==========================================================================
   MOBILE & TOUCH EXPERIENCE OPTIMIZATIONS (max-width: 768px)
   These styles apply ONLY to mobile screens and leave desktop (PC) 100% intact.
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Base Layout & Shell Main */
  .shell-main {
    width: calc(100% - 20px) !important;
    padding: 12px 0 32px !important;
  }

  /* 2. Top Shell Header */
  .shell-header {
    padding: 10px 14px !important;
    gap: 8px !important;
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .brand-block {
    gap: 10px !important;
    align-items: center !important;
  }

  .brand-mark {
    width: 42px !important;
    height: 38px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .brand-block h1 {
    font-size: 16px !important;
    line-height: 1.2 !important;
  }

  .brand-block .agency-line {
    font-size: 11px !important;
    margin-bottom: 1px !important;
  }

  .brand-block p:last-child {
    font-size: 11px !important;
    line-height: 1.3 !important;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .session-block {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-top: 6px !important;
    margin-top: 2px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
  }

  .session-block span {
    font-size: 11.5px !important;
  }

  .session-block button {
    padding: 4px 10px !important;
    font-size: 11.5px !important;
    min-height: 32px !important;
  }

  /* 3. Mode Navigation Bar (Quality Mode vs Challenge Mode Switcher) */
  .mode-navigation-bar {
    position: static !important;
    padding: 8px 12px !important;
    top: auto !important;
  }

  .mode-navigation-inner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .mode-switch-title {
    font-size: 11px !important;
    letter-spacing: 0.3px !important;
  }

  .mode-switcher-pill {
    flex-direction: column !important;
    width: 100% !important;
    gap: 4px !important;
    padding: 4px !important;
  }

  .mode-btn {
    width: 100% !important;
    padding: 8px 10px !important;
    gap: 8px !important;
  }

  .mode-icon {
    font-size: 18px !important;
  }

  .mode-name {
    font-size: 12.5px !important;
  }

  .mode-desc {
    font-size: 10.5px !important;
  }

  .badge-new-mode {
    font-size: 9px !important;
    padding: 1px 6px !important;
    margin-left: auto !important;
    align-self: center !important;
  }

  /* 4. Tab Navigation (Quality & Challenge Menus) */
  .tabs {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 6px !important;
    padding: 6px 4px !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    box-shadow: var(--shadow-soft) !important;
  }

  .tabs::-webkit-scrollbar {
    display: none !important;
  }

  .tab {
    flex: 0 0 auto !important;
    min-width: max-content !important;
    white-space: nowrap !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    min-height: 38px !important;
    border-radius: 8px !important;
    touch-action: manipulation !important;
  }

  /* 5. Panels & Headers */
  .panel {
    padding: 16px 14px !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
  }

  .section-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
  }

  .section-head h2 {
    font-size: 20px !important;
    line-height: 1.25 !important;
  }

  .section-head-right,
  .dashboard-actions,
  .audit-section-head {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }

  .dashboard-actions .button,
  .section-head-right .button {
    flex: 1 1 auto !important;
    min-width: calc(50% - 6px) !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
  }

  /* 6. Login View */
  .login-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .login-copy {
    min-height: auto !important;
    padding: 22px 18px !important;
    border-radius: 12px !important;
  }

  .copy-content {
    padding: 0 !important;
  }

  .copy-content h2 {
    font-size: 22px !important;
    line-height: 1.25 !important;
  }

  .copy-content p:last-child {
    font-size: 13.5px !important;
    line-height: 1.5 !important;
    margin-top: 10px !important;
  }

  .agency-badge {
    font-size: 11px !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    margin-bottom: 12px !important;
  }

  .login-panel {
    padding: 20px 16px !important;
    border-radius: 12px !important;
  }

  .agency-card {
    padding: 10px !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .mini-emblem {
    width: 40px !important;
    height: 40px !important;
    font-size: 11px !important;
  }

  .login-panel h2 {
    font-size: 20px !important;
  }

  /* 7. Form Grids & Entry Inputs */
  .entry-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .grades-container {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .grade-card {
    padding: 14px 12px !important;
    border-radius: 10px !important;
  }

  .grade-card-fields {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .stepper-wrap .step-btn {
    min-width: 44px !important;
    height: 44px !important;
    font-size: 20px !important;
  }

  .stepper-wrap .stepper-input {
    font-size: 16px !important;
    height: 44px !important;
  }

  .completion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  /* 8. Stat Cards & Challenge KPIs */
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .stat {
    padding: 12px 14px !important;
  }

  .metric-label {
    font-size: 11px !important;
  }

  .metric-value {
    font-size: 22px !important;
  }

  .chal-kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .kpi-card {
    padding: 12px 14px !important;
    gap: 12px !important;
  }

  .kpi-icon {
    width: 42px !important;
    height: 42px !important;
    font-size: 22px !important;
  }

  /* 9. Visual Panels, Charts & Economy Grids */
  .visual-panel {
    padding: 14px 12px !important;
    border-radius: 10px !important;
  }

  .chal-2col-grid,
  .chal-dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .province-assumptions-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .econ-inputs {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .econ-inputs label {
    min-width: 100% !important;
  }

  /* 10. Tables & Wrappers */
  .table-wrap,
  .macro-table-wrap,
  .matrix-table-wrap,
  .timeline-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 10px !important;
  }

  table {
    font-size: 12px !important;
  }

  th,
  td {
    padding: 8px 10px !important;
  }

  .point-tabs-bar,
  .tree-tabs-bar {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    padding-bottom: 6px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .point-tab-btn,
  .tree-tab-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    min-height: 36px !important;
  }

  /* 11. Form Grids for Challenge Modals */
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .form1-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    padding: 16px 12px !important;
    border-radius: 12px !important;
  }

  .form1-section {
    padding: 12px 10px !important;
    border-radius: 10px !important;
    margin-top: 10px !important;
  }

  .coord-points-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* 12. Modal Backdrops & Cards */
  .modal-backdrop {
    padding: 8px !important;
  }

  .modal-card,
  .modal-box,
  .official-form-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    padding: 14px 12px !important;
    border-radius: 14px !important;
    margin: 0 !important;
  }

  .modal-head {
    padding: 10px 12px !important;
    margin-bottom: 12px !important;
  }

  .modal-head h3 {
    font-size: 15px !important;
  }

  .modal-body {
    padding: 12px 10px !important;
  }

  .modal-actions {
    padding: 12px 10px !important;
    flex-direction: column-reverse !important;
    gap: 8px !important;
    margin-top: 14px !important;
  }

  .modal-actions .button {
    width: 100% !important;
    min-height: 42px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .official-paper-sheet {
    padding: 20px 14px !important;
    font-size: 13.5px !important;
    line-height: 1.8 !important;
  }

  .report-kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* 13. 2D Board & Garden Overview */
  .board2d-toolbar {
    padding: 12px 10px !important;
    gap: 10px !important;
  }

  .board2d-toolbar-main {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .board2d-status-filter-wrap {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .board2d-status-pills {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    padding-bottom: 4px !important;
    gap: 6px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .board2d-status-pills .filter-pill {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 11.5px !important;
    padding: 6px 10px !important;
  }

  .board2d-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .board2d-plot-card {
    padding: 14px 12px !important;
    border-radius: 12px !important;
  }

  /* 14. Anomaly List & Audit Trails */
  .audit-section-panel {
    padding: 14px 12px !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
  }

  .filter-pills {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    padding-bottom: 4px !important;
    gap: 6px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .filter-pill {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 11.5px !important;
    padding: 6px 10px !important;
  }

  .anomaly-item-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 12px !important;
  }

  .btn-anomaly-jump {
    width: 100% !important;
    justify-content: center !important;
    min-height: 40px !important;
  }

  .draft-notice {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* 15. Knowledge Hub & Articles */
  .coconut-topic-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .coconut-topic-card {
    padding: 16px 14px !important;
  }

  .tab-guide-box {
    padding: 16px 14px !important;
    margin-top: 20px !important;
  }

  .tab-guide-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* 16. App Global Footer & 3D Widget */
  .app-global-footer {
    margin-top: 24px !important;
  }

  .app-footer-card {
    padding: 18px 16px 14px !important;
    border-radius: 16px !important;
  }

  .footer-3d-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding-bottom: 14px !important;
  }

  .footer-3d-main {
    flex: 1 1 100% !important;
    width: 100% !important;
    gap: 12px !important;
  }

  .footer-3d-badge-icon {
    width: 44px !important;
    height: 44px !important;
    font-size: 22px !important;
    border-radius: 12px !important;
  }

  .footer-3d-title {
    font-size: 15px !important;
  }

  .footer-3d-desc {
    font-size: 12px !important;
    line-height: 1.45 !important;
  }

  .footer-3d-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .footer-btn-3d,
  .footer-btn-sub {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
  }

  .footer-meta-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    padding-top: 12px !important;
    font-size: 11px !important;
  }
}

/* ==========================================================================
   EXTRA SMALL MOBILE SCREENS (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .shell-header {
    padding: 8px 10px !important;
  }

  .brand-block h1 {
    font-size: 15px !important;
  }

  .stats {
    grid-template-columns: 1fr !important;
  }

  .completion-grid {
    grid-template-columns: 1fr !important;
  }

  .report-kpi-row {
    grid-template-columns: 1fr !important;
  }

  .grade-card-fields {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .garden-clusters-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}



/* ==========================================================================
   Forecast Workspace Split (Sidebar + 16:9 Main Area)
   ========================================================================== */
.forecast-workspace-split {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}

.forecast-sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 4px;
}

.f-sidebar-card {
  background: #ffffff;
  border: 1px solid #d5e5dc;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.f-sidebar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 8px;
}

.f-sidebar-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.f-sidebar-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: 13px;
  background: #f8fafc;
  color: var(--ink);
  box-sizing: border-box;
}

.f-sidebar-select:focus {
  border-color: var(--primary);
  outline: none;
  background: #ffffff;
}

.f-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.f-sidebar-progress {
  font-size: 11px;
  font-weight: 700;
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 8px;
  line-height: 1.4;
}

/* 7 Sample Points in Sidebar: compact 2-column grid */
.forecast-sidebar-panel .point-tabs-bar {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 5px !important;
  overflow: visible !important;
  flex-wrap: wrap !important;
  padding-bottom: 0 !important;
}

.forecast-sidebar-panel .point-tab-btn {
  width: 100% !important;
  justify-content: space-between !important;
  padding: 6px 8px !important;
  font-size: 12px !important;
  min-height: auto !important;
}

.forecast-sidebar-panel .point-tab-btn:last-child:nth-child(odd) {
  grid-column: span 2;
}

/* 5 Trees in Sidebar: full-width vertical list */
.forecast-sidebar-panel .tree-tabs-bar {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  margin-bottom: 0 !important;
  overflow: visible !important;
  flex-wrap: nowrap !important;
  padding-bottom: 0 !important;
}

.forecast-sidebar-panel .tree-tab-btn {
  width: 100% !important;
  justify-content: flex-start !important;
  padding: 7px 10px !important;
  font-size: 12.5px !important;
  min-height: auto !important;
}

/* Right Main Workspace (16:9 screen space) */
.forecast-main-workspace {
  min-width: 0;
  width: 100%;
}

@media (max-width: 1100px) {
  .forecast-workspace-split {
    grid-template-columns: 1fr;
  }
  .forecast-sidebar-panel {
    position: static;
    max-height: none;
  }
  .forecast-sidebar-panel .point-tabs-bar {
    display: flex !important;
    overflow-x: auto !important;
  }
  .forecast-sidebar-panel .tree-tabs-bar {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
  }
}

/* ==========================================
   Year 2569 / Year-switching Matrix Styles
   ========================================== */
.matrix-row-month.month-row-disabled {
  background: #f8fafc !important;
}

.matrix-sticky-col.month-disabled-label {
  background: #f1f5f9 !important;
  color: #94a3b8 !important;
}

.matrix-cell.cell-disabled-2569 {
  background: #f1f5f9 !important;
  cursor: not-allowed !important;
}

.matrix-input.matrix-input-disabled,
.matrix-input:disabled {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  opacity: 0.65 !important;
  box-shadow: none !important;
}

.f-year-select:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.year-notice-banner {
  animation: fadeInNotice 0.3s ease;
}

@keyframes fadeInNotice {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   Save Action Bar & Live Status Toast Styles
   ========================================== */
@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes pulseDotAmber {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.status-pulse-dot {
  animation: pulseDot 2s infinite;
}

.status-pulse-dot.dirty {
  background: #f59e0b !important;
  animation: pulseDotAmber 1.5s infinite;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(60px) scale(0.92); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.chal-save-toast {
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.18), 0 8px 10px -6px rgba(0,0,0,0.12) !important;
}
