:root {
  color-scheme: dark;
  --bg: #07131f;
  --surface: #0e1c2d;
  --surface-2: #13263b;
  --line: #26445f;
  --text: #f4f8fb;
  --muted: #9db0c4;
  --accent: #64c8f5;
  --accent-2: #80eea6;
  --danger: #ff7272;
  --warn: #ffd36a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

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

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(100, 200, 245, 0.12), transparent 38%),
    linear-gradient(310deg, rgba(128, 238, 166, 0.1), transparent 42%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 28, 45, 0.94);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.34);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--accent-2);
  font-weight: 900;
  letter-spacing: 0;
  background: #081927;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  display: block;
}

.brand-logo.small {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 18px 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 44px;
}

h2 {
  margin-bottom: 0;
  font-size: 30px;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.muted,
.account span,
.item-meta,
label {
  color: var(--muted);
}

.form-stack,
.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.register-page {
  display: grid;
  gap: 18px;
}

.register-grid {
  align-items: start;
}

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

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

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

.large-text {
  min-height: 170px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(100, 200, 245, 0.14);
}

.primary,
.ghost,
.nav,
.icon {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  padding: 12px 16px;
  background: var(--accent);
  color: #06111d;
}

.primary:hover {
  filter: brightness(1.06);
}

.ghost {
  padding: 10px 12px;
  background: transparent;
  color: var(--accent);
}

.full {
  width: 100%;
}

.error {
  color: var(--danger);
  min-height: 22px;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #081522;
}

.side-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.side-head strong,
.account strong {
  display: block;
}

.side-head span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.nav {
  padding: 13px 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav.active,
.nav:hover {
  background: var(--surface-2);
  color: var(--text);
}

.account {
  display: grid;
  gap: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions select {
  width: auto;
  min-width: 96px;
  padding: 10px 12px;
  background: #f4f7fb;
  color: #182333;
  border-color: #d4dde8;
}

.panel,
.record-card,
.user-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel {
  padding: 18px;
}

.kpi-panel {
  margin-bottom: 24px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  gap: 10px;
}

.filters select {
  width: 190px;
  padding: 9px 12px;
  background: #f4f7fb;
  color: #182333;
  border-color: #d4dde8;
}

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

.kpi-table {
  width: 100%;
  min-width: 930px;
  border-collapse: collapse;
}

.kpi-table th,
.kpi-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(157, 176, 196, 0.16);
  text-align: left;
  vertical-align: middle;
}

.kpi-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.kpi-table td:nth-child(3),
.kpi-table td:nth-child(4),
.kpi-table td:nth-child(5),
.kpi-table td:nth-child(6) {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.done {
  color: var(--accent-2);
  font-weight: 900;
}

.zero {
  color: var(--danger);
  font-weight: 900;
}

.progressing {
  color: var(--warn);
  font-weight: 900;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status.ok {
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
}

.status.progress {
  border: 1px solid var(--warn);
  color: var(--warn);
}

.status.bad {
  border: 1px solid var(--danger);
  color: var(--danger);
}

.list {
  display: grid;
  gap: 10px;
}

.record-card,
.user-row {
  padding: 14px;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stage-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.stage-pill.visit {
  border: 1px solid rgba(100, 200, 245, 0.65);
  color: var(--accent);
}

.stage-pill.presentation {
  border: 1px solid rgba(128, 238, 166, 0.65);
  color: var(--accent-2);
}

.stage-pill.approved {
  border: 1px solid rgba(128, 238, 166, 0.85);
  background: rgba(128, 238, 166, 0.12);
  color: var(--accent-2);
}

.stage-pill.not-approved {
  border: 1px solid rgba(255, 114, 114, 0.85);
  background: rgba(255, 114, 114, 0.12);
  color: var(--danger);
}

.option-group {
  display: grid;
  gap: 10px;
}

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

.check-grid .check {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #091827;
  color: var(--text);
}

.inline-select {
  max-width: 280px;
  margin-top: 12px;
}

.inline-select select {
  margin-top: 6px;
  padding: 9px 10px;
}

.danger-action {
  color: var(--danger);
}

.pending-card {
  border-color: rgba(255, 211, 106, 0.5);
}

.pending-card.is-overdue {
  border-color: rgba(255, 114, 114, 0.75);
  background: rgba(255, 114, 114, 0.08);
}

.pending-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 211, 106, 0.55);
  border-radius: 8px;
  background: rgba(255, 211, 106, 0.08);
  color: var(--warn);
  font-size: 13px;
  font-weight: 900;
}

.pending-banner.is-overdue {
  border-color: rgba(255, 114, 114, 0.75);
  background: rgba(255, 114, 114, 0.1);
  color: var(--danger);
}

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

.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.details b {
  color: var(--text);
}

.modal {
  width: min(820px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.64);
}

.modal form {
  padding: 20px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-actions {
  margin: 18px 0 0;
  justify-content: flex-end;
}

.icon {
  width: 38px;
  height: 38px;
  background: #1c3147;
  color: var(--text);
}

.hint {
  margin: -6px 0 14px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field-head label {
  margin: 0;
}

.field-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.presence-counter {
  min-width: 136px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #07111c;
  color: var(--text);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.presence-counter strong {
  color: var(--accent-2);
}

.participant-actions span,
.field-head span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.participant-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #091827;
}

.participant-header,
.participant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 48px;
  gap: 10px;
  align-items: center;
}

.participant-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.participant-list {
  display: grid;
}

.participant-row {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(157, 176, 196, 0.12);
}

.participant-row:last-child {
  border-bottom: 0;
}

.participant-row .icon {
  width: 42px;
  height: 42px;
}

.presence-toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101f31;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.presence-toggle.is-present {
  border-color: rgba(128, 238, 166, 0.65);
  background: rgba(128, 238, 166, 0.12);
  color: var(--accent-2);
}

.participant-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.add-row:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.photo-field input[type="file"] {
  padding: 10px;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.photo-chip {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #091827;
}

.photo-chip span {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-chip small {
  color: var(--muted);
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check input {
  width: auto;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .form-grid,
  .details {
    grid-template-columns: 1fr;
  }

  .participant-row {
    grid-template-columns: 1fr;
  }

  .participant-header {
    display: none;
  }

  .participant-actions,
  .field-head {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-preview {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .filters select {
    width: 100%;
  }

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