:root {
  color-scheme: light;
  --bg: #f3f8f2;
  --surface: #ffffff;
  --surface-soft: #f6fbf5;
  --line: #d7e4d4;
  --text: #173126;
  --muted: #597062;
  --primary: #1f7a43;
  --primary-dark: #176235;
  --danger: #b42318;
  --danger-soft: #fff1f1;
  --success: #157347;
  --success-soft: #ebf8f1;
  --warning: #9a6700;
  --warning-soft: #fff7e5;
  --shadow: 0 18px 42px rgba(23, 49, 38, 0.08);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #edf6ec 0%, var(--bg) 24%, #fbfdfb 100%);
  -webkit-text-size-adjust: 100%;
}

body.busy-active {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell,
.login-layout,
.loading-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.login-layout,
.loading-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card,
.loading-card,
.panel {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(214, 223, 235, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 480px);
  padding: 28px;
}

.loading-card {
  padding: 24px;
}

.brand-block {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.brand-wordmark {
  display: inline-grid;
  gap: 2px;
  width: fit-content;
}

.brand-wordmark strong {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--primary);
}

.brand-wordmark span {
  font-size: 14px;
  line-height: 1.2;
  color: var(--text-muted);
}

.brand-wordmark-login {
  margin-bottom: 4px;
}

.brand-wordmark-topbar strong {
  font-size: 22px;
}

.brand-wordmark-topbar span {
  font-size: 12px;
}

.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.brand-logo-login {
  width: min(280px, 100%);
}

.brand-logo-topbar {
  width: min(220px, 48vw);
  flex: 0 0 auto;
}

.brand-badge,
.section-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e7f5ea;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
}

h2 {
  font-size: 24px;
  line-height: 1.14;
}

h3 {
  font-size: 17px;
}

