:root {
  --bg: #f4f7fb;
  --ink: #102033;
  --muted: #6d7b8d;
  --line: #dce5ef;
  --panel: rgba(255, 255, 255, 0.82);
  --navy: #132a4f;
  --blue: #1769e8;
  --cyan: #17b8d8;
  --green: #13a06f;
  --orange: #f08a24;
  --shadow: 0 18px 55px rgba(17, 43, 77, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 80% 10%, rgba(23, 105, 232, 0.16), transparent 26rem),
    linear-gradient(135deg, #f7fbff 0%, #eef5fb 44%, #f8fafc 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 14px 32px rgba(23, 105, 232, 0.28);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.login-card h1 {
  margin: 16px 0 10px;
  font-size: clamp(34px, 7vw, 54px);
  line-height: 0.96;
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

label {
  color: var(--navy);
  font-weight: 800;
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 104px;
  padding: 14px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(23, 105, 232, 0.7);
  box-shadow: 0 0 0 4px rgba(23, 105, 232, 0.1);
}

button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  color: #fff;
  font-weight: 850;
  background: linear-gradient(135deg, var(--blue), #0d4eb8);
  box-shadow: 0 12px 28px rgba(23, 105, 232, 0.22);
}

.ghost {
  width: 100%;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.error {
  min-height: 20px;
  color: #cc2638;
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  background: rgba(10, 31, 60, 0.94);
  color: #fff;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-head span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

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

.nav-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  box-shadow: none;
}

.nav-btn.active,
.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar .ghost {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.status-pill {
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(19, 160, 111, 0.11);
  border: 1px solid rgba(19, 160, 111, 0.18);
  font-size: 13px;
  font-weight: 850;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  padding: 24px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(19, 42, 79, 0.94), rgba(16, 74, 146, 0.9)),
    #132a4f;
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-panel h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 1.04;
}

.hero-panel .eyebrow {
  color: #7ee5f4;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 10px;
  align-self: end;
}

.metric {
  min-width: 86px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
}

.metric span {
  display: block;
  font-size: 28px;
  font-weight: 950;
}

.metric small {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.coach-panel,
.mini-panel {
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 14px 42px rgba(17, 43, 77, 0.08);
  backdrop-filter: blur(18px);
}

.coach-panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin: 0;
  font-size: 22px;
}

.output {
  min-height: 380px;
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  line-height: 1.66;
  white-space: normal;
}

.output h1,
.output h2,
.output h3 {
  margin: 18px 0 8px;
  line-height: 1.15;
}

.output h1:first-child,
.output h2:first-child,
.output h3:first-child {
  margin-top: 0;
}

.output ul,
.output ol {
  padding-left: 22px;
}

.output code {
  padding: 2px 6px;
  border-radius: 8px;
  background: #eef5ff;
}

.right-rail {
  display: grid;
  gap: 20px;
}

.mini-panel {
  padding: 18px;
}

.mini-panel h3 {
  margin-bottom: 14px;
}

#checkinForm {
  display: grid;
  gap: 10px;
}

.score-label {
  margin-top: 4px;
}

input[type="range"] {
  padding: 0;
  min-height: auto;
  accent-color: var(--blue);
}

.history {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.history-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.history-card strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.history-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.loading {
  opacity: 0.72;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .sidebar-head {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-btn {
    text-align: center;
    justify-content: center;
    padding: 0 8px;
  }

  .sidebar .ghost {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .hero-panel,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .login-card,
  .coach-panel,
  .mini-panel,
  .hero-panel {
    border-radius: 16px;
  }

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

  .metric-row {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head button {
    width: 100%;
  }
}
