:root {
  --bg: #f2f7f5;
  --surface: #ffffff;
  --surface-alt: #e8f0ec;
  --surface-soft: #f7fbf9;
  --text: #20302a;
  --muted: #60736b;
  --border: #d1ddd7;
  --border-strong: #b8cbc3;
  --primary: #287d8b;
  --primary-dark: #216774;
  --accent: #74a02e;
  --accent-soft: #edf6df;
  --success-bg: #e4f1dd;
  --success-text: #31581a;
  --danger-bg: #f8e7e3;
  --danger-text: #7a3026;
  --warning-bg: #fff3d8;
  --warning-text: #775a17;
  --sidebar-bg: #eaf4f2;
  --sidebar-surface: rgba(255, 255, 255, 0.48);
  --sidebar-active: rgba(40, 125, 139, 0.14);
  --sidebar-active-border: rgba(40, 125, 139, 0.24);
  --sidebar-width: 268px;
  --shadow: 0 4px 14px rgba(32, 48, 42, 0.06);
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Aptos", "Candara", sans-serif;
}

a {
  color: var(--primary-dark);
}

a:hover,
a:focus-visible {
  color: var(--primary-dark);
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.app-layout-authenticated {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  z-index: 1035;
}

.app-sidebar-inner {
  height: 100%;
  overflow-y: auto;
  padding: 18px 16px 22px;
  display: grid;
  align-content: start;
  gap: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 18%);
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 16px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(32, 48, 42, 0.08);
}

.sidebar-brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex: 0 0 auto;
}

.sidebar-brand-copy {
  display: grid;
  gap: 2px;
}

.sidebar-brand-title {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.05;
}

.sidebar-brand-subtitle {
  color: var(--muted);
  font-size: 0.84rem;
}

.sidebar-nav {
  display: grid;
  gap: 16px;
}

.sidebar-group {
  display: grid;
  gap: 8px;
}

.sidebar-group-label {
  padding: 0 8px;
  color: #527069;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-group-links {
  display: grid;
  gap: 4px;
}

.sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--sidebar-surface);
  color: #45605a;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(32, 48, 42, 0.06);
  color: var(--text);
}

.sidebar-link.is-active {
  background: var(--sidebar-active);
  border-color: var(--sidebar-active-border);
  color: var(--primary-dark);
}

.sidebar-link .app-icon {
  color: currentColor;
  opacity: 0.95;
}

