﻿:root {
  --bg: #080912;
  --bg-deep: #050611;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --panel-soft: rgba(255, 255, 255, 0.05);
  --text: #f8f7ff;
  --text-soft: #dedcff;
  --muted: #9ca3c7;
  --muted-light: #74799f;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.24);
  --primary: #8b5cf6;
  --primary-2: #22d3ee;
  --primary-3: #5b8cff;
  --danger: #fb7185;
  --success: #34d399;
  --warning: #fbbf24;
  --blur: blur(22px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 8%, rgba(139, 92, 246, 0.42), transparent 32%),
    radial-gradient(circle at 82% 12%, rgba(34, 211, 238, 0.28), transparent 28%),
    radial-gradient(circle at 55% 88%, rgba(91, 140, 255, 0.24), transparent 34%),
    linear-gradient(135deg, #050611 0%, #0b1022 45%, #080912 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent 78%);
}

body.locked .app-shell {
  display: none;
}

body:not(.locked) .login-view {
  display: none;
}

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

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

.login-card {
  position: relative;
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.07));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.14);
  backdrop-filter: var(--blur);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(139,92,246,0.7), rgba(34,211,238,0.28), transparent 70%);
}

.login-brand {
  margin-bottom: 28px;
}

.login-brand p,
.login-help {
  color: var(--muted);
}

.login-help {
  margin: 16px 0 0;
  font-size: 12px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(5, 6, 17, 0.72);
  color: var(--text);
  backdrop-filter: var(--blur);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  font-weight: 700;
  box-shadow: 0 14px 36px rgba(139, 92, 246, 0.45);
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

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

.nav-item {
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 11px 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

.nav-item.active {
  color: white;
  border-color: rgba(139, 92, 246, 0.45);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(34, 211, 238, 0.12));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 12px 32px rgba(91, 140, 255, 0.12);
}

.main {
  min-width: 0;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 38px 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,0.06);
  backdrop-filter: var(--blur);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1;
}

#pageTitle {
  font-size: clamp(18px, 1.5vw, 24px);
  line-height: 1.15;
}

h3 {
  font-size: 18px;
  line-height: 1.2;
}

.api-box {
  width: min(520px, 42vw);
}

.api-box label,
.form-panel label,
.inline-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.api-row,
.user-box {
  display: flex;
  gap: 10px;
}

.user-box {
  align-items: end;
}

.user-box span {
  min-width: 138px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  color: var(--text-soft);
  font-size: 11px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px 12px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  outline: none;
}

input,
select {
  border-radius: 999px;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--muted-light);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(34, 211, 238, 0.72);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.14);
}

.btn {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 9px 16px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-3));
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 14px 38px rgba(139, 92, 246, 0.28);
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.secondary {
  color: var(--text-soft);
  background: rgba(255,255,255,0.08);
  box-shadow: none;
}

.btn.secondary:hover {
  background: rgba(255,255,255,0.12);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.055));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255,255,255,0.1);
  backdrop-filter: var(--blur);
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 11px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff, #aeb8ff);
  -webkit-background-clip: text;
  color: transparent;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

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

.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

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

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

.form-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.form-panel.compact h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: end;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(0,0,0,0.12);
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
  text-align: left;
  font-size: 12px;
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(255,255,255,0.045);
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--muted);
  background: rgba(255,255,255,0.055);
  font-weight: 600;
}

a {
  color: #a5f3fc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.status {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.08);
  color: var(--text-soft);
  font-size: 12px;
}

.status.ARCHIVED,
.status.RESET_WAITING,
.status.REVIEWED {
  color: #bbf7d0;
  background: rgba(52, 211, 153, 0.12);
}

.status.SUBMITTED,
.status.GRADING {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.12);
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.flow div {
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  text-align: center;
  color: var(--text-soft);
  font-size: 11px;
}

.log {
  min-height: 320px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  background: rgba(0,0,0,0.32);
  color: #dbeafe;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: none;
  max-width: 420px;
  padding: 13px 18px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, rgba(139,92,246,0.96), rgba(91,140,255,0.96));
  box-shadow: 0 20px 60px rgba(91, 140, 255, 0.28);
}

.toast.show {
  display: block;
}

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

.link-cell {
  max-width: 260px;
  word-break: break-all;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

  .api-box {
    width: 100%;
  }

  .metrics,
  .grid.two,
  .grid.four,
  .flow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 18px;
  }

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

  .api-row,
  .user-box,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
}

