:root {
  --bg: #1a1d23;
  --panel: #252932;
  --panel-2: #2f343f;
  --text: #e8e9ec;
  --muted: #8a8f99;
  --accent: #c89b3c;
  --accent-hover: #d8ab4c;
  --danger: #d9534f;
  --ok: #4a9a5a;
  --border: #3a3f4a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

header {
  background: var(--panel);
  border-bottom: 2px solid var(--accent);
  padding: 12px 24px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

header h1 {
  margin: 0;
  font-size: 20px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.store-name {
  color: var(--muted);
  font-size: 14px;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.card h3 {
  margin: 18px 0 8px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

input[type="text"],
input[type="number"] {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 16px;
}
input:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--accent);
  border: none;
  color: #1a1d23;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}
button:hover { background: var(--accent-hover); }
button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button.checkout {
  background: var(--danger);
  color: white;
  width: 100%;
  padding: 14px;
  font-size: 17px;
}

.customer-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  max-height: 240px;
  overflow-y: auto;
}
.customer-list li {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.customer-list li:hover { background: var(--panel-2); }
.customer-list li.active {
  background: var(--panel-2);
  border-color: var(--accent);
}
.customer-list li.empty {
  color: var(--muted);
  cursor: default;
  justify-content: center;
}
.customer-list .poker-name { flex: 1; font-weight: 600; }
.customer-list .member { color: var(--muted); font-size: 13px; font-family: monospace; }
.customer-list .balance { color: var(--accent); font-variant-numeric: tabular-nums; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.form-grid label input { font-size: 16px; }

.customer-detail h2 small {
  color: var(--muted);
  font-size: 13px;
  font-family: monospace;
  margin-left: 8px;
  font-weight: normal;
}

.balance-big {
  text-align: center;
  padding: 16px 0;
  font-size: 14px;
  color: var(--muted);
}
.balance-big strong {
  display: inline-block;
  font-size: 42px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin: 0 6px;
}
.balance-big strong.negative { color: var(--danger); }

.visit-info {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.package-grid button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
}
.package-grid .pts { font-size: 18px; font-weight: 700; }
.package-grid .yen { font-size: 13px; opacity: 0.85; }

.notice {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 600;
  z-index: 100;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.notice-ok { background: var(--ok); color: white; }
.notice-error { background: var(--danger); color: white; }

/* タブ */
.tabs {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 0;
  display: flex;
  gap: 4px;
}
.tabs button {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 10px 20px;
  font-size: 14px;
}
.tabs button.active {
  background: var(--panel-2);
  color: var(--accent);
  border-color: var(--accent);
}

/* 入場料選択 */
.admission-select {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admission-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  min-width: 100px;
}
.admission-btn .yen { font-size: 13px; opacity: 0.85; }

/* 入場料タグ */
.admission-tag {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  margin-left: 8px;
}

/* トーナメントアクション（顧客画面内） */
.tournament-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tournament-action-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.tournament-action-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}
.tournament-action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tournament-action-btns button {
  font-size: 13px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tournament-action-btns small {
  font-size: 11px;
  opacity: 0.8;
}

/* トーナメント一覧 */
.tournament-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.tournament-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
}
.tournament-card:hover { border-color: var(--accent); }
.tournament-name { font-weight: 600; margin-bottom: 4px; }
.tournament-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.tournament-status {
  text-transform: uppercase;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--border);
}
.tournament-detail-meta {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.entry-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.entry-list .poker-name { font-weight: 600; }
.entry-detail { color: var(--muted); font-size: 13px; }

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

/* select / textarea */
select, textarea {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* 取引履歴 */
.tx-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tx-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.tx-time { color: var(--muted); min-width: 44px; }
.tx-type { min-width: 80px; }
.tx-points { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.tx-points.positive { color: var(--ok); }
.tx-points.negative { color: var(--danger); }
.tx-yen { color: var(--muted); font-size: 12px; min-width: 60px; }
.tx-memo { color: var(--muted); font-size: 12px; flex: 1; text-align: right; }

/* カレンダー */
.cal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.cal-header h2 {
  margin: 0;
  border: none;
  padding: 0;
  flex: 1;
  text-align: center;
  white-space: nowrap;
}
.cal-nav {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 20px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.cal-today-btn {
  font-size: 12px;
  padding: 6px 10px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 0;
  font-weight: 600;
}
.cal-dow:first-child { color: var(--danger); }
.cal-dow:last-child { color: #4a90d9; }

.cal-cell {
  min-height: 64px;
  background: var(--panel-2);
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.cal-cell:hover { border-color: var(--border); }
.cal-cell.cal-other { opacity: 0.3; cursor: default; }
.cal-cell.cal-other:hover { border-color: transparent; }
.cal-cell.cal-today {
  border-color: var(--accent);
  background: rgba(200, 155, 60, 0.1);
}
.cal-cell.cal-has-events { background: var(--panel); }

.cal-date {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--muted);
}
.cal-cell.cal-today .cal-date { color: var(--accent); }
.cal-cell.cal-sun .cal-date { color: var(--danger); }
.cal-cell.cal-sat .cal-date { color: #4a90d9; }
.cal-cell.cal-other .cal-date { color: inherit; }

.cal-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-tag {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  color: white;
  overflow: hidden;
  white-space: nowrap;
}
.cal-tag-emoji { font-size: 10px; }
.cal-tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .package-grid { grid-template-columns: 1fr 1fr; }
  .admission-select { flex-direction: column; }
  .cal-cell { min-height: 48px; }
  .cal-tag { font-size: 9px; }
  .cal-tag-name { display: none; }
  .cal-tag-emoji { font-size: 12px; }
}
