:root {
  --bg: #f4efe6;
  --surface: #fff9f0;
  --panel: #ffffff;
  --text: #1d2420;
  --muted: #69736d;
  --line: #e5ddd1;
  --green: #245947;
  --green-dark: #14372c;
  --gold: #c7a15b;
  --gold-soft: #f1dfb9;
  --red: #b84d43;
  --amber: #b7791f;
  --blue: #315f8f;
  --shadow: 0 18px 46px rgba(41, 32, 23, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(199, 161, 91, 0.18), transparent 32rem),
    linear-gradient(135deg, #fbf7ef 0%, var(--bg) 42%, #ebe0d1 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

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

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(rgba(20, 55, 44, 0.72), rgba(20, 55, 44, 0.72)),
    url("logo-amoratte.jpg") center/280px repeat;
}

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

.login-card {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.3);
}

.login-logo {
  width: 104px;
  height: 104px;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 18px;
  border: 4px solid var(--gold-soft);
  box-shadow: 0 10px 28px rgba(20, 55, 44, 0.22);
}

.login-card h1 {
  text-align: center;
  color: var(--green-dark);
}

.login-card .eyebrow,
.login-copy {
  text-align: center;
}

.login-copy {
  margin: 10px 0 24px;
  color: var(--muted);
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(20, 55, 44, 0.98), rgba(13, 31, 25, 0.98)),
    #15231d;
  color: white;
  padding: 24px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

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

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: white;
}

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

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

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

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #dce8e0;
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(199, 161, 91, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}

.content {
  padding: 30px;
  overflow: auto;
}

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

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

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.user-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 150px;
}

.user-chip span,
.user-chip strong {
  display: block;
}

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

.user-chip button {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  padding: 0;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  color: var(--green-dark);
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header.compact {
  margin-bottom: 0;
}

.panel-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select,
.form-card input,
.form-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--text);
}

.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f8efe0;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  color: var(--green-dark);
  background: #dff1e9;
}

.badge.low {
  color: var(--red);
  background: #f8dedb;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.muted {
  color: var(--muted);
  font-size: 12px;
}

.form-card {
  max-width: 720px;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.form-card.wide-card {
  max-width: none;
}

.form-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf6ee;
}

.mode-button {
  border: 0;
  border-radius: 6px;
  padding: 11px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.mode-button.active {
  color: white;
  background: var(--green);
}

.output-mode {
  display: none;
  gap: 16px;
}

.output-mode.active {
  display: grid;
}

.calculation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbf6ee;
}

.calculation.stacked {
  display: grid;
  align-items: stretch;
  gap: 10px;
}

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

.preview-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.preview-list span {
  color: var(--muted);
}

.preview-total {
  color: var(--green-dark);
}

.primary,
.secondary {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
}

.primary:hover {
  background: var(--green-dark);
}

.secondary {
  color: var(--green-dark);
  background: #e8f1ec;
}

.supplier-list {
  display: grid;
  gap: 16px;
}

.supplier-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.supplier-card h3 {
  margin: 0;
  padding: 12px;
  background: #fbf6ee;
  font-size: 16px;
}

.supplier-card ul {
  margin: 0;
  padding: 12px 12px 12px 30px;
}

.recipes-layout {
  align-items: start;
}

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

.recipe-card {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.recipe-card.active,
.recipe-card:hover {
  border-color: var(--gold);
  background: #fff4dd;
}

.recipe-card span {
  font-weight: 800;
}

.recipe-card small {
  color: var(--muted);
}

.recipe-detail {
  display: grid;
  gap: 12px;
}

.recipe-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.recipe-total span {
  color: var(--muted);
}

.recipe-total.highlight {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.recipe-total.highlight span {
  color: #dce8e0;
}

.recipe-table {
  min-width: 0;
}

.ingredient-editor {
  display: grid;
  gap: 10px;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(110px, 0.7fr) minmax(110px, 0.7fr) minmax(150px, 0.8fr) 40px;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.ingredient-unit {
  min-height: 43px;
  display: grid;
  align-content: center;
  gap: 3px;
}

.ingredient-unit span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ingredient-unit strong {
  font-size: 13px;
}

.status-ok {
  color: var(--green-dark);
}

.status-alert {
  color: var(--red);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--red);
  cursor: pointer;
  font-weight: 900;
}

.alert-box {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

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

.alert-box.success {
  background: #e7f4ed;
  border-color: #b8dfc9;
}

.alert-box.danger {
  background: #fae6e3;
  border-color: #efbeb8;
}

.alert-box.notice {
  background: #fff4dd;
  border-color: #ead19c;
}

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

.problem-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.problem-list span {
  color: var(--red);
}

.inventory-header {
  align-items: flex-start;
}

.inventory-actions {
  display: flex;
  gap: 10px;
}

.inventory-actions select {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}

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

.inventory-summary article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.inventory-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inventory-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.inventory-input {
  width: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: 360px;
  padding: 13px 14px;
  color: white;
  background: var(--green-dark);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast.active {
  display: block;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

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

  .content {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .inventory-actions,
  .inventory-header {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .inventory-summary,
  .two-column,
  .form-grid,
  .ingredient-row {
    grid-template-columns: 1fr;
  }
}
