:root {
  color-scheme: light;
  --page: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --line: #dce3ed;
  --line-strong: #cbd5e1;
  --ink: #101828;
  --muted: #667085;
  --primary: #5b35d5;
  --primary-strong: #4b25c0;
  --primary-soft: #efeaff;
  --green: #1ca35c;
  --green-soft: #edf9f1;
  --red: #e5484d;
  --red-soft: #fff0f0;
  --blue: #2479d9;
  --blue-soft: #eef7ff;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.08);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  line-height: 1.5;
  background: var(--page);
  color: var(--ink);
}

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

button {
  color: inherit;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.app-page {
  min-height: 100vh;
  padding: 1rem;
  padding-bottom: 4.5rem;
}

.entry-shell {
  min-height: calc(100vh - 5.5rem);
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(320px, 1fr);
  gap: 1rem;
  align-items: center;
}

.entry-card,
.entry-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.entry-card {
  padding: 1.5rem;
}

.entry-heading {
  margin-bottom: 1.2rem;
}

.entry-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.entry-heading h1 {
  margin: 0.7rem 0 0.3rem;
  font-size: 2rem;
  line-height: 1.1;
}

.entry-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.entry-form {
  display: grid;
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  text-align: left;
}

.field span {
  font-size: 0.88rem;
  font-weight: 800;
  color: #344054;
}

.field input,
.field select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 0.72rem 0.8rem;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 53, 213, 0.14);
}

.primary-action {
  min-height: 2.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  padding: 0.72rem 1rem;
}

