:root {
  --ink: #5b4a55;
  --muted: #a98ea0;
  --line: #f3d9e6;
  --paper: #fff5fb;
  --panel: #ffffff;

  --pink: #ff9ec4;
  --pink-deep: #ff6fa5;
  --lavender: #c9b6ff;
  --mint: #a7e8d0;
  --sky: #aee2ff;
  --butter: #ffe6a0;
  --danger: #ff6f8e;

  --shadow: 0 14px 34px rgba(255, 138, 180, 0.22);
  --shadow-soft: 0 8px 20px rgba(201, 182, 255, 0.18);
  --radius: 22px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Quicksand", ui-rounded, "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(174, 226, 255, 0.45), transparent 40%),
    radial-gradient(circle at 88% 12%, rgba(201, 182, 255, 0.45), transparent 42%),
    radial-gradient(circle at 50% 100%, rgba(167, 232, 208, 0.4), transparent 45%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

h1,
h2,
.title-input,
.brand strong {
  font-family: "Baloo 2", "Quicksand", ui-rounded, system-ui, sans-serif;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(260px, 400px) 1fr;
  gap: 38px;
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  border: 2px solid #fff;
  border-radius: 34px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.hero-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 26px;
  border: 4px solid #fff;
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--pink-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "♡ ";
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 0.98;
  font-weight: 800;
  color: var(--pink-deep);
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(201, 182, 255, 0.35);
}

h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.subtle,
.upload-zone p,
.empty p,
.brand span,
.status {
  color: var(--muted);
}

.login-form {
  margin-top: 26px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input {
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0 18px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 158, 196, 0.25);
}

.login-form input {
  flex: 1 1 220px;
}

.primary,
.login-form button {
  min-height: 48px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff;
  padding: 0 22px;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(255, 111, 165, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.primary:hover,
.login-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(255, 111, 165, 0.45);
}

.primary:active,
.login-form button:active {
  transform: translateY(0);
}

.primary:disabled,
.login-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.secondary,
.ghost {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.12s ease;
}

.secondary {
  border: 2px solid var(--lavender);
  background: #fff;
  color: #8a6fc0;
}

.secondary:hover {
  transform: translateY(-2px);
  background: #f6f1ff;
}

.ghost {
  background: transparent;
  color: var(--muted);
}

.ghost:hover {
  background: rgba(255, 158, 196, 0.14);
}

.full {
  width: 100%;
}

.error {
  width: 100%;
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---------- Workspace ---------- */
.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 245, 251, 0.75));
  border-right: 2px solid var(--line);
  padding: 22px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.brand img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 16px;
  border: 3px solid #fff;
  box-shadow: var(--shadow-soft);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: var(--pink-deep);
  font-size: 1.1rem;
}

.brand span {
  font-size: 0.82rem;
}

.quote-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.quote-item {
  width: 100%;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  transition: background 0.12s ease, color 0.12s ease;
}

.quote-item:hover {
  background: rgba(201, 182, 255, 0.18);
}

.quote-item.active {
  background: #fff;
  color: var(--pink-deep);
  box-shadow: var(--shadow-soft);
}

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

.topbar,
.actions,
.run-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 20px;
}

.title-input {
  width: min(520px, 100%);
  border: 2px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding-left: 12px;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--pink-deep);
}

.title-input:focus {
  border-color: var(--pink);
  background: #fff;
}

.upload-zone {
  border: 3px dashed var(--lavender);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  min-height: 120px;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.upload-zone.dragging {
  border-color: var(--pink-deep);
  background: rgba(255, 158, 196, 0.14);
  transform: scale(1.01);
}

.upload-zone h2::after {
  content: " ✿";
  color: var(--pink);
}

.upload-zone input {
  display: none;
}

.upload-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

.file-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  max-width: 100%;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 10px 7px 14px;
  color: #8a6fc0;
  font-size: 0.9rem;
  font-weight: 600;
}

.file-pill button {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-weight: 700;
  line-height: 1;
}

.run-row {
  margin-bottom: 24px;
}

.status {
  font-weight: 600;
}

/* ---------- Results ---------- */
.results {
  display: grid;
  gap: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.section-head.subhead {
  margin-top: 6px;
}

.result-eyebrow {
  margin-bottom: 4px;
}

.count-pill {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--pink-deep);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.empty,
.result-block,
.vendor-page {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.empty {
  text-align: center;
  color: var(--muted);
}

.order-list {
  border-color: var(--pink);
  box-shadow: 0 10px 26px rgba(255, 158, 196, 0.28);
}

.vendor-lists {
  display: grid;
  gap: 16px;
}

.vendor-page {
  border-color: var(--mint);
}

.vendor-dashboard {
  border-color: var(--lavender);
}

.compact-summary {
  padding: 18px 22px;
}

.summary {
  max-width: 860px;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

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

.matrix-table {
  min-width: 980px;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  min-width: 260px;
}

.matrix-table th:first-child {
  z-index: 2;
}

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

thead th {
  background: rgba(255, 158, 196, 0.12);
  color: var(--pink-deep);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

tbody tr:nth-child(even) td {
  background: rgba(201, 182, 255, 0.06);
}

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

tfoot td {
  border-top: 2px solid var(--line);
  background: rgba(167, 232, 208, 0.18);
}

.price {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}

.notes {
  color: var(--muted);
  font-size: 0.88rem;
}

.best-cell {
  background: rgba(167, 232, 208, 0.3) !important;
  box-shadow: inset 0 0 0 2px var(--mint);
}

.missing-price {
  color: #d3c2cf;
}

ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin-bottom: 6px;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .login-panel,
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }

  .topbar,
  .actions,
  .upload-zone,
  .upload-actions,
  .section-head,
  .run-row {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-zone {
    display: flex;
  }
}

/* ---------- Print ---------- */
@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .upload-zone,
  .file-list,
  .run-row,
  .no-print {
    display: none !important;
  }

  .workspace {
    display: block;
  }

  .main-panel {
    padding: 0;
  }

  .result-block,
  .empty,
  .vendor-page,
  .vendor-lists {
    box-shadow: none;
    border-color: #ddd;
  }

  h1,
  h2 {
    text-shadow: none;
  }

  .result-block,
  .order-list {
    break-inside: avoid;
  }

  /* Each supplier's shopping list starts on its own page. */
  .vendor-page {
    break-inside: avoid;
    break-before: page;
    page-break-before: always;
  }
}