p,
.helper-text,
.demo-hint {
  color: var(--muted);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.nav-drawer-toggle,
.sidebar-close {
  display: none;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef8f0;
  color: var(--primary-dark);
  font-weight: 700;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-brand-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.topbar-title {
  justify-items: center;
  text-align: center;
}

.topbar-title h1 {
  margin: 0;
}

.topbar-brand-copy .brand-badge {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-self: end;
}

.app-layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.app-main {
  min-width: 0;
}

.app-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(18, 84, 47, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #1b6d3c 0%, #155a31 100%);
  box-shadow: 0 20px 40px rgba(18, 84, 47, 0.22);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.sidebar-profile {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-profile strong {
  font-size: 17px;
  line-height: 1.2;
  color: #fff;
}

.sidebar-profile span:last-child {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

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

.sidebar-single-link,
.nav-group-home,
.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 600;
  text-align: left;
}

.sidebar-single-link:hover,
.nav-group-home:hover,
.nav-item:hover,
.sidebar-single-link:focus-visible,
.nav-group-home:focus-visible,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
}

.sidebar-single-link.active,
.nav-group-home.active,
.nav-item.active {
  background: #f4b400;
  border-color: #f4b400;
  color: #173126;
}

.nav-group {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.nav-group > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
  color: #fff;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group > summary small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.nav-group[open] > summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.nav-group-items {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.sidebar-overlay {
  display: none;
}

.notification-shell {
  position: relative;
}

.notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-dark);
}

.notification-bell.is-open,
.notification-bell:hover,
.notification-bell:focus-visible {
  background: #eef8f0;
  border-color: #cde4d1;
}

.notification-bell-icon {
  font-size: 20px;
  line-height: 1;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 45;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  max-height: min(70vh, 560px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.notification-dropdown-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.notification-dropdown-header > div {
  display: grid;
  gap: 4px;
}

.notification-dropdown-header span {
  color: var(--muted);
  font-size: 13px;
}

.notification-dropdown-list,
.notification-list {
  display: grid;
  gap: 12px;
}

.notification-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notification-card-unread {
  border-color: rgba(31, 122, 67, 0.32);
  box-shadow: inset 3px 0 0 var(--primary);
  background: linear-gradient(180deg, #ffffff 0%, #f7fcf7 100%);
}

.notification-card-compact {
  padding: 14px;
}

.notification-card-main {
  display: grid;
  gap: 8px;
}

.notification-card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.notification-card p {
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notification-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.user-pill {
  display: grid;
  gap: 2px;
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
}

.feedback-banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

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

.feedback-dismiss {
  flex: 0 0 auto;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.feedback-dismiss:hover,
.feedback-dismiss:focus-visible {
  background: rgba(0, 0, 0, 0.08);
}

.feedback-success {
  background: var(--success-soft);
  border-color: rgba(21, 115, 71, 0.22);
  color: var(--success);
}

.feedback-error {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.24);
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  min-width: min(360px, calc(100vw - 32px));
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(20, 32, 48, 0.16);
  background: #fff;
  animation: toast-in 0.18s ease-out;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toast-success {
  background: var(--success-soft);
  border-color: rgba(21, 115, 71, 0.22);
  color: var(--success);
}

.toast-error {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.24);
  color: var(--danger);
}

.toast-info {
  background: #edf4ff;
  border-color: #c7dcff;
  color: var(--primary-dark);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 32, 48, 0.34);
  backdrop-filter: blur(3px);
  pointer-events: all;
  cursor: progress;
}

.busy-overlay.hidden {
  display: none;
}

.busy-card {
  width: min(100%, 420px);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px 24px;
  border-radius: 8px;
  border: 1px solid rgba(214, 223, 235, 0.95);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 48px rgba(20, 32, 48, 0.18);
  text-align: center;
}

.busy-card strong {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.busy-card p {
  max-width: 32ch;
}

.busy-spinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid #d8e5ff;
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.panel {
  padding: 24px;
  margin-bottom: 20px;
}

.panel-highlight {
  border-color: rgba(31, 122, 67, 0.28);
  box-shadow: 0 18px 42px rgba(31, 122, 67, 0.08);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.header-actions,
.form-actions,
.inline-actions,
.record-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.stats-grid,
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.compact-stats-grid,
.report-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card,
.action-card,
.employee-card,
.empty-state {
  border-radius: 8px;
  border: 1px solid var(--line);
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf5 100%);
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-value {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1;
}

.action-grid {
  margin-top: 18px;
}

.download-panel {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf5 100%);
}

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

.submission-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.submission-image-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  min-width: 0;
}

.submission-image-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(23, 49, 38, 0.08);
  background: #fff;
}

.submission-image-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.submission-image-meta strong {
  display: block;
  min-width: 0;
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.submission-image-meta span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.action-card {
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 18px;
  background: linear-gradient(180deg, #fbfefb 0%, #f1f9f2 100%);
  align-content: start;
  min-height: 132px;
}

.action-card strong {
  font-size: 16px;
  line-height: 1.2;
}

.action-card span {
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.filter-form {
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fcfefc 0%, #f4faf4 100%);
  align-items: end;
}

.filter-form .form-actions {
  gap: 14px;
  padding-top: 6px;
  margin-top: 4px;
}

.report-general-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf5 100%);
}

.report-general-card h3 {
  font-size: 18px;
  line-height: 1.2;
  margin-top: 6px;
}

.report-general-card .helper-text {
  margin-top: 4px;
  max-width: 54ch;
}

.report-builder-form {
  margin-bottom: 0;
  margin-top: 20px;
  padding: 24px;
  gap: 18px 20px;
}

.report-builder-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 6px;
}

.report-builder-header h3 {
  margin-top: 6px;
  font-size: 21px;
  line-height: 1.2;
}

.login-form {
  grid-template-columns: 1fr;
}

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

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.inline-filter {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #5d6c80 50%),
    linear-gradient(135deg, #5d6c80 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(31, 122, 67, 0.18);
  border-color: var(--primary);
}

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

.employee-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(180deg, #fbfefb 0%, #f3f9f4 100%);
}

.hidden-card {
  display: none;
}

.primary-button,
.secondary-button,
.secondary-link,
.danger-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 700;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  border: 0;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

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

.secondary-button,
.secondary-link {
  background: #eef8f0;
  color: var(--primary-dark);
  border: 1px solid #cde4d1;
}

.secondary-button:hover,
.secondary-button:focus-visible,
.secondary-link:hover,
.secondary-link:focus-visible {
  background: #e3f3e6;
}

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

.text-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--primary-dark);
}

.text-button:hover,
.text-button:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.text-button-danger {
  color: var(--danger);
}

.text-button-danger:hover,
.text-button-danger:focus-visible {
  color: #8f1c13;
}

.helper-text {
  font-size: 13px;
}

.selection-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf5 100%);
}

.selection-summary > div {
  display: grid;
  gap: 4px;
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.selection-summary strong {
  font-size: 28px;
  line-height: 1;
}

.plot-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfefb 0%, #f3f9f4 100%);
}

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

.plot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.selection-panel,
.scope-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfefb 0%, #f3f9f4 100%);
}

.selection-panel-header,
.scope-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.farm-selector-grid,
.stacked-scope-list {
  display: grid;
  gap: 12px;
}

.farm-selector-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.scope-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.compact-header {
  margin-top: 6px;
}

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

.tree-company-card,
.tree-leaf-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf6 100%);
}

