:root {
  --bg: #080a0f;
  --bg-soft: #11151d;
  --panel: #151a22;
  --panel-strong: #1b222c;
  --line: #2b3442;
  --text: #f6f8fb;
  --muted: #aeb8c7;
  --muted-strong: #d8dee8;
  --gold: #f7c948;
  --green: #34d399;
  --red: #ef4444;
  --blue: #60a5fa;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  color-scheme: dark;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: linear-gradient(135deg, #080a0f 0%, #11151d 48%, #0b1110 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand,
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(247, 201, 72, 0.45);
  border-radius: var(--radius);
  color: #15100a;
  background: linear-gradient(135deg, var(--gold), #ffe9a6);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.signed-user {
  color: var(--muted-strong);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px;
  text-underline-offset: 4px;
}

.account-settings {
  width: min(680px, 100%);
  margin: 24px auto 0;
}

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

.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.account-row > div {
  min-width: 0;
}

.account-row small {
  display: block;
  color: var(--green);
}

.account-create {
  margin-top: 32px;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 56px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.auth-page .page {
  width: min(440px, calc(100% - 32px));
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 22px 0 24px;
}

.hero h1,
.panel h1,
.panel h2,
.auth-card h1 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.12;
}

.hero h1 {
  max-width: 780px;
  font-size: 3.6rem;
}

.hero p:not(.eyebrow) {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stats-grid,
.workspace-grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.workspace-grid {
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  margin-bottom: 16px;
}

.stat-card,
.panel,
.auth-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(27, 34, 44, 0.94), rgba(17, 21, 29, 0.96));
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 118px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 3px solid var(--gold);
}

.stat-card span,
.filtered-total span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card strong {
  font-size: 1.85rem;
  line-height: 1.1;
}

.panel,
.auth-card {
  padding: 22px;
}

.panel-narrow {
  width: min(680px, 100%);
  margin: 36px auto 0;
}

.auth-card {
  width: 100%;
}

.auth-brand {
  margin-bottom: 24px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2,
.panel-heading h1 {
  font-size: 1.35rem;
}

.form-panel,
.form-stack,
.filters {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-weight: 700;
}

label span {
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(8, 10, 15, 0.66);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.16);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 15px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #101820;
  background: linear-gradient(135deg, var(--gold), #ffe39a);
}

.button-secondary,
.button-ghost {
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.button-danger {
  color: #fff;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.42);
}

.button-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.9rem;
}

.person-list,
.check-list {
  display: grid;
  gap: 10px;
}

.person-row,
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.person-row:last-child,
.check-row:last-child {
  border-bottom: 0;
}

.person-row strong,
.filtered-total strong,
.check-row strong {
  color: var(--green);
}

.filters {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  margin-bottom: 20px;
}

.filter-actions {
  display: grid;
  gap: 8px;
}

.filtered-total {
  min-width: 170px;
  text-align: right;
}

.filtered-total strong {
  display: block;
  font-size: 1.35rem;
}

.table-wrap {
  overflow-x: auto;
}

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

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

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

td {
  color: var(--muted-strong);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form {
  display: inline;
}

.empty-state,
.empty-table {
  color: var(--muted);
  text-align: center;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.flash {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  opacity: 1;
  transition: opacity 250ms ease;
}

.flash-success {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(52, 211, 153, 0.12);
}

.flash-error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
}

.flash-info {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.12);
}

.flash.is-fading {
  opacity: 0.72;
}

@media (max-width: 960px) {
  .stats-grid,
  .workspace-grid,
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .topbar,
  .page {
    width: min(100% - 22px, 1180px);
  }

  .topbar {
    min-height: auto;
    padding: 14px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .stats-grid,
  .workspace-grid,
  .filters {
    grid-template-columns: 1fr;
  }

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

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .filtered-total {
    text-align: left;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 0;
    padding: 8px 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
  }

  .empty-table {
    display: block;
    text-align: left;
  }

  .row-actions {
    justify-content: flex-end;
  }
}
