/* Local report redesign aligned with the Agroma Orchard Atlas visual system. */
:root {
  --atlas-bg: #f5f8f2;
  --atlas-card: #ffffff;
  --atlas-border: #e0ebd5;
  --atlas-accent: #3a7d30;
  --atlas-accent-dark: #2e6325;
  --atlas-accent-soft: rgba(58, 125, 48, 0.08);
  --atlas-text: #1a2d18;
  --atlas-muted: #5e7854;
  --atlas-muted-light: #8fa882;
  --atlas-sidebar: #eef3e8;
  --atlas-sidebar-border: #d6e4cc;
  --atlas-input-border: #c8dbbf;
  --atlas-danger: #c94e43;
  --atlas-danger-soft: #fcedea;
  --atlas-shadow: 0 1px 4px rgba(52, 100, 38, 0.07);
  --atlas-sidebar-width: 220px;
  --green-950: #1a2d18;
  --green-900: #2e6325;
  --green-800: #3a7d30;
  --green-700: #4e9141;
  --green-100: #e7f0e2;
  --green-50: #f5f8f2;
  --ink: var(--atlas-text);
  --muted: var(--atlas-muted);
  --line: var(--atlas-border);
  --soft-line: #edf3e8;
  --surface: var(--atlas-card);
  --page: var(--atlas-bg);
  --shadow-card: var(--atlas-shadow);
}

html,
body {
  background: var(--atlas-bg);
}

body {
  color: var(--atlas-text);
  background-image: none;
  font-size: 13px;
  line-height: 1.5;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-color: rgba(58, 125, 48, 0.24);
}

.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.workspace-heading h2,
.workspace-heading p {
  margin: 0;
}