.tree-company-card {
  padding: 18px;
}

.tree-company-selected {
  border-color: rgba(31, 122, 67, 0.34);
  box-shadow: 0 10px 28px rgba(31, 122, 67, 0.08);
}

.tree-company-header,
.tree-leaf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.tree-company-children,
.tree-children {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.tree-node {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tree-node-selected {
  border-color: rgba(31, 122, 67, 0.34);
  box-shadow: inset 0 0 0 1px rgba(31, 122, 67, 0.08);
}

.tree-node[open] {
  background: linear-gradient(180deg, #ffffff 0%, #f8fcf7 100%);
}

.tree-node > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
}

.tree-node > summary::-webkit-details-marker {
  display: none;
}

.tree-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.tree-heading p,
.tree-leaf-header p {
  margin-top: 4px;
}

.tree-node .tree-children {
  padding: 0 16px 16px;
}

.record-actions {
  padding: 2px 0 4px;
}

.tree-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.tree-metric-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.tree-metric-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.tree-leaf-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.compact-form-grid {
  gap: 14px;
}

.nested-plot-panel {
  padding: 14px;
}

.nested-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
}

.inline-actions {
  justify-content: flex-start;
}

.plot-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.plot-chip input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

.activity-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.activity-chip-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  min-height: 110px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.activity-chip-card input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
}

.activity-chip-body {
  display: grid;
  gap: 4px;
}

.activity-chip-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.activity-chip-id,
.activity-chip-mode {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.activity-chip-id {
  background: #eef4ff;
  color: var(--primary-dark);
}

.activity-chip-mode {
  background: #eef8f0;
  color: var(--primary-dark);
}

.activity-chip-body strong {
  font-size: 16px;
  line-height: 1.2;
}

.activity-chip-body span,
.activity-chip-body small {
  color: var(--muted);
}

.plot-chip-completed {
  background: #f5f7fb;
  color: var(--muted);
  border-style: dashed;
  cursor: not-allowed;
}

.compact-empty {
  padding: 14px 16px;
}

.detail-stack {
  display: grid;
  gap: 14px;
}

.compact-form {
  margin-bottom: 18px;
}

.detail-form-shell {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf5 100%);
}

.compact-stats {
  margin-bottom: 18px;
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  background: #fff;
  resize: vertical;
}

.detail-block,
.detail-subblock {
  display: grid;
  gap: 10px;
}

.detail-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
}