.app-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-shell,
.app-content,
.footer-inner {
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.topbar-shell {
  padding-top: 14px;
  padding-bottom: 14px;
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar-title {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.topbar-title strong {
  font-size: 1rem;
  line-height: 1.05;
}

.topbar-title span {
  color: var(--muted);
  font-size: 0.82rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-title {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.05;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.1;
}

.app-nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
}

.app-nav-toggle:hover,
.app-nav-toggle:focus-visible {
  background: var(--surface-alt);
}

.app-nav-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(40, 125, 139, 0.15);
}

.app-nav-toggle-lines,
.app-nav-toggle-lines::before,
.app-nav-toggle-lines::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.app-nav-toggle-lines {
  position: relative;
}

.app-nav-toggle-lines::before {
  position: absolute;
  top: -5px;
}

.app-nav-toggle-lines::after {
  position: absolute;
  top: 5px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

.topbar-user-meta strong {
  font-size: 0.95rem;
}

.topbar-user-meta span {
  color: var(--muted);
  font-size: 0.84rem;
}

.app-content {
  padding-top: 20px;
  padding-bottom: 32px;
}

.footer {
  border-top: 1px solid var(--border);
  background: transparent;
}

.footer-inner {
  padding-top: 12px;
  padding-bottom: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.app-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 27, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 1030;
}

.app-loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(242, 247, 245, 0.72);
  backdrop-filter: blur(2px);
  z-index: 1080;
}

.app-loading-overlay.is-visible {
  display: flex;
}

.app-loading-panel {
  min-width: 220px;
  max-width: 320px;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(32, 48, 42, 0.12);
  text-align: center;
}

.app-loading-panel strong {
  font-size: 1rem;
}

.app-loading-panel span {
  color: var(--muted);
  font-size: 0.9rem;
}

.app-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(40, 125, 139, 0.16);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}

@keyframes app-spin {
  to {
    transform: rotate(360deg);
  }
}

body.sidebar-open .app-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.page-shell {
  display: grid;
  gap: 16px;
}

.narrow-shell {
  max-width: 960px;
}

.auth-shell {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.auth-card-wide {
  max-width: 760px;
}

.auth-header {
  display: grid;
  gap: 6px;
}

.auth-header h1 {
  margin: 0;
  font-size: 1.7rem;
}

.auth-header p {
  margin: 0;
  color: var(--muted);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.08;
}

.page-header p {
  margin: 4px 0 0;
  color: var(--muted);
  max-width: 760px;
}

.table-card,
.form-card,
.filter-card,
.metric-card,
.workspace-panel,
.details-card,
.operation-card,
.home-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.table-card,
.operation-card {
  overflow: visible;
}

.form-card,
.filter-card,
.details-card,
.metric-card,
.workspace-panel,
.home-panel {
  padding: 18px;
}

.app-table {
  margin-bottom: 0;
}

.app-table thead th {
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-soft);
  border-bottom-color: var(--border);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  white-space: nowrap;
}

.app-table tbody td {
  border-bottom-color: var(--border);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  vertical-align: middle;
}

.app-table tbody tr:last-child td {
  border-bottom: 0;
}

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

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 22px 14px !important;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-active {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-inactive {
  background: #eceff0;
  color: #54635e;
}

.status-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.app-form {
  display: grid;
  gap: 14px;
}

.form-grid,
.compact-form-grid {
  display: grid;
  gap: 12px;
}

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

.compact-form-grid .input-group-text {
  min-width: 112px;
  background: var(--surface-alt);
  border-color: var(--border-strong);
  color: var(--muted);
  font-weight: 600;
}

.compact-form-grid .form-control,
.compact-form-grid .form-select {
  border-color: var(--border-strong);
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 2px;
}

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

.span-two {
  grid-column: 1 / -1;
}

.field-inline {
  display: flex;
  align-items: stretch;
  min-height: 42px;
}

.field-inline-label {
  min-width: 108px;
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.field-inline .form-control,
.field-inline .form-select {
  border-radius: 0 8px 8px 0;
}

.field-inline-textarea {
  align-items: stretch;
}

.field-inline-textarea .field-inline-label {
  align-items: flex-start;
  padding-top: 0.75rem;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn {
  border-radius: 8px;
  font-weight: 600;
}

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

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-secondary {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
  background: var(--surface-alt);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline-primary {
  border-color: rgba(116, 160, 46, 0.45);
  color: var(--accent);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  background: var(--accent-soft);
  border-color: rgba(116, 160, 46, 0.55);
  color: #4b671d;
}

.btn-link {
  color: var(--muted);
  text-decoration: none;
  padding-left: 0;
  padding-right: 0;
}

.btn-link:hover,
.btn-link:focus-visible {
  color: var(--text);
}

.form-control,
.form-select {
  border-color: var(--border-strong);
  padding: 0.58rem 0.75rem;
  min-height: 42px;
}

.app-date-field {
  position: relative;
}

.app-date-field .form-control {
  padding-right: 2.9rem;
}

.app-date-picker-native {
  position: absolute;
  inset: 0 0 0 auto;
  width: 44px;
  opacity: 0;
  pointer-events: none;
}

.app-date-picker-button {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 40px;
  height: calc(100% - 2px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
}

.app-date-picker-button:hover,
.app-date-picker-button:focus-visible {
  background: var(--surface-alt);
  color: var(--text);
}

.app-date-picker-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app-date-picker-button svg {
  width: 16px;
  height: 16px;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus,
.btn:focus-visible {
  border-color: rgba(40, 125, 139, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(40, 125, 139, 0.14);
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-field {
  min-width: 220px;
}

.filter-actions,
.stack-actions,
.workspace-links,
.home-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stack-actions {
  justify-content: space-between;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.app-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon-only-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
}

.table-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-only-mobile {
  white-space: nowrap;
}

.table-actions form {
  margin: 0;
}

.alert {
  margin-bottom: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.8rem 0.95rem;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #cadbb6;
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #e5bfb4;
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: #ebd39e;
}

.metrics-grid,
.workspace-grid,
.home-grid {
  display: grid;
  gap: 14px;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

.metric-compact {
  font-size: 1.12rem;
  line-height: 1.25;
}

.metric-note {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 6px;
}

.workspace-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.workspace-panel-header,
.home-panel-header {
  display: grid;
  gap: 4px;
}

.workspace-panel-header h2,
.home-panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.workspace-panel-header p,
.home-panel-header p,
.home-panel p,
.home-list {
  margin: 0;
  color: var(--muted);
}

.home-hero {
  display: grid;
  gap: 14px;
}

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

.home-grid {
  grid-template-columns: 1.2fr 1fr;
}

.home-list {
  padding-left: 18px;
}

.home-list li + li {
  margin-top: 6px;
}

.dashboard-shell {
  gap: 18px;
}

.home-hero-dashboard {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(116, 160, 46, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(40, 125, 139, 0.08), rgba(255, 255, 255, 0.94));
}

.dashboard-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  background: rgba(40, 125, 139, 0.1);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.home-hero-dashboard h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.02;
}

.dashboard-metrics-grid,
.dashboard-layout {
  display: grid;
  gap: 14px;
}

.dashboard-metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  align-items: flex-start;
}

.dashboard-layout-secondary {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
}

.dashboard-side {
  display: grid;
  gap: 14px;
}

.dashboard-panel,
.dashboard-metric-card {
  position: relative;
}

.dashboard-metric-card {
  min-height: 132px;
  display: grid;
  gap: 8px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 249, 0.95));
}

.dashboard-metric-primary {
  background:
    linear-gradient(180deg, rgba(40, 125, 139, 0.08), rgba(255, 255, 255, 0.96));
}

.dashboard-metric-accent {
  background:
    linear-gradient(180deg, rgba(116, 160, 46, 0.1), rgba(255, 255, 255, 0.96));
}

.dashboard-metric-warm {
  background:
    linear-gradient(180deg, rgba(226, 146, 33, 0.1), rgba(255, 255, 255, 0.96));
}

.dashboard-metric-calm {
  background:
    linear-gradient(180deg, rgba(62, 118, 153, 0.1), rgba(255, 255, 255, 0.96));
}

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

.dashboard-metric-icon,
.dashboard-breakdown-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(40, 125, 139, 0.08);
  color: var(--primary-dark);
}

.dashboard-metric-icon .app-icon,
.dashboard-breakdown-icon .app-icon {
  width: 18px;
  height: 18px;
}

.dashboard-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-card-header h2 {
  margin: 4px 0 0;
  font-size: 1.18rem;
}

.dashboard-card-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.dashboard-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.dashboard-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.dashboard-dot-consumos,
.dashboard-tone-consumos {
  background: linear-gradient(135deg, #74a02e, #8cbc4c);
}

.dashboard-dot-labores,
.dashboard-tone-labores {
  background: linear-gradient(135deg, #287d8b, #49a4b3);
}

.dashboard-dot-servicios,
.dashboard-tone-servicios {
  background: linear-gradient(135deg, #e29221, #f4b24e);
}

.dashboard-farm-list,
.dashboard-breakdown-list,
.dashboard-recent-list,
.dashboard-supply-list {
  display: grid;
  gap: 12px;
}

.dashboard-trend-section {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(32, 48, 42, 0.08);
}

.dashboard-subsection-header {
  margin-bottom: 0;
}

.dashboard-trend-highlight {
  min-width: 150px;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(116, 160, 46, 0.08), rgba(255, 255, 255, 0.98));
}

.dashboard-trend-highlight span,
.dashboard-trend-highlight small {
  color: var(--muted);
}

.dashboard-trend-highlight strong {
  font-size: 1rem;
}

.dashboard-trend-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-trend-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
}

.dashboard-trend-switch button {
  min-width: 94px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0 14px;
}

.dashboard-trend-switch button.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(40, 125, 139, 0.2);
}

.dashboard-trend-switch button:hover,
.dashboard-trend-switch button:focus-visible {
  color: var(--text);
}

.dashboard-trend-switch button.is-active:hover,
.dashboard-trend-switch button.is-active:focus-visible {
  color: #fff;
}

.dashboard-farm-item,
.dashboard-supply-item,
.dashboard-recent-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.dashboard-farm-item {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.dashboard-farm-head,
.dashboard-farm-meta,
.dashboard-breakdown-head,
.dashboard-supply-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-farm-head strong,
.dashboard-supply-item strong,
.dashboard-recent-main strong {
  font-size: 0.98rem;
}

.dashboard-farm-head span,
.dashboard-farm-meta,
.dashboard-breakdown-values span,
.dashboard-supply-item span,
.dashboard-recent-main span,
.dashboard-recent-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.dashboard-farm-meta {
  flex-wrap: wrap;
}

.dashboard-farm-total,
.dashboard-recent-total {
  white-space: nowrap;
  color: var(--primary-dark);
}

.dashboard-stack-track,
.dashboard-progress {
  width: 100%;
  height: 14px;
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 48, 42, 0.08);
}

.dashboard-stack-segment,
.dashboard-progress-bar {
  display: block;
  height: 100%;
}

.dashboard-stack-segment.is-consumos {
  background: linear-gradient(135deg, #74a02e, #8cbc4c);
}

.dashboard-stack-segment.is-labores {
  background: linear-gradient(135deg, #287d8b, #49a4b3);
}

.dashboard-stack-segment.is-servicios {
  background: linear-gradient(135deg, #e29221, #f4b24e);
}

.dashboard-breakdown-item {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.dashboard-breakdown-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.dashboard-breakdown-values {
  display: grid;
  gap: 2px;
  justify-items: end;
}

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

.dashboard-finance-tile {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.dashboard-finance-tile span,
.dashboard-finance-tile small,
.dashboard-callout span {
  color: var(--muted);
}

.dashboard-finance-tile strong {
  font-size: 1.05rem;
}

.dashboard-callout {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px dashed rgba(40, 125, 139, 0.22);
  border-radius: 10px;
  background: rgba(40, 125, 139, 0.04);
}

.dashboard-recent-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  text-decoration: none;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.dashboard-recent-item:hover,
.dashboard-recent-item:focus-visible {
  border-color: rgba(40, 125, 139, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(32, 48, 42, 0.06);
}

.dashboard-recent-main,
.dashboard-recent-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  text-align: center;
}

.dashboard-empty span {
  color: var(--muted);
  max-width: 420px;
}

.dashboard-empty-compact {
  min-height: 180px;
}

.dashboard-trend-shell {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.dashboard-trend-axis {
  position: relative;
  min-height: 280px;
  color: var(--muted);
  font-size: 0.78rem;
}

.dashboard-trend-axis span {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  white-space: nowrap;
}

.dashboard-trend-chart {
  display: grid;
  gap: 12px;
}

.dashboard-trend-svg {
  width: 100%;
  height: 280px;
  overflow: visible;
}

.dashboard-trend-grid-line {
  stroke: rgba(32, 48, 42, 0.12);
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
}

.dashboard-trend-line {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.dashboard-trend-line.is-consumos,
.dashboard-trend-point.is-consumos {
  stroke: #74a02e;
  fill: #74a02e;
}

.dashboard-trend-line.is-labores,
.dashboard-trend-point.is-labores {
  stroke: #287d8b;
  fill: #287d8b;
}

.dashboard-trend-line.is-servicios,
.dashboard-trend-point.is-servicios {
  stroke: #e29221;
  fill: #e29221;
}

.dashboard-trend-months {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-trend-months span {
  text-align: center;
  padding-top: 2px;
}

.operation-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px 0;
}

.operation-card-header h2 {
  margin: 0;
  font-size: 1.08rem;
}

.operation-card-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.operation-card .table-responsive {
  border-top: 1px solid var(--border);
  margin-top: 14px;
}

.table-responsive {
  overflow-y: visible;
}

.operation-table {
  min-width: 860px;
}

.finance-form .operation-table {
  min-width: 1080px;
}

.expense-table {
  min-width: 980px;
}

.service-table {
  min-width: 760px;
}

.production-table {
  min-width: 1480px;
}

.finance-summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.summary-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.summary-inline span {
  color: var(--muted);
  font-weight: 600;
}

.summary-inline strong {
  font-size: 1rem;
  color: var(--primary-dark);
}

.span-two-on-wide {
  grid-column: 1 / -1;
}

.table-input,
.table-select {
  min-width: 112px;
}

.table-input-wide {
  min-width: 220px;
}

.scope-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: #45605a;
  font-size: 0.8rem;
  font-weight: 700;
}

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

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

.details-item span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 3px;
}

.details-item strong {
  font-size: 0.98rem;
}

.distribution-row td {
  background: var(--surface-soft);
}

.distribution-shell {
  display: grid;
  gap: 8px;
}

.distribution-shell strong {
  font-size: 0.92rem;
}


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

.review-filter-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.review-actions {
  align-self: flex-end;
}

.review-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: flex-start;
}

.review-sidebar,
.review-main,
.review-panel,
.review-summary,
.audit-list {
  display: grid;
  gap: 14px;
}

.review-panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.review-summary-item {
  display: grid;
  gap: 3px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.review-summary-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.review-summary-item span,
.audit-state span,
.audit-entry-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

.review-summary-item strong {
  font-size: 0.96rem;
}

.review-note {
  background: var(--surface-alt);
}

.audit-entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.audit-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.audit-reason {
  margin: 8px 0 0;
}

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

.audit-state {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.row-id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 0.28rem 0.5rem;
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.finca-general-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
}

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

.finca-lotes-table td {
  vertical-align: top;
}

@media (max-width: 1199.98px) {
  .metrics-grid,
  .workspace-grid,
  .review-layout,
  .details-grid,
  .audit-grid,
  .home-grid,
  .dashboard-metrics-grid,
  .dashboard-layout,
  .dashboard-layout-secondary {
    grid-template-columns: 1fr 1fr;
  }

  .review-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .app-layout-authenticated {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(var(--sidebar-width), 86vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 0 18px 40px rgba(32, 48, 42, 0.12);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-nav-toggle {
    display: inline-flex;
  }

  .topbar-shell,
  .app-content,
  .footer-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-header,
  .operation-card-header,
  .topbar-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-main {
    gap: 14px;
  }

  .topbar-title {
    margin-right: 0;
  }

  .topbar-user,
  .topbar-user-meta {
    width: 100%;
    text-align: left;
  }

  .two-columns,
  .compact-form-grid,
  .diario-header-grid,
  .finca-general-grid,
  .filter-grid,
  .review-filter-grid,
  .metrics-grid,
  .workspace-grid,
  .details-grid,
  .audit-grid,
  .home-grid,
  .finance-summary-strip,
  .dashboard-metrics-grid,
  .dashboard-layout,
  .dashboard-layout-secondary,
  .dashboard-finance-grid {
    grid-template-columns: 1fr;
  }

  .span-two {
    grid-column: auto;
  }
}

@media (max-width: 767.98px) {
  .app-content {
    padding-top: 16px;
    padding-bottom: 24px;
  }

  .field-inline,
  .field-inline-textarea {
    flex-direction: column;
  }

  .field-inline-label {
    min-width: 100%;
    border-right: 1px solid var(--border-strong);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
  }

  .field-inline .form-control,
  .field-inline .form-select {
    border-radius: 0 0 8px 8px;
  }

  .form-actions,
  .filter-actions,
  .stack-actions,
  .workspace-links,
  .home-actions,
  .table-actions,
  .dashboard-card-header {
    width: 100%;
  }

  .form-actions,
  .filter-actions,
  .stack-actions,
  .workspace-links,
  .home-actions,
  .table-actions {
    justify-content: stretch;
  }

  .form-actions .btn,
  .filter-actions .btn,
  .stack-actions .btn,
  .workspace-links .btn,
  .home-actions .btn,
  .table-actions .btn,
  .dashboard-card-header .btn {
    width: 100%;
  }

  .table-actions form {
    width: 100%;
  }

  .dashboard-card-header,
  .dashboard-farm-head,
  .dashboard-farm-meta,
  .dashboard-breakdown-head,
  .dashboard-recent-main,
  .dashboard-recent-meta,
  .dashboard-supply-item,
  .dashboard-trend-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-trend-shell {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-trend-axis {
    min-height: 42px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }

  .dashboard-trend-axis span {
    position: static;
    transform: none;
  }

  .dashboard-trend-svg {
    height: 220px;
  }

  .dashboard-trend-months {
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }
}
