/* Shared styles. Built for an iPad held in one hand: large text, buttons at least 44px tall. */

:root {
  --text: #1c1b1a;
  --muted: #5f5b57;
  --bg: #f7f5f2;
  --card: #ffffff;
  --line: #d9d4ce;
  --accent: #b4441c;
  --accent-text: #ffffff;
  --error-bg: #fdecea;
  --error-text: #8a1c12;
  --note-bg: #fff6dd;
  --note-text: #5c4400;
  --ok-bg: #e6f4ea;
  --ok-text: #1e5631;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, "Segoe UI", sans-serif;
  font-size: 20px;
  line-height: 1.4;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 48px 24px;
}

h1 { font-size: 2.2rem; margin: 0 0 8px; }
.subtitle { color: var(--muted); margin: 0 0 32px; }

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

label { display: block; font-weight: 600; margin: 0 0 8px; }

input {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  margin: 0 0 20px;
  font-size: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }

button {
  width: 100%;
  min-height: 60px;
  font-size: 1.2rem;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}

button.secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
/* A link that looks like a button: tap to call or email a supplier. */
a.button {
  display: flex; align-items: center; justify-content: center; min-height: 60px; border-radius: 12px;
  font-size: 1.2rem; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; text-align: center; padding: 0 12px;
}
a.button.secondary { color: var(--accent); border: 2px solid var(--accent); }
button:disabled { opacity: 0.6; cursor: default; }

.message { border-radius: 10px; padding: 14px 16px; margin: 0 0 20px; }
.message.error { background: var(--error-bg); color: var(--error-text); }
.message.note { background: var(--note-bg); color: var(--note-text); }
.message.success { background: var(--ok-bg); color: var(--ok-text); }

/* A stack of full-width buttons with room between them for a thumb. */
.actions { display: grid; gap: 16px; margin-top: 20px; }

h2 { font-size: 1.3rem; margin: 12px 0 4px; }
.hint { color: var(--muted); margin: 0 0 8px; }

/* On/off switches. The whole row is the tap target, at least 56px tall. */
.switches { margin: 0 0 28px; }

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 72px;
  min-height: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.15s;
}

.switch input::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.switch input:checked { background: var(--accent); }
.switch input:checked::before { transform: translateX(28px); }

.badge {
  position: fixed;
  top: 12px;
  right: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--note-bg);
  color: var(--note-text);
  font-size: 0.85rem;
  font-weight: 700;
}

.restaurant { font-size: 2.6rem; font-weight: 800; margin: 0 0 4px; }
.role { font-size: 1.4rem; margin: 0 0 4px; }
.who { color: var(--muted); margin: 0 0 32px; word-break: break-all; }

[hidden] { display: none !important; }

/* Import and export: the pasted file and the dry run's list of problems. */
#import-card textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 16px;
  margin: 0 0 20px;
  font: 0.95rem/1.4 ui-monospace, Consolas, monospace;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
#import-card input[type="file"] { min-height: 56px; padding: 12px 0; border: 0; background: transparent; }
.issues { margin: 0 0 16px; padding-left: 22px; }
.issues li { margin: 0 0 8px; }
.issues .problem { color: var(--error-text); }

/* Lists of things to tap (ingredients). Each row is a big tap target. */
.search-label { margin-top: 20px; }
.rows { list-style: none; margin: 0 0 20px; padding: 0; }
.row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 10px 16px;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}
.row-name { font-weight: 700; }
.row-detail { color: var(--muted); font-size: 0.95rem; }
.row-detail.incomplete { color: var(--error-text); }

select {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  margin: 0 0 20px;
  font-size: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.card + .card { margin-top: 20px; }

/* One pack level: "1 [case] = [6] [can]". */
.level { display: grid; grid-template-columns: auto 1fr auto 1fr 1fr; gap: 8px; align-items: center; }
.level input { margin: 0 0 12px; min-width: 0; }
.level span { margin: 0 0 12px; font-weight: 700; }

.option { border-top: 1px solid var(--line); padding: 16px 0; }
.option:first-of-type { border-top: 0; }
.option-title { font-weight: 700; margin: 0 0 4px; }
.option .actions { margin-top: 12px; }
.cost-big { font-size: 1.6rem; font-weight: 800; margin: 0 0 4px; }
.fine { color: var(--muted); font-size: 0.95rem; margin: 0 0 8px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* Recipe screens. */
textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 16px;
  margin: 0 0 20px;
  font: inherit;
  font-size: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
.pair { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.lines { list-style: none; margin: 0 0 16px; padding: 0; }
.line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.line-main { font-weight: 600; }
.line-cost { grid-column: 1; color: var(--muted); font-size: 0.95rem; }
.line-cost.incomplete { color: var(--error-text); }
.line-buttons { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
/* Changing a line's amount and unit in place: a full-width row under the line. */
.line-edit { grid-column: 1 / -1; margin-top: 8px; }
.line-edit .pair input { margin: 0 0 12px; min-width: 0; }
.line-edit .actions { grid-template-columns: 1fr 1fr; margin-top: 0; }
button.small { width: auto; min-height: 44px; padding: 0 16px; font-size: 1rem; }
.figures { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 1rem; }
.figures th, .figures td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.figures th:first-child, .figures td:first-child { text-align: left; }

/* "Archive anyway?" box over the page. */
dialog.card { width: min(480px, calc(100vw - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
