:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --line: #e8eaf1;
  --text: #171a2b;
  --muted: #73788b;
  --accent: #5865f2;
  --accent-strong: #4653df;
  --accent-soft: #eef0ff;
  --success: #168a68;
  --success-soft: #e9f7f1;
  --warning: #a56a13;
  --warning-soft: #fff5e3;
  --danger: #c44e5a;
  --danger-soft: #fff0f1;
  --shadow: 0 18px 55px rgba(32, 39, 78, 0.08);
  --shadow-soft: 0 7px 24px rgba(32, 39, 78, 0.055);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 82% 0%, rgba(88, 101, 242, 0.075), transparent 34rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.backdrop-blur {
  display: none;
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 72px;
  position: relative;
  z-index: 1;
}

.nav {
  min-height: 68px;
  margin-bottom: 36px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(232, 234, 241, 0.9);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.brand-block,
.brand-copy,
.nav-links,
.user-chip {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 11px;
  min-width: max-content;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #7180ff, #4a57e5);
  border-radius: 13px;
  box-shadow: 0 5px 12px rgba(88, 101, 242, 0.24);
  font-size: 1.2rem;
  font-weight: 850;
  text-decoration: none;
}

.brand-copy {
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  line-height: 1.2;
}

.brand {
  font-size: 1rem;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.brand-caption {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.nav-links {
  justify-content: flex-end;
  gap: 10px;
}

.nav-links form,
.actions form {
  margin: 0;
}

.nav-link,
.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  color: #555b70;
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav-link:hover,
.logout-button:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.user-chip {
  gap: 9px;
  padding: 4px 11px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 0.84rem;
}

.user-chip img,
.user-chip > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 50%;
  font-weight: 750;
}

.page-stack {
  display: grid;
  gap: 28px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 770;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 740;
}

h3 {
  margin-bottom: 7px;
  font-size: 1.05rem;
  font-weight: 720;
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 780;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hero,
.card,
.table-wrap,
.form-grid,
.result-card,
.guild-grid article,
.feature-card,
.metric-card,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero {
  padding: clamp(24px, 4vw, 38px);
  display: grid;
  gap: 16px;
}

.hero > p:last-child {
  margin-bottom: 0;
}

.hero-spotlight {
  background:
    radial-gradient(ellipse at 95% 0%, rgba(112, 126, 255, 0.12), transparent 45%),
    var(--surface);
}

.hero-grid {
  align-items: stretch;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.actions,
.stack,
.stat-row,
.pill-row,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
button,
select,
input,
textarea {
  font: inherit;
}

.button,
button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
}

.button.primary,
button.primary {
  color: white;
  background: var(--accent);
  box-shadow: 0 5px 12px rgba(88, 101, 242, 0.2);
}

.button.primary:hover,
button.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 7px 16px rgba(88, 101, 242, 0.24);
}

.button.secondary,
button.secondary {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.button.secondary:hover,
button.secondary:hover {
  background: #e2e5ff;
}

.button.danger,
button.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.button.ghost {
  color: #565c70;
  background: var(--surface);
  border-color: var(--line);
}

.button.ghost:hover {
  background: var(--surface-soft);
  border-color: #d7dbea;
}

.button-large {
  min-height: 50px;
  padding: 13px 20px;
  font-size: 0.98rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 22px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.feature-card p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.feature-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 800;
}

.landing-hero {
  min-height: 430px;
  padding: clamp(28px, 6vw, 66px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(ellipse at 82% 48%, rgba(88, 101, 242, 0.13), transparent 36%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.landing-copy {
  position: relative;
  z-index: 1;
}

.landing-copy h1 {
  max-width: 12ch;
  font-size: clamp(2.55rem, 5.3vw, 4.35rem);
  line-height: 1.04;
  letter-spacing: -0.065em;
}

.landing-copy > .muted {
  max-width: 52ch;
  margin-bottom: 24px;
  font-size: 1.04rem;
}

.landing-copy .actions {
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
}

.landing-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.preview-card {
  min-width: 0;
  padding: 18px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #f8f9ff, #f3f5ff);
  border: 1px solid #e8eaff;
  border-radius: 21px;
  box-shadow: 0 24px 55px rgba(60, 69, 153, 0.12);
}

.preview-topline,
.preview-sync,
.preview-footer {
  display: flex;
  align-items: center;
}

.preview-topline {
  gap: 11px;
  margin-bottom: 15px;
}

.preview-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

.preview-topline > div,
.preview-sync > span:last-child {
  display: grid;
  gap: 2px;
}

.preview-topline strong,
.preview-sync strong {
  font-size: 0.84rem;
}

.preview-topline > div > span,
.preview-sync small {
  color: var(--muted);
  font-size: 0.72rem;
}

.preview-live {
  margin-left: auto;
  padding: 5px 8px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.preview-live i {
  width: 6px;
  height: 6px;
  margin-right: 4px;
  display: inline-block;
  background: var(--success);
  border-radius: 50%;
}

.preview-poll {
  padding: 17px;
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
  background: white;
  border: 1px solid #eceef6;
  border-radius: 15px;
  box-shadow: 0 7px 20px rgba(40, 48, 96, 0.055);
}

.preview-label {
  color: var(--accent-strong);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.preview-poll > strong {
  margin-bottom: 2px;
  font-size: 1rem;
  letter-spacing: -0.025em;
}

.preview-option {
  min-height: 38px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
  color: #454a60;
  background: #f7f8fc;
  border: 1px solid #eef0f6;
  border-radius: 9px;
  font-size: 0.76rem;
}

.preview-option b {
  z-index: 1;
  color: var(--accent-strong);
  font-size: 0.74rem;
}

.preview-option i {
  height: 100%;
  width: var(--progress);
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(88, 101, 242, 0.08);
}

.preview-option span {
  z-index: 1;
}

.preview-footer {
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.7rem;
}

.preview-sync {
  gap: 10px;
  padding: 14px 5px 1px;
  position: relative;
  z-index: 1;
}

.sync-check {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 10px;
  font-weight: 800;
}

.preview-orbit {
  width: 220px;
  height: 220px;
  position: absolute;
  border: 1px solid rgba(88, 101, 242, 0.1);
  border-radius: 50%;
}

.preview-orbit-one {
  top: -115px;
  right: -65px;
}

.preview-orbit-two {
  right: -105px;
  bottom: -155px;
}

.landing-features {
  display: grid;
  gap: 20px;
  padding: 12px 4px 0;
}

.landing-features .section-heading {
  align-items: end;
}

.landing-features .section-heading > p {
  max-width: 34ch;
  margin-bottom: 2px;
  font-size: 0.9rem;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.metric-card {
  padding: 16px;
  border-radius: 14px;
  box-shadow: none;
}

.metric-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.8rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.78rem;
}

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 15px;
}

.guild-grid article {
  padding: 20px;
  display: grid;
  align-content: start;
  gap: 14px;
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.guild-grid article:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.guild-grid article .muted {
  font-size: 0.84rem;
}

.section-block {
  display: grid;
  gap: 16px;
}

.list-tools {
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.archive-tools {
  padding-top: 16px;
}

.search-field {
  min-width: min(100%, 260px);
  flex: 1 1 280px;
  position: relative;
}

.search-field > span:not(.sr-only) {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  color: #888da0;
  font-size: 1.15rem;
  transform: translateY(-53%);
}

.search-field input {
  min-height: 40px;
  padding: 8px 12px 8px 36px;
  background: var(--surface-soft);
  font-size: 0.84rem;
}

.filter-field select {
  width: auto;
  min-width: 165px;
  min-height: 40px;
  padding: 7px 30px 7px 11px;
  background: var(--surface-soft);
  font-size: 0.82rem;
}

.list-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.empty-state,
.empty-table {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.sr-only {
  width: 1px;
  height: 1px;
  padding: 0;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading-inline {
  padding: 22px 22px 0;
}

.pill-row {
  gap: 7px;
}

.pill {
  min-height: 29px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #5e6376;
  background: #f5f6fa;
  border: 1px solid #eceef4;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 620;
}

.pill.ok {
  color: var(--success);
  background: var(--success-soft);
  border-color: #d9f0e5;
}

.pill.warn {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #f6e8c9;
}

.pill.bad {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f8dfe2;
}

.form-grid {
  padding: clamp(20px, 4vw, 30px);
  display: grid;
  gap: 22px;
}

.field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.field label {
  color: #373c50;
  font-size: 0.88rem;
  font-weight: 680;
}

.field-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.field-meta output {
  flex: 0 0 auto;
  color: #81869a;
  font-variant-numeric: tabular-nums;
}

.field-meta output.is-warning {
  color: var(--danger);
  font-weight: 700;
}

.quick-actions,
.checklist-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-actions > span,
.checklist-tools > .muted {
  color: var(--muted);
  font-size: 0.8rem;
}

.text-action {
  min-height: 30px;
  padding: 5px 8px;
  color: var(--accent-strong);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 0.79rem;
}

.text-action:hover {
  background: var(--accent-soft);
  transform: none;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: white;
  border: 1px solid #dfe2eb;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input::placeholder,
textarea::placeholder {
  color: #9a9eae;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.13);
}

input[type="checkbox"] {
  width: 17px;
  min-height: 17px;
  height: 17px;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

textarea {
  min-height: 132px;
  resize: vertical;
}

.checkbox-list {
  max-height: 300px;
  padding: 8px;
  display: grid;
  gap: 4px;
  overflow: auto;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.checkbox-item {
  min-height: 38px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #43485c;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.checkbox-item:hover {
  background: white;
}

.checkbox-item input {
  width: auto;
}

.checkbox-list > .muted {
  padding: 8px 9px;
  font-size: 0.84rem;
}

.table-wrap {
  overflow: hidden;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap table {
  background: white;
}

th,
td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #eef0f5;
}

th {
  color: #777c8f;
  background: #fafbfc;
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: #404559;
  font-size: 0.88rem;
}

td a:not(.button) {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

td a:not(.button):hover {
  text-decoration: underline;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fcfcff;
}

td .muted {
  max-width: 44ch;
  margin-top: 4px;
  font-size: 0.78rem;
}

.alert {
  padding: 12px 14px;
  color: #167451;
  background: var(--success-soft);
  border: 1px solid #d9f0e5;
  border-radius: 11px;
  font-size: 0.88rem;
}

.alert.warn {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #f6e8c9;
}

.alert.bad {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f8dfe2;
}

.stats-grid,
.result-grid {
  display: grid;
  gap: 15px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card,
.result-card {
  padding: 21px;
}

.stat-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.stat-card .muted {
  font-size: 0.82rem;
}

.result-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.result-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.result-card ul {
  margin: 10px 0 0;
  padding-left: 19px;
  color: #50556a;
}

.result-card li {
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}

.subtle-box {
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid #eef0f5;
  border-radius: 12px;
}

.subtle-box h3 {
  font-size: 0.9rem;
}

:focus-visible {
  outline: 3px solid rgba(88, 101, 242, 0.45);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .landing-hero {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 0.85fr);
    gap: 24px;
    padding: 34px;
  }

  .landing-copy h1 {
    font-size: clamp(2.3rem, 5vw, 3.3rem);
  }

  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 28px, 560px);
    padding-top: 12px;
  }

  .nav {
    margin-bottom: 23px;
    padding: 10px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .user-chip {
    margin-left: auto;
  }

  .logout-button {
    padding-inline: 8px;
  }

  .page-stack {
    gap: 22px;
  }

  .landing-hero {
    min-height: auto;
    padding: 28px 22px;
    grid-template-columns: 1fr;
    gap: 28px;
    border-radius: 20px;
  }

  .landing-copy h1 {
    max-width: 13ch;
    font-size: clamp(2.5rem, 12vw, 3.5rem);
  }

  .preview-card {
    padding: 13px;
  }

  .preview-poll {
    padding: 13px;
  }

  .landing-features {
    padding: 0;
  }

  .landing-features .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .feature-grid,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .feature-card {
    padding: 18px;
  }

  .feature-icon {
    margin-bottom: 12px;
  }

  .hero {
    padding: 23px;
  }

  .section-heading-inline {
    padding: 20px 18px 0;
  }

  .list-tools {
    padding-inline: 18px;
  }

  .filter-field,
  .filter-field select {
    width: 100%;
  }

  .list-count {
    margin-left: 0;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .table-wrap table {
    min-width: 680px;
  }

  .form-grid {
    padding: 19px;
  }

  .form-actions {
    align-items: stretch;
  }

  .form-actions > * {
    flex: 1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    padding: 17px;
  }

  th,
  td {
    padding: 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
