:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #202432;
  --muted: #707789;
  --line: #e4e7ef;
  --primary: #4f46e5;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.page {
  width: 100%;
  margin: 0 auto;
  padding: 22px 18px 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

#summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 210px));
  gap: 12px;
  align-items: start;
  justify-content: start;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(31, 41, 55, .05);
}

.preview {
  aspect-ratio: 9 / 19.5;
  background: #eef0f5;
  background-position: top center;
  background-size: cover;
}

.preview--empty {
  display: grid;
  place-items: center;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
  background: repeating-linear-gradient(45deg, #f2f3f6, #f2f3f6 10px, #e8eaf0 10px, #e8eaf0 20px);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 10px;
}

.theme-name {
  min-height: 34px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.theme-dot {
  width: 10px;
  height: 10px;
  margin-top: 3px;
  border-radius: 999px;
  background: var(--theme-color, #999999);
}

.theme-text {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

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

.link-button,
.action-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  padding: 6px 7px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.link-button--generator {
  color: #3730a3;
  background: #eef2ff;
}

.link-button--admin {
  color: #047857;
  background: #ecfdf5;
}

.link-button--invitation {
  color: #b45309;
  background: #fff7ed;
}

.link-button--disabled {
  color: #a1a1aa;
  background: #f3f4f6;
  pointer-events: none;
}

.action-button {
  width: 100%;
}

.action-button--create {
  color: #fff;
  background: var(--primary);
}

.action-button--delete {
  color: var(--danger);
  background: #fff;
  border: 1px solid #fca5a5;
}

.action-button[disabled] {
  opacity: .65;
  cursor: progress;
}

.card-error {
  margin: -2px 0 0;
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 7px 8px;
  color: #991b1b;
  background: #fef2f2;
  font-size: 12px;
  line-height: 1.35;
}

.instance-id {
  min-height: 14px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.toast {
  margin-bottom: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 9px 11px;
  color: #991b1b;
  background: #fef2f2;
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(168px, 196px));
  }
}

@media (max-width: 560px) {
  .page {
    padding: 16px 9px 32px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    gap: 10px;
  }

  h1 {
    font-size: 22px;
  }

  .card-body {
    padding: 9px;
  }
}
