* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --canvas: #f6f9fc;
  --canvas-soft: #edf7f4;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-subtle: #f3f7fb;
  --ink: #17202e;
  --ink-soft: #26364a;
  --muted: #657386;
  --line: #d8e3ee;
  --line-strong: #c2d0df;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e9f0ff;
  --teal: #0f9f95;
  --teal-soft: #def8f4;
  --amber: #f3b23f;
  --amber-soft: #fff5db;
  --danger: #dc3f52;
  --danger-soft: #ffe7ea;
  --success: #16875d;
  --success-soft: #def8eb;
  --shadow: 0 18px 50px rgba(23, 32, 46, 0.08);
  --shadow-sm: 0 8px 24px rgba(23, 32, 46, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --container: 1180px;
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.18);
  --font-sans: "Aptos", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Aptos Display", "Aptos", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

html {
  min-height: 100%;
  background: var(--canvas);
  font-family: var(--font-sans);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 159, 149, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #f8fbff 0%, #eef8f6 46%, #f7f9fd 100%);
  background-size: 44px 44px, 44px 44px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.1), transparent 34%),
    linear-gradient(300deg, transparent 55%, rgba(243, 178, 63, 0.11));
  opacity: 0.8;
}

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

a {
  color: inherit;
}

img {
  max-width: 100%;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.12;
  font-weight: 700;
}

h1 {
  font-size: clamp(30px, 4vw, 44px);
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 18px;
}

p {
  margin: 0;
}

.container {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 24px;
}

.app-main {
  position: relative;
  padding-block: 28px 56px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  color: #f8fbff;
  border-bottom: 1px solid rgba(216, 227, 238, 0.18);
  background: rgba(16, 28, 44, 0.92);
  backdrop-filter: blur(14px);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 20px;
  font-family: var(--font-display);
  font-weight: 700;
}

.logo-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #07111f;
  background:
    linear-gradient(135deg, #d8ecff 0%, #8fc7ff 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.nav-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: rgba(248, 251, 255, 0.78);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
}

.nav-link.nav-link-danger {
  color: #ffd6dc;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-head__copy {
  display: grid;
  gap: 8px;
}

.page-head__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.eyebrow {
  color: var(--teal);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.card,
.panel {
  position: relative;
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid rgba(194, 208, 223, 0.82);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card > :first-child,
.panel > :first-child {
  margin-top: 0;
}

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

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

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

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
}

.inline-actions,
.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.dashboard-bank-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 270px;
}

.dashboard-bank-actions .btn {
  width: 100%;
  text-align: center;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

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

select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus);
}

input:disabled,
textarea:disabled,
select:disabled {
  color: var(--muted);
  background: var(--surface-subtle);
}

.btn,
button.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.2;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.26);
}

.btn:focus-visible,
.mini-button:focus-visible,
.nav-link:focus-visible,
.mini-link:focus-visible,
.download-btn:focus-visible,
.file-card:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn-outline,
.btn-outline-dark {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.btn-outline:hover,
.btn-outline-dark:hover {
  color: var(--primary-dark);
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--primary-soft);
  box-shadow: none;
}

.btn-danger {
  background: var(--danger);
  box-shadow: 0 10px 22px rgba(220, 63, 82, 0.2);
}

.btn-danger:hover {
  background: #c42e43;
  box-shadow: 0 14px 26px rgba(220, 63, 82, 0.24);
}

.mini-link {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
}

.mini-link:hover {
  text-decoration: underline;
}

.mini-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--ink-soft);
  background: var(--surface-solid);
  cursor: pointer;
}

.mini-button-danger {
  border-color: rgba(220, 63, 82, 0.22);
  color: #b92338;
  background: var(--danger-soft);
}

.error,
.notice,
.success {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid;
}

.error {
  color: #a3162b;
  background: var(--danger-soft);
  border-color: rgba(220, 63, 82, 0.22);
}

.notice {
  color: #6b4b00;
  background: var(--amber-soft);
  border-color: rgba(243, 178, 63, 0.32);
}

.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(22, 135, 93, 0.24);
}

.chips,
.task-browser-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip,
.pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: var(--radius-sm);
  color: #1e4fbf;
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.pill-muted {
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-subtle);
}

.pill-difficulty {
  color: #08756d;
  border-color: rgba(15, 159, 149, 0.18);
  background: var(--teal-soft);
}

.task-list {
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.task-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 500;
}

.task-checkbox input {
  width: auto;
  min-height: 0;
  margin-top: 4px;
}

.task-card {
  margin-bottom: 18px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 180px minmax(240px, 1fr) 220px auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
}

.homework-filter-grid {
  margin-bottom: 20px;
}

.homeworks-filter-grid {
  grid-template-columns: 190px minmax(220px, 1fr) 200px 200px auto;
}

.homeworks-header,
.homeworks-header-actions {
  display: contents;
}

