/* ===== CSS Variables ===== */
:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5A4BD1;
  --success: #00B894;
  --success-dark: #00A382;
  --danger: #E17055;
  --danger-dark: #D05A3E;
  --warning: #FDCB6E;
  --info: #74B9FF;
  --pink: #FD79A8;

  --bg: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-header: #6C5CE7;
  --text: #2D3436;
  --text-muted: #6B7280;
  --border: #E1E4E8;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;

  --nav-height: 68px;
  --header-height: 56px;
}

.dark {
  --bg: #1A1A2E;
  --bg-card: #25253E;
  --bg-header: #2D2D4A;
  --text: #E8E8F0;
  --text-muted: #9CA3AF;
  --border: #3A3A5C;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

/* ===== Header ===== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.15);
}

/* ===== Main ===== */
#main {
  position: fixed;
  top: var(--header-height);
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  overflow: hidden;
}

.view {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-content {
  padding: 16px;
  padding-bottom: 24px;
  max-width: 800px;
  margin: 0 auto;
}

/* ===== Bottom Nav ===== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 6px 2px;
  min-height: 44px;
  position: relative;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: 4px;
}

.nav-item .nav-icon {
  font-size: 18px;
}

.nav-item .nav-label {
  font-weight: 600;
  font-size: 8px;
}

/* ===== Cards & Lists ===== */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.card-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

/* ===== Welcome Card ===== */
.welcome-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
}

.welcome-card h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.welcome-card p {
  opacity: 0.85;
  font-size: 14px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

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

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

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: var(--success-dark);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-dark);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--border);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== Section Header ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 10px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 700;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Forms ===== */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.input-large {
  font-size: 28px;
  text-align: center;
  padding: 14px;
  font-weight: 700;
}

.textarea {
  min-height: 80px;
  resize: vertical;
  font-family: monospace;
  font-size: 12px;
}

.input-row {
  display: flex;
  gap: 8px;
}

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

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

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

