:root {
  --black: #000;
  --surface: #111;
  --surface-2: #1a1a1a;
  --surface-3: #222;
  --neon: #ADFF2F;
  --white: #fff;
  --border: #333;
  --text-secondary: #888;
  --fat: #EF5B5B;
  --warn: #FFC107;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: var(--font);
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.setup-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 40px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.logo-img {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  display: block;
  border-radius: 16px;
  object-fit: contain;
}

.setup-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
}

.setup-subtitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--neon);
  letter-spacing: 3px;
  text-align: center;
  margin-bottom: 18px;
}

.account-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 10px;
}
.account-bar span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  min-width: 0;
}
.account-bar strong { color: var(--white); font-weight: 700; }

.privacy-note, .roster-note {
  width: 100%;
  font-size: 12px;
  line-height: 1.45;
  color: #777;
  margin: 0 0 12px;
}
.privacy-note a, .doc a, .inline-link { color: var(--neon); }

.cloud-msg, .preview-banner {
  width: 100%;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}
.cloud-msg { background: #2a1a1a; border: 1px solid var(--fat); color: var(--fat); }
.preview-banner { background: #2a2a1a; border: 1px solid var(--warn); color: var(--warn); }
[hidden] { display: none !important; }

.tabs { display: flex; gap: 6px; width: 100%; margin-bottom: 12px; }
.tab-btn {
  flex: 1;
  padding: 11px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.tab-btn.active { background: var(--neon); border-color: var(--neon); color: #000; }

.section-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--neon);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.btn-primary, .btn-secondary, .btn-ghost, .btn-link {
  font-family: var(--font);
  cursor: pointer;
}
.btn-primary {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--neon);
  color: #000;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 8px;
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--neon);
  border-radius: var(--radius);
  background: transparent;
  color: var(--neon);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 8px;
}
.btn-ghost {
  width: 100%;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}
.btn-link {
  text-decoration: none;
  background: none;
  border: none;
  color: var(--neon);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 2px;
}
.btn-tiny {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--white);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 6px 8px;
  cursor: pointer;
}
.btn-tiny.danger { color: var(--fat); border-color: #4f2f2f; }
.btn-tiny.on { background: var(--neon); color: #000; border-color: var(--neon); }

.account-input, select.account-input, textarea.account-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--white);
  font-size: 16px;
  font-family: var(--font);
  margin-bottom: 8px;
  outline: none;
}
.account-input:focus { border-color: var(--neon); }
input[type="time"].account-input,
input[type="date"].account-input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  height: 46px;
  min-height: 46px;
}
select.account-input { height: 46px; min-height: 46px; }
input[type="time"].account-input::-webkit-date-and-time-value,
input[type="time"].account-input::-webkit-datetime-edit,
input[type="date"].account-input::-webkit-datetime-edit {
  min-width: 0;
  padding: 0;
  text-align: left;
}
textarea.account-input { min-height: 72px; resize: vertical; }
.account-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--neon);
  text-transform: uppercase;
  margin: 10px 0 6px;
}
.field { width: 100%; min-width: 0; }
.field .account-label { margin-top: 2px; }
.field .account-input { margin-bottom: 0; }
.field-hint {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
  margin: 4px 0 10px;
}
.check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  line-height: 1.35;
  margin: 8px 0 4px;
}
.check-line input { margin-top: 2px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.section-head .section-title { margin-bottom: 0; }
.section-head .btn-tiny { flex-shrink: 0; }
.status-line {
  width: 100%;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--neon);
  color: var(--neon);
}
.status-line.ok { background: #1a2a1a; }
.status-line.error { background: #2a1a1a; border-color: var(--fat); color: var(--fat); }
body.is-busy { cursor: progress; }
body.is-busy button,
body.is-busy input,
body.is-busy select,
body.is-busy textarea { pointer-events: none; }
.row-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 8px;
  align-items: start;
}
.row-2 > .field {
  min-width: 0;
}
@supports (grid-template-rows: subgrid) {
  .row-2 > .field {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
  }
}
.row-2 > .field .field-hint { margin-bottom: 0; }
.row-2 > .btn-secondary,
.row-2 > .btn-primary {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  width: 100%;
  margin: 0;
  white-space: nowrap;
}
@media (max-width: 360px) {
  .row-2 { grid-template-columns: minmax(0, 1fr); }
  .row-2 > .field { display: block; grid-row: auto; }
  .row-2 > .btn-secondary,
  .row-2 > .btn-primary { grid-column: auto; grid-row: auto; margin-top: 8px; }
}

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
}
.chip-ok { background: #1a2a1a; color: var(--neon); border-color: #2f4f2f; }
.chip-warn { background: #2a2a1a; color: var(--warn); border-color: #4f4f2f; }
.chip-bad { background: #2a1a1a; color: var(--fat); border-color: #4f2f2f; }
button.chip { cursor: pointer; font-family: var(--font); }
button.chip.on { background: var(--neon); color: #000; border-color: var(--neon); }

.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.day-nav strong { font-size: 15px; letter-spacing: 0.3px; }
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--neon);
  font-size: 18px;
  cursor: pointer;
}

.grid-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.court-grid {
  display: grid;
  gap: 4px;
  min-width: 100%;
}
.grid-time, .grid-head, .slot {
  border-radius: 8px;
  min-height: 44px;
  font-size: 11px;
  line-height: 1.25;
}
.grid-time, .grid-head {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-weight: 800;
  letter-spacing: 0.3px;
}
.grid-head { color: var(--neon); font-size: 11px; text-transform: uppercase; }
.slot {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #666;
  padding: 4px 6px;
  text-align: left;
  font-family: var(--font);
  cursor: pointer;
}
.slot.free { color: #555; }
.slot.mine { background: #1a2a1a; border-color: var(--neon); color: var(--neon); }
.slot.busy { background: var(--surface-3); color: #bbb; }
.slot.block { background: #2a2a1a; border-color: #4f4f2f; color: var(--warn); }
.slot:disabled, .slot.past { opacity: 0.45; cursor: default; }
.slot b { display: block; font-size: 12px; font-weight: 800; }

.member-row, .fee-row, .duty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  min-width: 0;
  flex-wrap: wrap;
}
.member-row > div:first-child, .fee-row > div:first-child, .duty-row > div:first-child {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
.member-row:last-child, .fee-row:last-child, .duty-row:last-child { border-bottom: none; }
.member-row small, .fee-row small, .duty-row small { display: block; color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.check-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.check-grid label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}

.empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
  padding: 18px 8px;
}
.loading { text-align: center; color: var(--text-secondary); padding: 28px 0; }

.account-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.account-card {
  width: 100%;
  max-width: 520px;
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
}
.import-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.account-copy { font-size: 14px; color: var(--text-secondary); line-height: 1.45; margin-bottom: 10px; }

.att-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  background: var(--neon);
  color: #000;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 30px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
  pointer-events: none;
  max-width: calc(100% - 32px);
  text-align: center;
}
.att-toast.show { opacity: 1; transform: translate(-50%, 0); }
.att-toast.pending { background: #111; color: var(--neon); border: 1px solid var(--neon); }
.att-toast.error { background: #2a1a1a; color: var(--fat); border: 1px solid var(--fat); }

.doc {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 18px 64px;
}
.doc h1 { font-size: 28px; letter-spacing: 1px; margin: 8px 0; }
.doc h2 { font-size: 16px; color: var(--neon); margin: 22px 0 8px; letter-spacing: 0.4px; }
.doc p, .doc li { color: #ccc; font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
.doc ul { padding-left: 18px; margin-bottom: 8px; }
.template-banner {
  background: #2a2a1a;
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .setup-inner { padding-top: 48px; }
  .setup-title { font-size: 36px; }
}
