:root {
  --bg: #f7f3ee;
  --card: #ffffff;
  --text: #3d3229;
  --text-muted: #7a6f64;
  --brown: #6b4f3a;
  --brown-dark: #4a3628;
  --border: #e8dfd4;
  --available: #4caf7a;
  --available-bg: #e8f5ee;
  --few: #e6b84c;
  --few-bg: #fdf6e3;
  --full: #d96b5c;
  --full-bg: #fdecea;
  --checking: #9a9a9a;
  --checking-bg: #f0f0f0;
  --closed: #7a6f8a;
  --closed-bg: #f0edf5;
  --shadow: 0 4px 20px rgba(61, 50, 41, 0.08);
  --radius: 16px;
  --font-sans: "Noto Sans JP", system-ui, sans-serif;
  --font-serif: "Noto Serif JP", Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
}

.page {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Customer page */
.customer-header {
  text-align: center;
  padding: 0 0 28px;
}

.logo-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.store-name {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.store-name-ja {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.service-intro-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 0 20px;
  padding: 10px 14px;
  background: #fffdf9;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--brown);
  text-decoration: none;
  font-size: 0.78rem;
  line-height: 1.5;
  transition: background 0.15s, border-color 0.15s;
}

.service-intro-banner:hover {
  background: var(--bg);
  border-color: var(--brown);
}

.service-intro-icon {
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.service-intro-text {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  color: var(--text);
}

.service-intro-cta {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--brown);
  white-space: nowrap;
}

.status-card {
  text-align: center;
}

.status-display {
  padding: 8px 0 20px;
}

.status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.status-icon--available {
  background: var(--available-bg);
  color: var(--available);
}

.status-icon--few {
  background: var(--few-bg);
  color: var(--few);
}

.status-icon--full {
  background: var(--full-bg);
  color: var(--full);
}

.status-icon--checking {
  background: var(--checking-bg);
  color: var(--checking);
  font-weight: 700;
}

.status-icon--closed {
  background: var(--closed-bg);
  color: var(--closed);
}

.status-label {
  font-size: 1.5rem;
  font-weight: 700;
}

.status-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.seat-availability[hidden] {
  display: none;
}

.seat-availability .seat-info {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
}

.seat-info {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
}

.seat-info-label,
.last-update-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.seat-info-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.seat-detail {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
  text-align: left;
}

.seat-detail-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.seat-detail-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.seat-breakdown {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.last-update {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
  text-align: left;
}

.last-update-value {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.message-card {
  text-align: center;
  padding: 28px 24px;
}

.plant-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.welcome-message {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.store-info-list {
  list-style: none;
}

.store-info-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.store-info-list li:last-child {
  border-bottom: none;
}

.info-icon {
  flex-shrink: 0;
}

.store-info-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.store-links {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--brown);
  border-radius: 12px;
  background: #fff;
  color: var(--brown);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.btn-outline:hover {
  background: var(--bg);
}

.menu-nav {
  margin-bottom: 16px;
}

.menu-nav .btn {
  width: 100%;
}

.menu-page-header {
  text-align: center;
  padding: 0 0 24px;
}

.menu-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 8px;
}

.menu-back-nav {
  margin-bottom: 16px;
}

.menu-back-nav .btn-outline {
  margin-bottom: 0;
}

.menu-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.menu-category-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-category-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brown);
}

.menu-category-divider {
  height: 1px;
  background: var(--border);
}

.menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.menu-item-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.menu-item-price {
  font-weight: 600;
  color: var(--brown);
  white-space: nowrap;
}

.menu-empty,
.menu-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 16px;
  font-size: 0.9rem;
}

.admin-menu-link {
  margin-bottom: 16px;
}

.admin-menu-link .btn-outline {
  margin-bottom: 0;
}

.menu-form {
  display: grid;
  gap: 12px;
}

.menu-form label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.menu-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.menu-form input:focus {
  outline: 2px solid rgba(107, 79, 58, 0.25);
  border-color: var(--brown);
}

.menu-form-actions {
  display: grid;
  gap: 10px;
}

.admin-menu-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-menu-category-section {
  gap: 12px;
}

.admin-menu-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.admin-menu-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.admin-menu-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.admin-menu-category {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brown);
}

