:root {
  --pico-background-color: #0b1020;
  --pico-card-background-color: #141b2d;
  --pico-card-sectioning-background-color: #1b253b;
  --pico-color: #e5e7eb;
  --pico-muted-color: #99a4b8;
  --pico-primary: #6ea8fe;
  --pico-primary-background: #356fd3;
  --pico-primary-border: #356fd3;
  --pico-primary-hover-background: #4b82e0;
  --pico-primary-hover-border: #4b82e0;
  --pico-border-color: #28344e;
  --pico-form-element-background-color: #141b2d;
  --pico-form-element-border-color: #34415b;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgb(53 111 211 / 18%), transparent 32rem),
    var(--pico-background-color);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgb(153 164 184 / 16%);
  background: rgb(11 16 32 / 88%);
  backdrop-filter: blur(16px);
}

.app-nav {
  display: flex;
  min-height: 4.5rem;
  gap: 1.5rem;
  align-items: center;
}

.app-brand {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.6rem;
  align-items: center;
  color: var(--pico-color);
  font-weight: 700;
  text-decoration: none;
}

.app-brand i {
  color: var(--pico-primary);
}

.primary-nav {
  display: flex;
  flex: 1 1 auto;
  gap: 0.25rem;
  align-items: center;
  margin: 0;
  overflow-x: auto;
  white-space: nowrap;
}

.primary-nav a,
.primary-nav span,
.account-menu {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.7rem;
  border-radius: var(--pico-border-radius);
  color: var(--pico-muted-color);
  font-size: 0.9rem;
  text-decoration: none;
}

.primary-nav span {
  cursor: not-allowed;
  opacity: 0.62;
}

.primary-nav a:hover,
.primary-nav a.is-active {
  color: var(--pico-color);
  background: rgb(110 168 254 / 13%);
}

.primary-nav a.is-active {
  box-shadow: inset 0 -2px 0 var(--pico-primary);
}

.account-menu {
  flex: 0 0 auto;
  color: var(--pico-color);
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.25rem;
  align-items: center;
}

.account-actions form,
.account-actions button {
  width: auto;
  margin: 0;
}

.account-actions button {
  padding: 0.5rem 0.7rem;
}

.account-menu i {
  color: var(--pico-primary);
}

.app-content {
  padding-top: 2.25rem;
  padding-bottom: 3rem;
}

.page-header {
  display: flex;
  gap: 2rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin-bottom: 0.35rem;
}

.page-header p {
  margin-bottom: 0;
  color: var(--pico-muted-color);
}

.page-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: end;
}

.page-actions form {
  margin: 0;
}

.page-actions button,
.page-actions .action-button {
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.eyebrow {
  margin-bottom: 0.5rem !important;
  color: var(--pico-primary) !important;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state {
  display: grid;
  min-height: 19rem;
  padding: 3rem;
  border: 1px dashed #405072;
  border-radius: var(--pico-border-radius);
  place-content: center;
  text-align: center;
}

.empty-state > i {
  margin-bottom: 1rem;
  color: var(--pico-primary);
  font-size: 2.5rem;
}

.empty-state h2 {
  margin-bottom: 0.5rem;
}

.empty-state p {
  max-width: 32rem;
  margin: 0;
  color: var(--pico-muted-color);
}

.flash-message {
  border-left: 3px solid var(--pico-primary);
}

.flash-message.is-error {
  border-left-color: #f87171;
}

.pending-sync-notice {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgb(251 191 36 / 50%);
  border-radius: var(--pico-border-radius);
  background: rgb(251 191 36 / 8%);
}

.pending-sync-notice div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.55rem;
  align-items: center;
}

.pending-sync-notice i {
  grid-row: span 2;
  color: #fbbf24;
}

.pending-sync-notice small {
  color: var(--pico-muted-color);
}

.pending-sync-notice form,
.pending-sync-notice button {
  width: auto;
  margin: 0;
}

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

.list-panel {
  margin-bottom: 1rem;
  border: 1px solid var(--pico-border-color);
  border-radius: var(--pico-border-radius);
  background: rgb(20 27 45 / 72%);
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
}

.list-panel > .list-toolbar {
  padding: 0.75rem;
  margin: 0;
  border-bottom: 1px solid var(--pico-border-color);
}

.filter-search {
  display: flex;
  flex: 1 1 16rem;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
  padding: 0 0.7rem;
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-form-element-background-color);
}

.filter-search:focus-within {
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 var(--pico-outline-width) var(--pico-primary-focus);
}

.filter-search i {
  color: var(--pico-muted-color);
}

.filter-search input,
.filter-select select {
  height: 2.25rem;
  margin: 0;
  border: 0;
  box-shadow: none;
}

