:root {
  color-scheme: light;
  --bg: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel-line: #244c39;
  --panel-line-soft: #3b6452;
  --panel-line-subtle: #9db5aa;
  --surface: #ffffff;
  --surface-soft: #ffffff;
  --surface-strong: #f1f5f9;
  --sidebar: #1b3b2b;
  --accent: #2e7d32;
  --accent-strong: #1b3b2b;
  --blue: #285f86;
  --amber: #d97706;
  --danger: #b91c1c;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: var(--sidebar);
}

.login-screen.is-hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 10px;
  color: var(--ink);
}

.login-brand p {
  color: var(--muted);
}

.login-status {
  min-height: 20px;
  color: var(--danger);
  font-weight: 800;
}

.app-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.42);
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-dialog-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--panel-line-soft);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
  padding: 22px;
}

.app-dialog-head h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  color: var(--ink);
}

.app-dialog-text {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.app-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.app-shell.is-hidden {
  display: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  padding: 28px 22px;
  background: var(--sidebar);
  color: #f7fbf0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow: hidden;
  transition: padding 180ms ease, gap 180ms ease;
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.sidebar-brand-text {
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
}

.sidebar-toggle {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f7fbf0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 180ms ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(124, 179, 66, 0.4);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.sidebar-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.nav-list {
  display: grid;
  gap: 18px;
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group-toggle {
  width: 100%;
  min-height: 36px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-group-toggle:hover,
.nav-group-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.nav-group-caret {
  font-size: 0.9rem;
  transition: transform 160ms ease;
}

.nav-group:not(.expanded) .nav-group-caret {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: grid;
  gap: 6px;
}

.nav-group:not(.expanded) .nav-group-items {
  display: none;
}

.nav-link {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
  font-weight: 800;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(46, 125, 50, 0.9);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(124, 179, 66, 0.18);
}

.storage-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  line-height: 1.45;
}

.storage-note span {
  color: #dce9d4;
}

.sidebar-bottom {
  margin-top: auto;
}

.backup-nav {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.workspace {
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 22px;
  min-width: 0;
}

.topbar,
.page,
.recorder-panel,
.context-panel,
.output-panel,
.repository-panel,
.model-panel {
  background: var(--surface);
  border: 2px solid var(--panel-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 88px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 24px 12px;
  gap: 18px;
}

.app-shell.sidebar-collapsed .sidebar-head {
  flex-direction: column;
  align-items: center;
}

.app-shell.sidebar-collapsed .brand {
  width: 100%;
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-brand-text,
.app-shell.sidebar-collapsed .nav-group-toggle span:first-child,
.app-shell.sidebar-collapsed .nav-link,
.app-shell.sidebar-collapsed .backup-nav {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  width: 44px;
  min-width: 44px;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

.app-shell.sidebar-collapsed .nav-list {
  gap: 10px;
  padding-right: 0;
}

.app-shell.sidebar-collapsed .nav-group {
  justify-items: center;
}

.app-shell.sidebar-collapsed .nav-group-toggle {
  width: 44px;
  min-height: 44px;
  padding: 0;
  justify-content: center;
}

.app-shell.sidebar-collapsed .nav-group-caret {
  margin: 0;
}

.app-shell.sidebar-collapsed .nav-group.expanded .nav-group-caret {
  transform: rotate(0deg);
}

.app-shell.sidebar-collapsed .nav-group-items {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-bottom {
  display: flex;
  justify-content: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: var(--sidebar);
  color: #fff;
  border-color: rgba(46, 125, 50, 0.28);
}

.topbar-actions,
.record-actions,
.filters,
.field-pair {
  display: flex;
  gap: 10px;
}

.current-user {
  align-self: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  font-weight: 800;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7cb342;
  margin-right: 8px;
}

.page {
  display: none;
  padding: 28px;
}

#recordEditorHost {
  margin-top: 16px;
}

.editor-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.page.active {
  display: block;
}

.page-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 18px;
}

.page-toolbar-nav {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -4px 0 18px;
}

.page-nav-button-right {
  margin-left: auto;
}

.field-setup-subpage.is-hidden {
  display: none;
}

.widget-library-create-panel {
  margin-bottom: 10px;
  padding: 16px;
}

.widget-library-edit-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.ai-draft-generated-preview {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.ai-draft-generated-preview textarea {
  min-height: 220px;
}

.ai-draft-evidence-usage {
  padding: 12px 14px;
  border: 1px solid #9fc7a8;
  border-radius: 8px;
  background: #f4fbf5;
  color: var(--ink);
}

.ai-draft-evidence-usage strong,
.ai-draft-evidence-usage p {
  display: block;
  margin: 0;
}

.ai-draft-evidence-usage p {
  margin-top: 4px;
  color: var(--muted);
}

.ai-draft-evidence-usage ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.ai-drafting-tools-panel {
  margin-bottom: 18px;
}

.page-nav-button {
  min-width: 220px;
  min-height: 44px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.page-nav-button:hover,
.page-nav-button:focus-visible {
  background: var(--accent-strong);
  color: #ffffff;
}

.page-nav-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.4);
}

.load-entry-button {
  min-width: 220px;
  min-height: 44px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.load-entry-button:hover,
.load-entry-button:focus-visible {
  background: var(--accent-strong);
  color: #ffffff;
}

.load-entry-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.4);
}

.page-head {
  max-width: 760px;
  margin-bottom: 24px;
}

.page-head span {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.page-head h2 {
  margin: 8px 0 8px;
  font-size: 2rem;
  line-height: 1.12;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.status-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 800;
}

.report-generation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.page-nav-button-compact {
  min-width: auto;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.report-widget-library-nav-tab {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.staffing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.staffing-form,
.staffing-panel {
  padding: 18px;
}

.staffing-summary-panel {
  margin-top: 18px;
  padding: 18px;
  display: grid;
  gap: 18px;
}

.staffing-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 110px 110px;
  gap: 10px 12px;
  align-items: center;
}

.staffing-grid-current-only {
  grid-template-columns: minmax(220px, 1.4fr) 110px;
}

.staffing-grid-head {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.staffing-role-label {
  display: grid;
  gap: 4px;
}

.staffing-role-label span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.staffing-totals div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.staffing-totals span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.staffing-totals strong {
  display: block;
  margin-top: 6px;
}

.staffing-report-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.weeding-round-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 760px) {
  .weeding-round-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.embedded-tab {
  border: 1px solid var(--line);
  background: #f1f5f9;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
}

.embedded-tab.active {
  background: #ffffff;
  color: var(--accent-strong);
  border-color: rgba(46, 125, 50, 0.14);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.yield-pane-stack {
  display: grid;
  gap: 18px;
}

.yield-pane {
  display: none;
  gap: 18px;
}

.yield-pane.active {
  display: grid;
}

.staffing-summary-table.empty-state {
  padding: 18px;
}

.report-summary-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.report-summary-table caption {
  caption-side: top;
  text-align: left;
  padding: 14px 16px 10px;
  font-weight: 800;
  color: var(--ink);
}

.report-summary-table th,
.report-summary-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.report-summary-table thead th,
.report-summary-table tfoot th,
.report-summary-table tfoot td {
  background: var(--surface-soft);
  font-weight: 800;
}

.report-summary-table th:first-child,
.report-summary-table td:first-child,
.report-summary-table caption {
  text-align: left;
}

.report-summary-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.02);
}

.yield-average-table thead tr + tr th:first-child {
  text-align: center;
}

.report-summary-table-labour {
  min-width: 1320px;
}

.report-main-panel,
.report-preview-panel,
.report-history-panel,
.report-archive-panel {
  padding: 18px;
}

.report-main-panel {
  display: grid;
  gap: 18px;
}

.report-generation-form,
.report-editor-shell {
  display: grid;
  gap: 14px;
}

.ai-drafting-panel {
  display: grid;
  gap: 14px;
}

.ai-drafting-inline-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-top: 28px;
}

.ai-drafting-inline-toggle input {
  margin: 0;
}

.json-preview {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 120px;
  max-height: 420px;
}

.json-preview.empty-state {
  background: #ffffff;
  color: var(--muted);
}

.report-editor-shell {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.report-editor-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.report-editor-head h3 {
  margin: 0 0 4px;
}

.report-editor-head p {
  margin: 0;
  color: var(--muted);
}

.report-preview {
  min-height: 280px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.report-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.report-ai-launchers {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 2px;
}

.report-ai-launcher {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1b3b2b;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.report-ai-launcher:hover,
.report-ai-launcher:focus-visible {
  background: #2e7d32;
  color: #ffffff;
}

.report-translate-link {
  width: auto;
  min-width: 148px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.report-composer-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: stretch;
  min-height: 72vh;
}

.report-composer-layout.report-sections-collapsed {
  grid-template-columns: 46px minmax(0, 1fr) minmax(280px, 340px);
}

.pa-report-layout {
  min-height: 58vh;
}

#plantingAdvisorDecisionRows,
#plantingAdvisorOperationalTables,
#paSectionCanvas {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.pa-decision-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 1.5fr) minmax(200px, 1.5fr) auto;
  gap: 8px;
  align-items: start;
}

.pa-table-editor,
.pa-widget-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

.pa-table-editor h4,
.pa-widget-card h4 { margin: 0 0 10px; }
.pa-table-editor table { width: 100%; }
.pa-table-editor input { min-width: 90px; width: 100%; }
.pa-widget-card textarea { width: 100%; min-height: 110px; }

@media (max-width: 900px) {
  .pa-decision-row { grid-template-columns: 1fr; }
}

.report-column-toggle {
  min-width: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1;
}

.reviewed-report-editor-shell {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.reviewed-report-composer-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}

.reviewed-report-sidebar {
  display: grid;
  gap: 16px;
  align-self: start;
  position: sticky;
  top: 18px;
}

.reviewed-comments-list {
  display: grid;
  gap: 10px;
}

.reviewed-comment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.reviewed-comment-card.active {
  border-color: rgba(46, 125, 50, 0.28);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
}

.reviewed-comment-card h4,
.reviewed-comment-card p,
.reviewed-comment-card span {
  margin: 0;
}

.reviewed-comment-card p {
  margin-top: 8px;
  color: var(--ink);
  line-height: 1.5;
}

.reviewed-comment-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.report-navigation-column,
.report-widget-column {
  display: grid;
  align-self: stretch;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 120px);
}

.report-navigation-column {
  gap: 16px;
}

.report-navigation-column.report-column-collapsed {
  width: 46px;
}

.report-navigation-column.report-column-collapsed .report-navigation-panel {
  padding: 10px 8px;
}

.report-navigation-column.report-column-collapsed .form-section-title,
.report-navigation-column.report-column-collapsed .report-section-nav-list {
  display: none;
}

.report-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.report-panel-head .form-section-title {
  flex: 1;
}

.report-navigation-column.report-column-collapsed .report-panel-head {
  justify-content: center;
}

.report-widget-column {
  gap: 16px;
}

.report-navigation-panel,
.report-composer-panel,
.report-widget-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  display: grid;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.report-navigation-panel,
.report-widget-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.report-composer-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.report-section-nav-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.report-section-nav-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.report-section-nav-card.active {
  border-color: rgba(46, 125, 50, 0.28);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.09);
}

.report-section-nav-button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.report-section-nav-title {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.4;
}

.report-section-nav-count,
.report-section-nav-body p {
  color: var(--muted);
  font-size: 0.84rem;
}

.report-section-nav-body {
  padding: 0 14px 13px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.report-section-nav-body p {
  margin: 10px 0 0;
}

.report-composer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.report-composer-head-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.report-composer-head h4 {
  margin: 0 0 4px;
}

.report-composer-head p {
  margin: 0;
  color: var(--muted);
}

.report-section-canvas,
.report-widget-library {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.report-widget-card,
.report-library-card,
.report-preview-widget {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.report-widget-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.report-widget-card-sub {
  margin-top: 10px;
  margin-left: 18px;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.06);
}

.report-widget-caption-editor {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.report-widget-caption-editor input {
  min-width: 0;
}

.report-widget-image-caption-editors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.report-widget-head,
.report-library-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.report-widget-head-labels {
  display: grid;
  gap: 4px;
}

.report-widget-head-labels span {
  color: var(--muted);
  font-size: 0.84rem;
}

.report-library-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.report-library-group {
  display: grid;
  gap: 12px;
}

.report-library-group.collapsed .report-library-group-body {
  display: none;
}

.report-library-group + .report-library-group {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.report-library-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
}

.report-library-group-head p {
  grid-column: 1 / 2;
}

.report-library-group-toggle {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
  align-self: start;
  min-width: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  font-size: 0.72rem;
  line-height: 1;
}

.report-library-group-head h5 {
  margin: 0 0 4px;
  font-size: 0.94rem;
}

.report-library-group-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.report-library-meta span,
.report-widget-source,
.report-preview-empty {
  color: var(--muted);
  font-size: 0.88rem;
}

.report-library-sample-label {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.report-widget-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-widget-table-wrap.compact-field-table {
  width: fit-content;
  max-width: min(100%, 24rem);
}

.report-widget-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.report-widget-table-wrap.compact-field-table .report-widget-table {
  width: auto;
  min-width: 0;
  font-size: 0.84rem;
}

.report-widget-table-wrap.compact-field-table .report-widget-table th,
.report-widget-table-wrap.compact-field-table .report-widget-table td {
  padding: 7px 10px;
}

.report-widget-table th,
.report-widget-table td {
  padding: 9px 11px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-widget-table th {
  background: var(--surface-soft);
}

.report-widget-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-widget-attachment {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--accent-strong);
  font-size: 0.86rem;
  text-decoration: none;
}

.report-widget-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.record-image-grid,
.report-preview-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.record-image-thumb,
.report-widget-image-thumb,
.report-library-image-preview,
.report-preview-image-thumb {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  display: block;
}

.record-image-thumb img,
.report-widget-image-thumb img,
.report-library-image-preview img,
.report-preview-image-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.technical-image-editor {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.technical-image-editor h3,
.technical-image-editor h4 {
  margin: 0;
}

.technical-image-editor-groups {
  display: grid;
  gap: 14px;
}

.technical-image-editor-group {
  display: grid;
  gap: 4px;
}

.editable-record-image {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.editable-record-image a {
  display: block;
  overflow: hidden;
  border-radius: 6px;
}

.editable-record-image img {
  display: block;
  width: 100%;
  height: auto;
}

.editable-record-image span {
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  font-weight: 800;
}

.report-library-empty {
  min-height: 96px;
}

#widget-library .report-widget-library {
  margin-top: 16px;
}

.report-preview-sections {
  display: grid;
  gap: 16px;
}

.report-preview-section {
  display: grid;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.report-preview-section h4,
.report-preview-widget h5 {
  margin: 0;
}

.report-preview-widget {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.report-visual-caption {
  margin: 0 0 2px;
  color: var(--text);
  font-size: 0.92rem;
}

.report-preview-figure {
  display: grid;
  gap: 6px;
  margin: 0;
}

.report-preview h3 {
  margin-top: 0;
}

@media print {
  .report-preview-image-grid,
  .report-widget-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.report-context-grid,
.report-search-snippets,
.report-draft-meta {
  display: grid;
  gap: 12px;
}

.report-context-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-context-card,
.report-search-card,
.report-history-card,
.report-draft-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.report-context-card h4,
.report-history-card h4,
.report-draft-card h4,
.report-search-card h4 {
  margin: 0 0 8px;
}

.report-context-card p,
.report-history-card p,
.report-draft-card p,
.report-search-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.costing-review-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

.costing-review-layout.list-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.costing-review-list-column {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.costing-review-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.costing-review-list-head h4 {
  margin: 0;
}

.costing-review-list-column.is-collapsed {
  width: 72px;
}

.costing-review-list-column.is-collapsed #submittedAgronomyReportsList {
  display: none;
}

.costing-review-list-column.is-collapsed .costing-review-list-head {
  justify-items: center;
  display: grid;
}

.costing-review-list-column.is-collapsed .costing-review-list-head h4 {
  display: none;
}

.costing-review-panel,
.costing-review-content {
  display: grid;
  gap: 14px;
}

.costing-review-comments {
  display: grid;
  gap: 12px;
}

.coordinator-section-review-stack {
  display: grid;
  gap: 16px;
}

.coordinator-section-review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.coordinator-section-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.coordinator-section-comment-panel {
  display: grid;
  gap: 8px;
}

.coordinator-section-comment-panel span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.coordinator-section-preview {
  border-bottom: 0;
  padding-bottom: 0;
}

.report-review-comment-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

.report-review-comment-card h5,
.report-review-comment-card p,
.report-review-comment-card span {
  margin: 0;
}

.report-review-comment-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.ai-side-window {
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.ai-side-window ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.online-ai-links {
  display: grid;
  gap: 10px;
}

.external-ai-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 800;
}

.external-ai-link:hover {
  background: var(--surface-strong);
}

.report-draft-card .record-actions,
.report-history-card .record-actions {
  margin-top: 12px;
}

.report-body-text {
  white-space: pre-wrap;
}

.costing-report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.costing-data-panel,
.costing-report-panel,
.costing-overview-panel {
  padding: 18px;
}

.costing-overview-panel {
  padding-top: 12px;
  padding-bottom: 12px;
}

.costing-overview-panel .field-reference-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.costing-overview-panel .field-reference-summary div {
  min-height: auto;
  padding: 10px 12px;
}

.costing-overview-panel .field-reference-summary span:empty {
  display: none;
}

.costing-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0 14px 14px;
}

.costing-section > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 900;
  padding: 14px 0;
  color: var(--text);
}

.costing-section > summary::-webkit-details-marker {
  display: none;
}

.costing-section[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.collapsible-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0 16px 16px;
}

.collapsible-section > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 900;
  padding: 16px 0;
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collapsible-section > summary::-webkit-details-marker {
  display: none;
}

.collapsible-section > summary::after {
  content: "▾";
  font-size: 1rem;
  color: var(--accent-strong);
  transition: transform 160ms ease;
}

.collapsible-section[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.collapsible-section:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.collapsible-body {
  display: grid;
  gap: 12px;
}

.section-helper-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.domain-list {
  display: grid;
  gap: 12px;
}

.estate-profile-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.estate-profile-list {
  display: grid;
  gap: 14px;
}

.estate-profile-card {
  padding: 16px;
  border: 2px solid var(--panel-line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.estate-profile-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.estate-profile-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.estate-profile-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.estate-profile-head strong {
  color: var(--accent-strong);
  white-space: nowrap;
}

.estate-profile-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.estate-profile-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.estate-profile-card dd {
  margin: 3px 0 0;
  line-height: 1.35;
}

.estate-profile-card p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.upload-preview-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.upload-preview-group h4 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.upload-preview-item {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  position: relative;
}

.upload-preview-item img,
.file-badge {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-soft);
}

.file-badge {
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-weight: 900;
}

.upload-preview-item span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.image-upload-panel {
  display: grid;
  gap: 10px;
}

.image-upload-preview[hidden] {
  display: none !important;
}

.image-upload-preview .upload-preview-item {
  cursor: default;
}

.checkbox-panel-label {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.ganoderma-condition-panel {
  display: grid;
  gap: 8px;
}

.upload-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.upload-preview-remove:hover,
.upload-preview-remove:focus-visible {
  background: #b91c1c;
}

.field-enquiry-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
  padding: 18px;
  border: 2px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.field-enquiry-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.field-enquiry-form .panel-filter-grid {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.field-enquiry-form > label {
  min-width: 0;
}

.field-enquiry-form > label:last-of-type {
  max-width: 560px;
}

.field-enquiry-form > button {
  min-width: 148px;
  align-self: end;
}

.is-hidden {
  display: none !important;
}

.field-enquiry-result.empty-state {
  min-height: 96px;
}

.latest-visit-panel {
  margin-bottom: 18px;
}

.technical-agronomy-form {
  margin-top: 18px;
}

.technical-visit-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.42fr);
  gap: 18px;
  align-items: start;
}

.technical-visit-workspace.evidence-collapsed {
  grid-template-columns: minmax(0, 1fr) 56px;
}

.technical-evidence-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
  min-width: 0;
  margin-top: 18px;
  padding: 14px;
  border: 2px solid var(--panel-line);
}

.technical-evidence-panel > .form-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.technical-evidence-panel.is-collapsed {
  padding: 8px;
  min-height: 56px;
}

.technical-evidence-panel.is-collapsed .form-section-title > div {
  display: none;
}

.technical-evidence-panel.is-collapsed .form-section-title {
  justify-content: center;
}

.technical-evidence-panel-body,
.technical-evidence-list,
.technical-evidence-selected {
  display: grid;
  gap: 10px;
}

.technical-evidence-context,
.technical-evidence-card span,
.technical-evidence-card small,
.technical-evidence-preview-head span {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.technical-evidence-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.technical-evidence-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 179, 66, 0.18);
}

.technical-evidence-card > div:first-child,
.technical-evidence-preview-head > div {
  display: grid;
  gap: 3px;
}

.technical-evidence-card .record-actions {
  gap: 7px;
  margin-top: 2px;
}

.technical-evidence-card .record-actions button,
.technical-evidence-card .inline-link-button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.79rem;
}

.technical-evidence-preview {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.technical-evidence-preview.empty-state {
  color: var(--muted);
}

.technical-evidence-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.technical-evidence-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.technical-evidence-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.technical-evidence-table th,
.technical-evidence-table td {
  padding: 7px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

.technical-evidence-table th {
  position: sticky;
  top: 0;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 800;
}

.field-evidence-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
}

.field-evidence-slot > div {
  display: grid;
  gap: 3px;
}

.field-evidence-slot span {
  color: var(--muted);
  font-size: 0.84rem;
}

.evidence-jump-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.8rem;
}

.annual-data-panel {
  padding: 14px 16px;
  border: 2px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.annual-data-panel summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 900;
}

.annual-data-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.form-section-title h3 {
  margin: 0;
  font-size: 1.18rem;
}

.form-section-title p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

fieldset {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 16px;
  border: 2px solid var(--panel-line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

legend {
  padding: 0 6px;
  color: var(--accent-strong);
  font-weight: 900;
}

.form-save-status {
  color: var(--accent-strong);
  font-weight: 800;
  min-height: 20px;
}

.inline-popup-anchor {
  position: relative;
  display: flex;
  justify-content: center;
}

.inline-form-popup {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  border: 1px solid rgba(176, 62, 62, 0.28);
  border-radius: 8px;
  background: #fff4f2;
  box-shadow: 0 18px 40px rgba(18, 25, 38, 0.16);
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.inline-form-popup::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 14px;
  height: 14px;
  background: #fff4f2;
  border-right: 1px solid rgba(176, 62, 62, 0.28);
  border-bottom: 1px solid rgba(176, 62, 62, 0.28);
  transform: translateX(-50%) rotate(45deg);
}

.inline-form-popup-body {
  flex: 1;
  display: grid;
  gap: 6px;
}

.inline-form-popup-body strong {
  color: #9f2d2d;
  font-size: 0.95rem;
}

.inline-form-popup-body p {
  margin: 0;
  color: #653131;
  line-height: 1.45;
}

.inline-form-popup-close {
  padding: 8px 10px;
  min-width: auto;
  color: #9f2d2d;
  background: rgba(255, 255, 255, 0.75);
}

.app-toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2500;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.app-toast {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(27, 59, 43, 0.96);
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.2);
  font-size: 0.92rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.collected-data-panel {
  margin-top: 18px;
}

.technical-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.technical-record-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.technical-record-card {
  padding: 14px;
  border: 2px solid var(--panel-line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.technical-record-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.technical-record-head h4 {
  margin: 0;
  font-size: 1rem;
}

.technical-record-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.technical-record-head strong {
  white-space: nowrap;
  color: var(--accent-strong);
}

.technical-record-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.technical-record-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.technical-record-card dd {
  margin: 3px 0 0;
  line-height: 1.35;
}

.recommendation-list {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.recommendation-list p {
  margin: 0;
  line-height: 1.4;
}

.annual-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.annual-summary p {
  margin: 0;
  line-height: 1.4;
}

.file-link-row {
  display: grid;
  gap: 10px;
}

.report-preview {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.report-preview summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 800;
}

.record-image-details,
.record-file-details {
  padding: 8px 10px;
}

.record-image-details.report-preview,
.record-file-details.report-preview {
  min-height: 0;
}

.record-image-details[open],
.record-file-details[open] {
  padding-bottom: 12px;
}

.report-preview iframe {
  width: 100%;
  height: 380px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.technical-reference-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 14px;
}

.area-chart-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 2px solid var(--panel-line-soft);
  border-radius: 8px;
  background: var(--surface);
}

.area-chart-card.empty-state {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 120px;
}

.pie-chart {
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    conic-gradient(
      #2e7042 0 var(--planted),
      #c8df8c var(--planted) calc(var(--planted) + var(--plantable)),
      #a56728 calc(var(--planted) + var(--plantable)) 360deg
    );
  box-shadow: inset 0 0 0 14px #ffffff, 0 0 0 1px var(--line);
}

.chart-detail h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.chart-detail strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1.25rem;
}

.chart-legend {
  display: grid;
  gap: 7px;
  color: #344032;
  font-size: 0.86rem;
  font-weight: 800;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.chart-legend .planted {
  background: #2e7042;
}

.chart-legend .plantable {
  background: #c8df8c;
}

.chart-legend .unplantable {
  background: #a56728;
}

.domain-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.domain-code {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-weight: 900;
}

.domain-card h3 {
  margin: 0;
  font-size: 1.06rem;
}

.domain-card p {
  max-width: 680px;
  margin: 6px 0 12px;
  color: #485546;
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag,
.tag-row span,
.domain-action {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 900;
}

.tag.management {
  color: var(--blue);
  background: #e9f2f7;
}

.tag.costing {
  color: var(--amber);
  background: #f7efe4;
}

.tag.risk-high {
  color: #9c3729;
  background: #f7e5e1;
}

.tag.risk-medium {
  color: var(--amber);
  background: #f7efe4;
}

.domain-action {
  border: 1px solid #c8d9bd;
  cursor: pointer;
}

.capture-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(340px, 1.15fr);
  gap: 18px;
}

.field-reference-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.field-block-entry-panel {
  margin-bottom: 18px;
}

.field-block-entry-panel .context-panel {
  gap: 16px;
}

.field-block-entry-panel .field-enquiry-result dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.field-block-entry-panel .field-enquiry-result dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.field-block-entry-panel .field-enquiry-result dd {
  margin: 3px 0 0;
  line-height: 1.35;
}

.backup-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.role-options {
  display: grid;
  gap: 10px;
}

.checkbox-row,
.role-option {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
}

.checkbox-row input,
.role-option input {
  width: auto;
}

.checkbox-panel {
  max-height: 180px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.checkbox-dropdown {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.checkbox-dropdown > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-weight: 800;
  color: var(--ink);
}

.checkbox-dropdown > summary::-webkit-details-marker {
  display: none;
}

.checkbox-dropdown-panel {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.numeric-cell {
  text-align: right !important;
}

.record-actions-right {
  justify-content: flex-end;
}

.fertilizer-progress-input,
.fertilizer-progress-readonly {
  width: 100%;
  min-width: 120px;
}

.palm-age-ideal-input {
  width: 100%;
  min-width: 120px;
}

.field-action {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  align-items: flex-start;
}

.field-action-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.replanting-programme-input {
  width: 100%;
  min-width: 110px;
}

.palm-age-histogram {
  display: grid;
  gap: 16px;
}

.palm-age-chart-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.palm-age-chart-scale-note {
  justify-self: end;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
}

.estate-field-profile-table {
  width: auto;
  min-width: 0;
  max-width: 22rem;
  margin: 0 auto;
  font-size: 0.88rem;
}

.estate-field-profile-table th,
.estate-field-profile-table td {
  padding: 7px 12px;
}

.palm-age-chart-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ink);
}

.palm-age-chart-stage {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 360px;
}

.palm-age-chart-axis {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: stretch;
  justify-items: center;
  color: var(--muted);
  font-weight: 800;
  padding-top: 14px;
}

.palm-age-chart-axis-scale {
  width: 100%;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  align-items: stretch;
  justify-items: end;
  padding: 8px 0 2px;
}

.palm-age-chart-axis-scale span {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  width: 100%;
  font-size: 0.8rem;
  white-space: nowrap;
}

.palm-age-chart-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  align-items: end;
  min-height: 320px;
  padding: 20px 10px 8px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(to top, rgba(226, 232, 240, 0.9) 1px, transparent 1px);
  background-size: 100% 20%;
}

.palm-age-bar-group {
  display: grid;
  gap: 10px;
  align-items: end;
  justify-items: center;
  min-width: 0;
}

.palm-age-bars {
  width: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  height: 260px;
  min-height: 260px;
}

#palmAgeApplyAxisBtn {
  width: auto;
  min-width: 0;
  padding: 0.6rem 1rem;
  align-self: flex-start;
}

.palm-age-bar {
  position: relative;
  width: min(48px, 42%);
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.12);
}

@media print {
  .estate-field-profile-table {
    max-width: 90mm;
    font-size: 0.78rem;
  }
}

.palm-age-bar.actual {
  background: #7fb0de;
}

.palm-age-bar.ideal {
  background: #7cb342;
}

.palm-age-bar span {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  background: #e7eef8;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.palm-age-bar.ideal span {
  background: #dcefc6;
}

.palm-age-bar-group strong {
  font-size: 0.92rem;
}

.palm-age-footer-table th,
.palm-age-footer-table td {
  white-space: nowrap;
}

.yield-select-all-control {
  align-self: end;
  min-height: 44px;
  padding: 0 4px;
}

.empty-filter-message {
  color: var(--muted);
  font-size: 0.9rem;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-card {
  padding: 14px;
  border: 2px solid var(--panel-line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.user-card h3 {
  margin: 0;
  font-size: 1rem;
}

.user-card p {
  margin: 5px 0 10px;
  color: var(--muted);
  line-height: 1.4;
}

.user-card-actions {
  margin-top: 12px;
}

.backup-status {
  display: grid;
  gap: 12px;
}

.backup-status div {
  padding: 14px;
  border: 2px solid var(--panel-line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.backup-status span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.backup-status strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.translation-status-card {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.translation-status-card strong {
  display: block;
  margin-bottom: 4px;
}

.translation-status-ok {
  border-color: #b7d7c0;
  background: #edf8f0;
  color: #1b4332;
}

.translation-status-warn {
  border-color: #ead8a2;
  background: #fff7df;
  color: #8a5a00;
}

.translation-status-neutral {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--muted);
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field-reference-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.staffing-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.staffing-summary-wide {
  grid-column: 1 / -1;
}

.field-reference-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.field-reference-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.field-reference-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.panel-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.panel-filter-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-wide {
  grid-column: 1 / -1;
}

.field-reference-list {
  display: grid;
  gap: 12px;
}

.field-reference-card {
  padding: 14px;
  border: 2px solid var(--panel-line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.field-reference-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.field-reference-card dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.field-reference-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.field-reference-card dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.field-reference-card p {
  margin: 10px 0 0;
  color: #485546;
  line-height: 1.45;
}

.recorder-panel,
.context-panel,
.output-panel,
.repository-panel,
.model-panel {
  padding: 20px;
}

.output-panel,
.model-panel {
  margin-top: 18px;
}

.output-panel h3,
.model-panel h3 {
  margin: 0 0 14px;
}

.meter {
  height: 112px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #f4f1de, #d8f3dc);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meter span {
  width: 15px;
  height: 22px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: 0.55;
}

.is-recording .meter span {
  animation: pulse 0.85s ease-in-out infinite alternate;
}

.is-recording .meter span:nth-child(2n) {
  animation-delay: 0.12s;
}

.is-recording .meter span:nth-child(3n) {
  animation-delay: 0.24s;
}

@keyframes pulse {
  from { height: 24px; }
  to { height: 92px; opacity: 0.9; }
}

button {
  border-radius: 8px;
  min-height: 40px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.92rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button {
  border: none;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.secondary-button {
  border: none;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.danger-button {
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: var(--danger);
}

.ghost-button {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
}

.primary-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.4);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background: var(--accent-strong);
  color: #ffffff;
}

.secondary-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.4);
}

.ghost-button:hover,
.ghost-button:focus-visible {
  background: #f8fafc;
}

.topbar .ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.topbar .ghost-button:hover,
.topbar .ghost-button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #fecaca;
}

.file-picker {
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

audio {
  width: 100%;
  margin-top: 16px;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.field-pair > label {
  flex: 1;
}

.field-pair.wide-first > label:first-child {
  flex: 1.25;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #ffffff;
  font-size: 0.94rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

input[type="file"] {
  padding: 8px 0 0;
  border: 0;
  background: transparent;
}

textarea {
  resize: vertical;
}

.password-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-input-row .ghost-button {
  min-width: 72px;
}

.recommendation-input {
  min-height: 220px;
}

.empty-state {
  min-height: 140px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  background: #ffffff;
}

.summary-card {
  display: grid;
  gap: 14px;
}

.summary-card h3,
.visit-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.filters {
  margin-bottom: 16px;
}

.record-list {
  display: grid;
  gap: 12px;
}

.visit-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 2px solid var(--panel-line-soft);
  background: #ffffff;
  border-radius: 8px;
  background: var(--surface-soft);
}

.visit-card p {
  margin: 0;
  color: #344032;
  line-height: 1.45;
}

.model-summary {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.model-row {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app-shell,
  .capture-grid,
  .estate-profile-layout,
  .field-reference-layout,
  .technical-visit-workspace,
  .backup-layout,
  .admin-layout,
  .report-generation-layout,
  .report-composer-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .costing-report-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 22px;
    gap: 28px;
  }

  .app-shell.sidebar-collapsed .sidebar-head {
    flex-direction: row;
    align-items: flex-start;
  }

  .app-shell.sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .sidebar-brand-text,
  .app-shell.sidebar-collapsed .nav-group-toggle span:first-child,
  .app-shell.sidebar-collapsed .nav-link,
  .app-shell.sidebar-collapsed .backup-nav {
    display: initial;
  }

  .app-shell.sidebar-collapsed .nav-group-toggle {
    width: 100%;
    min-height: 36px;
    padding: 0 10px 0 12px;
    justify-content: space-between;
  }

  .app-shell.sidebar-collapsed .nav-group-items {
    display: grid;
  }

  .app-shell.sidebar-collapsed .sidebar-bottom {
    display: block;
  }

  .app-shell.sidebar-collapsed .sidebar-toggle-icon {
    transform: none;
  }

  .report-navigation-column,
  .report-widget-column,
  .technical-evidence-panel {
    position: static;
  }

  .technical-visit-workspace.evidence-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-context-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    overflow-x: hidden;
  }

  .sidebar,
  .workspace {
    padding: 18px 14px;
  }

  .topbar,
  .topbar-actions,
  .record-actions,
  .field-pair,
  .filters,
  .field-enquiry-form {
    align-items: stretch;
    flex-direction: column;
  }

  .field-enquiry-form {
    display: flex;
  }

  .report-title-row {
    grid-template-columns: 1fr;
  }

  .report-ai-launchers {
    justify-content: flex-start;
  }

  .field-enquiry-form .panel-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-enquiry-form > label:last-of-type,
  .field-enquiry-form > button {
    max-width: none;
    width: 100%;
  }

  .page {
    padding: 20px 16px;
  }

  .page-head h2 {
    font-size: 1.55rem;
  }

  .domain-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .area-grid,
  .upload-grid,
  .technical-filter-bar,
  .field-reference-summary,
  .estate-profile-card dl,
  .field-reference-card dl,
  .technical-reference-grid,
  .area-chart-card,
  .technical-record-card dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-filter-grid,
  .panel-filter-grid-wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .domain-action {
    grid-column: 2;
    justify-self: start;
  }
}
.finance-import-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.finance-import-tab {
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

.finance-import-tab.active {
  background: #173f35;
  color: #fff;
}

.finance-tab-panel {
  padding: 1rem;
  border-radius: 14px;
  background: #f5f8f4;
  margin-bottom: 1rem;
}

.finance-source-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem 0;
  color: #42534d;
}

.finance-table-wrap {
  overflow-x: auto;
}

.finance-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}

.finance-filter-panel {
  min-width: 0;
  border: 1px solid #d7e0dc;
  border-radius: 14px;
  padding: 1rem;
  background: #fbfdfc;
}

.finance-filter-panel legend {
  padding: 0 0.4rem;
  font-weight: 700;
  color: #173f35;
}

.filter-mini-actions {
  display: flex;
  gap: 0.75rem;
  margin: 0.65rem 0;
}

.finance-checkbox-list {
  display: grid;
  gap: 0.35rem;
  max-height: 260px;
  overflow: auto;
  padding-right: 0.35rem;
}

.finance-checkbox-list label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.35rem 0.45rem;
  border-radius: 7px;
}

.finance-checkbox-list label:hover {
  background: #edf4f0;
}

@media (max-width: 760px) {
  .finance-filter-grid {
    grid-template-columns: 1fr;
  }
}

.finance-extracted-table {
  min-width: 1500px;
}

.finance-extracted-table th:first-child {
  min-width: 250px;
  text-align: left;
}

.finance-extracted-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.finance-section-row th {
  background: #173f35;
  color: #fff;
}

.finance-total-row th,
.finance-total-row td {
  font-weight: 700;
  border-top: 2px solid #536b62;
}

.button-link {
  display: inline-flex;
  text-decoration: none;
}

.archive-cta-button,
#uploadedDocumentDownloadExcel {
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.72rem 1.05rem;
  border: 1px solid #2e7d32;
  border-radius: 8px;
  background: #2e7d32;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.18);
}

.archive-cta-button:hover,
.archive-cta-button:focus-visible,
#uploadedDocumentDownloadExcel:hover,
#uploadedDocumentDownloadExcel:focus-visible {
  background: #1b3b2b;
  border-color: #1b3b2b;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.22);
}

.archive-cta-button {
  text-decoration: none;
}

.document-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.document-type-tab {
  border: 1px solid #cbd8d2;
  border-radius: 999px;
  background: #f7faf8;
  color: #29463c;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  font-weight: 650;
}

.document-type-tab.active {
  background: #173f35;
  border-color: #173f35;
  color: #fff;
}

.document-upload-controls {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(260px, 1fr) minmax(180px, 220px) minmax(320px, 1.15fr);
  gap: 1rem;
  align-items: start;
}

.document-upload-controls + .record-actions {
  margin-top: 1.25rem;
}

.records-upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 1.1rem;
}

.records-upload-layout.archive-collapsed {
  grid-template-columns: 74px minmax(0, 1fr);
}

.records-upload-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.records-upload-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.records-upload-heading-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 0;
}

.records-upload-heading-actions p {
  margin: 0;
  text-align: right;
}

.records-upload-panel.archive-collapsed {
  padding: 14px 12px;
  overflow: hidden;
}

.uploaded-document-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.uploaded-document-workspace.is-hidden {
  display: none;
}

.uploaded-document-viewer {
  margin-top: 0;
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 860px;
}

.uploaded-document-viewer.is-hidden {
  display: none;
}

.uploaded-document-viewer-frame {
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.uploaded-document-viewer-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.uploaded-document-viewer-heading-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 0;
}

.uploaded-document-viewer-heading-actions p {
  margin: 0;
  text-align: right;
}

.records-pivot-panel {
  padding: 18px;
  min-width: 0;
  position: sticky;
  top: 18px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 860px;
}

.records-pivot-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.records-pivot-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.records-pivot-filters {
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: start;
  margin: -2px 0 0;
  padding: 2px 0 10px;
  background: var(--surface);
}

.records-pivot-filters select {
  width: 100%;
}

.records-pivot-table-wrap {
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: auto;
}

.records-pivot-stack {
  display: grid;
  gap: 16px;
}

.records-pivot-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.records-pivot-meta {
  display: grid;
  gap: 4px;
}

.records-pivot-meta strong {
  color: var(--ink);
}

.records-pivot-meta span {
  color: var(--muted);
  font-size: 0.88rem;
}

.records-pivot-actions {
  margin-bottom: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.records-pivot-preview-card,
.records-pivot-saved-section {
  display: grid;
  gap: 12px;
}

.records-pivot-summary-table {
  min-width: 0;
}

.records-pivot-summary-table th {
  width: 180px;
}

.records-pivot-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.82rem;
}

.records-pivot-table th,
.records-pivot-table td {
  white-space: normal;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.records-pivot-saved-list {
  display: grid;
  gap: 10px;
}

.records-pivot-saved-card {
  grid-template-columns: minmax(0, 1fr);
}

.records-pivot-panel.pivot-collapsed {
  padding: 14px 12px;
}

.records-pivot-panel.pivot-collapsed .records-pivot-heading {
  display: grid;
  justify-items: center;
  text-align: center;
}

.records-pivot-panel.pivot-collapsed .records-pivot-heading > div {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.records-pivot-panel.pivot-collapsed .records-pivot-heading h3 {
  margin: 6px 0 0;
  font-size: 0.92rem;
}

.records-pivot-panel.pivot-collapsed .records-pivot-heading span {
  font-size: 0.72rem;
}

.records-pivot-panel.pivot-collapsed .records-pivot-body {
  display: none;
}

.records-upload-panel.archive-collapsed #recordsDocumentTypeTabs,
.records-upload-panel.archive-collapsed #uploadedDocumentRecordList,
.records-upload-panel.archive-collapsed .uploaded-document-workspace {
  display: none;
}

.records-upload-panel.archive-collapsed .records-upload-heading {
  min-height: 280px;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-content: stretch;
  text-align: center;
}

.records-upload-panel.archive-collapsed .records-upload-heading > div:first-child {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: grid;
  align-content: center;
  gap: 6px;
}

.records-upload-panel.archive-collapsed .records-upload-heading h3 {
  margin: 4px 0 0;
  font-size: 0.96rem;
}

.records-upload-panel.archive-collapsed .records-upload-heading span {
  font-size: 0.72rem;
}

.records-upload-panel.archive-collapsed .records-upload-heading-actions {
  justify-items: center;
  align-self: end;
}

.records-upload-panel.archive-collapsed .records-upload-heading-actions p {
  display: none;
}

#documentUploadStatus {
  margin-top: 1.25rem;
}

.document-table-wrap {
  width: 100%;
  overflow: auto;
  max-height: 680px;
  --document-table-font-size: 0.84rem;
  --document-table-cell-padding: 0.45rem 0.55rem;
  --document-number-min-width: 72px;
  --document-number-max-width: 94px;
  --document-text-max-width: 200px;
}

.document-file-picker {
  display: grid;
  gap: 8px;
}

.document-selected-file-name {
  display: block;
  min-height: 1.25rem;
  color: #5f746b;
  font-size: 0.88rem;
  word-break: break-word;
}

.document-inline-action {
  display: grid;
  gap: 8px;
}

.document-inline-action span {
  color: #5f746b;
  font-size: 0.88rem;
  font-weight: 700;
}

.document-reference-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
  padding: 14px;
}

.document-reference-panel .form-section-title {
  margin-bottom: 10px;
}

.document-reference-panel h4,
.document-saved-record-card h4 {
  margin: 0;
  font-size: 0.98rem;
}

.document-reference-list {
  display: grid;
  gap: 10px;
}

.document-reference-item {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #d8e4de;
  border-radius: 8px;
  background: #fff;
}

.document-reference-item strong {
  color: #173f35;
}

.document-reference-item span {
  color: #5f746b;
  font-size: 0.86rem;
}

.document-record-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.records-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.records-main-panel,
.records-side-column {
  display: grid;
  gap: 18px;
}

.document-saved-records {
  display: grid;
  gap: 12px;
}

.document-saved-record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.document-saved-record-card p,
.document-saved-record-card span {
  margin: 4px 0 0;
  color: #5f746b;
}

.document-saved-record-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.document-confirm-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.document-data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: var(--document-table-font-size);
  line-height: 1.2;
  border-collapse: collapse;
}

.document-data-table th,
.document-data-table td {
  white-space: nowrap;
  max-width: var(--document-text-max-width);
  overflow: hidden;
  text-overflow: ellipsis;
  padding: var(--document-table-cell-padding);
  vertical-align: middle;
}

.document-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
  height: auto;
  min-height: 3.1rem;
  vertical-align: middle;
}

.document-data-table tbody th {
  position: sticky;
  left: 0;
  background: #eef4f1;
  color: #536b62;
}

.document-data-table td.document-cell-number,
.document-data-table th.document-cell-number {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  width: min-content;
  min-width: var(--document-number-min-width);
  max-width: var(--document-number-max-width);
}

.document-data-table .document-cell-date {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.document-data-table .document-cell-text {
  text-align: left;
}

.document-table-wrap.document-table-compact {
  --document-table-font-size: 0.79rem;
  --document-table-cell-padding: 0.38rem 0.46rem;
  --document-number-min-width: 64px;
  --document-number-max-width: 82px;
  --document-text-max-width: 170px;
}

.document-table-wrap.document-table-dense {
  --document-table-font-size: 0.74rem;
  --document-table-cell-padding: 0.3rem 0.38rem;
  --document-number-min-width: 56px;
  --document-number-max-width: 74px;
  --document-text-max-width: 140px;
}

.document-table-wrap.document-table-compact .document-data-table th,
.document-table-wrap.document-table-compact .document-data-table td,
.document-table-wrap.document-table-dense .document-data-table th,
.document-table-wrap.document-table-dense .document-data-table td {
  letter-spacing: 0;
}

.document-table-wrap.document-table-compact .document-data-table .estate-description-column,
.document-table-wrap.document-table-compact .document-data-table .income-subject-column,
.document-table-wrap.document-table-compact .document-data-table .estate-text-column,
.document-table-wrap.document-table-compact .document-data-table .estate-code-column,
.document-table-wrap.document-table-compact .document-data-table .estate-area-column,
.document-table-wrap.document-table-dense .document-data-table .estate-description-column,
.document-table-wrap.document-table-dense .document-data-table .income-subject-column,
.document-table-wrap.document-table-dense .document-data-table .estate-text-column,
.document-table-wrap.document-table-dense .document-data-table .estate-code-column,
.document-table-wrap.document-table-dense .document-data-table .estate-area-column {
  min-width: unset;
  width: auto;
}

.document-editable-cell {
  cursor: text;
  outline: none;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.document-editable-cell:hover {
  background: #fff8dc !important;
}

.document-editable-cell:focus {
  background: #fff3bf !important;
  box-shadow: inset 0 0 0 2px #b88720;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.document-editable-cell:focus-visible {
  outline: none;
}

.document-readonly-cell {
  cursor: default;
}

.document-readonly-cell:hover,
.document-readonly-cell:focus {
  background: inherit !important;
  box-shadow: none !important;
}

.document-row-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 112px;
}

.document-row-actions .secondary-button {
  width: 100%;
}

.estate-area-report-layout {
  display: grid;
  gap: 16px;
}

.estate-area-summary-card,
.estate-area-table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.estate-area-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.estate-area-summary-grid div {
  border: 1px solid #d8e4de;
  border-radius: 8px;
  background: #f8fbf9;
  padding: 12px;
}

.estate-area-summary-grid span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #5f746b;
  margin-bottom: 6px;
}

.estate-area-summary-grid strong {
  display: block;
  min-height: 1.5rem;
  color: #173f35;
}

.estate-areas-data-table {
  table-layout: auto;
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
}

.estate-areas-data-table .estate-text-column {
  width: 88px;
}

.estate-areas-data-table .estate-description-column {
  width: 180px;
}

.income-statement-data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.income-statement-data-table .income-subject-column {
  width: 220px;
  min-width: 220px;
}

.income-statement-data-table .document-numeric-column {
  width: auto;
  min-width: 72px;
}

.income-statement-data-table th,
.income-statement-data-table td {
  text-align: center;
}

.income-statement-data-table th:first-child,
.income-statement-data-table td:first-child {
  text-align: left;
}

.crop-statement-data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.crop-statement-data-table .estate-text-column {
  width: auto;
  min-width: 72px;
}

.crop-statement-data-table .estate-code-column {
  width: auto;
  min-width: 68px;
}

.crop-statement-data-table .estate-area-column {
  width: auto;
  min-width: 72px;
}

.crop-statement-data-table .document-numeric-column {
  width: auto;
  min-width: 72px;
}

.crop-statement-data-table thead th {
  position: static;
  text-align: center;
  vertical-align: middle;
}

.crop-statement-data-table thead tr:first-child th[colspan="3"] {
  border-bottom: 1px solid #9eb2aa;
}

.crop-statement-data-table tbody td {
  white-space: nowrap;
}

.area-expenditure-layout-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.area-expenditure-document-surface {
  padding: 0;
}

.area-expenditure-layout-table .estate-description-column {
  width: auto;
  min-width: 170px;
}

.area-expenditure-layout-table .document-numeric-column {
  width: auto;
  min-width: 72px;
}

.area-expenditure-layout-table thead th {
  text-align: center;
  vertical-align: top;
}

.area-expenditure-type-heading {
  text-align: left !important;
  vertical-align: middle !important;
}

.area-expenditure-stacked-heading {
  line-height: 1.15;
  white-space: normal;
}

.area-expenditure-meta-row th,
.area-expenditure-meta-row td,
.area-expenditure-banner-row th,
.area-expenditure-banner-row td {
  background: #fff;
  border-top: none;
  border-bottom: none;
  font-weight: 600;
}

.area-expenditure-meta-row td,
.area-expenditure-banner-row td {
  font-weight: 500;
}

.area-expenditure-banner-row th {
  text-align: center;
}

.area-expenditure-layout-table tbody td,
.area-expenditure-layout-table tbody th {
  white-space: nowrap;
}

.stock-movement-data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.stock-movement-data-table .estate-code-column {
  width: auto;
  min-width: 90px;
}

.stock-movement-data-table .estate-description-column {
  width: auto;
  min-width: 110px;
}

.stock-movement-data-table .estate-text-column {
  width: auto;
  min-width: 90px;
}

.stock-movement-data-table .document-numeric-column {
  width: auto;
  min-width: 72px;
}

.stock-movement-data-table th:first-child,
.stock-movement-data-table td:first-child,
.stock-movement-data-table th:nth-child(2),
.stock-movement-data-table td:nth-child(2),
.stock-movement-data-table th:nth-child(3),
.stock-movement-data-table td:nth-child(3),
.stock-movement-data-table th:nth-child(4),
.stock-movement-data-table td:nth-child(4) {
  text-align: left;
}

.stock-movement-data-table thead th {
  text-align: center;
  vertical-align: middle;
}

.stock-movement-data-table thead tr:first-child th[colspan="2"] {
  border-bottom: 1px solid #9eb2aa;
}

.document-parser-debug {
  margin-top: 12px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #d8e0dd;
  background: #f6f8f7;
  font-size: 12px;
  color: #33413d;
}

.document-parser-debug strong {
  font-size: 12px;
  color: #1f2a27;
}

.estate-areas-data-table .estate-code-column {
  width: auto;
  min-width: 80px;
}

.estate-areas-data-table .estate-area-column {
  width: auto;
  min-width: 72px;
}

.document-numeric-column {
  width: auto;
  min-width: var(--document-number-min-width);
  max-width: var(--document-number-max-width);
}

.document-table-wrap .document-data-table col.document-numeric-column {
  width: auto;
}

.estate-areas-data-table thead th {
  position: static;
  text-align: center;
  vertical-align: middle;
}

.estate-areas-data-table thead tr:first-child th[colspan="2"] {
  border-bottom: 1px solid #9eb2aa;
}

.estate-areas-data-table thead tr:nth-child(2) th {
  min-width: 84px;
  width: 84px;
  border: 1px solid #789087;
  background: #e8f0ec;
  text-align: center;
  font-weight: 750;
}

.estate-areas-data-table thead .estate-subheading-immature,
.estate-areas-data-table thead .estate-subheading-group-start {
  border-left: 2px solid #466a5f;
}

.estate-areas-data-table tbody td {
  white-space: normal;
  vertical-align: top;
}

.estate-areas-data-table .empty-cell {
  text-align: center;
  color: #667c73;
  padding: 18px;
}

.document-data-table .document-header-row th {
  background: #dce9e3;
  color: #173f35;
  font-weight: 750;
  border-top: 2px solid #7e988d;
  border-bottom: 2px solid #7e988d;
}

.document-data-table .document-metadata-row td,
.document-data-table .document-metadata-row th {
  background: #f6f9f7;
  color: #52665e;
  font-weight: 600;
}

@media (max-width: 900px) {
  .document-upload-controls {
    grid-template-columns: 1fr;
  }

  .records-upload-layout,
  .records-upload-layout.archive-collapsed,
  .uploaded-document-workspace {
    grid-template-columns: 1fr;
  }

  .records-pivot-panel.pivot-collapsed .records-pivot-heading > div {
    writing-mode: initial;
    transform: none;
  }

  .records-upload-panel.archive-collapsed .records-upload-heading {
    min-height: auto;
  }

  .records-upload-panel.archive-collapsed .records-upload-heading > div:first-child {
    writing-mode: initial;
    transform: none;
  }

  .records-workspace {
    grid-template-columns: 1fr;
  }

  .document-record-filters {
    grid-template-columns: 1fr;
  }

  .document-saved-record-card {
    grid-template-columns: 1fr;
  }

  .document-saved-record-actions {
    justify-content: flex-start;
  }

  .estate-area-summary-grid {
    grid-template-columns: 1fr;
  }

  .document-table-wrap {
    --document-table-font-size: 0.76rem;
    --document-table-cell-padding: 0.28rem 0.34rem;
    --document-number-min-width: 54px;
    --document-number-max-width: 70px;
    --document-text-max-width: 132px;
  }
}

/* Hierarchy refinement:
   - subsection panels: shadow-only, no visible coloured border
   - subsub sections (fieldset groups): very light green border with shadow */
.context-panel,
.repository-panel,
.output-panel,
.model-panel,
.field-enquiry-panel,
.annual-data-panel,
.visit-card,
.technical-record-card,
.estate-profile-card,
.user-card,
.backup-status div,
.field-reference-card,
.area-chart-card {
  border: 1px solid transparent !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1), 0 10px 24px rgba(27, 59, 43, 0.08) !important;
}

fieldset {
  border: 1px solid #d7e6db !important;
  border-image: none !important;
  outline: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background: #ffffff !important;
  box-shadow: 0 8px 18px rgba(27, 59, 43, 0.1) !important;
}

fieldset > legend {
  background: #ffffff !important;
  border: 0 !important;
  box-shadow: none !important;
}
