:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface2: #2a2a2a;
  --border: #3a3a3a;
  --text: #e0e0e0;
  --text-dim: #888;
  --accent: #e84855;
  --accent2: #f9a03f;
  --green: #4caf50;
  --red: #e84855;
  --blue: #42a5f5;
  --radius: 8px;
}

[x-cloak] { display: none !important; }
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

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

header h1 span { color: var(--accent); }

.tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.tab {
  padding: 12px 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  user-select: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.container { max-width: 960px; margin: 0 auto; padding: 24px; }

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

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

.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-dim); }

.add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

input, select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-dim); }

button {
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-calculate {
  background: var(--green);
  color: white;
  font-size: 16px;
  padding: 12px 32px;
  width: 100%;
  margin-top: 16px;
}
.btn-calculate:hover { filter: brightness(1.15); }

.roster-table {
  width: 100%;
  border-collapse: collapse;
}

.roster-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.roster-table th:last-child {
  width: 40px;
}

.roster-table td {
  padding: 8px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

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

.roster-table tr:hover {
  background: var(--surface2);
}

.roster-table .col-weight {
  width: 120px;
}

.weight-stepper {
  display: flex;
  align-items: center;
  gap: 0;
}

.weight-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
}

.weight-btn:first-child {
  border-radius: 4px 0 0 4px;
  border-right: none;
}

.weight-btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

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

.weight-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.roster-table .weight-input {
  width: 40px;
  height: 28px;
  padding: 4px 2px;
  font-size: 13px;
  text-align: center;
  border-radius: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  -moz-appearance: textfield;
}

.roster-table .weight-input::-webkit-inner-spin-button,
.roster-table .weight-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.roster-table .weight-input:focus {
  border-color: var(--accent);
  outline: none;
}

.roster-table .row-remove {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  background: none;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
}

.roster-table .row-remove:hover {
  color: var(--red);
  background: rgba(232, 72, 85, 0.1);
}

.role-section { margin-bottom: 12px; }
.role-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.role-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.member-tag {
  background: var(--accent);
  color: white;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.member-tag .remove {
  cursor: pointer;
  opacity: 0.7;
  font-size: 14px;
}
.member-tag .remove:hover { opacity: 1; }

.role-add-select {
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.song-form {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.form-row input { flex: 1; }

.setlist-song {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.setlist-song input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.setlist-song-info { flex: 1; }
.setlist-song-title { font-weight: 600; }
.setlist-song-artist { font-size: 13px; color: var(--text-dim); }
.setlist-song-members { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.result-card {
  background: var(--surface);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.result-number {
  background: var(--green);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.result-info { flex: 1; }
.result-title { font-weight: 600; font-size: 15px; }
.result-artist { font-size: 13px; color: var(--text-dim); }
.result-band { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.result-overlap {
  font-size: 12px;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 4px;
}

.overlap-warn { background: rgba(232, 72, 85, 0.15); color: var(--red); }
.overlap-ok { background: rgba(76, 175, 80, 0.15); color: var(--green); }

.result-summary {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  text-align: center;
}

.result-summary .total { font-size: 36px; font-weight: 700; color: var(--accent); }
.result-summary .label { font-size: 14px; color: var(--text-dim); margin-top: 4px; }

.loop-back {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 24px;
  font-size: 15px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.col-absent {
  width: 60px;
  text-align: center;
}

.absent-check {
  width: 16px;
  height: 16px;
  accent-color: var(--accent2);
  cursor: pointer;
}

.row-absent td {
  opacity: 0.45;
}

.row-absent td .absent-check {
  opacity: 1;
}

.io-row {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 90%;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-divider {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 12px 0;
  position: relative;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--border);
}

.modal-divider::before { left: 0; }
.modal-divider::after { right: 0; }

.import-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px;
  font-size: 13px;
  font-family: monospace;
  resize: vertical;
}

.import-textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.import-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
}

.mode-toggle {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-wrap: wrap;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent2);
  cursor: pointer;
}

.toggle-text {
  font-weight: 600;
  font-size: 14px;
}

.toggle-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.absent-notice {
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent2);
  padding: 6px 12px;
  background: rgba(249, 160, 63, 0.1);
  border-radius: var(--radius);
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 90%;
}

.confirm-box p { margin-bottom: 16px; line-height: 1.5; }
.confirm-box .affected { color: var(--accent); font-size: 13px; margin-bottom: 16px; }

.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