.detail-subblock {
  padding: 12px 14px;
  border: 1px solid #e1e8f2;
  border-radius: 8px;
  background: #fbfdff;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.helper-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.pwa-helper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.notification-actions {
  margin-top: 14px;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-table-shell {
  margin-top: 34px;
}

.list-context-note {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

.report-data-table {
  min-width: 1480px;
}

.report-data-table th,
.report-data-table td {
  padding: 20px 16px;
  line-height: 1.5;
  font-size: 15px;
}

.report-production-table {
  min-width: 1820px;
}

.report-collaborator-summary-table {
  min-width: 1240px;
}

.report-work-order-table {
  min-width: 1420px;
}

.report-data-table th:first-child,
.report-data-table td:first-child {
  min-width: 124px;
  width: 124px;
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
}

.report-date-text {
  display: inline-block;
  min-width: 96px;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  font-variant-numeric: tabular-nums;
}

.report-data-table th:nth-child(2),
.report-data-table td:nth-child(2) {
  min-width: 150px;
}

.report-data-table th:nth-child(5),
.report-data-table td:nth-child(5) {
  min-width: 190px;
}

.report-data-table th:nth-child(7),
.report-data-table td:nth-child(7) {
  min-width: 120px;
}

.report-data-table th:nth-child(12),
.report-data-table td:nth-child(12) {
  min-width: 180px;
}

.report-data-table th:nth-child(14),
.report-data-table td:nth-child(14) {
  min-width: 140px;
}

.report-data-table th:nth-child(15),
.report-data-table td:nth-child(15) {
  min-width: 160px;
}

.report-work-order-table th:nth-child(1),
.report-work-order-table td:nth-child(1) {
  min-width: 124px;
}

.report-work-order-table th:nth-child(2),
.report-work-order-table td:nth-child(2) {
  min-width: 180px;
}

.report-work-order-table th:nth-child(3),
.report-work-order-table td:nth-child(3) {
  min-width: 220px;
}

.report-work-order-table th:nth-child(4),
.report-work-order-table td:nth-child(4) {
  min-width: 150px;
}

.report-work-order-table th:nth-child(5),
.report-work-order-table td:nth-child(5) {
  min-width: 180px;
}

.report-work-order-table th:nth-child(8),
.report-work-order-table td:nth-child(8) {
  min-width: 260px;
}

.report-collaborator-summary-table th:nth-child(1),
.report-collaborator-summary-table td:nth-child(1) {
  min-width: 190px;
}

.report-collaborator-summary-table th:nth-child(7),
.report-collaborator-summary-table td:nth-child(7) {
  min-width: 260px;
}

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

.data-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #f5faf5;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(31, 122, 67, 0.035);
}

.submission-date-text,
.submission-production-text {
  display: inline-block;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.submission-row-actions {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.data-table td[data-label="Ações"] {
  min-width: 120px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-ok {
  background: var(--success-soft);
  color: var(--success);
}

.status-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-neutral {
  background: #eef4f1;
  color: var(--muted);
}

.empty-state {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: var(--surface-soft);
}

.demo-hint {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  background: #f7fafc;
  border: 1px solid var(--line);
}

.compact-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.status-note {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.submission-scope-summary {
  display: grid;
  gap: 8px;
}

.submission-scope-summary > div {
  display: grid;
  gap: 2px;
}

.submission-scope-label,
.muted-inline {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.submission-scope-summary strong {
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.inline-edit-input {
  width: 100%;
  min-width: 92px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

code {
  padding: 1px 6px;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--primary-dark);
}

.panel,
.table-shell,
.stat-card,
.action-card,
.notification-card,
.user-pill,
.section-header,
.section-header > div {
  min-width: 0;
}

.table-shell {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table th,
.data-table td {
  overflow-wrap: anywhere;
}

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

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(320px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    border-radius: 0 8px 8px 0;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.2s ease-out;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 44;
    display: block;
    border: 0;
    padding: 0;
    background: rgba(20, 32, 48, 0.28);
  }

  .nav-drawer-toggle,
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .stats-grid,
  .action-grid,
  .form-grid,
  .employee-grid,
  .selection-summary {
    grid-template-columns: 1fr;
  }

  .download-panel,
  .section-header,
  .topbar,
  .topbar-left {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar {
    display: flex;
    gap: 14px;
  }

  .topbar-left {
    width: 100%;
  }

  .topbar-brand-copy,
  .topbar-actions {
    width: 100%;
  }

  .topbar-title {
    justify-items: flex-start;
    text-align: left;
  }

  .topbar-actions {
    justify-self: auto;
  }

  .nested-summary,
  .scope-card-header,
  .selection-panel-header {
    align-items: stretch;
  }

  .filter-form {
    padding: 16px;
  }

  .notification-dropdown {
    right: auto;
    left: 0;
    width: min(360px, calc(100vw - 24px));
  }
}

@media (max-width: 720px) {
  .shell,
  .login-layout,
  .loading-shell {
    padding: 18px 12px 36px;
  }

  .panel {
    padding: 18px;
  }

  h2 {
    font-size: 22px;
  }

  .filter-form .form-actions,
  .header-actions,
  .inline-actions,
  .record-actions {
    width: 100%;
  }

  .filter-form .form-actions > *,
  .header-actions > *,
  .inline-actions > *,
  .record-actions > * {
    flex: 1 1 100%;
  }

  .download-panel,
  .tree-company-header,
  .tree-leaf-header,
  .tree-heading {
    align-items: stretch;
  }

  .topbar-actions,
  .user-pill {
    width: 100%;
  }

  .nav-drawer-toggle {
    width: 100%;
  }

  .notification-bell {
    width: 44px;
    min-width: 44px;
  }

  .notification-dropdown {
    position: fixed;
    top: max(68px, calc(env(safe-area-inset-top, 0px) + 56px));
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: min(72vh, calc(100vh - 88px));
  }

  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(23, 49, 38, 0.04);
  }

  .data-table td {
    border: 0;
    padding: 8px 0;
  }

  .data-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .toast {
    right: auto;
    left: 50%;
    bottom: 16px;
    min-width: auto;
    width: min(420px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    transform: translateX(-50%);
  }
}

@media (max-width: 480px) {
  .shell,
  .login-layout,
  .loading-shell {
    padding: 14px 10px 28px;
  }

  .panel,
  .login-card {
    padding: 16px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 20px;
  }

  .notification-dropdown {
    right: 10px;
    left: 10px;
    top: max(64px, calc(env(safe-area-inset-top, 0px) + 52px));
    width: auto;
  }

  .brand-logo-topbar,
  .brand-logo-login {
    width: min(220px, 100%);
  }

  .data-table tr {
    padding: 8px 10px;
  }

  .inline-actions .text-button,
  .inline-actions .secondary-button,
  .inline-actions .primary-button {
    width: 100%;
  }
}
