/* ─── Profile page ───────────────────────────────────────────────────────── */
.profile-page {
  max-width: 600px;
  margin: 0 auto;
}

/* ─── Profile top bar (back + edit) ─────────────────────────────────────── */
.profile-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}

.profile-back-btn {
  background: transparent;
  border: 1px solid var(--kith-border);
  color: var(--kith-text-muted);
  border-radius: var(--radius-lg);
  padding: 6px 14px;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.profile-back-btn:hover {
  border-color: var(--kith-text-muted);
  color: var(--kith-text);
}

.profile-edit-btn {
  background: transparent;
  border: 1px solid var(--kith-border);
  color: var(--kith-text-muted);
  border-radius: var(--radius-lg);
  padding: 6px 14px;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.profile-edit-btn:hover {
  border-color: var(--kith-green);
  color: var(--kith-green);
}

/* ─── Hero section ───────────────────────────────────────────────────────── */
.profile-hero {
  background: var(--kith-surface);
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--kith-border);
  text-align: center;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 600;
  color: #fff;
  margin: 0 auto 12px;
  background: var(--kith-surface-2);
}

.profile-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--kith-text);
}

.profile-circles-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.profile-circle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
}

.profile-circle-dot:hover {
  transform: scale(1.3);
}

.profile-circle-label {
  font-size: var(--text-xs);
  color: var(--kith-text-muted);
}

.profile-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.profile-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-lg);
  background: var(--kith-surface-2);
  border: 1px solid var(--kith-border);
  color: var(--kith-text);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s;
}

.profile-action-btn:hover {
  border-color: var(--kith-green);
}

.profile-action-btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ─── Content sections ───────────────────────────────────────────────────── */
.profile-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--kith-border);
}

.profile-section-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--kith-text-dim);
  margin-bottom: 8px;
}

.profile-section-text {
  font-size: var(--text-base);
  color: var(--kith-text);
  line-height: 1.6;
}

/* ─── Contact info rows (Cell / Email) ──────────────────────────────────── */
.contact-info-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 0;
}

.contact-info-row + .contact-info-row {
  border-top: 1px solid var(--kith-border);
}

.contact-info-label {
  font-size: var(--text-sm);
  color: var(--kith-text-muted);
  min-width: 48px;
  flex-shrink: 0;
}

.contact-info-value {
  font-size: var(--text-base);
  color: var(--kith-green);
  text-decoration: none;
  font-weight: 500;
}

.contact-info-value:hover {
  text-decoration: underline;
}

/* ─── Tag chips ──────────────────────────────────────────────────────────── */
.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-block;
  background: var(--kith-surface-2);
  border: 1px solid var(--kith-border);
  border-radius: var(--radius-lg);
  padding: 4px 12px;
  font-size: var(--text-sm);
  color: var(--kith-text-muted);
}

/* ─── Files section ──────────────────────────────────────────────────────── */
.file-placeholder {
  border: 1px dashed var(--kith-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  color: var(--kith-text-dim);
  font-size: var(--text-sm);
}

/* ─── Reminder / date items ──────────────────────────────────────────────── */
.profile-date-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: var(--text-base);
  color: var(--kith-text);
}

.profile-reminder-text {
  font-size: var(--text-sm);
  color: var(--kith-text-muted);
  margin-bottom: 8px;
}

.profile-reminder-btn {
  background: transparent;
  border: 1px solid var(--kith-border);
  color: var(--kith-text-muted);
  border-radius: var(--radius-lg);
  padding: 5px 14px;
  font-size: var(--text-sm);
  cursor: pointer;
}

/* ─── Circles view — read-only indented tree ─────────────────────────────── */
.cv-tree {
  padding-top: 2px;
}

.cv-group {
  margin-bottom: 8px; /* 8px + 10px row margin = 18px between top-level groups */
}

.cv-group:last-child {
  margin-bottom: 0;
}

.cv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.cv-row:last-child {
  margin-bottom: 0;
}

.cv-arrow {
  font-size: 0.72rem;
  color: var(--kith-text-dim);
  flex-shrink: 0;
  line-height: 1;
}

.cv-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cv-name {
  font-size: 0.9rem;
  color: var(--kith-text);
  line-height: 1;
}

