:root {
  color-scheme: light;
  --ink: #27231f;
  --muted: #71665f;
  --line: #e6ddd4;
  --paper: #fffaf4;
  --panel: #ffffff;
  --strawberry: #c9344c;
  --milk: #f7ead5;
  --mint: #7fc8a9;
  --choco: #5a392b;
  --sky: #9ecae1;
  --shadow: 0 18px 50px rgba(72, 52, 41, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.95), transparent 25rem),
    linear-gradient(135deg, #f8efe4 0%, #f5fbfb 46%, #fff6f8 100%);
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(39, 35, 31, 0.42);
  backdrop-filter: blur(8px);
}

.pin-gate[hidden] {
  display: none;
}

.pin-panel {
  display: grid;
  gap: 14px;
  width: min(100%, 380px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pin-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.pin-panel small {
  min-height: 1.2em;
  color: var(--strawberry);
  font-weight: 900;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  min-height: 270px;
  overflow: hidden;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 250, 244, 0.96), rgba(255, 250, 244, 0.66)),
    linear-gradient(120deg, rgba(201, 52, 76, 0.18), rgba(127, 200, 169, 0.18) 50%, rgba(158, 202, 225, 0.22));
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-total {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--strawberry);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 14em;
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.hero-copy p:last-child {
  max-width: 34em;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.hero-total {
  min-width: 178px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.hero-total span,
.stat span,
.favorite-box span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-total strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
}

.hero-total small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.lock-button {
  min-height: 32px;
  margin-top: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: #f7efe8;
  color: var(--choco);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 900;
}

.hero-actions {
  margin-top: 18px;
}

.primary-link,
.ghost-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 900;
  text-decoration: none;
}

.primary-link {
  background: var(--strawberry);
  color: #fff;
}

.ghost-link {
  background: #f7efe8;
  color: var(--choco);
}

.hero-art {
  position: absolute;
  inset: 0;
  opacity: 0.92;
}

.ice-pop,
.ice-cup,
.ice-sand {
  position: absolute;
  display: block;
  filter: drop-shadow(0 16px 20px rgba(76, 43, 31, 0.18));
}

.ice-pop {
  width: 74px;
  height: 150px;
  border-radius: 36px 36px 18px 18px;
}

.ice-pop::after {
  content: "";
  position: absolute;
  left: 28px;
  bottom: -52px;
  width: 18px;
  height: 58px;
  border-radius: 0 0 12px 12px;
  background: #d8a76e;
}

.pop-strawberry {
  right: 260px;
  top: 36px;
  rotate: -15deg;
  background: linear-gradient(155deg, #ffb5be, var(--strawberry));
}

.pop-milk {
  right: 116px;
  top: 76px;
  rotate: 13deg;
  background: linear-gradient(155deg, #fffdf8, var(--milk));
}

.ice-cup {
  right: 345px;
  bottom: 14px;
  width: 138px;
  height: 92px;
  border-radius: 18px 18px 34px 34px;
  background: linear-gradient(180deg, #f8f1e8 0 25%, var(--choco) 26% 100%);
}

.ice-cup::before {
  content: "";
  position: absolute;
  left: 13px;
  top: -24px;
  width: 112px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff9eb, #8b5a42);
}

.ice-sand {
  right: 42px;
  bottom: 22px;
  width: 186px;
  height: 88px;
  border-radius: 8px;
  rotate: -6deg;
  background: linear-gradient(180deg, #c88a58 0 24%, #fff8e8 25% 75%, #8f5639 76%);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.entry-panel,
.summary-panel,
.inventory-panel,
.calendar-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 35px rgba(72, 52, 41, 0.08);
}

.entry-panel,
.summary-panel {
  padding: 22px;
}

.entry-panel {
  grid-row: span 2;
}

.inventory-panel,
.calendar-panel {
  padding: 22px;
}

.section-heading {
  margin-bottom: 18px;
}

.row-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.item-form {
  display: grid;
  gap: 16px;
}

.mini-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.mini-heading small {
  font-size: 0.72rem;
  font-weight: 800;
}

.product-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.product-card {
  display: grid;
  grid-template-rows: 84px auto auto;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.product-card.selected {
  border-color: rgba(201, 52, 76, 0.72);
  box-shadow: 0 0 0 3px rgba(201, 52, 76, 0.12);
}

.product-card img {
  width: 100%;
  height: 84px;
  border-radius: 6px;
  object-fit: cover;
  background: #f7efe8;
}

.product-card-name {
  display: -webkit-box;
  min-height: 2.6em;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-card-category {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.product-card-price {
  color: var(--strawberry);
  font-size: 0.82rem;
  font-weight: 900;
}

label,
.rating-field legend {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #d9cfc6;
  border-radius: 8px;
  background: #fffdfa;
  color: var(--ink);
}

input:focus,
button:focus-visible {
  outline: 3px solid rgba(127, 200, 169, 0.42);
  outline-offset: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rating-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.stars {
  display: flex;
  gap: 3px;
}

.star-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #c6b9ad;
  cursor: pointer;
  font-size: 1.55rem;
  line-height: 1;
}

.star-button.active {
  color: #e1a52c;
}

.primary-button,
.ghost-button,
.icon-button,
.delete-button {
  border: 0;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  min-height: 52px;
  border-radius: 8px;
  background: var(--strawberry);
  color: white;
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f7efe8;
  color: var(--choco);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat,
.favorite-box {
  min-height: 86px;
  padding: 16px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
}

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

.favorite-box {
  margin-top: 10px;
}

.favorite-box strong {
  display: block;
  margin-top: 8px;
}

.inventory-panel,
.calendar-panel {
  grid-column: 2;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.78rem;
}

.product-name {
  font-weight: 900;
}

.inventory-product {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.inventory-product img {
  width: 58px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  background: #f7efe8;
}

.note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.quantity-control {
  display: inline-grid;
  grid-template-columns: 30px 38px 30px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.quantity-control button {
  width: 30px;
  height: 32px;
  border: 0;
  background: #f7efe8;
  cursor: pointer;
  font-weight: 900;
}

.quantity-control span {
  text-align: center;
  font-weight: 900;
}

.delete-button {
  min-width: 34px;
  min-height: 34px;
  border-radius: 8px;
  background: #f8e4e8;
  color: var(--strawberry);
}

.empty-state {
  display: none;
  padding: 16px;
  border: 1px dashed #d7c9bd;
  border-radius: 8px;
  color: var(--muted);
  background: #fffdfa;
}

.empty-state.show {
  display: block;
}

.calendar-controls {
  display: grid;
  grid-template-columns: 36px minmax(120px, auto) 36px;
  gap: 8px;
  align-items: center;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f7efe8;
  color: var(--choco);
  font-size: 1.35rem;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.weekday-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.calendar-grid {
  margin-top: 8px;
}

.day {
  min-height: 70px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  text-align: left;
  cursor: pointer;
}

.day.outside {
  opacity: 0.36;
}

.day.has-items {
  border-color: rgba(201, 52, 76, 0.42);
  background: linear-gradient(180deg, #fffdfa, #fff2f4);
}

.day.selected {
  outline: 3px solid rgba(201, 52, 76, 0.26);
}

.day-number {
  display: block;
  font-weight: 900;
}

.day-total {
  display: block;
  margin-top: 9px;
  color: var(--strawberry);
  font-size: 0.78rem;
  font-weight: 900;
}

.day-detail {
  min-height: 64px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
}

.day-detail strong {
  color: var(--ink);
}

.order-shell {
  max-width: 1260px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.order-header h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 4rem);
}

.order-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.order-header-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.order-header-actions small {
  color: var(--muted);
  font-weight: 900;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  margin-top: 18px;
}

.order-products,
.order-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 35px rgba(72, 52, 41, 0.08);
}

.order-products {
  padding: 18px;
}

.order-summary {
  padding: 18px;
}

.summary-sticky {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}

.order-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.search-field {
  margin: 0;
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.category-tab {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdfa;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.category-tab.active {
  border-color: rgba(201, 52, 76, 0.58);
  background: #fff2f4;
  color: var(--strawberry);
}

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

.order-product {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: center;
  min-height: 112px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.order-product img {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  object-fit: cover;
  background: #f7efe8;
}

.order-product-main h3 {
  margin: 4px 0 8px;
  font-size: 1rem;
  line-height: 1.35;
}

.order-product-main strong {
  color: var(--strawberry);
}

.order-stepper {
  display: grid;
  grid-template-columns: 38px 42px 38px;
  align-items: center;
  justify-content: end;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.order-stepper button {
  width: 38px;
  height: 42px;
  border: 0;
  background: #f7efe8;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 900;
}

.order-stepper span {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 900;
}

.order-count-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.order-count-row span {
  color: var(--muted);
  font-weight: 900;
}

.order-count-row strong {
  font-size: 1.35rem;
}

.selected-list {
  display: grid;
  gap: 8px;
  max-height: 44vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.selected-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.selected-item img {
  width: 54px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.selected-item strong,
.selected-item span {
  display: block;
}

.selected-item strong {
  font-size: 0.86rem;
  line-height: 1.35;
}

.selected-item span,
.empty-summary,
.order-message {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.selected-item b {
  text-align: right;
  font-size: 1.25rem;
}

.empty-summary {
  margin-bottom: 0;
  padding: 12px;
  border: 1px dashed #d7c9bd;
  border-radius: 8px;
  background: #fffdfa;
}

.order-message {
  min-height: 1.2em;
}

.redirect-page {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.redirect-page h1,
.redirect-page p {
  margin-bottom: 0;
}

.purchase-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.purchase-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.purchase-list-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 35px rgba(72, 52, 41, 0.08);
}

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

.purchase-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 72px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.purchase-item img {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  object-fit: cover;
  background: #f7efe8;
}

.purchase-item h3 {
  margin: 4px 0 8px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.purchase-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 900;
}

.purchase-item > strong {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  justify-self: end;
  border-radius: 50%;
  background: var(--strawberry);
  color: #fff;
  font-size: 1.6rem;
}

@media (max-width: 920px) {
  .hero,
  .dashboard,
  .order-layout {
    grid-template-columns: 1fr;
  }

  .inventory-panel,
  .calendar-panel {
    grid-column: auto;
  }

  .entry-panel {
    grid-row: auto;
  }

  .summary-sticky {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero,
  .order-header,
  .entry-panel,
  .summary-panel,
  .inventory-panel,
  .calendar-panel,
  .order-products,
  .order-summary {
    padding: 16px;
  }

  .order-header {
    align-items: start;
    flex-direction: column;
  }

  .order-header-actions {
    width: 100%;
    justify-items: stretch;
  }

  .order-toolbar {
    grid-template-columns: 1fr;
  }

  .order-product {
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 112px;
  }

  .order-product img {
    width: 74px;
    height: 74px;
  }

  .order-product-main h3 {
    font-size: 0.9rem;
  }

  .order-stepper {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 56px 1fr;
    width: 100%;
  }

  .order-stepper button {
    width: 100%;
    height: 44px;
  }

  .order-summary {
    position: sticky;
    bottom: 0;
    z-index: 10;
    border-radius: 8px 8px 0 0;
  }

  .purchase-summary {
    grid-template-columns: 1fr;
  }

  .purchase-item {
    grid-template-columns: 74px minmax(0, 1fr) 54px;
    gap: 10px;
  }

  .purchase-item img {
    width: 74px;
    height: 74px;
  }

  .purchase-item h3 {
    font-size: 0.92rem;
  }

  .purchase-item > strong {
    width: 48px;
    height: 48px;
    font-size: 1.35rem;
  }

  .selected-list {
    max-height: 220px;
  }

  .hero {
    min-height: 330px;
    align-items: start;
  }

  .hero-total {
    width: 100%;
  }

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

  .product-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 390px;
  }

  .product-card {
    grid-template-rows: 76px auto auto auto;
    min-height: 178px;
  }

  .product-card img {
    height: 76px;
  }

  .product-card-category {
    font-size: 0.68rem;
  }

  .primary-button {
    position: sticky;
    bottom: 10px;
    z-index: 5;
    box-shadow: 0 12px 24px rgba(201, 52, 76, 0.22);
  }

  .row-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-controls {
    width: 100%;
    grid-template-columns: 36px 1fr 36px;
  }

  .calendar-controls strong {
    text-align: center;
  }

  .day {
    min-height: 58px;
    padding: 6px;
  }

  .day-total {
    font-size: 0.68rem;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdfa;
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 0;
  }

  td:first-child {
    display: block;
  }

  td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
  }

  td:last-child {
    justify-content: flex-end;
  }

  .pop-strawberry {
    right: 160px;
    top: 178px;
  }

  .pop-milk {
    right: 45px;
    top: 190px;
  }

  .ice-cup {
    right: 188px;
    bottom: 14px;
  }

  .ice-sand {
    right: 12px;
    bottom: 14px;
  }
}
