:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #172033;
  --muted: #667085;
  --line: #d7dee8;
  --brand: #126b5c;
  --brand-strong: #0d5147;
  --accent: #3454d1;
  --warn: #b54708;
  --bad: #b42318;
  --good: #16803c;
  --radius: 8px;
  --shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 14px;
}

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

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--brand-strong);
}

button.secondary {
  background: #eef2f6;
  color: var(--text);
}

button.secondary:hover {
  background: #e4e9f0;
}

button.danger {
  background: #fef3f2;
  color: var(--bad);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 700;
}

.compact-label {
  margin: 8px 0;
  max-width: 420px;
}

.hidden {
  display: none !important;
}

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

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1 {
  margin: 6px 0 18px;
  font-size: 28px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px 1fr;
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 22px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.brand h1 {
  margin: 5px 0 0;
  font-size: 24px;
}

.brand p,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow,
.sidebar .brand p {
  color: #8fb7ad;
}

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

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: #d9e2ea;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: #1f2937;
  border-color: #374151;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

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

.topbar h2 {
  margin: 3px 0 0;
  font-size: 24px;
}

.workspace {
  min-width: 0;
  padding: 20px 24px 36px;
}

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

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

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

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

.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.card {
  padding: 14px;
}

.stat {
  min-height: 96px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.muted {
  color: var(--muted);
}

.error {
  min-height: 20px;
  color: var(--bad);
}

.form {
  display: grid;
  gap: 12px;
}

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

.row.between {
  justify-content: space-between;
}

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

.table-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(220px, 2fr) 120px auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

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

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

.item h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.item p {
  margin: 5px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3538cd;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.pill.good {
  background: #ecfdf3;
  color: var(--good);
}

.pill.bad {
  background: #fef3f2;
  color: var(--bad);
}

.pill.warn {
  background: #fffaeb;
  color: var(--warn);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.editor-title {
  font-size: 20px;
  font-weight: 800;
}

.editor {
  min-height: 620px;
  line-height: 1.55;
}

.score-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.score-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--surface-soft);
}

.pre {
  white-space: pre-wrap;
  overflow: auto;
  border-radius: 6px;
  background: #101828;
  color: #e4e7ec;
  padding: 12px;
}

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

.span-2 {
  grid-column: span 2;
}

@media (max-width: 1120px) {
  .grid.four,
  .grid.three,
  .grid.two,
  .editor-layout,
  .split-form {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

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

  .sidebar {
    position: static;
  }

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