:root {
  --bg: #f6fbff;
  --bg-2: #f9f7ff;
  --surface: #ffffff;
  --surface-soft: #f8f9ff;
  --text: #1f2a37;
  --muted: #687992;
  --line: #dfe8f2;
  --brand: #8fb8f8;
  --brand-strong: #739fe8;
  --brand-purple: #c8b7f6;
  --brand-green: #bfe7d5;
  --danger: #ff6b7a;
  --success: #58b98a;
  --shadow: 0 10px 30px rgba(31, 58, 95, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 420px at 6% -12%, #e7f3ff 0%, transparent 72%),
    radial-gradient(900px 420px at 100% -8%, #f1ebff 0%, transparent 72%),
    radial-gradient(900px 420px at 60% 110%, #e9f9f1 0%, transparent 75%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.background-orb {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
}

.orb-a {
  left: -80px;
  top: -80px;
  background: rgba(143, 184, 248, 0.26);
}

.orb-b {
  right: -100px;
  bottom: -100px;
  background: rgba(191, 231, 213, 0.24);
}

.auth-shell,
.app-shell {
  width: min(1240px, 96vw);
  margin: 2rem auto;
}

.auth-card,
.sidebar,
.content,
.panel,
.stat-card,
.history-item {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-card {
  max-width: 540px;
  margin: 3.5rem auto;
  padding: 1.4rem;
}

.auth-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0.8rem 0 0.5rem;
}

.auth-footer {
  margin-top: 1rem;
  margin-bottom: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

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

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

.tiny {
  font-size: 0.82rem;
}

.menu-btn,
button {
  border: none;
  border-radius: 12px;
  padding: 0.62rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.form-block {
  display: grid;
  gap: 0.45rem;
}

label {
  margin-top: 0.35rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(164, 157, 236, 0.3);
  border-color: #b6c8f1;
}

button,
.menu-btn {
  background: var(--brand);
  color: #fff;
}

.ghost-btn {
  background: linear-gradient(90deg, #eff7ff 0%, #f2edff 100%);
  color: #4d6590;
  border: 1px solid var(--line);
}

.ghost-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

button:hover,
.menu-btn:hover {
  background: var(--brand-strong);
}

.ghost-btn:hover {
  background: #e9f2ff;
  color: #3f5d8a;
}

.hidden {
  display: none;
}

.view.hidden {
  display: none !important;
}

.message {
  margin-top: 0.95rem;
  border-radius: 14px;
  padding: 0.9rem;
  border: 1px solid #d9e5fb;
  background: #f7fbff;
}

.app-shell {
  display: grid;
  grid-template-columns: 244px 1fr;
  gap: 1rem;
}

.sidebar {
  padding: 1rem;
  height: fit-content;
}

.sidebar-user {
  margin: 0.35rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.sidebar nav {
  display: grid;
  gap: 0.52rem;
}

.menu-btn {
  text-align: left;
  background: linear-gradient(90deg, #ebf6ff 0%, #f1ecff 100%);
  color: #4f6993;
}

.menu-btn.active {
  background: var(--brand);
  color: #fff;
}

.menu-btn.danger {
  background: #ffeef0;
  color: #b83a53;
}

.content {
  padding: 1rem;
}

.content-header {
  margin-bottom: 0.8rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-card {
  padding: 0.9rem;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.stat-value {
  margin-top: 0.35rem;
  font-size: 1.7rem;
  font-weight: 700;
}

.stat-value.small {
  font-size: 0.96rem;
  line-height: 1.35;
}

.model-panel {
  margin-top: 0.75rem;
  background: var(--surface-soft);
}

#view-sentiment,
#view-relevance,
#view-learning {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

#view-sentiment {
  grid-template-columns: 1fr 1fr;
}

.panel {
  padding: 1rem;
}

.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.75rem;
}

.history-item {
  padding: 0.8rem;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.tag {
  display: inline-block;
  background: linear-gradient(90deg, #eaf6ff 0%, #ebfaef 100%);
  color: #4b668f;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
}

ul {
  margin: 0.35rem 0 0.1rem;
  padding-left: 1.2rem;
}

pre {
  white-space: pre-wrap;
  background: #f2f8ff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  color: #274363;
}

.resume-mod-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  padding: 0.75rem;
  margin: 0.45rem 0;
}

.resume-mod-item p {
  margin: 0.22rem 0;
}

.qa-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.55rem 0;
}

.qa-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #f8fbff;
}

.qa-box h4 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: #355377;
}

.qa-box p {
  margin: 0;
  font-weight: 600;
  color: #1f3652;
}

.qa-box-student {
  background: linear-gradient(180deg, #ffffff 0%, #f2faff 100%);
}

.qa-box-correct {
  background: linear-gradient(180deg, #ffffff 0%, #eefdf5 100%);
}

.qa-verdict {
  display: inline-block;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.qa-verdict-correct {
  background: #e6f8ee;
  color: #1f7a4f;
}

.qa-verdict-incorrect {
  background: #ffecef;
  color: #b74157;
}

.qa-verdict-partial {
  background: #fff7e8;
  color: #a86d18;
}

.qa-verdict-review_required,
.qa-verdict-not_provided {
  background: #edf3ff;
  color: #355f97;
}

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

  .stats-grid,
  #view-sentiment {
    grid-template-columns: 1fr;
  }

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