:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --accent: #60a5fa;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 12px;
  --tap: 52px;
  --max: 980px;
  --gap: 12px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
}

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  background: radial-gradient(900px 600px at 10% 0%, rgba(96, 165, 250, 0.16), transparent 60%),
    radial-gradient(800px 500px at 90% 20%, rgba(52, 211, 153, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  line-height: 1.35;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 10px 10px;
  gap: 10px;
  width: 100%;
  max-width: 100vw;
  background: linear-gradient(to bottom, rgba(11, 18, 32, 0.92), rgba(11, 18, 32, 0.78));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.topnav__tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.topnav__tab {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  min-height: 44px;
  padding: 10px 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
  min-width: 0;
  touch-action: manipulation;
}

.topnav__tab.active {
  color: var(--text);
  font-weight: 800;
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.topnav__icon {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.78);
}

.topnav__icon svg {
  width: 22px;
  height: 22px;
}

#tab-attendance .topnav__icon {
  color: rgba(52, 211, 153, 0.98);
}

#tab-payments .topnav__icon {
  color: rgba(251, 191, 36, 0.98);
}

#tab-groups .topnav__icon {
  color: rgba(96, 165, 250, 0.98);
}

#tab-people .topnav__icon {
  color: rgba(244, 114, 182, 0.98);
}

#tab-stats .topnav__icon {
  color: rgba(255, 255, 255, 0.86);
}

.topnav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.topnav__gear {
  font-size: 18px;
  line-height: 1;
}

.main {
  padding: 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  display: block;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: var(--max);
  display: grid;
  gap: var(--gap);
  margin: 0 auto;
  align-content: start;
  overflow-x: hidden;
}

.card--hero {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.16);
}

.card--hero .title {
  letter-spacing: 0.2px;
}

.card--hero .sub {
  color: rgba(255, 255, 255, 0.72);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.row {
  display: flex;
  gap: var(--gap);
  align-items: center;
}

.row.space {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

.stack {
  display: grid;
  gap: var(--gap);
}

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

.title {
  font-size: 18px;
  font-weight: 800;
}

.sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.35;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 40px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  cursor: pointer;
}

.btn--primary {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.35);
}

.btn--good {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.35);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  padding: 10px 10px;
}

.btn:active {
  transform: translateY(1px);
}

.input,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 12px;
  min-height: 44px;
  font-size: 15px;
  outline: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 44px;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A//www.w3.org/2000/svg'%20width%3D'16'%20height%3D'16'%20viewBox%3D'0%200%2024%2024'%3E%3Cpath%20fill%3D'%23E5E7EB'%20d%3D'M7%2010l5%205%205-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
  background-origin: padding-box;
  background-clip: padding-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

select::-ms-expand {
  display: none;
}

input[type="date"],
input[type="time"],
input[type="month"] {
  padding-right: 44px;
}

input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A//www.w3.org/2000/svg'%20width%3D'16'%20height%3D'16'%20viewBox%3D'0%200%2024%2024'%3E%3Cpath%20fill%3D'%23E5E7EB'%20d%3D'M7%2010l5%205%205-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  opacity: 0.85;
  filter: invert(1) saturate(0) brightness(1.2);
  cursor: pointer;
}

input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0;
}

.input--button {
  text-align: left;
  cursor: pointer;
}

.input--button:active {
  transform: translateY(1px);
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.list {
  display: grid;
  gap: var(--gap);
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap);
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.item.big {
  padding: 14px;
}

.item:active {
  background: rgba(255, 255, 255, 0.075);
}

.item--static {
  cursor: default;
}

.item--static:active {
  background: rgba(255, 255, 255, 0.05);
}

.checklist {
  display: grid;
  gap: 10px;
  max-height: min(52vh, 420px);
  overflow: auto;
  padding-right: 2px;
}

.checkitem {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  cursor: pointer;
  user-select: none;
}

.checkitem:active {
  background: rgba(255, 255, 255, 0.075);
}

.checkitem input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.cal {
  display: grid;
  gap: 10px;
}

.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cal__title {
  font-weight: 800;
  color: var(--text);
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.cal__dow {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}

.cal__day {
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.cal__day.empty {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.cal__day.training {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(96, 165, 250, 0.8);
}

.cal__day.selected {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.12);
}

.cal__day.today {
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35);
}

.pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
}

.stats .title {
  font-size: 20px;
}

.stats .sub {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
}

.stats .pill {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
}

.pill--nowrap {
  white-space: nowrap;
}

.pill.danger {
  color: rgba(251, 113, 133, 0.95);
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.08);
}

.toggle {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  flex: 0 0 auto;
}

.toggle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.toggle.on {
  background: rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.35);
}

.toggle.on::after {
  left: 21px;
  background: rgba(255, 255, 255, 0.92);
}

.paydot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}

.paydot--paid {
  background: rgba(52, 211, 153, 0.92);
  border-color: rgba(52, 211, 153, 0.55);
}

.paydot--unpaid {
  background: rgba(251, 113, 133, 0.9);
  border-color: rgba(251, 113, 133, 0.55);
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal__card {
  width: min(760px, calc(100vw - 18px));
  margin: 10px auto;
  background: rgba(14, 22, 40, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: calc(100vh - 20px);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.modal__header,
.modal__footer {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 22, 40, 0.98);
}

.modal__footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  justify-content: flex-end;
}

.modal__body {
  padding: 16px;
  display: grid;
  gap: var(--gap);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.modal__title {
  font-weight: 900;
}

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

.danger {
  color: var(--bad);
}

.hr {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

@media (max-width: 520px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
  .modal__card {
    width: calc(100vw - 16px);
    margin: 8px auto;
    max-height: calc(100vh - 16px);
  }
}

svg {
  display: block;
  max-width: 100%;
}