.homeworks-filter-grid .filter-actions {
  flex-wrap: nowrap;
}

.generator-meta {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.generator-meta-compact {
  grid-template-columns: 1.5fr 1fr;
}

.generator-table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
}

.generator-table {
  display: grid;
  grid-template-columns: 90px minmax(200px, 1fr) 150px 120px;
  min-width: 680px;
}

.generator-head,
.generator-cell {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.generator-head {
  color: var(--ink-soft);
  background: #edf5ff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.generator-type,
.generator-available {
  font-family: var(--font-sans);
  font-weight: 700;
}

.generator-table > :nth-last-child(-n + 4) {
  border-bottom: 0;
}

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

.task-browser-card,
.task-feed-card,
.file-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
}

.task-browser-card,
.task-feed-card {
  padding: 18px;
}

.task-browser-card h3,
.task-feed-card h3 {
  margin-top: 10px;
}

.task-feed {
  display: grid;
  gap: 14px;
}

.task-feed-header {
  margin-bottom: 12px;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.task-longtext {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.68;
}

.task-longtext p {
  margin: 0 0 16px;
}

.task-longtext table {
  width: auto;
  max-width: 100%;
  margin: 18px auto;
  border-collapse: collapse;
  background: var(--surface-solid);
}

.task-longtext td,
.task-longtext th {
  border: 1px solid rgba(38, 54, 74, 0.42);
  padding: 8px 12px;
  text-align: center;
  vertical-align: middle;
}

.task-longtext tbody tr:first-child td,
.task-longtext thead th {
  font-weight: 700;
}

.inline-image-wrap {
  margin: 18px 0;
  text-align: center;
}

.inline-task-image {
  display: inline-block;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
}

.task-attachments {
  margin-top: 18px;
}

.task-attachments h4 {
  margin: 0 0 10px;
  color: var(--ink-soft);
}

.download-list,
.file-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.download-btn,
.file-card {
  color: var(--ink-soft);
  text-decoration: none;
}

.download-btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(15, 159, 149, 0.22);
  border-radius: var(--radius);
  background: var(--teal-soft);
  font-weight: 600;
}

.file-card {
  display: block;
  padding: 16px;
}

.file-card strong,
.file-card span {
  display: block;
}

.answer-box {
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--radius);
  background: var(--primary-soft);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
}

.answer-toggle {
  margin-top: 18px;
}

.answer-toggle summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 600;
  list-style: none;
}

.answer-toggle summary::-webkit-details-marker {
  display: none;
}

.answer-toggle summary::after {
  content: " +";
}

.answer-toggle[open] summary::after {
  content: " -";
}

.answer-toggle .answer-box {
  margin-top: 12px;
}

.result-ok,
.result-bad {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.result-ok {
  color: var(--success);
  background: var(--success-soft);
}

.result-bad {
  color: #b92338;
  background: var(--danger-soft);
}

.task-text {
  white-space: pre-wrap;
  line-height: 1.6;
}

section.card:has(table) {
  overflow-x: auto;
}

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

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

th {
  color: var(--ink-soft);
  background: #edf5ff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

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

.auth-panel {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: stretch;
}

.auth-info,
.auth-card {
  border: 1px solid rgba(194, 208, 223, 0.82);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-info {
  display: grid;
  align-content: space-between;
  min-height: 420px;
  padding: 28px;
  color: #f8fbff;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, #11243a 0%, #164e63 54%, #1d4ed8 100%);
  background-size: 36px 36px, 36px 36px, auto;
}

.auth-info .logo {
  align-self: start;
}

.auth-copy {
  display: grid;
  gap: 12px;
}

.auth-copy h1 {
  color: #ffffff;
}

.auth-copy p {
  color: rgba(248, 251, 255, 0.76);
  max-width: 34rem;
}

.auth-card {
  padding: 28px;
}

.auth-card h1 {
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .grid-2,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-info {
    min-height: 260px;
  }

  .page-head,
  .row-between {
    flex-direction: column;
  }

  .page-head__actions,
  .dashboard-bank-actions {
    width: 100%;
  }

  .page-head__actions .btn,
  .inline-actions .btn,
  .dashboard-bank-actions .btn {
    width: 100%;
  }

  .filter-grid,
  .homeworks-filter-grid,
  .generator-meta,
  .generator-meta-compact {
    grid-template-columns: 1fr;
  }

  .homeworks-filter-grid .filter-actions {
    flex-wrap: wrap;
  }
}

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

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

  .header nav,
  .inline-actions,
  .filter-actions,
  .pager {
    width: 100%;
  }

  .nav-link {
    flex: 1 1 auto;
  }

  .card,
  .panel {
    padding: 18px;
  }

  .btn,
  button.btn,
  .filter-actions .btn,
  .pager .btn {
    width: 100%;
  }

  table {
    min-width: 620px;
  }
}
