:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --ink: #17202a;
  --muted: #697583;
  --line: #d9e0e7;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #b45309;
  --bad: #b42318;
  --ok-bg: #e7f6ef;
  --bad-bg: #fee4e2;
  --shadow: 0 18px 45px rgba(39, 54, 71, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.08;
}

h2 {
  font-size: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
  gap: 18px;
}

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

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 220px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf1f5;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status[data-tone="ok"] {
  background: var(--ok-bg);
  color: var(--accent-strong);
}

.status[data-tone="bad"] {
  background: var(--bad-bg);
  color: var(--bad);
}

.login-panel,
.average-panel {
  grid-column: 1;
}

.chart-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.table-panel {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fbfcfd;
}

input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.17);
  border-color: var(--accent);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border 150ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  width: 100%;
  margin-top: 4px;
  background: var(--accent);
  color: white;
  font-weight: 750;
}

.primary:hover {
  background: var(--accent-strong);
}

.ghost,
.icon-button {
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
}

.ghost {
  width: 100%;
  margin-top: 10px;
}

.compact {
  width: auto;
  min-height: 34px;
  padding: 0 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.average-value {
  font-size: 58px;
  line-height: 1;
  font-weight: 800;
  color: var(--accent-strong);
}

.muted {
  min-height: 42px;
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.subject-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subject-chip {
  min-height: 34px;
  max-width: 100%;
  border: 1px solid var(--line);
  padding: 6px 10px;
  background: #fbfcfd;
  color: var(--ink);
  font-size: 13px;
}

.subject-chip[data-active="true"] {
  border-color: var(--accent);
  background: #dff4ef;
  color: var(--accent-strong);
  font-weight: 750;
}

.chart {
  display: grid;
  gap: 14px;
  min-height: 420px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(92px, 170px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.bar-label {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.bar-track {
  position: relative;
  min-height: 36px;
  overflow: hidden;
  border-radius: 8px;
  background: #edf1f5;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 34px;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #22a699);
}

.bar-score {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

td {
  font-size: 14px;
}

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

  .login-panel,
  .average-panel,
  .chart-panel,
  .table-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}


.prediction-panel {
  grid-column: 1 / -1;
}

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

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fbfcfd;
  font: inherit;
}

select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.17);
  border-color: var(--accent);
}

.prediction-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.prediction-results div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.prediction-results span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.prediction-results strong {
  font-size: 30px;
  color: var(--accent-strong);
}

.detail-row td {
  padding-top: 0;
  background: #fbfcfd;
}

.course-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}

.course-details summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 750;
}

.nested {
  margin-top: 10px;
}

.assignment-table {
  min-width: 720px;
}

.assignment-table th,
.assignment-table td {
  font-size: 13px;
  padding: 10px 8px;
}

.empty-detail {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .predict-grid,
  .prediction-results {
    grid-template-columns: 1fr;
  }
}
