:root {
  --flour: #f2ead9;
  --crust: #3a2a1e;
  --crumb: #6b5744;
  --honey: #c8892b;
  --rye: #8a3b2b;
  --paper: #fffdf8;
  --line: #ddd0b6;
  --ok: #4b7a4a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--flour);
  color: var(--crust);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 3px solid var(--crust);
  background: var(--paper);
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand span { color: var(--honey); }

.who { font-family: -apple-system, sans-serif; font-size: 13px; color: var(--crumb); }
.who button {
  margin-left: 10px;
  border: 1px solid var(--crumb);
  background: transparent;
  color: var(--crumb);
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 12px 18px;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
  font-size: 14px;
  color: var(--crumb);
  border-bottom: 3px solid transparent;
}
.tab.active { color: var(--rye); border-color: var(--rye); font-weight: 600; }

main { padding: 28px; max-width: 1000px; margin: 0 auto; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

h1, h2, h3 { font-family: 'Georgia', serif; margin-top: 0; }
h2 { font-size: 19px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }

table { width: 100%; border-collapse: collapse; font-family: -apple-system, sans-serif; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--crumb); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

input, select {
  font-family: -apple-system, sans-serif;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  background: var(--flour);
}

button.primary {
  background: var(--rye);
  color: var(--paper);
  border: none;
  padding: 9px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
  font-size: 14px;
}
button.primary:hover { background: #6f2d20; }
button.secondary {
  background: transparent;
  border: 1px solid var(--crumb);
  color: var(--crumb);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
  font-size: 13px;
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ingredient-row { display: grid; grid-template-columns: 2fr 1fr 40px; gap: 8px; margin-bottom: 6px; align-items: center; }

.cost-box {
  background: #f7f1e3;
  border: 1px dashed var(--honey);
  border-radius: 4px;
  padding: 12px 14px;
  font-family: -apple-system, sans-serif;
  font-size: 14px;
  margin-top: 10px;
}
.cost-box .big { font-size: 20px; font-weight: 700; color: var(--rye); }

.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 36px;
  border-radius: 8px;
  width: 320px;
}
.login-card h1 { text-align: center; margin-bottom: 24px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-card button { width: 100%; }
.error { color: var(--rye); font-family: -apple-system, sans-serif; font-size: 13px; margin-top: 8px; }
.hint { font-family: -apple-system, sans-serif; font-size: 12px; color: var(--crumb); margin-top: 14px; text-align: center; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-family: -apple-system, sans-serif; background: #eee; }

@media (max-width: 640px) {
  .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .brand { font-size: 17px; }
  .who { font-size: 12px; }

  .tabs {
    padding: 0 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }
  .tab {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  main { padding: 14px; }
  .card { padding: 14px; margin-bottom: 14px; }
  h2 { font-size: 16px; }

  table { font-size: 12px; }
  th, td { padding: 6px 4px; }

  .row { flex-direction: column; align-items: stretch; gap: 8px; }
  .row input, .row select { width: 100% !important; }

  .ingredient-row {
    grid-template-columns: 1fr !important;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
  }

  button.primary, button.secondary { width: 100%; }
  .card .row button.secondary { width: auto; }

  .login-card { width: 88vw; padding: 24px; }
}
