:root {
  --bg: #f5efe6;
  --bg-soft: #faf6f0;
  --card: #ffffff;
  --ink: #2c241b;
  --muted: #7a6e62;
  --line: #e8dfd3;
  --primary: #5c3d2e;
  --primary-hover: #4a3124;
  --accent: #c4a484;
  --chip: #f3ebe1;
  --chip-active: #5c3d2e;
  --success: #3d7a4a;
  --making: #b7791f;
  --waiting: #7a6e62;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(92, 61, 46, 0.08);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse at top, #faf6f0 0%, transparent 55%),
    linear-gradient(180deg, #f7f1e8 0%, #efe6da 100%);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: var(--primary);
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.hero {
  text-align: center;
  padding: 12px 8px 20px;
}

.hero-emoji {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 8px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0.02em;
}

.hero .subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 18px;
  padding: 10px 14px;
  background: #fff8ef;
  border: 1px solid #f0e2d0;
  border-radius: 999px;
  color: #8a5a2b;
  font-size: 14px;
  font-weight: 600;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 223, 211, 0.9);
  padding: 18px 16px 16px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.field .hint {
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 164, 132, 0.25);
  background: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
  user-select: none;
}

.chip:hover {
  border-color: var(--accent);
}

.chip.active {
  background: var(--chip-active);
  border-color: var(--chip-active);
  color: #fff;
}

.chip.multi.active {
  background: #efe4d8;
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

.btn.secondary:hover {
  background: var(--bg-soft);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
}

.btn.sm {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.count-pill {
  background: #efe4d8;
  color: var(--primary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  font-size: 14px;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--bg-soft);
}

.order-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.order-name {
  font-weight: 700;
  font-size: 15px;
}

.order-style {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink);
}

.order-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.status {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

.status.waiting {
  background: #ece7e1;
  color: var(--waiting);
}

.status.making {
  background: #fff1d6;
  color: var(--making);
}

.status.done {
  background: #e3f2e7;
  color: var(--success);
}

.footer-link {
  text-align: center;
  margin-top: 8px;
  padding: 8px;
}

.footer-link a,
.footer-link button.linkish {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(44, 36, 27, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.show {
  opacity: 1;
}

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

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.gate {
  max-width: 360px;
  margin: 60px auto;
  padding: 0 16px;
}

.gate .card {
  text-align: center;
}

.gate p {
  color: var(--muted);
  font-size: 14px;
}

.style-edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.style-edit-row .input {
  flex: 1;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
}

.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

@media (min-width: 520px) {
  .app-shell {
    padding-top: 28px;
  }
}

/* Role picker landing */
.role-shell {
  padding-top: 28px;
}

.role-prompt {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0 18px;
}

.role-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.role-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(232, 223, 211, 0.95);
  background: #fff;
  border-radius: 20px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, border-color 0.15s;
  font: inherit;
  color: inherit;
}

.role-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(92, 61, 46, 0.12);
}

.role-card:active {
  transform: scale(0.985);
}

.role-card-barista {
  background: linear-gradient(180deg, #fff 0%, #faf6f0 100%);
}

.role-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 10px;
}

.role-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--primary);
  margin-bottom: 6px;
}

.role-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.role-foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 22px 0 0;
}

.hero-compact {
  padding: 0 8px 10px;
}

.hero-compact .subtitle {
  margin: 0;
}

.topbar a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.topbar a:hover {
  color: var(--primary);
  text-decoration: underline;
}

@media (min-width: 420px) {
  .role-grid {
    flex-direction: row;
  }
  .role-card {
    flex: 1;
    min-height: 180px;
  }
}

/* Brand script title */
.brand-title,
.hero h1.brand-title {
  font-family: "Great Vibes", "Allura", "Apple Chancery", "Segoe Script", cursive;
  font-size: 46px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--primary);
  line-height: 1.15;
  margin: 4px 0 10px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand-title .heart {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 0.72em;
  margin-left: 2px;
  vertical-align: middle;
}

.brand-subtitle {
  font-family: "Great Vibes", "Allura", cursive;
  font-size: 28px;
  font-weight: 400;
  color: var(--primary);
  margin: 0 0 4px;
  line-height: 1.2;
}

.brew-start-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.brew-start-row .input {
  flex: 1;
}

.brew-start-row .btn {
  width: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

/* History pages */
.history-entry-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-day-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.history-day-link:hover {
  background: #fff;
  border-color: var(--accent);
}

.history-day-label {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}

.history-chevron {
  color: var(--muted);
  font-size: 16px;
  width: 1em;
  text-align: center;
}

.history-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

.history-day-shell {
  max-width: 720px;
}

.history-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.history-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th,
.history-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}

.history-table td:nth-child(4) {
  white-space: normal;
  min-width: 120px;
  max-width: 220px;
}

.history-table th {
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.history-table .status {
  display: inline-block;
}

.pref-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.pref-edit-row .input {
  flex: 1;
}
.pref-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Style cards (taster) */
.style-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.style-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.style-card:hover {
  border-color: var(--accent);
}

.style-card:active {
  transform: scale(0.98);
}

.style-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(92, 61, 46, 0.2);
  background: #fff;
}

.style-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: #efe4d8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.style-thumb.placeholder {
  font-size: 28px;
  color: var(--muted);
}

.style-thumb.sm {
  width: 64px;
  min-width: 64px;
  aspect-ratio: 1;
  font-size: 22px;
}

.style-card-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

/* Barista style manage */
.style-manage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.style-manage-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
}

.style-manage-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-manage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-right: 4px;
}

.style-add-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.style-add-row .input {
  flex: 1;
}

.style-add-row .btn {
  width: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .style-card-grid {
    grid-template-columns: 1fr;
  }
}


/* Role icon images (local assets) */
.role-icon-img {
  display: block;
  width: 56px;
  height: 44px;
  object-fit: contain;
}

/* Today menu picker on barista home */
.today-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(232, 223, 211, 0.95);
  border-radius: 14px;
  background: #fff;
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
}

.today-pick-row.on {
  border-color: var(--accent);
  background: #faf6f0;
}

.today-pick-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--primary);
  flex: 1;
  min-width: 0;
}

.today-pick-row .today-remove-btn {
  flex-shrink: 0;
}

.today-add-row {
  flex-wrap: wrap;
}

.today-add-row #today-add-select {
  flex: 1;
  min-width: 140px;
}

.style-add-row a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


.role-icon-img.role-icon-photo {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 14px;
}
