:root {
  color-scheme: dark;
  --bg: #070b17;
  --surface: rgba(17, 24, 39, 0.72);
  --surface-strong: #131b2f;
  --text: #edf2ff;
  --muted: #93a3c7;
  --gold: #ffd700;
  --silver: #d1d5db;
  --bronze: #b45309;
  --ok: #10b981;
  --warn: #fde047;
  --orange: #f97316;
  --bad: #f43f5e;
  --line: rgba(148, 163, 184, 0.15);
  --ring: rgba(99, 102, 241, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.45;
  animation: floatOrb 10s ease-in-out infinite;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: #4338ca;
  top: -70px;
  right: 6%;
}

.orb-2 {
  width: 380px;
  height: 380px;
  background: #0ea5e9;
  bottom: -120px;
  left: 4%;
  animation-delay: 1.3s;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 34px 24px 110px;
}

.header {
  display: block;
  animation: fadeInDown 0.55s ease;
}

.eyebrow {
  margin: 0 0 6px;
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-row {
  margin-bottom: 10px;
}

.restaurant-logo {
  height: 52px;
  width: auto;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.5));
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.06;
}

#updatedAt {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
  animation: fadeInUp 0.55s ease;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  margin: 12px 0 0;
  font-size: clamp(30px, 2.7vw, 38px);
  font-weight: 700;
}

.card {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
}

.leaderboard-card {
  animation: fadeInUp 0.7s ease;
}

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

.card-header h2 {
  margin: 0;
  font-size: 36px;
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  overflow: auto;
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 22px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 14px 10px;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: sticky;
  top: 0;
  background: var(--surface-strong);
  z-index: 1;
}

th:nth-child(4),
th:nth-child(5),
th:nth-child(6),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6) {
  text-align: center;
}

tbody tr {
  transition: transform 0.2s ease, background 0.2s ease;
  animation: rowEnter 0.45s ease both;
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.rank-1 td:first-child {
  color: var(--gold);
  font-weight: 700;
}

.rank-2 td:first-child {
  color: var(--silver);
  font-weight: 700;
}

.rank-3 td:first-child {
  color: var(--bronze);
  font-weight: 700;
}

.progress {
  min-width: 250px;
}

.progress-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.progress-track {
  width: 190px;
  height: 18px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.25);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.2);
}

.progress-label {
  min-width: 58px;
  text-align: right;
  font-weight: 600;
}

.settings-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #eff6ff;
  font-size: 30px;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-btn:hover {
  transform: translateY(-3px) rotate(8deg);
  box-shadow: 0 22px 36px rgba(79, 70, 229, 0.42);
}

.settings-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.settings-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.settings-btn:hover .settings-icon {
  transform: rotate(20deg);
}

.settings-dialog {
  width: min(720px, 94vw);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #0c1325;
  color: var(--text);
  box-shadow: 0 24px 45px rgba(0, 0, 0, 0.4);
  padding: 0;
}

.settings-dialog::backdrop {
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(4px);
}

#planForm {
  padding: 18px;
}

#planForm h2 {
  margin: 0 0 8px;
}

.hint {
  color: var(--muted);
  margin: 0 0 14px;
}

.plan-inputs {
  display: grid;
  gap: 12px;
}

.plan-row {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 12px;
  align-items: center;
}

input[type="number"] {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: #0f172a;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="number"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #1f2937;
  color: var(--text);
  cursor: pointer;
}

.btn-primary {
  border: none;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
}

.btn-secondary {
  background: #0f172a;
}

@media (max-width: 860px) {
  .page {
    padding: 24px 16px 96px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  table {
    font-size: 18px;
  }

  .progress-track {
    width: 140px;
    height: 16px;
  }

  .card-header {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rowEnter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatOrb {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(12px);
  }
}