.admin-menu-name {
  font-weight: 600;
}

.admin-menu-price {
  font-size: 0.9rem;
  color: var(--brown);
}

.admin-menu-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-small {
  width: auto;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.btn-outline-small {
  background: #fff;
  color: var(--brown);
  border: 1px solid var(--brown);
}

.btn-outline-small:hover {
  background: var(--bg);
}

.btn-danger-small {
  background: #fff;
  color: var(--full);
  border: 1px solid var(--full);
}

.btn-danger-small:hover {
  background: var(--full-bg);
}

.customer-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Admin page */
.admin-header {
  background: var(--brown-dark);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-header h1 {
  font-size: 1rem;
  font-weight: 500;
}

.admin .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.admin .section-header h2,
.admin-section > h2 {
  font-size: 1rem;
  font-weight: 700;
}

.total-capacity {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.inline-seat-input {
  width: 2.5rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  padding: 0 2px;
  -moz-appearance: textfield;
}

.inline-seat-input::-webkit-outer-spin-button,
.inline-seat-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.inline-seat-input:focus {
  outline: none;
  border-bottom-color: var(--brown);
}

.seat-type-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.seat-type-row:last-of-type {
  border-bottom: none;
}

.seat-type-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.seat-type-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.seat-type-capacity {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.seat-type-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.seat-type-prefix,
.seat-type-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.seat-stepper.compact {
  flex: 1;
}

.seat-input.compact {
  height: 48px;
  font-size: 1.5rem;
  max-width: 72px;
}

.seat-summary {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
}

.seat-summary p {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 6px 0;
}

.seat-summary .label {
  color: var(--text-muted);
}

.seat-summary .value {
  font-weight: 700;
}

.seat-input-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.seat-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.stepper-btn {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 1.5rem;
  color: var(--brown);
  cursor: pointer;
  line-height: 1;
}

.stepper-btn:hover {
  border-color: var(--brown);
}

.seat-input {
  flex: 1;
  height: 56px;
  border: 2px solid var(--border);
  border-radius: 12px;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  -moz-appearance: textfield;
}

.seat-input::-webkit-outer-spin-button,
.seat-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.seat-total-display {
  font-size: 1.1rem;
  font-weight: 500;
  white-space: nowrap;
}

.hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.status-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.status-option {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.status-option:hover {
  border-color: var(--brown);
}

.status-option.selected {
  border-color: var(--brown);
  background: var(--bg);
}

.status-option-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 6px;
}

.status-option-icon.available {
  background: var(--available-bg);
  color: var(--available);
}

.status-option-icon.few {
  background: var(--few-bg);
  color: var(--few);
}

.status-option-icon.full {
  background: var(--full-bg);
  color: var(--full);
}

.status-option-icon.checking {
  background: var(--checking-bg);
  color: var(--checking);
  font-weight: 700;
}

.status-option-icon.closed {
  background: var(--closed-bg);
  color: var(--closed);
}

.status-option-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-option-action {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.criteria-box {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
}

.criteria-box h3 {
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.criteria-box ul {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-left: 1.2em;
}

.criteria-box li {
  margin-bottom: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  padding: 12px 20px;
}

.btn-primary {
  background: var(--brown);
  color: #fff;
  width: 100%;
  padding: 16px;
  font-size: 1rem;
}

.btn-primary:hover {
  background: var(--brown-dark);
}

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 8px 14px;
  font-size: 0.8rem;
}

.btn-update {
  margin-bottom: 16px;
}

.admin-footer-info {
  font-size: 0.85rem;
}

.admin-footer-info .label {
  color: var(--text-muted);
}

.admin-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.6;
}

.update-message {
  text-align: center;
  font-size: 0.9rem;
  min-height: 1.5em;
  margin-top: 8px;
}

.update-message.success {
  color: var(--available);
}

.update-message.error {
  color: var(--full);
}

/* Login */
.login-page .page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-title {
  font-family: var(--font-serif);
  text-align: center;
  font-size: 1.5rem;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin: 8px 0 24px;
  font-size: 0.9rem;
}

.login-form label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 16px;
}

.login-error {
  background: var(--full-bg);
  color: var(--full);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.login-error[hidden] {
  display: none;
}

/* Owner pages */
.owner-page .page.owner {
  padding-bottom: 32px;
}

.owner-actions-top {
  margin-bottom: 16px;
}

.owner-back-nav {
  margin-bottom: 12px;
}

.owner-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  padding: 10px 4px;
  min-height: 44px;
}

.owner-back-link:hover {
  text-decoration: underline;
}

.owner-list-section {
  padding-bottom: 20px;
}

.owner-search-wrap {
  margin-bottom: 16px;
}

.owner-search-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.owner-search-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
}

.owner-search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.owner-store-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.owner-store-card {
  padding: 18px;
  border: 1px solid var(--border);
}

.owner-store-card--inactive {
  background: #f3f0ec;
  border-color: #d9cfc4;
  opacity: 0.92;
}

.owner-store-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.owner-store-titles {
  min-width: 0;
}

.owner-store-name-en {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 2px;
}

.owner-store-name {
  font-size: 1.15rem;
  margin: 0;
  line-height: 1.35;
}

.owner-store-id {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 6px 0 0;
  font-family: ui-monospace, monospace;
}

.owner-store-status {
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
  flex-shrink: 0;
}

.owner-store-status.is-active {
  background: var(--available-bg);
  color: var(--available);
}

.owner-store-status.is-inactive {
  background: #fde8e8;
  color: #b42318;
  border: 1px solid #f5c2c2;
}

.owner-qr-section {
  margin: 14px 0 16px;
  padding: 14px;
  background: var(--bg-subtle, #f5f0ea);
  border-radius: 12px;
  text-align: center;
}

.owner-qr-store-label {
  font-weight: 600;
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.owner-qr-image-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  margin-bottom: 10px;
}

.owner-qr-image {
  display: block;
  border-radius: 8px;
  background: #f7f3ee;
}

.owner-qr-loading {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.owner-qr-url-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.owner-qr-url-value {
  display: block;
  font-size: 0.78rem;
  word-break: break-all;
  margin-bottom: 12px;
  padding: 6px 8px;
  background: #fff;
  border-radius: 6px;
}

.owner-qr-download {
  width: 100%;
  max-width: 280px;
}

.owner-url-notice {
  font-size: 0.82rem;
  color: #8a4b12;
  background: #fff8e6;
  border: 1px solid #f0d9a8;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
  line-height: 1.5;
}

.owner-url-section {
  margin-bottom: 14px;
}

.owner-url-section--operator {
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.owner-url-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.owner-url-list {
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}

.owner-url-row {
  margin-bottom: 8px;
  line-height: 1.5;
}

.owner-url-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.owner-url-value {
  display: block;
  font-size: 0.8rem;
  word-break: break-all;
  background: var(--bg-subtle, #f5f0ea);
  padding: 6px 8px;
  border-radius: 6px;
}

.owner-store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.owner-form label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.owner-form input[type="text"],
.owner-form input[type="url"],
.owner-form input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  margin-top: 6px;
}

.owner-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.owner-checkbox input {
  width: auto;
  margin: 0;
}

.page-message-card {
  text-align: center;
  padding: 48px 24px;
}

.page-message-card h2 {
  margin-bottom: 12px;
}

.page-message-card p {
  color: var(--text-muted);
  line-height: 1.6;
}

@media (min-width: 480px) {
  .status-options {
    grid-template-columns: repeat(4, 1fr);
  }
}