.color-opt {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.color-opt.selected {
  border-color: var(--text);
  transform: scale(1.15);
}

.color-opt:hover {
  transform: scale(1.1);
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}

.modal.active {
  display: flex;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-content h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ===== Payment Modal ===== */
.payment-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.payment-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.quick-amount-btn {
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-amount-btn:hover {
  border-color: var(--primary);
  background: rgba(108,92,231,0.08);
}

.quick-amount-btn:active {
  transform: scale(0.96);
}

.quick-amount-btn.btn-exact {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
  font-weight: 800;
}

.quick-amount-btn.btn-exact:hover {
  background: var(--success);
  border-color: var(--success);
  opacity: 0.9;
}

/* Quick amounts editor */
.quick-amounts-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qa-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qa-edit-input {
  flex: 1;
  text-align: right;
}

.qa-edit-yen {
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.btn-remove-qa {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
}

.btn-icon-sm {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.btn-icon-sm:hover {
  background: var(--bg);
  color: var(--text);
}

.change-display {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--success), #55EFC4);
  border-radius: var(--radius-sm);
  color: #fff;
  margin-top: 12px;
}

.change-label {
  font-size: 14px;
  opacity: 0.9;
}

.change-amount {
  font-size: 36px;
  font-weight: 800;
  margin: 4px 0;
}

.change-breakdown {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 8px;
  line-height: 1.6;
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.info::before { background: var(--info); }
.stat-card.warning::before { background: var(--warning); }

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
}

/* ===== Register ===== */
.register-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 !important;
  background: #1a1a2e;
}

.register-top {
  padding: 8px 12px;
  background: #16162a;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.register-goal {
  padding: 4px 12px 6px;
  background: #16162a;
  flex-shrink: 0;
}

.goal-bar {
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}

.goal-fill {
  height: 100%;
  background: linear-gradient(90deg, #6C5CE7, #00B894);
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}

.goal-text {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

.register-cart {
  max-height: 120px;
  overflow-y: auto;
  font-size: 14px;
}

.cart-empty {
  color: rgba(255,255,255,0.35);
  text-align: center;
  padding: 10px;
  font-size: 13px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-name {
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cart-item-count {
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  font-weight: 600;
  min-width: 32px;
  text-align: center;
}

.cart-qty-btn {
  width: 34px;
  height: 34px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cart-qty-btn:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Summary bar between cart and products */
.register-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #0d7377;
  flex-shrink: 0;
}

.register-summary-qty {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.register-summary-total {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

/* Product grid */
.register-products {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  align-content: start;
  background: #1a1a2e;
}

.register-product-btn {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s, border-color 0.15s;
  position: relative;
  overflow: hidden;
  background: #2a2a4a;
  display: flex;
  flex-direction: column;
}

.register-product-btn:active {
  transform: scale(0.94);
  border-color: #4fc3f7;
}

.register-product-btn.sold-out {
  opacity: 0.35;
  pointer-events: none;
}

/* Product tile image area */
.product-tile-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* R18 badge on tile */
.r18-tile-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #E53E3E;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
  z-index: 2;
}

/* Stock number badge */
.stock-num-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  min-width: 20px;
  height: 18px;
  background: rgba(0,0,0,0.65);
  color: #4fc3f7;
  font-size: 11px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.stock-num-badge.stock-low {
  color: #FFD93D;
  background: rgba(0,0,0,0.7);
}

.stock-num-badge.stock-critical {
  color: #FF6B6B;
  background: rgba(0,0,0,0.7);
  animation: pulseText 1.5s ease-in-out infinite;
}

@keyframes pulseText {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Timeslot remaining badge (left-bottom of tile) */
.ts-remain-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  min-width: 18px;
  height: 18px;
  background: rgba(13,115,119,0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.ts-remain-badge.ts-over {
  background: rgba(229,62,62,0.85);
  color: #fff;
}

/* Sold out overlay on tile */
.sold-out-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,0.7);
  letter-spacing: 1px;
  z-index: 2;
}

/* Product tile info (name + price below image) */
.product-tile-info {
  padding: 3px 4px 4px;
  background: rgba(0,0,0,0.55);
  border-radius: 0 0 6px 6px;
}

.register-product-btn .product-btn-name {
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff !important;
}

.register-product-btn .product-btn-price {
  font-size: 12px;
  font-weight: 800;
  color: #fff !important;
}

/* Set buttons */
.register-set-btn {
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  color: #fff;
  border: none;
  cursor: pointer;
}

.register-set-btn .product-btn-name,
.register-set-btn .product-btn-price {
  color: #fff !important;
}

/* Bottom action bar */
.register-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #16162a;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  gap: 8px;
}

.register-bottom-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reg-action-btn {
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 16px;
  transition: all 0.15s;
}

.reg-btn-outline {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.15);
}

.reg-btn-outline:active {
  background: rgba(255,255,255,0.15);
}

.reg-btn-pay {
  background: #0d7377;
  color: #fff;
  font-size: 16px;
  padding: 12px 24px;
  min-width: 100px;
}

.reg-btn-pay:disabled {
  opacity: 0.4;
}

.reg-btn-pay:not(:disabled):active {
  background: #0a5c5f;
}

/* Visitor counter in register */
.register-bottom-bar .visitor-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: none;
  box-shadow: none;
  border: none;
}

.register-bottom-bar .visitor-count {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  min-width: 24px;
  text-align: center;
}

.visitor-label-sm {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
}

.register-bottom-bar .visitor-btn {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Chart ===== */
.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  height: 200px;
}

#hourly-chart {
  width: 100%;
  height: 100%;
}

/* ===== Settings ===== */
.settings-group {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.settings-group h4 {
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 700;
}

.setting-item {
  margin-bottom: 14px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

/* ===== Sales History Item ===== */
.sale-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sale-time {
  font-size: 12px;
  color: var(--text-muted);
}

.sale-details {
  font-size: 13px;
  margin-top: 2px;
}

.sale-amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.sale-undo {
  font-size: 12px;
  color: var(--danger);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
}

.sale-undo:hover {
  background: rgba(225,112,85,0.1);
}

/* ===== Product Card ===== */
.product-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-color-tag {
  width: 6px;
  height: 40px;
  border-radius: 3px;
  flex-shrink: 0;
}

.product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-info .card-title {
  font-size: 15px;
}

.product-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.product-meta strong {
  color: var(--text);
}

/* ===== Product Sales Rank ===== */
.product-rank {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  width: 30px;
  text-align: center;
}

.rank-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.rank-info {
  flex: 1;
}

.rank-count {
  font-size: 14px;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

/* ===== Event Card ===== */
.event-card {
  cursor: pointer;
}

.event-card:hover {
  box-shadow: var(--shadow-lg);
}

.event-card.selected {
  border: 2px solid var(--primary);
}

.event-date-badge {
  font-size: 12px;
  padding: 3px 10px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Payment Method ===== */
.payment-method-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.payment-method-btn {
  padding: 8px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.payment-method-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.payment-method-btn:active {
  transform: scale(0.95);
}

/* ===== Sale Payment Badge ===== */
.sale-method-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}

.sale-method-badge.cash { background: #E8F5E9; color: #2E7D32; }
.sale-method-badge.paypay { background: #FFF3E0; color: #E65100; }
.sale-method-badge.credit { background: #E3F2FD; color: #1565C0; }
.sale-method-badge.other_pay { background: #F3E5F5; color: #7B1FA2; }

.dark .sale-method-badge.cash { background: #1B5E2040; color: #81C784; }
.dark .sale-method-badge.paypay { background: #E6510040; color: #FFB74D; }
.dark .sale-method-badge.credit { background: #1565C040; color: #64B5F6; }
.dark .sale-method-badge.other_pay { background: #7B1FA240; color: #CE93D8; }

/* ===== Set Checklist ===== */
.set-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.set-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}

.set-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.set-check-item label {
  flex: 1;
  margin: 0 !important;
  font-size: 14px !important;
  color: var(--text) !important;
  cursor: pointer;
}

.set-check-qty {
  width: 50px;
  padding: 4px 6px;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
}

/* ===== Set Button in Register ===== */
.register-set-btn {
  padding: 16px 12px;
  border: 2px dashed rgba(255,255,255,0.5);
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
  position: relative;
  background: linear-gradient(135deg, var(--danger), #E17055CC);
}

.register-set-btn:active {
  transform: scale(0.94);
}

.register-set-btn .set-btn-label {
  font-size: 10px;
  opacity: 0.85;
  margin-bottom: 2px;
}

.register-set-btn .product-btn-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  word-break: break-all;
}

.register-set-btn .product-btn-price {
  font-size: 18px;
  font-weight: 800;
}

/* ===== Set Card ===== */
.set-card-items {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Gift / 差し入れ ===== */
.gift-photo-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gift-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px;
}

.gift-photo-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.gift-photo-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

.gift-card {
  position: relative;
}

.gift-card-content {
  display: flex;
  gap: 12px;
}

.gift-card-photo {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  cursor: pointer;
}

.gift-card-info {
  flex: 1;
  min-width: 0;
}

.gift-card-from {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}

.gift-card-note {
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.gift-card-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.gift-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}

/* Gift Photo Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

/* ===== Payment Method Stats ===== */
.method-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.method-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ===== Responsive (Desktop) ===== */
@media (min-width: 768px) {
  :root {
    --nav-height: 0px;
  }

  #bottom-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 200px;
    height: auto;
    flex-direction: column;
    border-top: none;
    border-right: 1px solid var(--border);
    padding: 12px 0;
    padding-bottom: 0;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 14px 20px;
    gap: 12px;
    font-size: 16px;
  }

  .nav-item .nav-icon {
    font-size: 24px;
  }

  .nav-item .nav-label {
    font-size: 15px;
  }

  #main {
    left: 200px;
    bottom: 0;
  }

  .view-content {
    max-width: 900px;
    padding: 24px;
  }

  .modal-content {
    border-radius: var(--radius);
    max-width: 480px;
  }

  .modal {
    align-items: center;
  }

  @keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .register-products {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .register-product-btn .product-btn-name {
    font-size: 12px;
  }

  .register-product-btn .product-btn-price {
    font-size: 14px;
  }

  .product-tile-info {
    padding: 5px 6px 6px;
  }

  .r18-tile-badge {
    width: 22px;
    height: 22px;
    font-size: 9px;
    top: 4px;
    left: 4px;
  }

  .stock-num-badge {
    min-width: 24px;
    height: 20px;
    font-size: 13px;
    bottom: 4px;
    right: 4px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .toast {
    bottom: 32px;
  }
}

/* ===== Animations ===== */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.pop {
  animation: pop 0.2s ease;
}

/* ===== Analysis Table ===== */
.analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.analysis-table th,
.analysis-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.analysis-table th {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 12px;
}

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

/* ===== Simulation Card ===== */
.sim-card .sim-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sim-recommend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(108,92,231,0.08), rgba(0,184,148,0.06));
  border: 1.5px solid rgba(108,92,231,0.15);
  border-radius: var(--radius-sm);
  margin: 8px 0;
  font-size: 14px;
  font-weight: 600;
}

.sim-recommend-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sim-events {
  font-size: 12px;
  line-height: 1.6;
}

/* ===== Tag Chips ===== */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag-chip {
  display: inline-block;
  padding: 1px 8px;
  background: rgba(108,92,231,0.12);
  color: var(--primary);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.dark .tag-chip {
  background: rgba(162,155,254,0.2);
  color: var(--primary-light);
}

/* ===== Pro Badge ===== */
.pro-badge {
  display: inline-block;
  background: linear-gradient(135deg, #6C5CE7, #A29BFE);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

/* ===== Timeslot Limit ===== */
.timeslot-limit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeslot-limit-row input[type="time"] {
  width: 100px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
}

.timeslot-limit-row .timeslot-sep {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.timeslot-limit-row .btn-remove-timeslot {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
}

.ts-time-row input[type="number"] {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.timeslot-limit-banner {
  padding: 6px 14px;
  background: rgba(13,115,119,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  font-weight: 600;
  color: #4fc3f7;
  text-align: center;
  flex-shrink: 0;
}

/* ===== Register Stats Bar ===== */
.register-stats-bar {
  display: flex;
  justify-content: space-around;
  padding: 6px 12px;
  background: #16162a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 4px;
  flex-shrink: 0;
}

.register-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.register-stat-label {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.register-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.register-stat-value.stat-warn {
  color: #FFD93D;
}

.register-stat-value.stat-danger {
  color: #FF6B6B;
}

/* ===== R18 Badges ===== */
.r18-badge {
  display: inline-block;
  background: #E53E3E;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  vertical-align: middle;
  line-height: 1.3;
}

.r18-badge-sm {
  display: inline-block;
  background: #E53E3E;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  padding: 0 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 2px;
}

.r18-corner-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #E53E3E;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  z-index: 2;
  line-height: 1.3;
}

/* ===== Timeslot Editor Enhanced ===== */
.timeslot-limit-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ts-time-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ts-product-limits {
  margin-top: 4px;
}

.ts-product-limits summary {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.ts-product-limit-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.ts-product-limit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.ts-product-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ts-product-limit-row input[type="number"] {
  width: 60px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

/* ===== Upgrade Modal ===== */
.upgrade-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.upgrade-header h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.upgrade-feature-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
  min-height: 20px;
}

.upgrade-price {
  text-align: center;
  padding: 20px 16px;
  margin: 0 -24px 16px;
  background: linear-gradient(135deg, rgba(108,92,231,0.08), rgba(162,155,254,0.08));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.dark .upgrade-price {
  background: linear-gradient(135deg, rgba(108,92,231,0.15), rgba(162,155,254,0.1));
}

.upgrade-price-amount {
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.upgrade-price-period {
  font-size: 16px;
  color: var(--text-muted);
  margin-left: 2px;
}

.upgrade-features {
  list-style: none;
  margin-bottom: 20px;
  padding: 0 4px;
}

.upgrade-features li {
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.upgrade-features li::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.upgrade-features li:last-child {
  border-bottom: none;
}

/* ===== Event Limit Button ===== */
#btn-add-event:disabled {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  opacity: 0.6;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  pointer-events: auto;
}

/* ===== Nav Pro Indicator ===== */
.nav-item .nav-pro-dot {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  width: 6px;
  height: 6px;
  background: linear-gradient(135deg, #6C5CE7, #A29BFE);
  border-radius: 50%;
}

/* ===== Auth UI ===== */
.auth-area {
  display: flex;
  align-items: center;
}

.user-avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-btn:hover {
  opacity: 0.8;
}

.user-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  object-fit: cover;
}

.user-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.btn-header-login {
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-header-login:hover {
  background: rgba(255,255,255,0.3);
}

/* ===== Divider Text ===== */
.divider-text {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-text span {
  padding: 0 12px;
}

/* ===== Account Info ===== */
.account-info-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar-initial {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

#account-details {
  flex: 1;
  min-width: 0;
}

#account-details .account-name {
  font-weight: 700;
  font-size: 15px;
  word-break: break-all;
}

#account-details .account-email {
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
}

/* ===== Cover Image Upload ===== */
.cover-upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
}

.cover-upload-area:hover {
  border-color: var(--primary);
}

.cover-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px;
}

.cover-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.cover-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.cover-remove-btn:hover {
  background: rgba(225,112,85,0.9);
}

/* ===== Oshinagaki Modal ===== */
.oship-bg-options,
.oship-col-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.oship-bg-opt {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.oship-bg-opt.selected {
  border-color: var(--primary);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--primary);
}

.oship-bg-opt:hover {
  transform: scale(1.1);
}

.oship-col-opt {
  padding: 6px 18px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.oship-col-opt.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.oship-col-opt:hover:not(.selected) {
  border-color: var(--primary);
}

.oshinagaki-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.oshinagaki-toggle-row label {
  margin-bottom: 0;
}

.oshinagaki-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

/* ===== 在庫管理 ===== */

/* 在庫サマリーバー */
.inventory-summary-bar {
  display: flex;
  gap: 2px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.inv-summary-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.inv-summary-item.warning {
  background: rgba(253,203,110,0.15);
}

.inv-summary-item.danger {
  background: rgba(225,112,85,0.15);
}

.dark .inv-summary-item.warning {
  background: rgba(253,203,110,0.1);
}

.dark .inv-summary-item.danger {
  background: rgba(225,112,85,0.1);
}

.inv-summary-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.inv-summary-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.inv-summary-item.warning .inv-summary-value {
  color: #E67E22;
}

.inv-summary-item.danger .inv-summary-value {
  color: var(--danger);
}

/* 在庫アラートバッジ */
.stock-alert-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  z-index: 2;
  line-height: 1.2;
}

.stock-alert-badge.low {
  background: var(--warning);
  color: #7C5E00;
}

.stock-alert-badge.critical {
  background: var(--danger);
  color: #fff;
  animation: pulseBadge 1s ease-in-out infinite;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* 在庫少ボタンスタイル */
.register-product-btn.stock-low {
  border-color: #FFD93D;
}

.register-product-btn.stock-critical {
  border-color: #FF6B6B;
}

/* 完売バッジ＆アニメーション */
.sold-out-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  background: rgba(225,112,85,0.95);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: 6px;
  z-index: 3;
  letter-spacing: 2px;
  white-space: nowrap;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.register-product-btn.sold-out-animate {
  opacity: 0.5;
  pointer-events: none;
  animation: soldOutSlam 0.5s ease-out;
}

@keyframes soldOutSlam {
  0% { transform: scale(1); }
  20% { transform: scale(1.05); }
  40% { transform: scale(0.95); }
  60% { transform: scale(1.02); }
  80% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* 在庫回転率・残り予測時間 */
.product-btn-eta {
  font-size: 9px;
  opacity: 0.75;
  margin-top: 2px;
  background: rgba(0,0,0,0.2);
  padding: 1px 6px;
  border-radius: 8px;
  display: inline-block;
}

/* 在庫調整ボタン */
.inv-adjust-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
  transition: background 0.2s;
}

.inv-adjust-btn:hover {
  background: rgba(255,255,255,0.5);
}

/* 在庫調整モーダル */
.inv-adjust-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.inv-adjust-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

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

.inv-adjust-stock-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== Visitor Counter ===== */
.register-aux-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.visitor-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.visitor-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
}

.visitor-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.visitor-btn:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.visitor-count {
  font-size: 18px;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
}

.visitor-rate {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.btn-memo-float {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-memo-float:active {
  transform: scale(0.94);
}

/* ===== Memo List ===== */
.memo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.memo-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 8px;
}

.memo-item-content {
  flex: 1;
  min-width: 0;
}

.memo-item-text {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.memo-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.memo-item .btn-sm {
  flex-shrink: 0;
}

/* ===== Timeline ===== */
.timeline-container {
  position: relative;
  padding-left: 24px;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 8px 0 16px 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-content {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.timeline-amount {
  font-weight: 800;
  color: var(--primary);
  font-size: 15px;
}

.timeline-items {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.timeline-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  font-size: 13px;
}

/* ===== Badges ===== */
.badges-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 90px;
  text-align: center;
  transition: transform 0.2s;
}

.badge-card.earned {
  border: 2px solid var(--warning);
}

.badge-card.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.badge-icon {
  font-size: 32px;
}

.badge-name {
  font-size: 11px;
  font-weight: 700;
}

.badge-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* ===== Badge Notification ===== */
.badge-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 400;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.badge-notification.show {
  animation: badgePop 0.5s ease forwards, badgeFade 0.5s ease 2s forwards;
}

@keyframes badgePop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes badgeFade {
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

.badge-notification .badge-notif-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 8px;
}

.badge-notification .badge-notif-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.badge-notification .badge-notif-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Confetti Canvas ===== */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 350;
}

/* ===== Goal Celebration ===== */
.goal-celebration {
  position: fixed;
  inset: 0;
  z-index: 380;
  pointer-events: none;
  display: none;
}

.goal-celebration.show {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: goalCelebFade 3s ease forwards;
}

.goal-celebration-inner {
  text-align: center;
  animation: goalCelebPop 0.6s ease;
}

.goal-celebration-icon {
  font-size: 72px;
  display: block;
  margin-bottom: 8px;
}

.goal-celebration-text {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 2px 8px rgba(108,92,231,0.3);
}

@keyframes goalCelebPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes goalCelebFade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== Settings Toggle Row ===== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-row label {
  margin-bottom: 0 !important;
}

.toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

/* ===== Tip / 応援 ===== */
.tip-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tip-amount-btn {
  padding: 10px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tip-amount-btn.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tip-amount-btn:active {
  transform: scale(0.95);
}

.tip-thanks-icon {
  font-size: 64px;
  animation: tipBounce 0.6s ease;
}

@keyframes tipBounce {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.15); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Sale Flash Animation ===== */
@keyframes saleFlash {
  0% { box-shadow: 0 0 0 0 rgba(0,184,148,0.5); }
  50% { box-shadow: 0 0 20px 10px rgba(0,184,148,0.2); }
  100% { box-shadow: 0 0 0 0 rgba(0,184,148,0); }
}

.sale-flash {
  animation: saleFlash 0.6s ease;
}

/* ===== Header Event Selector ===== */
.header-event-selector {
  position: relative;
  margin-left: 12px;
}

.header-event-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 160px;
  transition: background 0.2s;
}

.header-event-btn:hover {
  background: rgba(255,255,255,0.25);
}

#header-event-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-event-arrow {
  font-size: 8px;
  flex-shrink: 0;
}

.header-event-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  max-width: 280px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 150;
  max-height: 300px;
  overflow-y: auto;
}

.header-event-dropdown.open {
  display: block;
}

.header-event-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.header-event-dropdown-item:last-child {
  border-bottom: none;
}

.header-event-dropdown-item:hover {
  background: rgba(108,92,231,0.08);
}

.header-event-dropdown-item.selected {
  font-weight: 700;
  color: var(--primary);
}

.header-event-dropdown-item .event-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== Event Status Badge ===== */
.event-status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.event-status-badge.preparing {
  background: #FFF3E0;
  color: #E65100;
}

.event-status-badge.active {
  background: #E8F5E9;
  color: #2E7D32;
}

.event-status-badge.ended {
  background: #ECEFF1;
  color: #546E7F;
}

.dark .event-status-badge.preparing {
  background: rgba(230, 81, 0, 0.2);
  color: #FFB74D;
}

.dark .event-status-badge.active {
  background: rgba(46, 125, 50, 0.2);
  color: #81C784;
}

.dark .event-status-badge.ended {
  background: rgba(84, 110, 127, 0.2);
  color: #90A4AE;
}

/* ===== View Toggle ===== */
.section-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle-btn {
  background: var(--bg);
  border: none;
  padding: 5px 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  line-height: 1;
}

.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

.view-toggle-btn:not(.active):hover {
  background: var(--border);
}

/* ===== Calendar ===== */
.event-calendar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

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

.cal-month-label {
  font-size: 16px;
  font-weight: 700;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 2px;
}

.cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  position: relative;
  min-height: 40px;
  padding: 4px;
  text-align: center;
  font-size: 12px;
  border-radius: 6px;
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cal-day.other-month {
  color: var(--text-muted);
  opacity: 0.4;
}

.cal-day.today {
  background: rgba(108, 92, 231, 0.1);
  font-weight: 700;
}

.cal-day.has-event {
  cursor: pointer;
}

.cal-day.has-event:hover {
  background: rgba(108, 92, 231, 0.08);
}

.cal-day-num {
  font-size: 12px;
  line-height: 1;
}

.cal-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-event-dots {
  display: flex;
  gap: 2px;
  justify-content: center;
  flex-wrap: wrap;
}

.cal-event-name {
  font-size: 9px;
  color: var(--primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  line-height: 1.1;
}

/* ===== Event Card Status ===== */
.event-card-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Event Stock Input ===== */
.ev-check-stock {
  width: 60px;
  padding: 4px 6px;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
}

@media (min-width: 768px) {
  .calendar-days .cal-day {
    min-height: 60px;
  }
  .cal-event-name {
    font-size: 10px;
  }
}

/* ===== Daily Summary Card ===== */
.daily-summary-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.daily-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.daily-summary-event {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.9;
}

.daily-summary-header .btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
}

.daily-summary-header .btn:hover {
  background: rgba(255,255,255,0.3);
}

.daily-summary-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.daily-summary-main {
  flex-shrink: 0;
}

.daily-summary-total-label {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 600;
}

.daily-summary-total {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.1;
}

.daily-summary-sub {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.daily-summary-sub-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.daily-sub-label {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 600;
}

.daily-sub-value {
  font-size: 18px;
  font-weight: 800;
}

.daily-summary-goal {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.25);
}

.daily-goal-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  opacity: 0.9;
}

.daily-goal-bar {
  height: 8px;
  background: rgba(255,255,255,0.25);
  border-radius: 4px;
  overflow: hidden;
}

.daily-goal-fill {
  height: 100%;
  background: #fff;
  border-radius: 4px;
  transition: width 0.6s ease;
  width: 0%;
}

.daily-goal-detail {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 4px;
  text-align: right;
}

.daily-summary-comparison {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.25);
  font-size: 13px;
}

.daily-comparison-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.daily-comparison-label {
  opacity: 0.8;
  font-size: 12px;
}

.daily-comparison-value {
  font-weight: 700;
}

.daily-comparison-diff {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 6px;
}

.daily-comparison-diff.up {
  background: rgba(0,184,148,0.3);
}

.daily-comparison-diff.down {
  background: rgba(225,112,85,0.3);
}

/* ===== Payment Doughnut Chart ===== */
.analysis-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.chart-container-doughnut {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  padding: 12px;
}

.payment-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.payment-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.payment-legend-label {
  flex: 1;
  font-weight: 600;
}

.payment-legend-value {
  font-weight: 800;
  font-size: 14px;
}

.payment-legend-pct {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
}

/* ===== Hourly Detail Grid ===== */
.hourly-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 8px;
}

.hourly-detail-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.hourly-detail-item.peak {
  border: 2px solid var(--warning);
  position: relative;
}

.hourly-detail-item.peak::after {
  content: 'PEAK';
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 9px;
  font-weight: 800;
  background: var(--warning);
  color: #fff;
  padding: 1px 6px;
  border-radius: 6px;
}

.hourly-detail-time {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.hourly-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.hourly-detail-row strong {
  color: var(--text);
}

/* ===== Category Bar Chart & Detail ===== */
.category-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 8px;
}

.category-detail-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.category-detail-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.category-detail-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.category-detail-stats strong {
  color: var(--text);
}

@media (max-width: 480px) {
  .analysis-row {
    flex-direction: column;
  }
  .chart-container-doughnut {
    width: 140px;
    height: 140px;
  }
  .daily-summary-total {
    font-size: 28px;
  }
  .daily-summary-stats {
    flex-direction: column;
    gap: 12px;
  }
}
