*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  color: var(--g-text);
  font-family: var(--g-font);
  background:
    radial-gradient(1200px 600px at 10% 0%, color-mix(in srgb, var(--g-primary) 18%, white), transparent),
    radial-gradient(800px 500px at 90% 20%, color-mix(in srgb, var(--g-secondary) 16%, white), transparent),
    #f8f9fb;
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.card {
  background: #ffffffcc;
  border: 1px solid var(--g-border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  backdrop-filter: blur(6px);
}

.inner {
  padding: 0.85rem;
}

.mt {
  margin-top: 1rem;
}
.mt-xs {
  margin-top: 0.4rem;
}
.pad-sm {
  padding: 0.45rem 0.75rem !important;
}
.gap {
  gap: 0.85rem;
}
.gap-xs {
  gap: 0.35rem;
}
.small {
  font-size: 0.85rem;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.row {
  display: flex;
  align-items: center;
}
.wrap {
  flex-wrap: wrap;
}

.muted {
  color: #636e72;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-shell {
  grid-template-columns: 250px 1fr;
}

.app-main {
  padding: clamp(14px, 3vw, 28px);
  max-width: 1100px;
  margin-inline-start: auto;
  margin-inline-end: auto;
  width: 100%;
}

.side-nav {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-radius: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.75rem;
  border-inline-end: 1px solid var(--g-border);
  border-block: none;
  padding: 18px;
}

.side-footer {
  align-self: end;
}

.brand {
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--g-primary);
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-block: 6px;
}

.nav-list a {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.nav-list a:hover {
  background: #eef2ff77;
}

.nav-list a.active {
  border-color: color-mix(in srgb, var(--g-primary), #fff);
  background: white;
}

.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.block-title {
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}
.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--g-border);
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.span-2 {
  grid-column: span 2;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--g-border);
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  background: white;
}
.btn-primary {
  background: linear-gradient(135deg, var(--g-primary), color-mix(in srgb, var(--g-primary), black 12%));
  color: #fff;
  border-color: transparent;
}
.btn-secondary {
  background: #fff;
}
.btn-ghost {
  background: transparent;
}
.btn-danger {
  background: #ffe8e6;
  border-color: #fab1a0;
  color: #d63031;
}
.btn-wa {
  background: #25d366;
  color: #fff;
  border-color: transparent;
}
.btn-small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.inline {
  display: inline-block;
  margin-inline-end: 6px;
  margin-block: 4px;
}

.alert {
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0 14px;
}
.alert-ok {
  background: #e8fff4;
  border: 1px solid #b2f0d1;
}
.alert-error {
  background: #ffecec;
  border: 1px solid #ffb3b3;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card.wide {
  width: min(860px, 100%);
}

.auth-logo {
  font-weight: 800;
  color: var(--g-primary);
  margin-bottom: 4px;
}

.grid-3 {
  display: grid;
  gap: clamp(12px, 2vw, 18px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tile {
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px #636e7240;
}

.ring-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 12px;
}

.ring {
  --p: 0;
  --ring: var(--g-primary);
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background:
    conic-gradient(var(--ring) calc(var(--p) * 1%), #dfe6e9 0);
  box-shadow:
    inset 0 0 0 14px white,
    0 6px 20px #0000001a;
}

.trainer-card .price-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.price-list em {
  font-style: normal;
  font-weight: 700;
}

.datetime {
  min-width: 190px;
  text-align: center;
}

.row-checks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--g-border);
  border-radius: 999px;
  padding: 8px 12px;
  background: white;
}

.ex-cat {
  margin-top: 1rem;
}

.ex-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 0.65rem;
}

.ex-chip {
  border: 1px solid var(--g-border);
  border-radius: 14px;
  padding: 8px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ex-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.ex-thumb img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--g-border);
}

.ex-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-link {
  font-size: 0.8rem;
  color: var(--g-primary);
  white-space: nowrap;
}

.calendar {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.cal-head {
  text-align: center;
  font-size: 0.85rem;
}
.cal-empty {
  min-height: 40px;
}
.cal-cell {
  text-align: center;
  padding: 10px 0;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  background: white;
}

.cal-cell.rest {
  border-color: color-mix(in srgb, var(--rest-color), #bbb);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rest-color), transparent 82%);
}

.cal-cell.trained {
  border-color: color-mix(in srgb, var(--train-color), #bbb);
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--train-color), transparent 74%), transparent),
    #fff;
}

.pill.rest,
.pill.trained {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  vertical-align: middle;
}

.pill.rest {
  background: var(--rest-color);
}
.pill.trained {
  background: var(--train-color);
}

.inline-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.roadmap {
  display: grid;
  gap: 0;
}
.road-node {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 150px) 1fr;
  align-items: start;
}

.road-media img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--g-border);
}
.road-bar {
  margin-inline-start: 75px;
  width: 3px;
  height: 32px;
  background: linear-gradient(var(--g-primary), transparent);
}

.table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}
.table th,
.table td {
  border-bottom: 1px solid var(--g-border);
  padding: 10px;
  vertical-align: top;
}
.table-responsive {
  overflow-x: auto;
}
.nowrap {
  white-space: nowrap;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.cat-tile {
  text-decoration: none;
  display: grid;
  gap: 8px;
  padding: 16px !important;
}
.cat-tile:hover {
  outline: 2px solid color-mix(in srgb, var(--g-primary), #fff);
}

.machine-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.machine .topic {
  font-size: 0.93rem;
  margin: 6px 0;
}
.machine figure img {
  border-radius: 12px;
  border: 1px solid var(--g-border);
  width: 100%;
}
.media-row {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  object-fit: cover;
  border: 3px solid white;
  box-shadow: 0 6px 22px #00000024;
}

.avatar.placeholder {
  background:
    radial-gradient(circle at 30% 30%, white, transparent),
    linear-gradient(135deg, var(--g-primary), var(--g-secondary));
  display: inline-block;
}

.breadcrumbs {
  font-size: 0.92rem;
  margin-block: 2px;
}

.thumb-admin,
.preview {
  max-height: 90px;
  border-radius: 10px;
  border: 1px solid var(--g-border);
}

@media (max-width: 900px) {
  .app-shell,
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .side-nav {
    position: relative;
    height: auto;
    grid-auto-flow: column;
    border-inline-end: none;
    border-block-end: 1px solid var(--g-border);
  }
  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid.two-col {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: auto;
  }
  .ring-card {
    grid-template-columns: 90px 1fr;
  }
}

@media (max-width: 600px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
