:root {
  --pink: #c71e6b;
  --ink: #23262a;
  --muted: #6b7178;
  --line: #e2e4e7;
  --bg: #f5f6f7;
  --panel: #fff;
  --ok: #1f7a44;
  --warn: #b25b00;
  --danger: #c02b2b;
  --radius: 9px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--pink); }
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

/* topbar */
.topbar {
  background: var(--ink);
  color: #fff;
}
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 54px; }
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; }
.topbar .brand span { color: #ffa8cf; font-weight: 400; }
.topbar nav { display: flex; gap: 18px; margin-right: auto; }
.topbar nav a { color: #cfd3d8; text-decoration: none; font-size: 14px; }
.topbar nav a.on, .topbar nav a:hover { color: #fff; }
.topbar .logout { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cfd3d8; }
.topbar .logout button {
  background: transparent; border: 1px solid #4a4f56; color: #cfd3d8;
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
.topbar .logout button:hover { color: #fff; border-color: #6b7178; }

main.app { padding: 26px 0 80px; }
main.bare { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

/* flash */
.flash { border-radius: var(--radius); padding: 10px 14px; margin: 0 0 18px; font-size: 14px; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { background: #e6f4ec; color: var(--ok); border: 1px solid #b9e0c9; }
.flash-error { background: #fdeaea; color: var(--danger); border: 1px solid #f2c4c4; }
.flash-warn { background: #fff2e2; color: var(--warn); border: 1px solid #f3d7b0; }

/* login */
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 34px; width: 340px; box-shadow: 0 20px 50px rgba(0,0,0,.06);
}
.login-card h1 { margin: 0 0 2px; font-size: 22px; }
.login-card .muted { margin: 0 0 20px; color: var(--muted); }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.login-card input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}

/* buttons */
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 15px; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #c9ccd0; }
.btn-primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn-primary:hover { background: #a81a5a; border-color: #a81a5a; }
.btn-danger { background: #fff; border-color: #e6b3b3; color: var(--danger); }
.btn-danger:hover { background: #fdeaea; }
.btn-add { margin-top: 8px; font-size: 13px; padding: 6px 12px; }

/* page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .count {
  font-size: 13px; background: #e9ebee; color: var(--muted);
  border-radius: 20px; padding: 2px 9px; margin-left: 6px; vertical-align: middle;
}
.page-head .back { font-size: 13px; color: var(--muted); text-decoration: none; display: block; margin-bottom: 3px; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.head-actions select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* list table */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfb; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fafbfc; }
table.list .num { text-align: right; width: 70px; }
table.list .num.zero { color: #c9ccd0; }
table.list .slug { font-size: 12px; color: var(--muted); }
table.list .date { font-size: 13px; color: var(--muted); white-space: nowrap; }
table.list .row-actions { white-space: nowrap; font-size: 13px; }
table.list .row-actions a { margin-left: 10px; text-decoration: none; }

.badge { font-size: 12px; border-radius: 5px; padding: 2px 7px; text-transform: capitalize; }
.badge-published { background: #e6f4ec; color: var(--ok); }
.badge-draft { background: #eef0f2; color: var(--muted); }
.badge-archived { background: #fff2e2; color: var(--warn); }

/* form */
.recipe-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 18px; margin: 0 0 18px; }
.recipe-form legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 6px; }
.cols { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.field:last-child { margin-bottom: 0; }
.field input, .field textarea, .field select {
  display: block; width: 100%; margin-top: 5px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 14px; color: var(--ink); background: #fff;
  font-family: inherit;
}
.field small { display: block; margin-top: 4px; color: #9aa0a6; font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.hint { font-size: 12px; color: var(--muted); margin: 0 0 10px; }

/* dynamic rows */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 6px; align-items: flex-start; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fcfcfd; }
.row input, .row textarea, .row select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-family: inherit; }
.row .drag { color: #c4c8cc; cursor: grab; user-select: none; padding-top: 6px; font-size: 12px; }
.row .row-del { background: transparent; border: 0; color: #b0b4b9; cursor: pointer; font-size: 14px; padding: 4px 6px; }
.row .row-del:hover { color: var(--danger); }
.ingredient-row { flex-wrap: wrap; }
.ingredient-row .ing-name { flex: 1 1 180px; }
.ingredient-row .qty { width: 60px; }
.ingredient-row .unit { width: 120px; }
.ingredient-row .qtext { flex: 1 1 120px; }
.ingredient-row .inote { flex: 1 1 120px; }
.ingredient-row .opt { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 3px; padding-top: 4px; white-space: nowrap; }
.step-row .step-fields, .note-row .step-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.step-fields input, .step-fields textarea { width: 100%; }
.note-row .note-type { width: 100px; }

/* check lists */
.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 2px; }
.check input[type="radio"] { accent-color: var(--pink); }
.check.dim span { color: #a7abb0; }
.check em { color: #a7abb0; font-style: normal; font-size: 11px; }

.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.danger-form { margin-top: 30px; padding-top: 18px; border-top: 1px dashed var(--line); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }

/* photo panel */
.photo-panel {
  display: flex; gap: 18px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px;
}
.photo-preview {
  position: relative; flex: 0 0 200px; width: 200px; aspect-ratio: 4 / 3;
  border-radius: 8px; overflow: hidden; background: #eef0f2;
  display: grid; place-items: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview .dim {
  position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6);
  color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px;
}
.photo-empty { color: var(--muted); font-size: 13px; }
.photo-fields { flex: 1; min-width: 0; }
.photo-fields > strong { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 10px; }
.photo-fields .field input[type="file"] { padding: 6px; }
.photo-actions { display: flex; gap: 10px; margin-top: 6px; }
.photo-hint { color: var(--muted); font-size: 13px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; }

@media (max-width: 640px) {
  .photo-panel { flex-direction: column; }
  .photo-preview { flex-basis: auto; width: 100%; max-width: 280px; }
}

@media (max-width: 920px) {
  .cols { grid-template-columns: 1fr; }
}
