* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(143, 19, 32, 0.14), transparent 28%),
    radial-gradient(circle at top left, rgba(114, 67, 209, 0.08), transparent 24%),
    linear-gradient(180deg, #f8fafc 0%, var(--paper) 48%, #eef1f5 100%);
  font: 17px/1.5 "Segoe UI", Arial, sans-serif;
  letter-spacing: -0.01em;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 2000;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--sidebar);
  color: #fff;
}

.skip-link:focus {
  top: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.login {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8vw;
  color: #fff;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.1), transparent 18%),
    radial-gradient(circle at 82% 16%, rgba(255, 255, 255, 0.08), transparent 22%),
    linear-gradient(135deg, #091018 0%, #161b22 42%, #2a1116 100%);
}

.brand::before,
.brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.brand::before {
  width: 420px;
  height: 420px;
  top: -150px;
  right: -120px;
  border: 64px solid rgba(255, 255, 255, 0.06);
}

.brand::after {
  width: 280px;
  height: 280px;
  bottom: -120px;
  left: -100px;
  border: 54px solid rgba(143, 19, 32, 0.34);
}

.brand-logo {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  margin-bottom: 42px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-red), #bf1e32);
  box-shadow: 0 18px 38px rgba(143, 19, 32, 0.28);
  font-size: 30px;
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.brand h1 span {
  color: #ff8b99;
}

.brand p:last-child {
  max-width: 560px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
}

.login-side {
  display: grid;
  place-items: center;
  padding: 44px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.92));
}

.login-form,
.card,
dialog,
.process-table,
.average-card,
.timeline-item,
.record {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.login-form {
  width: min(430px, 100%);
  padding: 36px 34px;
}

.login-form h2 {
  margin: 0 0 8px;
  font-size: 44px;
  letter-spacing: -0.04em;
}

.login-form > p {
  margin: 0 0 30px;
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(23, 33, 47, 0.14);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}

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

input:focus,
select:focus,
textarea:focus,
button:focus,
summary:focus {
  outline: 3px solid rgba(45, 108, 223, 0.18);
  outline-offset: 2px;
}

.btn,
.mini-btn,
.logout,
summary.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
}

.btn,
.logout {
  padding: 13px 18px;
}

.mini-btn,
summary.mini-btn {
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.btn.red,
.start-btn {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-deep));
  color: #fff;
}

.btn.light,
.logout,
.menu {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.mini-btn.danger {
  color: var(--danger);
}

.full,
.form-grid .full {
  width: 100%;
}

.release-meta {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
}

.release-meta strong,
.release-meta small,
.release-meta span {
  display: block;
}

.release-version {
  font-weight: 800;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #151b25 100%);
  color: #fff;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 22px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo b,
.avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-red), #bf1e32);
  color: #fff;
  font-weight: 800;
}

.logo span,
.logo small,
.side-user small {
  display: block;
}

.logo small,
.side-user small,
.top-meta,
.task-meta,
.record-meta,
.timezone-note,
.table-hint,
.move-note,
.no-notes,
.empty-row {
  color: var(--muted);
}

.sidebar-release {
  position: static;
  background: rgba(255, 255, 255, 0.06);
}

.nav {
  display: grid;
  gap: 10px;
  align-content: start;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: #e6edf3;
  text-align: left;
}

.nav button.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.ui-icon {
  width: 22px;
  height: 22px;
}

.side-user {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 18px 14px;
  border: 1px solid var(--sidebar-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.side-user .logout {
  grid-column: 1 / -1;
}

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

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.top h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: -0.03em;
}

.menu {
  display: none;
  width: 50px;
  height: 50px;
  border-radius: 16px;
}

.content {
  display: grid;
  gap: 20px;
}

.hero,
.stats,
.grid,
.form-grid,
.score-overview,
.log-summary {
  display: grid;
  gap: 16px;
}

.hero {
  grid-template-columns: 1fr auto;
  align-items: end;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(143, 19, 32, 0.9), rgba(31, 39, 54, 0.95));
  color: #fff;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  max-width: 700px;
  color: rgba(255, 255, 255, 0.82);
}

.hero-value {
  min-width: 150px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  text-align: right;
}

.hero-value strong {
  display: block;
  font-size: 36px;
}

.stats,
.log-summary,
.score-overview {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat,
.log-stat,
.average-card {
  padding: 20px;
  border-radius: 20px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.stat-icon,
.record-icon,
.timeline-dot,
.state-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
}

.amber { background: rgba(194, 138, 18, 0.14); color: var(--warning); }
.green { background: rgba(24, 128, 93, 0.14); color: var(--success); }
.blue { background: rgba(45, 108, 223, 0.14); color: var(--info); }
.violet { background: rgba(114, 67, 209, 0.14); color: var(--purple); }

.section-head,
.level-heading,
.actions,
.progress-line,
.evidence-state,
.benefit-row,
.aspect-item,
.record-meta,
.task-actions,
.profile-actions,
.dialog-head,
.log-person,
.back-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.card {
  overflow: hidden;
}

.card-body,
.process-table,
.average-card,
.record,
.timeline-body,
.timeline-item,
dialog {
  padding: 22px;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(23, 33, 47, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.badge.gray { background: rgba(123, 132, 147, 0.16); color: var(--neutral); }
.badge.green,
.status-completed { background: rgba(24, 128, 93, 0.12); color: var(--success); }
.status-started { background: rgba(45, 108, 223, 0.12); color: var(--info); }
.status-pending { background: rgba(194, 138, 18, 0.16); color: var(--warning); }

.progress,
.score-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 33, 47, 0.08);
}

.progress span,
.score-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand-red), #ca3649);
}

.tasks,
.record-list,
.timeline,
.benefits,
.aspect-list {
  display: grid;
  gap: 12px;
}

.task,
.benefit-row,
.aspect-item,
.timeline-item,
.record,
.clipboard-bar {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
}

.task {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
}

.catalog-task {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.student-notes {
  margin-top: 14px;
}

.student-note {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(23, 33, 47, 0.05);
}

.table-box {
  overflow: auto;
}

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

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

thead th {
  color: var(--ink-soft);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:nth-child(odd) {
  background: rgba(23, 33, 47, 0.02);
}

.person {
  display: flex;
  align-items: center;
  gap: 12px;
}

details.profile-menu {
  position: relative;
}

.profile-menu-items {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.profile-menu-items .mini-btn {
  width: 100%;
  justify-content: flex-start;
  margin-top: 6px;
}

dialog {
  width: min(760px, calc(100% - 24px));
  border: 0;
}

dialog::backdrop {
  background: rgba(13, 17, 23, 0.48);
}

.modal-body {
  padding-top: 0;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2200;
  min-width: 260px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(23, 33, 47, 0.94);
  color: #fff;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  background: rgba(24, 128, 93, 0.94);
}

.sidebar-overlay {
  display: none;
}

.empty {
  padding: 24px;
  border: 1px dashed rgba(23, 33, 47, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .brand {
    min-height: 44vh;
  }

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    width: min(320px, calc(100vw - 28px));
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu,
  .sidebar-overlay.show {
    display: inline-flex;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(13, 17, 23, 0.42);
    border: 0;
  }

  .app-main {
    padding: 18px;
  }
}

@media (max-width: 720px) {
  .release-meta {
    position: static;
    margin: 16px;
    color: #fff;
  }

  .hero,
  .catalog-task,
  .section-head,
  .level-heading,
  .actions,
  .dialog-head,
  .top {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .hero {
    align-items: stretch;
  }

  .hero-value {
    text-align: left;
  }

  .card-body,
  .process-table,
  dialog {
    padding: 18px;
  }
}