/* ─── Edit mode ──────────────────────────────────────────────────────────── */
.edit-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--kith-border);
}

.edit-field-row:first-of-type {
  border-top: none;
}

.edit-field-label {
  font-size: var(--text-sm);
  color: var(--kith-text-muted);
  min-width: 72px;
  flex-shrink: 0;
}

.profile-edit-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--kith-green);
  color: var(--kith-text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  padding: 4px 2px;
  min-width: 0;
}

.profile-edit-input::placeholder {
  color: var(--kith-text-dim);
}

/* ─── Edit-mode tag chips ─────────────────────────────────────────────────── */
.edit-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.edit-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--kith-surface-2);
  border: 1px solid var(--kith-border);
  border-radius: var(--radius-lg);
  padding: 4px 10px;
  font-size: var(--text-sm);
  color: var(--kith-text-muted);
}

.edit-tag-remove {
  background: none;
  border: none;
  color: var(--kith-text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-left: 2px;
}

.edit-tag-remove:hover { color: var(--kith-text); }

.edit-tag-add {
  background: transparent;
  border: 1.5px dashed var(--kith-border);
  color: var(--kith-text-dim);
  border-radius: var(--radius-lg);
  padding: 4px 10px;
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: inherit;
}

.edit-tag-add:hover { border-color: var(--kith-green); color: var(--kith-green); }

.edit-tag-input {
  background: var(--kith-surface-2);
  border: 1.5px solid var(--kith-green);
  border-radius: var(--radius-lg);
  padding: 4px 10px;
  font-size: var(--text-sm);
  color: var(--kith-text);
  font-family: inherit;
  outline: none;
  width: 90px;
}

/* ─── Circles collapsible section ────────────────────────────────────────── */
.profile-circles-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.circles-chevron {
  font-size: 1.1rem;
  color: var(--kith-text-dim);
  line-height: 1;
}

.circles-dropdown {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.circle-row {
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  transition: background 0.1s;
}

.circle-row:hover {
  background: var(--kith-surface-2);
}

.circle-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 10px 8px;
  cursor: pointer;
  min-width: 0;
}

.circle-row-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: background 0.15s;
}

.circle-row-name {
  font-size: var(--text-base);
  color: var(--kith-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.circle-row.is-member .circle-row-name {
  font-weight: 600;
}

.circle-row-conf {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--kith-green);
  opacity: 0.8;
  flex-shrink: 0;
}

.circle-row-expand {
  padding: 8px 10px;
  font-size: 1rem;
  color: var(--kith-text-dim);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

.circles-loading,
.circles-empty {
  font-size: var(--text-sm);
  color: var(--kith-text-dim);
  padding: 8px 4px;
  text-align: center;
}

/* ─── Notes textarea ─────────────────────────────────────────────────────── */
.profile-notes-area {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--kith-border);
  color: var(--kith-text);
  font-size: var(--text-base);
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  outline: none;
  padding: 4px 2px 8px;
  min-height: 80px;
  field-sizing: content;
}

.profile-notes-area::placeholder {
  color: var(--kith-text-dim);
}

.profile-notes-area:focus {
  border-bottom-color: var(--kith-green);
}

/* ─── File cards ──────────────────────────────────────────────────────────── */
.file-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.file-card {
  display: flex;
  align-items: center;
  background: var(--kith-surface-2);
  border: 1px solid var(--kith-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.file-card-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 10px 12px;
  text-decoration: none;
  min-width: 0;
}

.file-card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
}

.file-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.file-card-name {
  font-size: var(--text-sm);
  color: var(--kith-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card-meta {
  font-size: var(--text-xs);
  color: var(--kith-text-dim);
}

.file-card-delete {
  background: transparent;
  border: none;
  border-left: 1px solid var(--kith-border);
  color: var(--kith-text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 14px;
  height: 100%;
  align-self: stretch;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.file-card-delete:hover {
  color: var(--kith-text);
}

.file-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1.5px dashed var(--kith-border);
  color: var(--kith-text-dim);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.file-upload-btn:hover {
  border-color: var(--kith-green);
  color: var(--kith-green);
}

.file-upload-progress {
  margin-top: 6px;
  font-size: var(--text-sm);
  color: var(--kith-text-muted);
}
