:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #657083;
  --line: #d9dee8;
  --paper: #f7f8fb;
  --white: #ffffff;
  --green: #157f54;
  --green-soft: #e8f5ee;
  --blue: #246bfe;
  --danger: #a33d64;
  --shadow: 0 18px 45px rgba(24, 32, 51, 0.12);
  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: var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-panel {
  width: 100%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--green);
  color: var(--white);
  font-size: 24px;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

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

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

.topbar p,
.week-card p,
.store-head p {
  margin-bottom: 0;
  font-size: 13px;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.week-card,
.quick-panel,
.store-card {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.week-card {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: center;
}

.week-card .icon-button {
  border-radius: 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
}

.quick-panel {
  padding: 12px;
}

.panel-title,
.store-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-title {
  margin-bottom: 10px;
}

.panel-title h2 {
  margin-bottom: 0;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.text-button {
  min-height: 40px;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 850;
  padding: 0;
}

.favorite-manager {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef1f5;
}

.favorite-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.restore-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.favorite-manager h3 {
  margin: 0;
  font-size: 15px;
}

.stack,
.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  padding: 10px 12px;
}

.primary,
.secondary,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 850;
}

.primary {
  background: var(--green);
  color: var(--white);
}

.secondary {
  border: 1px solid var(--line);
  background: var(--green-soft);
  color: var(--green);
}

.danger-button {
  border: 1px solid #f1c7d8;
  background: #fff2f7;
  color: var(--danger);
}

.error {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--danger);
  font-weight: 700;
}

.store-card {
  overflow: hidden;
  padding: 12px;
}

.store-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px 44px 44px;
  margin-bottom: 12px;
}

.store-logo {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.store-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-head h2 {
  margin-bottom: 2px;
}

.progress {
  overflow: hidden;
  height: 7px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: #e7eaf0;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.collapse-store svg {
  transition: transform 160ms ease;
}

.collapse-store.is-collapsed svg {
  transform: rotate(-90deg);
}

.store-card.complete {
  border-color: #b9dec9;
  background: #fbfefd;
}

.store-card.collapsed .items {
  display: none;
}

.store-card.collapsed {
  padding-bottom: 12px;
}

.inline-add {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 0;
  border-top: 1px solid #eef1f5;
}

.item-row {
  display: grid;
  width: 100%;
  min-height: 62px;
  grid-template-columns: 1fr 36px;
  gap: 10px;
  align-items: center;
  border-top: 1px solid #eef1f5;
}

.item-row.dragging {
  opacity: 0.45;
}

.drag-handle {
  width: 36px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #9aa4b2;
  font-size: 24px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

.check-action {
  display: grid;
  width: 100%;
  min-height: 62px;
  grid-template-columns: 42px 1fr 46px;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 0;
  text-align: left;
}

.item-row.no-image .check-action {
  grid-template-columns: 42px 1fr;
}

.check-box {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid #c9d1dc;
  border-radius: 10px;
  color: transparent;
}

.item-row.checked .check-box {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
}

.check-box svg {
  width: 18px;
  height: 18px;
}

.item-copy {
  min-width: 0;
}

.item-copy strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.25;
}

.item-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.item-row.checked .item-copy strong {
  color: #78818f;
  text-decoration: line-through;
}

.item-image {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #eef1f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-lane {
  margin: 12px 0 0;
}

[hidden] {
  display: none !important;
}

@media (min-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr 0.75fr;
  }

  .form-grid .primary,
  .form-grid input[type="file"] {
    grid-column: 1 / -1;
  }

  .favorite-row {
    grid-template-columns: 1fr 0.7fr;
  }

  .favorite-row select,
  .favorite-row .primary,
  .favorite-row .danger-button {
    grid-column: 1 / -1;
  }

  .inline-add {
    grid-template-columns: 1fr 0.65fr;
  }

  .inline-add .primary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 390px) {
  .store-head {
    grid-template-columns: 40px 1fr 40px 40px 40px;
    gap: 8px;
  }

  .store-logo,
  .store-head .icon-button {
    width: 40px;
    height: 40px;
  }
}
