/* ── Channel settings page ───────────────────────── */
.ws-main--settings {
  overflow-y: auto;
  position: relative;
}

turbo-frame#settings-content[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 20, 0.6);
  z-index: 10;
  display: block;
}

turbo-frame#settings-content[aria-busy="true"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--accent-bg);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ws-spin 0.7s linear infinite;
  z-index: 11;
  transform: translate(-50%, -50%);
}

.ch-settings-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ch-settings-back {
  font-size: 0.82rem;
  color: var(--text-faint);
  transition: color 120ms;
  white-space: nowrap;
}
.ch-settings-back:hover { color: var(--text-muted); }

.ch-settings-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ch-settings-edit-link {
  margin-left: auto;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  transition: color 120ms;
}
.ch-settings-edit-link:hover { color: var(--text-muted); }

.collection-description {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.collection-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collection-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  color: var(--accent-lighter);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.collection-export-btn:hover {
  background: var(--bg-active);
  border-color: var(--accent-border);
  color: var(--accent-lighter);
}

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

.collection-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.collection-items-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-card);
}

.collection-items-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.collection-items-table tr:last-child td { border-bottom: none; }

.collection-items-id-col {
  color: var(--text-faint);
  width: 3rem;
}

/* ── Collection item action buttons ─────────────── */
.collection-items-actions-col {
  white-space: nowrap;
  width: 1%;
}
.collection-item-actions {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}
.collection-item-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  color: var(--accent-lighter);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
  white-space: nowrap;
}
.collection-item-action-btn:hover {
  background: var(--bg-active);
  border-color: var(--accent-border);
  color: var(--accent-lighter);
}
.collection-item-action-btn:active {
  transform: translateY(1px);
}

/* ── Collection buttons editor ───────────────────── */
.cb-buttons-rows {
  display: flex;
  flex-direction: column;
}
.cb-button-row {
  border-bottom: 1px solid var(--bg-composer);
  animation: cf-row-in 150ms ease;
}
.cb-button-row:last-child {
  border-bottom: none;
}
.cb-button-row--removing {
  animation: cf-row-out 160ms ease forwards;
  overflow: hidden;
  pointer-events: none;
}
.cb-button-header {
  display: grid;
  grid-template-columns: 1fr 32px;
  align-items: stretch;
}
.cb-button-name {
  border: none !important;
  border-right: 1px solid var(--bg-composer) !important;
  border-bottom: 1px solid var(--bg-composer) !important;
  border-radius: 0 !important;
  background: var(--bg-input);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
}
.cb-button-name:focus {
  outline: none;
  box-shadow: none !important;
  background: var(--bg-secondary);
}
.cb-button-action {
  border: none !important;
  border-radius: 0 !important;
  background: var(--bg-input);
  font-size: 0.85rem;
  padding: 0.55rem 0.75rem;
  min-height: 80px;
  resize: vertical;
}
.cb-button-action:focus {
  outline: none;
  box-shadow: none !important;
  background: var(--bg-secondary);
}

.ch-settings-body {
  padding: 2rem;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.ch-settings-body--wide { max-width: 900px; }

.ch-settings-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ch-settings-section-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

/* ── Workspace picture upload ───────────────────── */
.ws-picture-upload {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ws-picture-preview {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.ws-picture-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ws-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ws-file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: var(--bg-composer);
  color: var(--text-muted);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  max-width: 260px;
}

.ws-file-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-file-label:hover {
  border-color: var(--accent);
  color: var(--accent-lighter);
  background: var(--accent-bg);
}

/* ── Members list ────────────────────────────────── */
.ch-members-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  overflow: hidden;
}

.ch-member-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.ch-member-item:last-child { border-bottom: none; }

.ch-member-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
}
.ch-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ch-member-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-member-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-light);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  padding: 0.15rem 0.45rem;
}

/* ── Invite link ─────────────────────────────────── */
.ws-invite-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.ws-invite-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ws-invite-input {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: text;
  user-select: all;
  min-width: 0;
}

.ws-invite-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  color: var(--accent-lighter);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms, color 120ms;
  flex-shrink: 0;
}

.ws-invite-copy-btn:hover {
  background: var(--bg-active);
  border-color: var(--accent-border);
  color: var(--accent-lighter);
}

/* ── Members section ─────────────────────────────── */
.ch-member-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  border-radius: 6px;
  padding: 0 0.25rem;
  transition: background 120ms;
}
.ch-member-link:hover {
  background: var(--accent-bg);
}
.ch-member-badge--founder {
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.25);
}


.member-panel {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.member-panel-avatar {
  flex-shrink: 0;
}

.member-panel-avatar-img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
}

.member-panel-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-panel-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}

.member-panel-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.member-panel-email {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.member-panel-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.25rem;
}

.member-panel-badge--founder {
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.25);
}

.member-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
}

.member-panel-action-btn {
  width: 100%;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.member-panel-action-btn--promote {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--accent-lighter);
}
.member-panel-action-btn--promote:hover {
  background: var(--bg-active);
  border-color: var(--accent-border);
  color: var(--accent-lighter);
}

.member-panel-action-btn--demote {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}
.member-panel-action-btn--demote:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
  color: #fecaca;
}

.member-panel-alert {
  font-size: 0.82rem;
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 0;
  width: 100%;
  text-align: center;
}

/* ── Roles ──────────────────────────────────────── */
.roles-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-submit--small {
  width: auto;
  margin-top: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  box-shadow: none;
}

.role-permissions-summary {
  margin-left: auto;
}

.role-perm-text {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.role-perm-text--none {
  color: var(--text-faint);
  font-style: italic;
}

.role-permissions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.role-permission-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.role-permission-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.role-permission-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.ch-member-badge--role {
  color: var(--text-dim);
  background: var(--bg-composer);
  border-color: var(--border-card);
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  .ch-settings-header { padding: 0.875rem 1rem; }
  .ch-settings-body { padding: 1.25rem 1rem; }
  .ws-main--settings .auth-form { padding: 1.25rem 1rem; }
}
