:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1f2430;
  --muted: #707888;
  --line: #e3e6ec;
  --accent: #b5462f;      /* warm brick — food/kitchen feel */
  --accent-ink: #ffffff;
  --good: #2f8f5b;
  --warn: #c0392b;
  --shadow: 0 1px 3px rgba(20,24,33,.08), 0 6px 24px rgba(20,24,33,.06);
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
a { color: inherit; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: var(--panel); padding: 32px; border-radius: var(--radius);
  box-shadow: var(--shadow); width: 320px; display: flex; flex-direction: column; gap: 6px;
}
.login-card h1 { color: var(--accent); }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-top: 10px; }
.login-card button { margin-top: 18px; }
.alert { background: #fdecea; color: var(--warn); padding: 8px 10px; border-radius: 6px; font-size: 13px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #20242e; color: #c9cedb; display: flex; flex-direction: column; padding: 18px 0; }
.brand { font-weight: 700; font-size: 16px; padding: 0 20px 16px; color: #fff; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar nav a { padding: 10px 20px; text-decoration: none; color: #c9cedb; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: #2a2f3b; }
.sidebar nav a.active { background: #2a2f3b; border-left-color: var(--accent); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 16px 20px 0; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid #2a2f3b; }
.sidebar-foot a { text-decoration: none; }
.content { padding: 28px 32px; overflow: auto; }

/* ---------- bits ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.toolbar .left { display: flex; align-items: center; gap: 12px; }
button {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 8px 14px; border-radius: 8px;
}
button:hover { border-color: #c7ccd6; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(.95); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 8px; }
button.danger { color: var(--warn); }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
tr:last-child td { border-bottom: none; }
tr.clickable:hover { background: #fafbfc; cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.good { background: #e7f4ec; color: var(--good); }
.badge.bad { background: #fdecea; color: var(--warn); }
.tag { display: inline-block; background: #eef0f4; color: var(--muted); padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.linkish { color: var(--accent); cursor: pointer; }
.err-text { color: var(--warn); font-size: 12px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,24,33,.45); display: grid; place-items: start center; padding: 40px 16px; overflow: auto; z-index: 50; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 720px; padding: 24px; }
.modal h2 { margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.hint { font-size: 12px; color: var(--muted); margin-top: -6px; margin-bottom: 12px; }

/* recipe builder */
.line-row { display: grid; grid-template-columns: 2.4fr .8fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.line-row .lc { text-align: right; font-variant-numeric: tabular-nums; padding-right: 4px; }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.summary .card { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.summary .card .k { font-size: 12px; color: var(--muted); }
.summary .card .v { font-size: 20px; font-weight: 650; margin-top: 2px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 13px; background: #f1f2f5; padding: 5px 10px; border-radius: 6px; }
.checks input { width: auto; }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0; border: none; padding: 0; }
  .grid2, .grid3, .summary { grid-template-columns: 1fr 1fr; }
  .line-row { grid-template-columns: 1fr 1fr; }
}
