* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
}

header {
  background: #2196F3;
  color: white;
  padding: 16px;
  text-align: center;
}

header h1 {
  font-size: 1.3rem;
  font-weight: bold;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 12px 40px;
}

/* タブナビ */
.tab-nav {
  display: flex;
  background: white;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 12px 4px;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active {
  color: #2196F3;
  border-bottom-color: #2196F3;
  font-weight: bold;
}

.tab-btn:hover {
  background: #f0f4ff;
}

/* タブコンテンツ */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: #444;
}

h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #555;
}

/* フォーム */
.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-row label {
  font-size: 0.9rem;
  white-space: nowrap;
}

input[type="text"],
input[type="date"],
input[type="number"] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  background: white;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #2196F3;
}

.btn-primary {
  padding: 10px 16px;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1976D2;
}

.btn-full {
  width: 100%;
}

/* メニューリスト */
.item-list {
  list-style: none;
}

.item-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: white;
  border-radius: 6px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.item-name {
  font-size: 0.95rem;
}

.btn-delete {
  background: none;
  border: none;
  color: #e53935;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-delete:hover {
  background: #ffeaea;
}

.empty-msg {
  text-align: center;
  color: #999;
  padding: 20px;
  font-size: 0.9rem;
}

/* 注文フォーム */
.order-form {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 12px;
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.order-row:last-child {
  border-bottom: none;
}

.order-menu-name {
  font-size: 0.95rem;
  flex: 1;
}

.order-input {
  width: 80px;
  text-align: right;
  flex: none;
}

/* フィルター */
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-row label {
  font-size: 0.9rem;
  white-space: nowrap;
}

.filter-row span {
  font-size: 0.9rem;
}

/* ランキング */
.ranking-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ranking-section {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.ranking-list {
  list-style: none;
  padding: 0;
}

.ranking-list li {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
  font-size: 0.9rem;
}

.ranking-list li:last-child {
  border-bottom: none;
}

.rank-num {
  font-size: 1.1rem;
  font-weight: bold;
  width: 28px;
  text-align: center;
  color: #2196F3;
  flex-shrink: 0;
}

.rank-num.gold   { color: #F9A825; }
.rank-num.silver { color: #78909C; }
.rank-num.bronze { color: #8D6E63; }

.rank-name {
  flex: 1;
}

.rank-count {
  font-weight: bold;
  color: #333;
  white-space: nowrap;
}

.no-data-msg {
  text-align: center;
  color: #999;
  padding: 16px;
  font-size: 0.9rem;
}

/* 保存成功トースト */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 400px) {
  .tab-btn {
    font-size: 0.78rem;
    padding: 10px 2px;
  }
  .filter-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
