:root {
  color-scheme: light;
  --ink: #131416;
  --muted: #697078;
  --line: #e7e9ec;
  --soft: #f6f7f8;
  --panel: #ffffff;
  --accent: #1d6f4f;
  --accent-dark: #12523a;
  --danger: #b42318;
  --focus: #80b9a3;
  --shadow: 0 20px 55px rgb(16 24 40 / 8%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--soft);
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(145deg, #fff 0, var(--soft) 55%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  border-bottom: 1px solid rgb(231 233 236 / 88%);
  background: rgb(255 255 255 / 86%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  gap: 11px;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

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

.brand strong {
  color: var(--muted);
  font-weight: 500;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.username {
  color: var(--muted);
  font-size: 13px;
}

.center-panel {
  display: grid;
  min-height: calc(100vh - 68px);
  place-items: center;
  padding: 32px 20px;
}

#boot-screen {
  align-content: center;
  color: var(--muted);
  gap: 8px;
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: auto;
  animation: spin 0.8s linear infinite;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.login-card {
  width: min(100%, 430px);
  padding: clamp(28px, 6vw, 46px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

h1,
h2 {
  margin-bottom: 8px;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

h1 {
  font-size: clamp(28px, 4vw, 38px);
}

h2 {
  font-size: 24px;
}

.eyebrow {
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.login-card .muted {
  margin-bottom: 28px;
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 650;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  min-height: 44px;
  margin-bottom: 18px;
  padding: 9px 12px;
  border: 1px solid #d5d9de;
  border-radius: 10px;
  color: var(--ink);
  background: white;
}

input:hover {
  border-color: #aab0b7;
}

.button {
  min-height: 40px;
  padding: 8px 15px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 650;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: white;
  background: var(--accent);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button-secondary,
.button-quiet {
  border-color: var(--line);
  color: var(--ink);
  background: white;
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  background: var(--soft);
}

.button-quiet {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 13px;
}

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

.button-full {
  width: 100%;
}

.form-error {
  margin: 0 0 14px;
  color: var(--danger);
  font-size: 13px;
}

.admin-layout {
  display: grid;
  max-width: 1440px;
  min-height: calc(100vh - 68px);
  margin: auto;
  grid-template-columns: 190px minmax(0, 1fr);
}

.section-nav {
  padding: 34px 20px;
  border-right: 1px solid var(--line);
}

.nav-item {
  display: block;
  width: 100%;
  margin-bottom: 5px;
  padding: 10px 12px;
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--ink);
  background: white;
}

.nav-item.is-active {
  box-shadow: 0 1px 2px rgb(16 24 40 / 7%);
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: clamp(28px, 5vw, 64px);
}

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

.page-heading p:last-child {
  margin-bottom: 0;
}

.notice {
  margin-bottom: 18px;
  padding: 11px 14px;
  border: 1px solid #f0c7c2;
  border-radius: 10px;
  color: #8f1d14;
  background: #fff5f3;
}

.loading-state,
.empty-state {
  padding: 42px 20px;
  border: 1px dashed #cfd4da;
  border-radius: 15px;
  color: var(--muted);
  text-align: center;
}

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

.member-card {
  display: grid;
  align-items: center;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  grid-template-columns: 44px minmax(150px, 0.8fr) minmax(220px, 1.4fr) auto;
  gap: 15px;
}

.member-position {
  color: #9aa0a7;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.member-name {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 720;
}

.member-meta,
.member-roles {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.member-roles span {
  display: block;
}

.member-tags {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
  gap: 5px;
}

.tag,
.status {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  color: #4e555d;
  background: var(--soft);
  font-size: 11px;
}

.status {
  margin-top: 5px;
  color: var(--accent-dark);
  background: #eaf5f0;
}

.status.inactive {
  color: #6e4c14;
  background: #fff4d6;
}

.member-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: white;
}

.icon-button:hover:not(:disabled) {
  background: var(--soft);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

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

.contact-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
}

.contact-summary {
  display: grid;
  padding: 17px 18px;
  grid-template-columns: minmax(130px, 0.8fr) minmax(150px, 1fr) minmax(170px, 1fr) auto;
  gap: 16px;
}

.contact-label {
  display: block;
  margin-bottom: 3px;
  color: #949aa1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-value {
  overflow-wrap: anywhere;
}

.contact-details {
  display: grid;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  background: #fafbfb;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.contact-intro {
  grid-column: 1 / -1;
  white-space: pre-wrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  gap: 16px;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
}

dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(16 24 32 / 45%);
  backdrop-filter: blur(3px);
}

.member-form,
.confirm-dialog {
  padding: clamp(22px, 5vw, 34px);
}

.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.dialog-heading .icon-button {
  flex: 0 0 auto;
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

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

.field-help {
  display: block;
  margin: -13px 0 17px;
  color: var(--muted);
  font-size: 11px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  min-height: 62px;
  gap: 9px;
}

.checkbox-field label {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
  gap: 9px;
}

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

  .section-nav {
    display: flex;
    overflow-x: auto;
    padding: 14px 4vw;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 6px;
  }

  .nav-item {
    width: auto;
    min-width: 100px;
    margin: 0;
    text-align: center;
  }

  .member-card {
    grid-template-columns: 34px minmax(140px, 0.8fr) minmax(200px, 1.3fr);
  }

  .member-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }

  .contact-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .site-header {
    min-height: 60px;
  }

  .username {
    display: none;
  }

  .workspace {
    padding: 28px 18px 48px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .page-heading .button {
    width: 100%;
  }

  .member-card {
    grid-template-columns: 28px 1fr;
  }

  .member-info,
  .member-actions {
    grid-column: 2;
  }

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

  .contact-details > *,
  .contact-intro,
  .field-wide {
    grid-column: 1;
  }

  .pagination {
    justify-content: space-between;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
