:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --panel: #ffffff;
  --ink: #17211c;
  --muted: #64706b;
  --line: #d8ded8;
  --green: #256b4f;
  --green-strong: #114b37;
  --green-soft: #e8f2ea;
  --amber: #8a6118;
  --amber-soft: #fff4d8;
  --red: #9a2e26;
  --red-soft: #fae7e4;
  --blue: #285f8f;
  --blue-soft: #e7f0f8;
  --sidebar: #14221b;
  --sidebar-line: rgba(255, 255, 255, 0.14);
  --shadow: 0 16px 40px rgba(24, 35, 30, 0.08);
  --focus: 0 0 0 3px rgba(37, 107, 79, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

button:disabled,
input:disabled,
select:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(37, 107, 79, 0.12), transparent 42%),
    var(--bg);
}

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

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

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

.login-card h1 {
  margin: 4px 0 10px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.05;
}

.login-form {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.login-form input {
  width: 100%;
}

.invite-panel {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.invite-panel summary {
  cursor: pointer;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(223, 234, 223, 0.14), transparent 32%),
    linear-gradient(180deg, #15251d 0%, var(--sidebar) 62%, #0f1a15 100%);
  color: #f6faf7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex: 0 0 auto;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dfeadf, #eff7ef);
  color: #18231e;
  font-weight: 800;
  font-size: 24px;
  box-shadow: inset 0 -1px 0 rgba(20, 34, 27, 0.18);
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  right: 6px;
  bottom: 6px;
  border-radius: 4px;
  border: 2px solid rgba(20, 34, 27, 0.26);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #b7c4bc;
  font-size: 13px;
}

.profile-panel h2 {
  margin: 0 0 10px;
  font-size: 13px;
  color: #b7c4bc;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.auth-panel h2 {
  margin: 0;
  color: #b7c4bc;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-current-user {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.auth-panel .field-label,
.auth-warning {
  color: #bac8c0;
  font-size: 12px;
}

.auth-panel select,
.auth-panel button {
  width: 100%;
  min-height: 38px;
}

.auth-warning {
  margin: 0;
  line-height: 1.35;
}

.profile-list,
.nav {
  display: grid;
  gap: 8px;
}

.profile-panel,
.nav {
  flex: 0 0 auto;
}

.profile-button,
.nav-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.profile-button:hover,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.profile-button {
  padding: 10px 12px;
}

.profile-button strong,
.profile-button span {
  display: block;
}

.profile-button span {
  margin-top: 3px;
  color: #bac8c0;
  font-size: 12px;
}

.profile-button.active,
.nav-button.active {
  background: #dfeadf;
  color: #18231e;
  border-color: #dfeadf;
  font-weight: 720;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.nav-button.active::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--green);
  vertical-align: middle;
}

.profile-button.locked {
  opacity: 0.78;
}

.profile-button.locked:hover {
  opacity: 1;
}

.nav {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--sidebar-line);
}

.nav-button {
  padding: 0 12px;
  white-space: normal;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.topbar > div {
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 40px;
  border: 1px solid #bad0c1;
  border-radius: 999px;
  background: #eef4ee;
  padding: 3px;
}

.language-toggle button {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--green-strong);
  padding: 0 10px;
  cursor: pointer;
  font-weight: 700;
}

.language-toggle button.active {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 12px rgba(17, 75, 55, 0.18);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.12;
}

.route-subtitle {
  max-width: 920px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

h2 {
  margin: 0;
  font-size: 17px;
}

.primary-button,
.note-form button,
.placeholder-actions button,
.file-action button,
.menu-action-grid button,
.inline-action {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
  box-shadow: 0 6px 16px rgba(17, 75, 55, 0.16);
}

.primary-button:hover,
.note-form button:hover,
.placeholder-actions button:hover,
.file-action button:hover,
.menu-action-grid button:hover,
.inline-action:hover {
  background: var(--green-strong);
}

.inline-action:disabled {
  background: #aab5ae;
  box-shadow: none;
  cursor: not-allowed;
}

.safety-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.safety-banner span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #bad0c1;
  border-radius: 999px;
  background: #eef4ee;
  color: #1f4f3c;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 650;
}

.message {
  border: 1px solid #cbd6d0;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--muted);
  box-shadow: 0 8px 22px rgba(24, 35, 30, 0.05);
}

.hidden,
.section-view {
  display: none;
}

.section-view.active {
  display: block;
}

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

.metric {
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--green);
}

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

.metric strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 30px;
}

.metric p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.metric[data-state="missing"],
.metric[data-state="empty"] {
  border-color: #ead4a3;
}

.metric[data-state="missing"]::before,
.metric[data-state="empty"]::before {
  background: var(--amber);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-start;
  border-bottom: 1px solid #edf1ee;
  padding-bottom: 10px;
}

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

.workflow-list {
  display: grid;
  gap: 8px;
}

.workflow-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid #edf1ee;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfb;
}

.workflow-state {
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 8px;
  text-align: center;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.workflow-state.ready {
  background: var(--green);
}

.workflow-state.next {
  background: var(--amber);
}

.workflow-state.done {
  background: var(--green);
}

.workflow-state.blocked {
  background: #7d8b84;
}

.checklist-safety {
  margin-top: 12px;
}

.checklist-summary {
  margin-top: 12px;
}

.checklist-steps {
  display: grid;
  gap: 10px;
}

.checklist-step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid #edf1ee;
  border-radius: 8px;
  background: #fbfdfb;
  padding: 12px;
}

