:root {
  --bg: #f5f6f4;
  --card: #ffffff;
  --ink: #1d2320;
  --muted: #66706b;
  --line: #e3e6e2;
  --brand: #1f7a4d;
  --brand-dark: #165c3a;
  --brand-soft: #e6f3ec;
  --amber: #a15c00;
  --amber-soft: #fff1dc;
  --red: #b42318;
  --red-soft: #fde8e6;
  --grey-soft: #eef0ee;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #17201b; color: #d7dfda; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.sidebar .logo { color: #fff; font-weight: 700; font-size: 18px; padding: 4px 10px 18px; }
.sidebar .logo span { color: #6fd39c; }
.sidebar a { color: #d7dfda; padding: 9px 10px; border-radius: 8px; display: block; }
.sidebar a:hover { background: #24302a; text-decoration: none; }
.sidebar a.active { background: var(--brand); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar form button { background: none; border: 0; color: #9fb0a7; padding: 9px 10px; cursor: pointer; font: inherit; text-align: left; width: 100%; }
.sidebar .gymname { color: #9fb0a7; font-size: 13px; padding: 0 10px 6px; }
.main { flex: 1; padding: 28px 32px 60px; max-width: 1180px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: block; color: inherit; }
.stat:hover { text-decoration: none; border-color: #c9cfca; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.stat.warn .value { color: var(--amber); }
.stat.bad .value { color: var(--red); }
.stat.good .value { color: var(--brand); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 4px; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--brand-soft); color: var(--brand-dark); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-grey { background: var(--grey-soft); color: var(--muted); }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 3px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cdd3ce; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9bd3b5; border-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.check input { width: 18px; height: 18px; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand); padding: 9px 16px;
  border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-align: center; white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--ink); border-color: #cdd3ce; }
.btn-secondary:hover { background: #f1f3f1; }
.btn-danger { background: #fff; color: var(--red); border-color: #f0c3be; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.inline { display: inline; }

/* Filters */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; }
.tabs a.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs a:hover { text-decoration: none; }
.search { display: flex; gap: 8px; margin-bottom: 14px; max-width: 460px; }

/* Flash */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: var(--brand-soft); border-color: #b9dfc9; color: var(--brand-dark); }
.flash-error { background: var(--red-soft); border-color: #f3c1bb; color: var(--red); }
.flash-info { background: #eaf2fb; border-color: #c4d8ef; color: #1f4f82; }
.banner { background: var(--amber-soft); border: 1px solid #f2d3a4; color: #6b3d00; padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; }

/* Auth pages */
.auth { max-width: 420px; margin: 7vh auto; padding: 0 16px; }
.auth .logo { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth .logo span { color: var(--brand); }
.auth .tagline { text-align: center; color: var(--muted); margin-bottom: 22px; }

/* Key-value */
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; }
.preview { background: #e7f6ec; border-radius: 8px; padding: 9px 12px; font-size: 14px; white-space: pre-wrap; }
details summary { cursor: pointer; font-weight: 600; }
.rule { border-top: 1px solid var(--line); padding: 16px 0; }
.rule:first-of-type { border-top: 0; padding-top: 4px; }
code { background: #eef0ee; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 10px; gap: 2px; align-items: center; }
  .sidebar .logo { padding: 4px 10px; width: 100%; }
  .sidebar .gymname, .sidebar .spacer { display: none; }
  .sidebar a, .sidebar form button { padding: 7px 10px; font-size: 14px; width: auto; }
  .main { padding: 18px 14px 50px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .row, .row-3 { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 110px 1fr; }
}

/* Public payment page */
.paybody { background: #eef3ef; }
.pay { max-width: 460px; margin: 0 auto; padding: 18px 14px 40px; }
.pay-head { text-align: center; margin: 8px 0 14px; }
.pay-gym { font-size: 20px; font-weight: 800; }
.pay-card { padding: 20px; }
.pay-for { font-weight: 600; font-size: 16px; }
.pay-amount { font-size: 36px; font-weight: 800; margin: 2px 0 14px; color: var(--brand-dark); }
.pay-steps { padding-left: 20px; margin: 10px 0; }
.pay-steps li { margin-bottom: 6px; }
.qr-wrap { display: flex; justify-content: center; margin: 8px 0 14px; }
#qr { width: 240px; height: 240px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
#qr svg { width: 100%; height: 100%; display: block; }
.pay-app-btn { padding: 12px; font-size: 16px; margin-bottom: 10px; }
.pay-upi { text-align: center; margin-bottom: 18px; line-height: 2; }
.pay-status { border-radius: 8px; padding: 12px 14px; margin: 6px 0 4px; }
.pay-ok { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.pay-wait { background: #eaf2fb; color: #1f4f82; }
.pay-bad { background: var(--red-soft); color: var(--red); margin-bottom: 12px; }
.pay-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.shot-thumb { max-width: 90px; max-height: 120px; border: 1px solid var(--line); border-radius: 6px; display: block; }
.nav-count { background: #f5b84a; color: #2a1a00; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; margin-left: 6px; }
