:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #4f46e5;
  --confirmed: #16a34a;
  --new: #d97706;
  --cancelled: #dc2626;
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

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

.summary {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
}

.summary strong {
  color: var(--text);
  font-size: 16px;
}

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

.filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--card);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.filters label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  gap: 4px;
}

.filters select, .filters button {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.filters button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
}

.status {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  white-space: nowrap;
}

th {
  background: #f0f1f5;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f5f6fb;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: white;
}

.badge.confirmed { background: var(--confirmed); }
.badge.new { background: var(--new); }
.badge.cancelled { background: var(--cancelled); }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.template-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.template-card-header h3 {
  margin: 0;
  font-size: 15px;
}

.template-trigger {
  font-size: 12px;
  color: var(--muted);
}

.lang-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0 8px;
}

.lang-tab-btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
}

.lang-tab-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.template-lang-panel { display: none; }
.template-lang-panel.active { display: block; }

.template-card input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.template-card textarea {
  width: 100%;
  min-height: 220px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.6;
  font-family: inherit;
  box-sizing: border-box;
  resize: vertical;
}

.template-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.template-save-status {
  font-size: 12px;
  color: var(--muted);
}

.template-card-footer button {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 13px;
}

.report-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.report-card {
  flex: 1;
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.report-card .label {
  font-size: 12px;
  color: var(--muted);
}

.report-card .value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
}

.fee-rate-input {
  width: 60px;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 13px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --card: #1c1f28;
    --border: #2b2f3a;
    --text: #e5e7eb;
    --muted: #9aa1ac;
  }
  th { background: #232735; }
  tbody tr:hover { background: #23283a; }
}
