:root {
  --bg: #f4f2ea;
  --ink: #111613;
  --muted: #5f665f;
  --line: #d8d4c7;
  --panel: #fffdf7;
  --panel-2: #ebe7db;
  --green: #16643a;
  --green-2: #21834e;
  --lime: #b7dc67;
  --amber: #d88b26;
  --red: #b84538;
  --blue: #236b8e;
  --shadow: 0 18px 50px rgba(17, 22, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(22, 100, 58, 0.09), transparent 32%),
    linear-gradient(315deg, rgba(216, 139, 38, 0.13), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  border: 0;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
}

.auth-brand {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #111613;
  color: #f9f6ee;
}

.auth-brand h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(2.2rem, 5vw, 5.2rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.auth-brand p {
  max-width: 590px;
  color: #d9d4c5;
  font-size: 1.05rem;
  line-height: 1.65;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-weight: 800;
}

.auth-panel {
  align-self: center;
  justify-self: center;
  width: min(520px, calc(100% - 36px));
  padding: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #111613;
  color: #f7f4ec;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.05rem;
}

.side-logo span:first-child {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green-2);
  color: white;
}

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

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 13px;
  text-align: left;
  border-radius: 8px;
  color: #dcd6c7;
  background: transparent;
  cursor: pointer;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.user-box {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.main {
  padding: 24px;
  min-width: 0;
}

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

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.8rem, 3vw, 3.05rem);
  line-height: 1;
}

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

.grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.editor-grid {
  grid-template-columns: minmax(420px, 1fr) 360px;
}

.panel {
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(17, 22, 19, 0.07);
}

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

.panel-body {
  padding: 18px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #343b35;
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfcabd;
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(33, 131, 78, 0.16);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.btn.secondary {
  background: #e5e0d1;
  color: var(--ink);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.warn {
  background: var(--red);
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffefa;
  color: #333a33;
  font-size: 0.86rem;
  font-weight: 750;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 12px;
  font-weight: 750;
}

.checkline input {
  width: auto;
}

.item-list {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  cursor: pointer;
}

.list-item.active {
  border-color: var(--green-2);
  box-shadow: inset 4px 0 0 var(--green-2);
}

.list-item h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.exercise-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.exercise-card {
  min-width: 0;
}

.exercise-card .panel-head {
  align-items: flex-start;
  gap: 12px;
}

.mini-field {
  margin: 10px 0 12px;
  overflow: hidden;
  border: 1px solid #cfcabd;
  border-radius: 8px;
  background: #206b42;
}

.mini-field svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 210px;
}

.explain-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.explain-box div {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.explain-box span {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.explain-box p {
  margin: 0;
  color: #333a33;
  line-height: 1.45;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tool {
  min-height: 48px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  cursor: pointer;
}

.tool.active {
  border-color: var(--green-2);
  background: #e7f3df;
}

.tool span {
  display: block;
  font-size: 1.12rem;
  line-height: 1;
}

.tool small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.field-stage {
  overflow: hidden;
  border: 1px solid #bfc8b8;
  border-radius: 8px;
  background: #185b38;
}

.field-stage svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 420px;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.field-stage svg [data-object-id] {
  cursor: move;
}

.kit-box {
  display: grid;
  gap: 12px;
}

.kit-score {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: center;
}

.score-circle {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green-2) calc(var(--score) * 1%), #e5e0d1 0);
  color: white;
  font-size: 1.55rem;
  font-weight: 900;
  position: relative;
}

.score-circle::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #111613;
  z-index: 0;
}

.score-circle span {
  position: relative;
  z-index: 1;
}

.suggestions {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggestions li {
  padding: 10px 11px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fff8e6;
  line-height: 1.45;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.empty {
  padding: 28px;
  border: 1px dashed #bdb7aa;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.source-note {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.76);
  color: var(--muted);
  font-size: 0.9rem;
}

.source-note a {
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 1100px) {
  .dashboard-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .auth-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 40vh;
    padding: 32px 22px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .main {
    padding: 16px;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
  }

  .form-grid,
  .metric-row,
  .exercise-library {
    grid-template-columns: 1fr;
  }

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

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

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

  .auth-panel {
    padding: 22px;
  }
}