.checklist-step.next {
  border-color: #d4ad56;
  background: #fff9ea;
}

.checklist-step.blocked {
  background: #f6f8f7;
}

.checklist-step-number {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e7efe9;
  color: var(--ink);
  font-weight: 800;
}

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

.checklist-step h3 {
  margin: 0 0 5px;
}

.checklist-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.checklist-check {
  margin: 8px 0 10px !important;
}

.warning-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.4;
}

.table-like {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.table-row {
  border: 1px solid #edf1ee;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfb;
  min-width: 0;
}

.table-row strong,
.table-row span {
  display: block;
  overflow-wrap: anywhere;
}

.table-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.note-form {
  display: grid;
  grid-template-columns: 140px 120px minmax(0, 1fr) 110px;
  gap: 8px;
  margin-bottom: 14px;
}

.note-form input,
.note-form select {
  min-height: 40px;
  border: 1px solid #cbd6d0;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.notes {
  display: grid;
  gap: 8px;
}

.note {
  border: 1px solid #d9e5dc;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #f7faf7;
  padding: 9px 10px;
}

.note.blocker {
  border-color: var(--red);
}

.note.friction {
  border-color: var(--amber);
}

.note small {
  display: block;
  color: var(--muted);
  margin-bottom: 3px;
}

.placeholder-panel {
  max-width: 760px;
}

.placeholder-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.placeholder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.section-intro {
  max-width: 920px;
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.safety-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.safety-strip span {
  border: 1px solid #d7e0da;
  border-radius: 999px;
  background: #f3f8f3;
  color: var(--green-strong);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 650;
}

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

.file-action {
  display: grid;
  gap: 9px;
  align-content: start;
  min-height: 230px;
  border: 1px solid #edf1ee;
  border-radius: 8px;
  background: #fbfdfb;
  padding: 14px;
}

.file-action p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.file-action input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd6d0;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

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

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

.recipe-action-grid.compact {
  grid-template-columns: minmax(0, 1fr) 120px;
}

.menu-action-grid.compact {
  grid-template-columns: minmax(0, 1fr);
}

.recipe-action-grid input,
.menu-action-grid input,
.file-action input[type="text"] {
  min-height: 40px;
  border: 1px solid #cbd6d0;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.recipe-action-grid button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}

.recipe-action-grid button:hover {
  background: var(--green-strong);
}

.confirm-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  line-height: 1.35;
  border: 1px solid #e6ece7;
  border-radius: 8px;
  background: #fbfdfb;
  padding: 9px 10px;
}

.confirm-line input {
  width: auto;
  min-height: 0;
  margin-top: 2px;
}

.field-label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

#receiving-approval-phrase {
  width: 100%;
  max-width: 520px;
  min-height: 40px;
  border: 1px solid #cbd6d0;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.import-summary {
  margin-top: 16px;
}

.result-box,
.issue-list {
  display: grid;
  gap: 8px;
}

.key-value-row,
.issue-row {
  border: 1px solid #edf1ee;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfb;
}

.key-value-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
}

.key-value-row strong,
.key-value-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.key-value-row span,
.issue-row span,
.issue-row p,
.batch-row small {
  color: var(--muted);
}

.key-value-row span,
.issue-row p,
.batch-row small {
  overflow-wrap: anywhere;
}

.issue-row p {
  margin: 3px 0 0;
  line-height: 1.35;
}

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

  .sidebar {
    position: relative;
    display: block;
    height: auto;
    max-height: none;
    min-height: auto;
    overflow: visible;
    padding: 16px;
  }

  .brand {
    margin-bottom: 14px;
  }

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

  .profile-button,
  .nav-button {
    min-height: 38px;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .primary-button {
    width: auto;
  }

  .summary-grid,
  .content-grid,
  .content-grid.three {
    grid-template-columns: 1fr;
  }

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

  .import-actions {
    grid-template-columns: 1fr;
  }

  .key-value-row {
    grid-template-columns: 1fr;
  }

  .recipe-action-grid,
  .recipe-action-grid.compact,
  .menu-action-grid,
  .menu-action-grid.compact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .login-screen {
    padding: 14px;
    align-items: start;
  }

  .login-card {
    padding: 18px;
  }

  .sidebar {
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .profile-list,
  .nav {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .profile-button,
  .nav-button {
    min-height: 48px;
    padding: 8px 10px;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    gap: 12px;
  }

  .language-toggle {
    flex: 1 1 auto;
  }

  .language-toggle button {
    flex: 1 1 0;
  }

  .topbar .primary-button {
    min-width: 84px;
  }

  .panel,
  .metric {
    padding: 14px;
  }

  .workflow-item {
    grid-template-columns: 1fr;
  }

  .checklist-step {
    grid-template-columns: 1fr;
  }

  .checklist-step-header {
    display: grid;
  }

  .workflow-state {
    width: max-content;
    max-width: 100%;
  }

  .panel-header {
    display: grid;
  }

  .safety-banner,
  .safety-strip {
    gap: 7px;
  }

  .safety-banner span,
  .safety-strip span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}
