:root {
  color-scheme: light;
  --bg: #f4fbf9;
  --panel: #ffffff;
  --ink: #0d1b1e;
  --muted: #5f7173;
  --line: #d9e8e5;
  --brand: #4ddab7;
  --brand-2: #35948f;
  --accent: #4ddab7;
  --danger: #b42318;
  --ok: #12805c;
  --warn: #b7791f;
  --shadow: 0 22px 70px rgba(13, 27, 30, 0.15);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 92% 6%, rgba(77, 218, 183, 0.22), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #eaf5f2 100%);
  color: var(--ink);
  min-height: 100vh;
}

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

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #dff8f1;
  color: var(--ink);
}

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

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(77, 218, 183, 0.22);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 52px);
  border-bottom: 1px solid rgba(77, 218, 183, 0.22);
  background: rgba(13, 27, 30, 0.96);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  color: white;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
}

.topbar-logo {
  width: 54px;
  height: 32px;
  object-fit: contain;
}

.auth-logo {
  width: min(260px, 100%);
  height: auto;
  display: block;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(77, 218, 183, 0.18) calc(100% - 1px)),
    radial-gradient(circle at 86% 66%, rgba(77, 218, 183, 0.16), transparent 26rem),
    var(--ink);
  background-size: 64px 64px, auto, auto;
}

.auth-card,
.panel,
.question-card,
.client-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(223, 228, 236, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(460px, 100%);
  padding: 30px;
}

.auth-card h1,
.page-title h1 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.auth-card p,
.page-title p,
.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

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

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
}

.block-nav,
.panel {
  padding: 18px;
}

.panel::before,
.auth-card::before {
  content: "";
  display: block;
  height: 3px;
  width: 72px;
  background: var(--brand);
  margin-bottom: 16px;
}

.block-nav {
  position: sticky;
  top: 96px;
  align-self: start;
}

.block-link {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  margin-bottom: 8px;
}

.block-link.active {
  background: #e8faf5;
  border-color: rgba(77, 218, 183, 0.5);
  color: var(--ink);
}

.progress-wrap {
  height: 10px;
  background: #e9eef5;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  width: 0;
}

.question-card {
  padding: 20px;
  display: grid;
  gap: 12px;
  box-shadow: none;
}

.question-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.question-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
  background: #dff8f1;
  white-space: nowrap;
}

.badge.required {
  color: #8f3a05;
  background: #fff1db;
}

.badge.synced {
  color: var(--ok);
  background: #e5f6ef;
}

.badge.pending,
.badge.error {
  color: var(--warn);
  background: #fff7e6;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
}

.client-list {
  display: grid;
  gap: 12px;
}

.client-card {
  padding: 16px;
  box-shadow: none;
}

.client-card h3 {
  margin: 0 0 4px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  background: var(--ink);
  color: white;
  padding: 14px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 30;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 840px) {
  .layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .block-nav {
    position: static;
  }

  .page-title {
    align-items: stretch;
    flex-direction: column;
  }
}
