:root {
  color-scheme: light;
  --ink: #1d2521;
  --muted: #66736d;
  --line: #d8ddd7;
  --paper: #fbfbf7;
  --panel: #ffffff;
  --hop: #4d7c43;
  --copper: #b55e32;
  --amber: #e7b74f;
  --cool: #315d6a;
  --danger: #b44242;
  --shadow: 0 12px 30px rgba(37, 49, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.standalone body {
  padding-top: env(safe-area-inset-top);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  align-items: center;
  background:
    linear-gradient(rgba(9, 10, 9, 0.76), rgba(29, 37, 33, 0.74)),
    url("assets/brewery-workbench.svg");
  background-size: cover;
  background-position: center;
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 220px;
  padding: 36px clamp(18px, 4vw, 56px);
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: clamp(16px, 3vw, 28px);
}

.brand-lockup img {
  aspect-ratio: 1;
  background: #090909;
  border: 1px solid rgba(231, 183, 79, 0.75);
  border-radius: 999px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
  height: clamp(86px, 12vw, 138px);
  object-fit: cover;
}

.app-header h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 0.95;
  margin: 0;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

main {
  margin: 0 auto;
  max-width: 1360px;
  padding: 24px clamp(14px, 3vw, 36px) 48px;
}

.pipeline {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: -58px;
}

.pipeline article,
.panel,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pipeline article {
  min-height: 112px;
  padding: 18px;
}

.pipeline span {
  color: var(--hop);
  display: block;
  font-size: 2.1rem;
  font-weight: 850;
}

.pipeline p {
  color: var(--muted);
  font-weight: 750;
  margin: 6px 0 0;
}

.toolbar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin: 22px 0;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 760;
  gap: 7px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.grid-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-title,
.view-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 14px;
}

.form-grid,
.converter-grid,
.ingredient-entry {
  display: grid;
  gap: 12px;
}

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

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

.ingredient-entry {
  align-items: end;
  grid-template-columns: minmax(110px, 1fr) minmax(86px, 0.7fr);
  margin-top: 14px;
}

.ingredient-entry label,
.converter-grid label,
.form-grid label {
  min-width: 0;
}

.ingredient-entry .secondary-button {
  grid-column: 1 / -1;
}

.form-panel > label {
  margin-top: 12px;
}

.logo-upload {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) 180px auto;
  margin-top: 12px;
}

.logo-preview {
  align-items: center;
  background: #111;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 140px;
  overflow: hidden;
}

.logo-preview.empty {
  background: #f4f6f2;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.logo-preview img {
  display: block;
  max-height: 220px;
  max-width: 100%;
  object-fit: contain;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 6px;
  font-weight: 800;
  min-height: 40px;
  padding: 10px 14px;
}

.primary-button {
  background: var(--hop);
  color: #fff;
  margin-top: 14px;
  width: 100%;
}

.secondary-button {
  background: var(--cool);
  color: #fff;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.36);
  color: currentColor;
}

.panel .ghost-button {
  background: #f4f6f2;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #f8eaea;
  color: var(--danger);
}

.hidden {
  display: none;
}

.scale-readout {
  align-items: center;
  background: #f5f8f2;
  border: 1px solid #d7e4cf;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding: 13px 14px;
}

.scale-readout p {
  color: var(--muted);
  font-weight: 780;
  margin: 0;
}

.scale-readout strong {
  color: var(--hop);
  font-size: 1.4rem;
}

.caution {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 14px 0 0;
}

.view-heading {
  margin: 26px 0 12px;
}

.batch-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.batch-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--hop);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  padding: 16px;
}

.beer-logo-thumb {
  aspect-ratio: 16 / 10;
  background: #111;
  border-radius: 7px;
  display: block;
  max-height: 180px;
  object-fit: contain;
  width: 100%;
}

.batch-card.overdue {
  border-left-color: var(--danger);
}

.batch-card h3 {
  font-size: 1.08rem;
  margin: 0;
}

.style-line,
.meta,
.notes {
  color: var(--muted);
  margin: 0;
}

.meta {
  display: grid;
  gap: 5px;
}

.status-pill {
  align-self: start;
  background: #eef5ea;
  border-radius: 999px;
  color: var(--hop);
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 850;
  padding: 5px 9px;
}

.overdue .status-pill {
  background: #fae8e8;
  color: var(--danger);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions button {
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}

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

.compact-table {
  margin-top: 14px;
  min-width: 0;
  table-layout: fixed;
}

.compact-table th,
.compact-table td {
  padding: 10px;
}

.compact-table .danger-button {
  min-height: 34px;
  padding: 8px 10px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.table-beer {
  align-items: center;
  display: flex;
  gap: 10px;
}

.table-beer img {
  aspect-ratio: 1;
  background: #111;
  border-radius: 6px;
  flex: 0 0 42px;
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.date-warning {
  color: var(--danger);
  font-weight: 850;
}

@media (max-width: 980px) {
  .grid-layout,
  .batch-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .pipeline,
  .form-grid,
  .converter-grid,
  .ingredient-entry,
  .logo-upload {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-lockup img {
    height: 76px;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar label {
    width: 100%;
  }
}
