:root {
  --cream: #fff8ea;
  --paper: #fffdf7;
  --ink: #2b2118;
  --muted: #75675d;
  --line: #eadfce;
  --rose: #e85b7d;
  --rose-dark: #b83f5f;
  --saffron: #f5b23f;
  --pistachio: #8bbf77;
  --mint: #dff2d8;
  --cocoa: #6e402d;
  --blueberry: #6676c6;
  --shadow: 0 20px 50px rgba(71, 43, 24, 0.12);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(232, 91, 125, 0.09), transparent 34%),
    linear-gradient(215deg, rgba(139, 191, 119, 0.14), transparent 30%),
    var(--cream);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.auth-panel {
  display: grid;
  gap: 22px;
  width: min(460px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 13vh 0 48px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  background: conic-gradient(
    from 20deg,
    var(--rose),
    var(--saffron),
    var(--pistachio),
    var(--blueberry),
    var(--rose)
  );
  color: #fff;
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: var(--shadow);
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.brand-lockup-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.brand-lockup-stack .brand-logo {
  height: 64px;
  max-width: 320px;
}

.auth-panel {
  text-align: left;
}

.print-brand .brand-logo {
  height: 54px;
  max-width: 260px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rose-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.login-card,
.panel,
.metric,
.record,
.toast,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(232, 91, 125, 0.16);
}

.button-row,
.toolbar,
.record-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--rose);
  font-weight: 800;
}

.btn.secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.btn.ghost {
  border: 0;
  color: var(--rose-dark);
  background: transparent;
}

.btn.danger {
  background: #b64242;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 248, 234, 0.88);
  padding: 14px clamp(16px, 4vw, 44px);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  font-size: 1.45rem;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  padding: 22px clamp(16px, 4vw, 44px) 44px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 84px;
  display: grid;
  gap: 18px;
}

.week-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.7);
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  font-weight: 800;
  text-align: left;
}

.tab.active {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 4px 0 0 var(--rose);
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.hero h2 {
  margin-bottom: 6px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 14px;
}

.metric small {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

.panel {
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.grid-form .wide {
  grid-column: span 2;
}

.grid-form .full {
  grid-column: 1 / -1;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px;
  box-shadow: none;
}

.record-title {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-weight: 850;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--mint);
  color: #31552e;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 850;
}

.pill.warn {
  background: #ffe8ba;
  color: #71460c;
}

.pill.rose {
  background: #ffe1e9;
  color: var(--rose-dark);
}

.pill.blue {
  background: #e6e9ff;
  color: #3d4a99;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state {
  padding: 20px;
  box-shadow: none;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
}

.setup-note {
  border-left: 4px solid var(--saffron);
  padding: 12px 14px;
  background: #fff6dc;
  color: #624218;
  border-radius: 8px;
}

.swatches {
  display: flex;
  gap: 7px;
  align-items: center;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

/* Sheet-style transfer / reserved forms */
.sheet-form {
  display: grid;
  gap: 18px;
}

.sheet-header {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.sheet-header .wide {
  grid-column: span 2;
}

.sheet-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pane {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.6);
  padding: 12px;
}

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pane-head h4 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.pane-total {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--mint);
  color: #31552e;
  font-weight: 850;
  font-size: 0.84rem;
}

.pane-table {
  display: grid;
  gap: 0;
  max-height: 420px;
  overflow-y: auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.pane-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 28px;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.pane-row:last-child {
  border-bottom: 0;
}

.pane-head-row {
  background: var(--cream);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pane-flavor {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pane-qty {
  padding: 4px 8px;
  min-height: 32px;
  border-radius: 6px;
}

.pane-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--rose);
}

.sheet-items {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.sheet-items h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.items-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-height: 320px;
  overflow-y: auto;
}

.sheet-footer {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.sheet-footer .btn {
  align-self: end;
  height: 42px;
}

@media (max-width: 980px) {
  .sheet-header,
  .sheet-footer {
    grid-template-columns: 1fr 1fr;
  }
  .sheet-header .wide {
    grid-column: span 2;
  }
  .sheet-panes {
    grid-template-columns: 1fr;
  }
}

/* Printable transfer sheet view */
.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 248, 234, 0.92);
  backdrop-filter: blur(14px);
}

.print-sheet {
  max-width: 920px;
  margin: 24px auto 60px;
  padding: 28px clamp(20px, 4vw, 44px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  color: var(--ink);
}

.print-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 24px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 20px;
}

.print-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.print-brand h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
  font-size: 0.94rem;
}

.print-meta strong {
  display: inline-block;
  min-width: 110px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.print-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

.print-pane {
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 10px 12px;
}

.print-pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.print-pane-head h3 {
  margin: 0;
  font-size: 1rem;
}

.print-total {
  font-weight: 850;
  font-size: 0.92rem;
  color: var(--rose-dark);
}

.print-pane table,
.print-items table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 0;
}

.print-pane th,
.print-pane td,
.print-items th,
.print-items td {
  border-bottom: 1px solid var(--line);
  padding: 6px 6px;
  text-align: left;
  vertical-align: top;
}

.print-pane th,
.print-items th {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  color: var(--muted);
}

.print-empty {
  text-align: center;
  padding: 18px 0;
}

.print-items {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  margin-bottom: 22px;
}

.print-items h3 {
  margin: 0 0 8px;
}

.print-signoff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  margin-top: 32px;
}

.signoff-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.signoff-line {
  margin: 0;
  padding-top: 26px;
  border-bottom: 1.5px solid var(--ink);
  min-height: 30px;
  font-weight: 700;
}

.print-notes {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .print-head {
    grid-template-columns: 1fr;
  }
  .print-panes {
    grid-template-columns: 1fr;
  }
  .print-signoff {
    grid-template-columns: 1fr;
  }
}

/* Print stylesheet — strips chrome, fits to A4-ish portrait */
@media print {
  @page {
    margin: 14mm 12mm;
  }
  body {
    background: #fff !important;
  }
  .topbar,
  .sidebar,
  .toolbar,
  .tabs,
  .week-card,
  .swatches,
  .print-toolbar,
  .no-print {
    display: none !important;
  }
  .workspace,
  .app-shell,
  .content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .print-sheet {
    box-shadow: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .print-pane,
  .print-items table {
    break-inside: avoid;
  }
}

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

  .sidebar {
    position: static;
  }

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

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

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

@media (max-width: 640px) {
  .topbar,
  .hero,
  .record {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .metrics,
  .grid-form,
  .tabs {
    grid-template-columns: 1fr;
  }

  .grid-form .wide {
    grid-column: auto;
  }

  .button-row,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