.primary-action:hover:not(:disabled) {
  background: var(--primary-strong);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.form-error {
  margin: 0;
  min-height: 1.2rem;
  color: var(--red);
  font-size: 0.9rem;
}

.entry-preview {
  min-height: 440px;
  padding: 1.25rem;
  display: grid;
  align-content: space-between;
  gap: 1rem;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
}

.preview-stage {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-card {
  width: 108px;
  aspect-ratio: 5 / 7;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.preview-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: calc(var(--radius) - 1px);
}

.preview-card-back {
  grid-area: 1 / 1;
  transform: rotate(-8deg) translateX(-52px);
  background: var(--blue-soft);
}

.preview-card-front {
  grid-area: 1 / 1;
  background: var(--surface);
  color: var(--primary);
  font-size: 2.6rem;
  transform: rotate(7deg) translateX(46px);
}

.preview-card-small {
  position: absolute;
  right: 15%;
  bottom: 14%;
  width: 68px;
  background: #ffffff;
  color: var(--blue);
  font-size: 1.35rem;
}

.preview-votes {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.5rem;
}

.preview-votes span {
  min-height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 900;
}

.room-shell {
  width: min(1180px, 100%);
  margin: 3rem auto 5rem;
}

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

.room-heading h1 {
  margin: 0.7rem 0 0.25rem;
  font-size: 2rem;
  line-height: 1.1;
}

.room-display {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.room-userbar {
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 0.8rem;
  display: grid;
  gap: 0.55rem;
  justify-items: end;
}

.user-greeting {
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

.room-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.text-action {
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.text-action:hover {
  text-decoration: underline;
}

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

.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.room-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading.compact {
  margin-bottom: 0.55rem;
}

.section-heading h2 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.section-kicker,
.deck-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.deck-label {
  color: var(--primary);
}

.voting-deck {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: center;
}

.voting-deck.is-disabled {
  opacity: 0.62;
  pointer-events: none;
}

.observer-note {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0.75rem;
  text-align: center;
  font-weight: 800;
}

.room-error {
  text-align: center;
  margin-top: 0.75rem;
}

.participants-list,
.ordered-votes-list {
  display: grid;
  gap: 0.65rem;
}

.participant-row,
.result-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem;
}

.participant-info {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.participant-name {
  color: var(--ink);
  font-weight: 800;
}

.participant-name.is-current-user {
  color: var(--primary);
}

.participant-role {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.participant-role.is-facilitator {
  color: #ad6200;
}

.participant-role-controls {
  flex-basis: 100%;
}

.participant-role-select {
  min-height: 2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.25rem 0.45rem;
}

.participant-vote {
  flex-shrink: 0;
}

.result-card {
  grid-column: 1;
}

.result-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

#average-vote,
.result-value {
  color: var(--primary);
  font-weight: 900;
}

.grouped-results {
  grid-column: 1 / -1;
}

.result-names {
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.facilitator-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.success-action,
.secondary-action,
.danger-action {
  min-height: 2.75rem;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  padding: 0.7rem 1rem;
}

.success-action {
  background: var(--green);
  color: #ffffff;
}

.secondary-action {
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-action {
  background: var(--red);
  color: #ffffff;
}

.success-action:hover:not(:disabled) {
  background: #14874a;
}

.secondary-action:hover:not(:disabled) {
  background: #edf2f7;
}

.danger-action:hover:not(:disabled) {
  background: #c9343a;
}

.success-action:disabled,
.secondary-action:disabled,
.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-footer {
  position: fixed;
  left: 50%;
  bottom: 0.8rem;
  transform: translateX(-50%);
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

.app-footer a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
}

.app-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 820px) {
  .app-page {
    padding: 0.75rem;
    padding-bottom: 1.5rem;
  }

  .entry-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: stretch;
    padding-top: 3rem;
  }

  .entry-preview {
    min-height: 320px;
  }

  .room-shell {
    margin-top: 3.25rem;
  }

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

  .room-userbar {
    justify-items: start;
    min-width: 0;
  }

  .user-greeting {
    text-align: left;
  }

  .room-actions {
    justify-content: flex-start;
  }

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

  .voting-deck {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .result-card,
  .grouped-results {
    grid-column: auto;
  }

  .app-footer {
    position: static;
    transform: none;
    width: fit-content;
    margin: 1.5rem auto 0;
  }
}

@media (max-width: 520px) {
  .entry-card,
  .entry-preview {
    padding: 1rem;
  }

  .entry-heading h1 {
    font-size: 1.65rem;
  }

  .preview-votes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .preview-stage {
    min-height: 220px;
  }

  .room-heading h1 {
    font-size: 1.65rem;
  }

  .room-card {
    padding: 0.85rem;
  }

  .voting-deck {
    gap: 0.5rem;
  }

  .participant-row,
  .result-row {
    align-items: flex-start;
  }
}

/* Card flip animation */
.vote-card {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  aspect-ratio: 5 / 7;
  min-width: 0;
  padding: 0;
  perspective: 1000px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.vote-card:hover:not(:disabled) {
  transform: translateY(-4px);
}

.vote-card:focus-visible {
  outline: 3px solid rgba(91, 53, 213, 0.28);
  outline-offset: 3px;
}

.vote-card:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.card-container {
  perspective: 1000px;
  width: 44px;
  height: 62px;
  position: relative;
}

.card,
.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 2, 0.4, 0.8);
}

.card {
  cursor: default;
}

.card.flipped,
.card-inner.is-face-down {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.1);
  font-weight: 900;
}

.vote-card .card-front {
  background: var(--surface);
  color: var(--primary);
  font-size: 1.45rem;
}

.vote-card .card-back {
  overflow: hidden;
  transform: rotateY(180deg);
  background: var(--blue-soft);
}

.vote-card.selected .card-front {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 53, 213, 0.16), 0 10px 24px rgba(15, 23, 42, 0.12);
}

.vote-card-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.card-container .card-front {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1.05rem;
}

.card-container .card-back {
  background: var(--surface);
  color: var(--primary);
  transform: rotateY(180deg);
  font-size: 1rem;
}

.vote-checkmark {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.2rem;
  min-height: 1.2rem;
  border-radius: 999px;
  background: var(--green);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: var(--shadow-sm);
}

/* Hide elements */
.hidden {
    display: none;
}

/* Basic modal styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(16, 24, 40, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  width: min(420px, 100%);
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
}

.modal-content h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

.admin-warning-modal {
  display: grid;
  gap: 0.85rem;
  animation: modalIn 180ms ease-out;
}

.admin-warning-modal h2 {
  margin: 0;
}

.admin-warning-kicker {
  width: fit-content;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  padding: 0.18rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 900;
}

.admin-warning-message {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-warning-note {
  margin: 0;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
  color: #9a3412;
  padding: 0.75rem;
  font-weight: 800;
}

.modal-overlay.is-busy .admin-warning-modal {
  cursor: wait;
}

.modal-overlay.is-busy .admin-warning-note {
  background: #fffaf0;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Connection Status Indicator */
#connection-status {
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 900;
  z-index: 100;
}
#connection-status.connected {
    background-color: #dcfce7; /* Light green */
    color: #166534; /* Dark green */
}
#connection-status.disconnected {
     background-color: #fee2e2; /* Light red */
    color: #991b1b; /* Dark red */
}
 #connection-status.connecting {
     background-color: #fef9c3; /* Light yellow */
    color: #854d0e; /* Dark yellow */
}
/* License page styles (kept in external CSS for CSP compatibility). */
.license-wrap {
  max-width: 900px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  padding: 2rem;
}

