:root {
  color-scheme: light;
  --bg: #f5f7f1;
  --panel: #ffffff;
  --ink: #1b2420;
  --muted: #66716b;
  --line: #dbe2d8;
  --green: #1f6b4a;
  --green-dark: #164f38;
  --gold: #c88c2d;
  --blue: #295a7a;
  --shadow: 0 18px 45px rgba(32, 46, 38, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(31, 107, 74, 0.13), transparent 280px),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.clock,
.countdown,
.target-summary,
.tee-time {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.clock {
  min-width: 180px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: right;
}

.clock span,
.countdown span {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

small {
  color: var(--muted);
}

.booking-grid {
  display: grid;
  grid-template-columns: 340px minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls,
.launch,
.profile,
.results,
.log-panel {
  padding: 18px;
}

.controls {
  grid-row: span 2;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
}

input:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

fieldset {
  margin: 0 0 13px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.course-picker {
  display: grid;
  gap: 8px;
}

.course-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.course-row label {
  min-height: 42px;
  margin: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbf6;
  color: var(--ink);
  font-weight: 900;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.controls label,
.field-row {
  margin-bottom: 13px;
}

.primary,
.secondary-action,
.icon-button {
  border: 0;
  cursor: pointer;
}

.primary {
  width: 100%;
  min-height: 44px;
  border-radius: 6px;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.primary:hover,
.icon-button:hover {
  background: var(--green-dark);
}

.secondary-action {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.secondary-action:hover:not(:disabled) {
  border-color: #a9d6bd;
  background: #edf8f1;
}

.secondary-action:disabled,
.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 1.1rem;
  line-height: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4eb;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.countdown {
  padding: 22px;
  margin-bottom: 12px;
  background: #f9fbf6;
}

.countdown span {
  font-size: clamp(2.2rem, 7vw, 4.7rem);
  line-height: 1;
}

.target-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.target-summary span {
  color: var(--muted);
  font-weight: 700;
}

.run-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.run-list label {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 650;
}

.run-list input {
  width: 18px;
  min-height: 18px;
}

.timer-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 2px;
}

.cloud-schedule {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf8;
}

.cloud-schedule .panel-heading {
  margin-bottom: 0;
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
}

.results {
  min-height: 330px;
}

.tee-times {
  display: grid;
  gap: 10px;
}

.future-options {
  display: grid;
  gap: 10px;
}

.run-log {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.log-entry {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.9rem;
}

.log-entry span {
  display: inline-block;
  min-width: 76px;
  color: var(--muted);
  font-weight: 800;
}

.log-entry--success {
  border-color: #a9d6bd;
  background: #edf8f1;
}

.log-entry--warn {
  border-color: #e4c47d;
  background: #fff8e8;
}

.log-entry--error {
  border-color: #dda4a4;
  background: #fff0f0;
}

.cloud-status {
  grid-column: 1 / -1;
}

.status-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.status-columns h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-card,
.status-empty {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
}

.status-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-card p {
  margin: 0;
  color: var(--muted);
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8ece8;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill--complete,
.status-pill--dry_run_complete {
  background: #daf0e2;
  color: #0d6b36;
}

.status-pill--scheduled,
.status-pill--claimed,
.status-pill--running {
  background: #e6eef8;
  color: #1e5d95;
}

.status-pill--failed,
.status-pill--cancelled {
  background: #f7dfdf;
  color: #9a2525;
}

.status-error {
  color: #9a2525 !important;
}

.tee-time {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.tee-time:hover {
  border-color: #a9d6bd;
  background: #edf8f1;
  transform: translateY(-1px);
}

.tee-time--disabled {
  cursor: default;
}

.tee-time--disabled:hover {
  border-color: var(--line);
  background: #fff;
  transform: none;
}

.book-now {
  min-width: 86px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  transform: translateX(4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.tee-time:hover .book-now,
.tee-time:focus-within .book-now {
  opacity: 1;
  transform: translateX(0);
}

.tee-time--disabled .book-now {
  background: #8a928d;
}

.confirmation {
  display: grid;
  gap: 12px;
}

.confirmation-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf6;
}

.confirmation-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.detail span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.course {
  font-weight: 800;
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 2px;
}

.slots {
  color: var(--green);
  font-weight: 800;
}

.time {
  min-width: 78px;
  font-weight: 900;
  text-align: right;
}

@media (max-width: 820px) {
  .topbar,
  .booking-grid,
  .run-list,
  .timer-actions,
  .tee-time,
  .detail-grid,
  .status-columns {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .clock {
    text-align: left;
  }

  .tee-time {
    align-items: start;
  }

  .book-now {
    width: fit-content;
  }

  .time {
    text-align: left;
  }
}