.filter-search input:focus {
  box-shadow: none;
}

.filter-select {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
  white-space: nowrap;
}

.filter-select select {
  width: auto;
  min-width: 7rem;
  padding: 0 1.8rem 0 0.5rem;
}

.filter-count {
  margin-left: auto;
  color: var(--pico-muted-color);
  font-variant-numeric: tabular-nums;
}

.section-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pico-border-color);
}

.section-header h2 {
  margin: 0;
  font-size: 1rem;
}

.section-header h2 i {
  margin-right: 0.4rem;
  color: var(--pico-primary);
}

.section-header p,
.section-header small,
.empty-section {
  margin: 0.2rem 0 0;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.empty-section {
  padding: 0.75rem 1rem;
}

.data-table {
  margin: 0;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
}

.data-table th {
  color: var(--pico-muted-color);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.users-table td {
  vertical-align: middle;
}

.users-table strong,
.users-table small,
.sync-error {
  display: block;
}

.users-table small,
.sync-error {
  margin-top: 0.2rem;
  color: var(--pico-muted-color);
}

.table-actions {
  text-align: right;
}

.action-button {
  display: inline-flex;
  width: auto;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
  padding: 0.38rem 0.55rem;
  font-size: 0.875rem;
  text-decoration: none;
}

.table-actions form {
  display: inline-block;
  margin: 0;
}

.table-actions button {
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.icon-button {
  padding: 0.38rem 0.55rem;
}

.text-danger {
  color: #f87171;
}

.danger-button {
  border-color: rgb(248 113 113 / 65%);
  color: #fca5a5;
}

button.danger-button {
  background: #b91c1c;
  border-color: #b91c1c;
  color: white;
}

button.danger-button:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.confirmation-card {
  max-width: 42rem;
  padding: 1.5rem;
  border: 1px solid rgb(248 113 113 / 50%);
  border-radius: var(--pico-border-radius);
  background: rgb(127 29 29 / 12%);
}

.confirmation-card footer {
  margin-top: 1.5rem;
}

.confirmation-card form {
  margin: 0;
}

.sync-status {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.875rem;
}

.sync-status--synced {
  color: #4ade80;
}

.sync-status--failed {
  color: #f87171;
}

.sync-status--pending {
  color: #fbbf24;
}

.user-form {
  max-width: 44rem;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.form-footer button {
  width: auto;
  margin: 0;
}

.defer-sync {
  margin: 0;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.auth-card {
  max-width: 30rem;
  margin: 8vh auto;
}

.user-identity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: var(--pico-spacing);
}

.user-identity div {
  padding: 0.85rem 1rem;
  border: 1px solid var(--pico-border-color);
  border-radius: var(--pico-border-radius);
}

.user-identity dt {
  margin-bottom: 0.25rem;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}

.user-identity dd {
  margin: 0;
}

.extension-card {
  margin-top: 1rem;
  padding: 1rem;
  border-color: var(--pico-border-color);
  border-radius: var(--pico-border-radius);
}

.extension-card > p {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

.extension-fields {
  display: none;
}

.extension-card:has(input[name="unix_enabled"]:checked) .extension-fields {
  display: grid;
}

.extension-fields--grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
}

.ssh-key-list {
  display: grid;
  gap: 0.65rem;
}

.ssh-key-row {
  padding: 0.65rem;
  border: 1px solid var(--pico-border-color);
  border-radius: var(--pico-border-radius);
}

.ssh-key-row__header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.ssh-key-row__header small {
  overflow: hidden;
  color: var(--pico-muted-color);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ssh-key-row__header button,
.add-ssh-key {
  width: auto;
  margin: 0;
}

.ssh-key-row__header button {
  flex: 0 0 auto;
  padding: 0.35rem 0.5rem;
}

.ssh-key-row input {
  margin: 0;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.8rem;
}

.add-ssh-key {
  margin-top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-footer {
  padding-bottom: 2rem;
  color: var(--pico-muted-color);
}

@media (width <= 768px) {
  .app-nav {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .primary-nav {
    order: 3;
    width: 100%;
  }

  .account-menu span {
    display: none;
  }

  .app-content {
    padding-top: 2rem;
  }

  .page-header {
    align-items: start;
    flex-direction: column;
    gap: 1.25rem;
  }

  .page-actions {
    justify-content: start;
  }

  .filter-count {
    width: 100%;
    margin-left: 0;
  }

  .pending-sync-notice {
    align-items: start;
    flex-direction: column;
  }

  .user-identity,
  .extension-fields--grid {
    grid-template-columns: 1fr;
  }
}