.license-wrap h1 {
  font-size: 1.75rem;
  margin: 0 0 1rem;
  color: #111827;
}

.license-wrap p {
  margin: 0 0 1rem;
  color: #374151;
  line-height: 1.6;
}

.license-wrap a {
  color: #1d4ed8;
  text-decoration: underline;
}

.license-wrap pre {
  margin-top: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #111827;
  line-height: 1.5;
}

/* Admin team access */
.admin-page {
  min-height: 100vh;
  padding: 1rem;
  background: var(--page);
  color: var(--ink);
}

.admin-header {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 3rem 0 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.admin-heading {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
}

.admin-header h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
}

.admin-heading p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.admin-room-link {
  text-decoration: none;
}

.admin-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
}

.auth-panel {
  max-width: 520px;
}

.admin-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-panel-header h2 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.admin-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-count {
  min-height: 1.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 900;
}

.admin-form {
  display: grid;
  gap: 0.75rem;
}

.keys-panel .admin-form {
  max-width: 560px;
}

.admin-invite-options {
  max-width: 720px;
  margin-top: 0.75rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.45fr);
}

.admin-team-search {
  max-width: 720px;
  margin-top: 0.75rem;
}

.admin-list-actions {
  max-width: 720px;
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.compact-action {
  min-height: 2.2rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.86rem;
}

.admin-status {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-weight: 800;
}

.admin-status.success {
  color: var(--green);
}

.admin-status.error {
  color: var(--red);
}

.admin-key-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.admin-empty {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0.85rem;
  font-weight: 800;
}

.admin-key-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  overflow: hidden;
}

.admin-key-row.is-suspended {
  border-color: #fed7aa;
  background: #fff7ed;
}

.admin-team-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  cursor: pointer;
}

.admin-team-summary::-webkit-details-marker {
  display: none;
}

.admin-team-summary-text {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.admin-team-name {
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.admin-team-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.admin-team-status {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 900;
}

.admin-team-status.is-active {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #166534;
}

.admin-team-status.is-suspended {
  border-color: #fed7aa;
  background: #ffedd5;
  color: #9a3412;
}

.admin-team-indicator {
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  position: relative;
}

.admin-team-indicator::before,
.admin-team-indicator::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.78rem;
  height: 2px;
  border-radius: 999px;
  background: var(--muted);
  transform: translate(-50%, -50%);
  transition: transform 160ms ease, opacity 160ms ease;
}

.admin-team-indicator::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.admin-key-row[open] .admin-team-indicator::after {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg);
}

.admin-team-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  padding: 0 0.8rem 0.8rem;
  animation: adminTeamPanelIn 180ms ease-out;
}

@keyframes adminTeamPanelIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-key-details {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.admin-key-details strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.admin-key-details code {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.admin-key-status {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.admin-key-status.is-active {
  color: #166534;
}

.admin-key-status.is-suspended {
  color: #9a3412;
}

.admin-invite-preview {
  margin: 0.55rem 0 0;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface);
  color: var(--ink);
  padding: 0.65rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.admin-key-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-copy-buffer {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.admin-activity-list {
  display: grid;
  gap: 0.65rem;
}

.admin-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 0.8rem;
}

.admin-activity-badge {
  min-width: 5.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0.2rem 0.55rem;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 900;
}

.admin-activity-badge.is-created,
.admin-activity-badge.is-restored,
.admin-activity-badge.is-rotated {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #166534;
}

.admin-activity-badge.is-suspended {
  border-color: #fed7aa;
  background: #ffedd5;
  color: #9a3412;
}

.admin-activity-badge.is-removed {
  border-color: #fecaca;
  background: #fee2e2;
  color: #991b1b;
}

.admin-activity-body {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.admin-activity-summary,
.admin-activity-meta {
  margin: 0;
}

.admin-activity-summary {
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.admin-activity-meta {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-activity-meta code {
  color: inherit;
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .admin-page {
    padding: 0.75rem;
  }

  .admin-header {
    align-items: stretch;
    flex-direction: column;
    padding-top: 3rem;
  }

  .admin-header h1 {
    font-size: 1.65rem;
  }

  .admin-panel-header,
  .admin-team-body {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .admin-panel-actions {
    justify-content: flex-start;
  }

  .admin-invite-options {
    grid-template-columns: 1fr;
  }

  .admin-key-actions {
    width: 100%;
    justify-content: stretch;
  }

  .admin-key-actions button {
    flex: 1;
  }

  .admin-activity-item {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-activity-badge {
    width: fit-content;
  }
}
