/* ── Knowledge Sources page ───────────────────────────────────────────────── */

.ks-main {
  max-width: 760px;
}

.ks-subtitle {
  color: rgba(255,255,255,0.55);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 2rem;
}

.ks-state { margin-bottom: 1.5rem; }

.ks-card-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.75rem;
}

.ks-card-heading-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
}
.ks-card-heading-row .ks-card-heading { margin: 0; }

.ks-confluence-icon { color: #5CC5A7; flex-shrink: 0; }
.ks-confluence-icon--small { opacity: 0.8; }

.ks-connected-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: rgba(92,197,167,0.1);
  border: 1px solid rgba(92,197,167,0.3);
  border-radius: 0.5rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 1.25rem;
}
.ks-connected-badge strong { color: #5CC5A7; }
.ks-connected-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5CC5A7;
  flex-shrink: 0;
}

.ks-card-body {
  color: rgba(255,255,255,0.6);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 0 1.25rem;
}

.ks-permission-note {
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  font-style: italic;
  margin: 0.75rem 0 0;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.ks-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  text-decoration: none;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}
.ks-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ks-btn--primary {
  background: #5CC5A7;
  color: #06231b;
}
.ks-btn--primary:hover:not(:disabled) { opacity: 0.9; }

.ks-btn--secondary {
  background: transparent;
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.8);
}
.ks-btn--secondary:hover:not(:disabled) { border-color: rgba(255,255,255,0.4); }

.ks-btn--danger {
  background: transparent;
  border-color: rgba(255,107,107,0.4);
  color: #ff6b6b;
}
.ks-btn--danger:hover:not(:disabled) { background: rgba(255,107,107,0.1); }

.ks-actions {
  display: flex;
  gap: 0.75rem;
}

/* ── Banner ────────────────────────────────────────────────────────────────── */

.ks-banner {
  border-radius: 0.6rem;
  font-size: 0.88rem;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
}
.ks-banner--error   { background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.3); color: #ff9b9b; }
.ks-banner--warning { background: rgba(245,197,66,0.1);  border: 1px solid rgba(245,197,66,0.3);  color: #f5c542; }
.ks-banner--success { background: rgba(92,197,167,0.12); border: 1px solid rgba(92,197,167,0.35); color: #5CC5A7; }

/* ── Space selection list ─────────────────────────────────────────────────── */

.ks-space-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.ks-space-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.5rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
}

.ks-space-checkbox { accent-color: #5CC5A7; }

.ks-space-key {
  color: rgba(255,255,255,0.4);
  font-size: 0.82rem;
}

.ks-select-all {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  cursor: pointer;
  margin: 0.9rem 0 0.6rem;
}
.ks-select-all input { accent-color: #5CC5A7; }

.ks-space-item--row {
  cursor: default;
  flex-wrap: wrap;
  align-items: center;
}

.ks-space-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ks-space-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Personal/user Confluence spaces get long, ugly hash-style keys —
   truncate rather than let them wrap and stretch the row. */
.ks-space-item--row .ks-space-key {
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ks-space-item__linked-badge {
  flex-shrink: 0;
  background: rgba(92,197,167,0.12);
  border: 1px solid rgba(92,197,167,0.3);
  border-radius: 999px;
  color: #5CC5A7;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}

.ks-space-item__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

.ks-space-item__open {
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.ks-space-item__open:hover { color: #5CC5A7; }

.ks-space-item__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 0.5rem;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.ks-space-item__action:hover { border-color: rgba(92,197,167,0.5); color: #fff; }

.ks-linked-list {
  background: rgba(92,197,167,0.08);
  border: 1px solid rgba(92,197,167,0.25);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.ks-linked-list p { margin: 0; }

/* ── Extracting progress ──────────────────────────────────────────────────── */

.ks-progress {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  height: 6px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.ks-progress__bar {
  background: linear-gradient(90deg, #5CC5A7, rgba(92,197,167,0.4));
  height: 100%;
  width: 40%;
  border-radius: 999px;
  animation: ks-progress-slide 1.6s ease-in-out infinite;
}

@keyframes ks-progress-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ── Active connection meta ───────────────────────────────────────────────── */

.ks-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 0 0 1.5rem;
}

.ks-meta-grid dt {
  color: rgba(255,255,255,0.4);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.ks-meta-grid dd {
  color: #fff;
  font-size: 0.95rem;
  margin: 0;
}

/* ── Disconnect confirmation dialog ───────────────────────────────────────── */

.ks-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ks-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.ks-dialog__card {
  position: relative;
  background: #12121a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1rem;
  max-width: 420px;
  padding: 1.75rem;
  z-index: 1;
}

.ks-dialog__card h2 {
  color: #fff;
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.ks-dialog__card p {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

.ks-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .ks-meta-grid { grid-template-columns: 1fr; }
}
