:root {
  --ink: #0b1c24;
  --ink-soft: #16303b;
  --fog: #d7e4e8;
  --paper: #f3f7f5;
  --amber: #e8a317;
  --amber-deep: #c47f08;
  --sea: #1f6f78;
  --danger: #b33a2b;
  --ok: #1f7a4c;
  --muted: #5c7380;
  --line: rgba(11, 28, 36, 0.12);
  --shadow: 0 24px 60px rgba(11, 28, 36, 0.18);
  --radius: 14px;
  --font-display: "Syne", sans-serif;
  --font-body: "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--ink);
}

body {
  position: relative;
  overflow-x: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(232, 163, 23, 0.28), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(31, 111, 120, 0.45), transparent 50%),
    linear-gradient(160deg, #07141a 0%, #0f2a33 45%, #163a3f 100%);
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

#app {
  min-height: 100vh;
}

a {
  color: var(--sea);
}

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

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: rise 0.55s ease both;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--paper);
}

.brand span {
  color: var(--amber);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.nav button {
  border: 0;
  background: transparent;
  color: var(--fog);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.85;
}

.nav button.active,
.nav button:hover {
  background: rgba(243, 247, 245, 0.1);
  opacity: 1;
}

.panel {
  background: linear-gradient(180deg, rgba(243, 247, 245, 0.96), rgba(215, 228, 232, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem 1.6rem;
  animation: rise 0.6s ease both;
}

.panel h1,
.panel h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
}

.panel h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.lede {
  color: var(--muted);
  margin: 0 0 1.25rem;
  max-width: 42rem;
}

.auth-hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.auth-card {
  width: min(440px, 100%);
  background: linear-gradient(165deg, #f6faf8 0%, #e4eef0 100%);
  border-radius: 22px;
  padding: 2rem 1.6rem 1.7rem;
  box-shadow: var(--shadow);
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.auth-card .mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
  margin: 0 0 0.6rem;
  color: var(--ink);
}

.auth-card .mark em {
  font-style: normal;
  color: var(--amber-deep);
}

.auth-card .tagline {
  margin: 0 0 1.4rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tabs button {
  flex: 1;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 10px;
  padding: 0.55rem;
  cursor: pointer;
}

.tabs button.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0.7rem 0 0.3rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.75);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--ink-soft);
}

.btn-accent {
  background: var(--amber);
  color: var(--ink);
}

.btn-accent:hover {
  background: var(--amber-deep);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(179, 58, 43, 0.35);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

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

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.doc-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
}

.doc-check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  cursor: pointer;
}

.doc-check input {
  margin-top: 0.25rem;
}

.file-preview {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.preview-body {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  max-height: 60vh;
  overflow: auto;
}

.preview-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.flash {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  background: rgba(31, 111, 120, 0.12);
  color: var(--ink-soft);
}

.flash.error {
  background: rgba(179, 58, 43, 0.12);
  color: var(--danger);
}

.flash.ok {
  background: rgba(31, 122, 76, 0.12);
  color: var(--ok);
}

.q-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.q-item .stem {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.q-item.in-quiz {
  opacity: 0.55;
}

.q-item.in-quiz input:disabled {
  cursor: not-allowed;
}

.badge.in-quiz-badge {
  background: rgba(232, 163, 23, 0.2);
  color: var(--amber-deep);
}

.draft-bar {
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

.draft-bar.active {
  border-color: rgba(31, 111, 120, 0.35);
  box-shadow: 0 0 0 1px rgba(31, 111, 120, 0.08);
}

.draft-count {
  background: rgba(232, 163, 23, 0.18);
  color: var(--ink);
}

.bank-filters {
  margin-bottom: 0.75rem;
}

.bank-list-head {
  justify-content: space-between;
  margin: 0.75rem 0 0.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pager {
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.pager .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.settings-section {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.settings-section h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.data-table .role-select {
  min-width: 7.5rem;
}

textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  resize: vertical;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(31, 111, 120, 0.15);
  color: var(--sea);
}

.check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.35rem 0;
}

.take-option {
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0.35rem 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.55);
}

.take-option:has(input:checked) {
  border-color: var(--sea);
  background: rgba(31, 111, 120, 0.1);
}

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

.full {
  width: 100%;
}

.mt {
  margin-top: 1rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