.workspace-kicker {
  color: var(--atlas-muted-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.workspace-heading h2 {
  margin-top: 3px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.workspace-heading div > p:last-child {
  margin-top: 3px;
  color: var(--atlas-muted);
  font-size: 12px;
}

.form-section,
.sent-panel,
.fridge-panel {
  margin-top: 0;
  overflow: hidden;
  border: 1px solid var(--atlas-border);
  border-radius: 14px;
  background: var(--atlas-card);
  box-shadow: var(--atlas-shadow);
}

.section-heading {
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #edf3e8;
}

.section-heading h2 {
  color: var(--atlas-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-heading p {
  margin-top: 3px;
  color: var(--atlas-muted);
  font-size: 11px;
}

.section-number,
.optional-number {
  width: 30px;
  height: 30px;
  color: var(--atlas-accent);
  font-size: 11px;
  border: 1px solid rgba(58, 125, 48, 0.16);
  border-radius: 9px;
  background: var(--atlas-accent-soft);
}

.setup-card {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 20px;
}

.setup-row,
.setup-row + .setup-row {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  min-height: 76px;
  padding: 11px 12px;
  border: 1px solid var(--atlas-border);
  border-radius: 10px;
  background: var(--atlas-card);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.setup-row:hover,
.setup-row:focus-within {
  border-color: var(--atlas-input-border);
  background: #fbfdf9;
  box-shadow: 0 0 0 2px rgba(58, 125, 48, 0.06);
}

.setup-row-wide {
  grid-column: 1 / -1;
}

.row-icon,
.pale-green,
.pale-yellow,
.pale-purple {
  width: 36px;
  height: 36px;
  color: var(--atlas-accent);
  font-size: 16px;
  border-radius: 9px;
  background: var(--atlas-accent-soft);
}

.field-label {
  margin-bottom: 3px;
  color: var(--atlas-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.setup-row input,
.setup-row select {
  min-height: 28px;
  color: var(--atlas-text);
  font-size: 14px;
  font-weight: 650;
}

.chevron {
  display: none;
}

.number-grid,
.sales-grid {
  gap: 12px;
  padding: 18px 20px 14px;
}

.metric-card,
.sales-card,
.metric-gold,
.metric-red,
.sales-damaged {
  border: 1px solid var(--atlas-border);
  border-radius: 10px;
  background: #fbfdf9;
}

.metric-card {
  padding: 13px;
}

.metric-red,
.sales-damaged {
  border-color: #efd9d5;
  background: #fffafa;
}

.metric-title,
.sales-helper {
  color: var(--atlas-muted);
  font-size: 11px;
}

.input-wrap,
.money-input {
  border-color: var(--atlas-input-border);
  border-radius: 8px;
}

.input-wrap input {
  height: 44px;
  color: var(--atlas-text);
  font-size: 20px;
  font-weight: 700;
}

.unit,
.currency {
  color: var(--atlas-accent);
  font-size: 10px;
}

.metric-red .unit {
  color: var(--atlas-danger);
}

.calculation-card,
.sales-summary {
  border-color: rgba(58, 125, 48, 0.18);
  border-radius: 10px;
  background: var(--atlas-accent-soft);
}

.calculation-card {
  margin: 0 20px 20px;
}

.calculation-icon,
.money-icon {
  color: var(--atlas-accent);
  border: 1px solid rgba(58, 125, 48, 0.16);
  background: var(--atlas-card);
}

.calculation-copy strong,
.sales-summary strong {
  color: var(--atlas-accent);
}

.sales-section {
  max-height: 760px;
}

.sales-card {
  padding: 13px;
}

.sales-title {
  color: var(--atlas-text);
  font-size: 13px;
}

.sales-damaged .money-icon {
  color: var(--atlas-danger);
  border-color: #efd9d5;
  background: var(--atlas-danger-soft);
}

.money-input input {
  height: 44px;
  color: var(--atlas-text);
  font-size: 15px;
}

.sales-card-total {
  border-color: var(--atlas-border);
}

.sales-summary {
  margin: 0 20px 20px;
}

.notes-field {
  padding: 18px 20px 20px;
}

textarea,
.duplicate-reason-field textarea {
  min-height: 104px;
  border-color: var(--atlas-input-border);
  border-radius: 10px;
  background: #fbfdf9;
}

.input-wrap:focus-within,
.money-input:focus-within,
textarea:focus,
.duplicate-reason-field textarea:focus {
  border-color: var(--atlas-accent);
  box-shadow: 0 0 0 2px rgba(58, 125, 48, 0.1);
}

.form-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

.button {
  min-height: 44px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
}

.button-primary {
  color: #fff;
  border: 1px solid var(--atlas-accent);
  background: var(--atlas-accent);
  box-shadow: none;
}

.button-primary:hover {
  border-color: var(--atlas-accent-dark);
  background: var(--atlas-accent-dark);
}

.button-secondary {
  color: var(--atlas-accent);
  border: 1px solid var(--atlas-accent);
  background: transparent;
}

.button-danger {
  background: var(--atlas-danger);
  box-shadow: none;
}

.confirmation-dialog {
  border: 1px solid var(--atlas-border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(26, 45, 24, 0.2);
}

.confirmation-dialog::backdrop {
  background: rgba(26, 45, 24, 0.46);
}

.dialog-icon {
  color: var(--atlas-accent);
  border-radius: 10px;
  background: var(--atlas-accent-soft);
}

.confirmation-dialog dl,
.duplicate-match-card {
  border-color: var(--atlas-border);
  border-radius: 10px;
  background: #fbfdf9;
}

.sent-panel,
.fridge-panel {
  margin-top: 0;
}

.sent-list,
.fridge-list,
.fridge-summary {
  padding-right: 20px;
  padding-left: 20px;
}

.sent-item,
.fridge-item {
  border-color: var(--atlas-border);
  border-radius: 10px;
  box-shadow: none;
}

.toast {
  border: 1px solid var(--atlas-border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(26, 45, 24, 0.16);
}

@media (min-width: 961px) {
  .app-header {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--atlas-sidebar-width);
    height: 100vh;
    padding: 0;
    color: var(--atlas-text);
    overflow: visible;
    border-right: 1px solid var(--atlas-sidebar-border);
    background: var(--atlas-sidebar);
    box-shadow: none;
  }

  .header-inner {
    display: block;
    width: 100%;
    min-height: 0;
    height: 100%;
    padding: 24px 20px;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .brand-cluster {
    display: block;
  }

  .brand-mark {
    display: none;
  }

  .eyebrow {
    color: #7cb069;
    font-size: 23px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: lowercase;
  }

  .title-block h1 {
    margin-top: 16px;
    color: var(--atlas-text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
  }

  .title-block > p:last-child {
    margin-top: 3px;
    color: var(--atlas-muted);
    font-size: 10px;
  }

  .header-actions {
    position: absolute;
    right: 20px;
    bottom: 24px;
    left: 20px;
    align-items: center;
  }

  .language-toggle {
    width: 108px;
    color: var(--atlas-muted);
    border: 1px solid var(--atlas-sidebar-border);
    background: rgba(255, 255, 255, 0.52);
  }

  .language-toggle::before {
    background: var(--atlas-card);
    box-shadow: 0 1px 4px rgba(52, 100, 38, 0.1);
  }

  :root[data-language="ru"] [data-lang-pill="ru"],
  :root[data-language="az"] [data-lang-pill="az"] {
    color: var(--atlas-accent);
  }

  .account-menu summary {
    color: var(--atlas-accent);
    border: 1px solid var(--atlas-sidebar-border);
    background: rgba(255, 255, 255, 0.52);
  }

  .account-popover {
    top: auto;
    right: auto;
    bottom: calc(100% + 8px);
    left: 0;
    border-color: var(--atlas-border);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(52, 100, 38, 0.14);
  }

  .page-shell {
    width: auto;
    max-width: 1240px;
    padding: 26px 32px 56px;
    margin: 0 0 0 var(--atlas-sidebar-width);
  }

  #harvest-form {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 16px;
    align-items: start;
  }

  .details-section,
  .notes-section {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    position: fixed;
    z-index: 11;
    top: 124px;
    right: auto;
    bottom: auto;
    left: 0;
    display: grid;
    width: var(--atlas-sidebar-width);
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    justify-content: stretch;
    justify-items: stretch;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .bottom-nav-label {
    display: block;
    padding: 16px 20px 8px;
    color: var(--atlas-muted-light);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
  }

  .nav-item {
    display: flex;
    grid-template-columns: none;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    justify-content: flex-start;
    padding: 10px 20px;
    color: var(--atlas-muted);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    border-left: 3px solid transparent;
    transition:
      color 200ms cubic-bezier(0.4, 0, 0.2, 1),
      background-color 200ms cubic-bezier(0.4, 0, 0.2, 1),
      border-left-color 200ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  .nav-item > .nav-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    color: var(--atlas-muted);
    background: transparent;
  }

  .nav-item > .nav-icon svg {
    width: 16px;
    height: 16px;
  }

  .nav-item:hover {
    color: var(--atlas-text);
    background: rgba(58, 125, 48, 0.05);
  }

  .nav-item:is(.active, .is-active) {
    color: var(--atlas-accent);
    background: rgba(58, 125, 48, 0.1);
    animation: operator-nav-active-pulse 400ms ease forwards;
  }

  .nav-item:is(.active, .is-active)::before {
    display: none;
  }

  .nav-item:is(.active, .is-active) > .nav-icon {
    color: var(--atlas-accent);
    background: transparent;
  }

  .operator-nav-ink {
    position: fixed;
    z-index: 12;
    left: 0;
    display: block;
    width: 3px;
    height: 40px;
    pointer-events: none;
    opacity: 0;
    border-radius: 0 2px 2px 0;
    background: var(--atlas-accent);
    transition:
      top 200ms cubic-bezier(0.4, 0, 0.2, 1),
      height 200ms cubic-bezier(0.4, 0, 0.2, 1),
      opacity 160ms ease;
    will-change: top, height;
  }

  .sent-panel,
  .fridge-panel {
    min-height: 320px;
  }
}

@media (max-width: 960px) {
  .bottom-nav-label {
    display: none;
  }

  .workspace-heading {
    display: none;
  }

  .app-header {
    color: var(--atlas-text);
    background: rgba(245, 248, 242, 0.94);
    box-shadow: 0 1px 0 var(--atlas-sidebar-border);
    backdrop-filter: blur(14px);
  }

  .header-inner {
    border-color: var(--atlas-border);
    border-radius: 14px;
    background: var(--atlas-card);
    box-shadow: var(--atlas-shadow);
  }

  .brand-mark {
    border-color: var(--atlas-border);
    border-radius: 10px;
    background: var(--atlas-accent-soft);
  }

  .eyebrow {
    color: var(--atlas-accent);
  }

  .title-block h1 {
    color: var(--atlas-text);
  }

  .title-block > p:last-child {
    color: var(--atlas-muted);
  }

  .language-toggle {
    color: var(--atlas-muted);
    border: 1px solid var(--atlas-border);
    background: var(--atlas-bg);
  }

  .language-toggle::before {
    background: var(--atlas-card);
    box-shadow: 0 1px 4px rgba(52, 100, 38, 0.12);
  }

  :root[data-language="ru"] [data-lang-pill="ru"],
  :root[data-language="az"] [data-lang-pill="az"] {
    color: var(--atlas-accent);
  }

  .account-menu summary {
    color: var(--atlas-accent);
    border: 1px solid var(--atlas-border);
    background: var(--atlas-bg);
  }

  .page-shell {
    padding-top: 6px;
  }

  #harvest-form {
    display: grid;
    gap: 14px;
  }

  .bottom-nav {
    border-top-color: var(--atlas-sidebar-border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -8px 24px rgba(52, 100, 38, 0.08);
  }

  .nav-item:is(.active, .is-active) {
    color: var(--atlas-accent);
  }

  .nav-item:is(.active, .is-active) > .nav-icon {
    color: var(--atlas-accent);
    background: var(--atlas-accent-soft);
  }
}

@keyframes operator-nav-active-pulse {
  0% {
    background-color: rgba(58, 125, 48, 0.2);
  }

  100% {
    background-color: rgba(58, 125, 48, 0.1);
  }
}

@media (max-width: 700px) {
  .setup-card,
  .number-grid {
    grid-template-columns: 1fr;
  }

  .setup-row-wide {
    grid-column: auto;
  }

  .section-heading {
    padding: 15px 14px 12px;
  }

  .setup-card,
  .number-grid,
  .sales-grid {
    padding: 14px;
  }

  .calculation-card,
  .sales-summary {
    margin: 0 14px 14px;
  }

  .notes-field {
    padding: 14px;
  }
}

@media (max-width: 380px) {
  .sales-card {
    grid-template-columns: 1fr;
  }

  .money-input,
  .sales-helper {
    grid-row: auto;
    grid-column: 1;
  }
}

.harvest-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--atlas-bg);
}

.harvest-loading-mark {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--atlas-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(52, 100, 38, 0.10);
}

.harvest-loading-mark img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 12px;
}

.harvest-loading-mark span {
  position: absolute;
  inset: -5px;
  border: 2px solid transparent;
  border-top-color: var(--atlas-accent);
  border-radius: 22px;
  animation: harvest-session-spin 700ms linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .harvest-loading-mark span { animation: none; }
}

.harvest-gate-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--atlas-border);
  border-radius: 14px;
  background: var(--atlas-card);
  box-shadow: 0 12px 34px rgba(52, 100, 38, 0.12);
}

.harvest-gate-card h1,
.harvest-gate-card p {
  margin: 0;
}

.harvest-gate-card h1 {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.harvest-gate-card > p:not(.workspace-kicker):not(.harvest-gate-error) {
  color: var(--atlas-muted);
  font-size: 13px;
}

.harvest-gate-brand {
  color: #7cb069;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.harvest-gate-card label {
  display: grid;
  gap: 6px;
  color: var(--atlas-muted);
  font-size: 11px;
  font-weight: 700;
}

.harvest-gate-card input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  color: var(--atlas-text);
  border: 1px solid var(--atlas-input-border);
  border-radius: 10px;
  background: #fff;
}

.harvest-gate-error {
  min-height: 18px;
  color: var(--atlas-danger);
  font-size: 12px;
  font-weight: 700;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sent-list {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
}

.harvest-report-item {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--atlas-border);
  border-radius: 10px;
  background: #fbfdf9;
}

.harvest-report-item.is-cancelled {
  opacity: 0.68;
  background: #f7f7f5;
}

.harvest-report-head,
.harvest-report-actions,
.harvest-report-totals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.harvest-report-head strong {
  font-size: 14px;
}

.harvest-report-head span,
.harvest-report-meta,
.harvest-report-owner {
  color: var(--atlas-muted);
  font-size: 11px;
}

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

.harvest-report-metric {
  padding: 9px 10px;
  border: 1px solid var(--atlas-border);
  border-radius: 8px;
  background: #fff;
}

.harvest-report-metric span {
  display: block;
  color: var(--atlas-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.harvest-report-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.harvest-report-actions {
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--atlas-border);
}

.harvest-report-actions .button {
  min-height: 36px;
}

.editing-banner {
  grid-column: 1 / -1;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--atlas-accent);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(58, 125, 48, 0.18);
  border-radius: 10px;
  background: var(--atlas-accent-soft);
}

.editing-banner.visible {
  display: flex;
}

.editing-banner button {
  color: var(--atlas-accent);
  border: 0;
  background: transparent;
}

@media (max-width: 700px) {
  .harvest-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .harvest-gate {
    padding: 12px;
  }

  .harvest-gate-card {
    padding: 22px;
  }
}

@media (max-width: 560px) {
  .harvest-gate-card .button-primary {
    grid-row: auto;
  }
}
