:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #16202a;
  --muted: #667789;
  --line: #dce5ee;
  --soft: #eef4f8;
  --nav: #0d232b;
  --nav-active: #145459;
  --teal: #0f766e;
  --blue: #2563eb;
  --green: #15803d;
  --amber: #d97706;
  --red: #be123c;
  --violet: #6d28d9;
  --cyan: #0891b2;
  --shadow: 0 14px 34px rgba(22, 32, 42, 0.09);
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: var(--nav);
  color: #e7f5f5;
  overflow-y: auto;
}

.brand {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  padding: 0 2px 20px;
}

.brand img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.brand b {
  display: block;
  font-size: 18px;
  letter-spacing: 0;
}

.brand span {
  color: #a6d6da;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: #cfe6e8;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: var(--nav-active);
  color: #ffffff;
}

.nav .glyph {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.11);
  font-weight: 800;
  font-size: 13px;
}

.side-note {
  margin-top: 20px;
  color: #9cc8ce;
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: 82px minmax(0, 1fr);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.title h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

.title p {
  margin: 5px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.content {
  min-width: 0;
  padding: 18px 24px 28px;
  position: relative;
  animation: enter .22s ease-out;
}

.content::after {
  content: "";
  position: fixed;
  right: 44px;
  bottom: 32px;
  width: min(320px, 26vw);
  aspect-ratio: 1;
  background: url("./assets/logo.png") center/contain no-repeat;
  opacity: .045;
  pointer-events: none;
}

@keyframes enter {
  from { opacity: .35; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(7, minmax(180px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
.two { grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); }
.wide-two { grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

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

.panel-head {
  padding: 15px 16px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel h2,
.panel h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.panel-body { padding: 16px; }

.kpi {
  min-width: 180px;
  padding: 15px;
  display: grid;
  gap: 10px;
}

.kpi .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi .value { font-size: 27px; font-weight: 850; line-height: 1; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.track {
  height: 8px;
  background: #e8eef5;
  border-radius: 99px;
  overflow: hidden;
}
.track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--teal);
}

.btn {
  min-height: 37px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn:hover { border-color: #94a3b8; background: #f8fafc; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { background: #fff1f2; color: #9f1239; border-color: #fecdd3; }
.btn.ghost { background: transparent; color: #e7f5f5; border-color: rgba(255,255,255,.18); }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 11px;
}
.form-grid.four { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  min-height: 39px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}
textarea { min-height: 78px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56,189,248,.17);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td input, td select { min-width: 84px; }

.list { display: grid; gap: 10px; }
.item {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.item-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}
.item-title { font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  background: #eef2ff;
  color: #3730a3;
}
.tag.green { background: #dcfce7; color: #166534; }
.tag.red { background: #ffe4e6; color: #9f1239; }
.tag.amber { background: #fef3c7; color: #92400e; }
.tag.blue { background: #dbeafe; color: #1d4ed8; }
.tag.gray { background: #f1f5f9; color: #475569; }

canvas {
  display: block;
  width: 100%;
  min-height: 260px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.plan-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  gap: 8px;
  min-height: 280px;
  overflow-x: auto;
}
.day-col {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px;
  min-width: 118px;
}
.day-col b { font-size: 13px; }
.plan-block {
  margin-top: 8px;
  border-radius: 8px;
  padding: 8px;
  color: white;
  background: var(--teal);
  font-size: 12px;
  min-height: 46px;
}
.plan-block span { display: block; opacity: .88; font-size: 11px; }

.coach-score {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.score-card {
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.score-card b { font-size: 24px; display: block; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .46);
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal.hidden { display: none; }
.dialog {
  width: min(860px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0,0,0,.22);
  padding: 18px;
}

.empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--nav);
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .nav { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
  .side-note { display: none; }
  .main { grid-template-rows: auto minmax(0, 1fr); }
  .two, .wide-two, .three { grid-template-columns: 1fr; }
  .topbar { position: relative; }
}

@media (max-width: 720px) {
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand { grid-template-columns: 48px 1fr; }
  .brand img { width: 46px; height: 46px; }
  .topbar { display: grid; }
  .top-actions { justify-content: flex-start; }
  .form-grid, .form-grid.four { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(7, 180px); }
  .coach-score { grid-template-columns: 1fr; }
}
