*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f111a;
  --surface: #1a1d2e;
  --surface-hover: #232740;
  --border: #2a2e45;
  --text: #e2e4f0;
  --text-muted: #8b8fa8;

  --backlog: #6366f1;
  --in-progress: #f59e0b;
  --review: #8b5cf6;
  --done: #10b981;

  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* --- Header --- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 1.2rem;
  transition: background var(--transition);
}

.back-link:hover {
  background: var(--surface-hover);
}

.status-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--done);
}

.status-live::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--done);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Dashboard Project Cards --- */

.project-card-board {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: grab;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.project-card-board:hover {
  border-color: #4a4f6a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.project-card-board.unavailable {
  opacity: 0.45;
  cursor: not-allowed;
}

.project-card-board.unavailable:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.project-card-board.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.project-card-link {
  display: block;
  text-decoration: none;
  color: var(--text);
}

.project-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.project-unavailable {
  font-size: 0.8rem;
  color: #ef4444;
  font-style: italic;
}

.project-progress-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.project-stats {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.backlog-dot { background: var(--backlog); }
.in-progress-dot { background: var(--in-progress); }
.review-dot { background: var(--review); }
.done-dot { background: var(--done); }

.project-delete-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}

.project-card-board:hover .project-delete-btn {
  opacity: 1;
}

.project-delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* --- Board --- */

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1.5rem 2rem;
  min-height: 50vh;
  align-content: start;
}

/* --- Column --- */

.column {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.column-header h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.backlog-header h2 { color: var(--backlog); }
.in-progress-header h2 { color: var(--in-progress); }
.review-header h2 { color: var(--review); }
.done-header h2 { color: var(--done); }

.count {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
}

.card-list {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
  overflow-y: auto;
}

/* --- Card --- */

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: #4a4f6a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card-id {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.6rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-muted);
}

.badge-high { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-medium { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-low { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress-fill.backlog { background: var(--backlog); }
.progress-fill.inProgress { background: var(--in-progress); }
.progress-fill.review { background: var(--review); }
.progress-fill.done { background: var(--done); }

.progress-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Modal --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  animation: slideUp 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-id {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.modal-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.modal-section {
  margin-bottom: 1.25rem;
}

.modal-section h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.modal-section p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.modal-section ul {
  list-style: none;
  padding: 0;
}

.modal-section li {
  font-size: 0.85rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-section li:last-child {
  border-bottom: none;
}

.task-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.task-check.checked {
  background: var(--done);
  border-color: var(--done);
}

.task-check.checked::after {
  content: '\2713';
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.task-text.checked {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* --- Header actions --- */

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- Buttons --- */

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--backlog);
  color: white;
}

.btn-primary:hover {
  background: #4f46e5;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-full {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.9rem;
}

/* --- Drag & Drop --- */

.card[draggable="true"] {
  cursor: grab;
}

.card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.column.drag-over {
  border-color: var(--backlog);
  background: rgba(99, 102, 241, 0.05);
}

/* --- Clickable tasks --- */

.task-item {
  cursor: pointer;
  transition: background var(--transition);
  padding: 0.5rem 0.4rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.task-item:hover {
  background: var(--surface-hover);
}

.task-text {
  flex: 1;
}

.task-actions {
  display: none;
  gap: 0.2rem;
  margin-left: auto;
  flex-shrink: 0;
}

.task-item:hover .task-actions {
  display: flex;
}

.task-edit-btn,
.task-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}

.task-edit-btn:hover {
  background: var(--primary);
  color: white;
}

.task-delete-btn:hover {
  background: var(--danger, #ef4444);
  color: white;
}

.task-check.clickable {
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.task-check.clickable:hover {
  border-color: var(--done);
}

/* --- Inline editing --- */

.inline-edit-input {
  width: 100%;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0.3rem 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--backlog);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
}

.inline-edit-textarea {
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--backlog);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

.modal-title[data-field] {
  cursor: text;
  padding: 0.2rem;
  border-radius: 4px;
  transition: background var(--transition);
}

.modal-title[data-field]:hover {
  background: var(--surface-hover);
}

.editable-text {
  cursor: text;
  padding: 0.3rem;
  border-radius: 4px;
  transition: background var(--transition);
}

.editable-text:hover {
  background: var(--surface-hover);
}

/* --- Modal actions --- */

.task-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.task-locked .task-check {
  pointer-events: none;
}

.lock-hint {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 1.6rem;
  margin-top: 0.15rem;
}

.add-task-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.add-task-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
}

.add-task-input::placeholder {
  color: var(--text-muted);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.modal-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* --- Create form --- */

.create-modal {
  max-width: 450px;
}

.create-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--backlog);
}

.form-group select {
  cursor: pointer;
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

/* --- Custom Columns --- */

.custom-columns-section {
  padding: 1.5rem 2rem 2rem;
  border-top: 1px solid var(--border);
}

.custom-columns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.custom-columns-header h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.custom-columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.custom-columns-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  grid-column: 1 / -1;
}

.custom-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.custom-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid;
}

.custom-col-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.custom-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.custom-col-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.custom-col-count {
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
}

.custom-col-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.custom-col:hover .custom-col-actions {
  opacity: 1;
}

.custom-col-edit-btn,
.custom-col-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background var(--transition), color var(--transition);
}

.custom-col-edit-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.custom-col-delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.custom-col-desc {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}

.custom-col-items {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 300px;
  overflow-y: auto;
}

.custom-col-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
}

.custom-col-item-text {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.4;
}

.custom-col-item-date {
  font-size: 0.7rem;
  color: var(--review);
  background: rgba(139, 92, 246, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 600;
}

.custom-col-item-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.custom-col-item:hover .custom-col-item-delete {
  opacity: 1;
}

.custom-col-item-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.custom-col-add-form {
  border-top: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.custom-col-add-row {
  display: flex;
  gap: 0.4rem;
}

.custom-col-add-text {
  flex: 1;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  min-width: 0;
}

.custom-col-add-text::placeholder {
  color: var(--text-muted);
}

.custom-col-add-row-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.custom-col-add-row-date label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.custom-col-add-date {
  flex: 1;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  color-scheme: dark;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
  .board {
    grid-template-columns: repeat(2, 1fr);
    padding: 1rem;
  }
}

/* --- Share UI --- */

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
  background: var(--border);
}

.share-banner {
  background: #6366f1;
  color: #fff;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.share-modal {
  max-width: 520px;
}

.share-result {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.share-result label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: block;
}

.share-link-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.share-link-row input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--bg);
  color: var(--text);
}

.active-shares {
  margin-top: 1rem;
}

.active-shares h3 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.share-entry {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.4rem;
}

.share-entry-info {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
}

.share-entry-scope {
  font-weight: 600;
}

.share-entry-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.share-entry-link {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.shares-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.no-drag {
  cursor: default !important;
}

@media (max-width: 600px) {
  .board {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }

  header {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.1rem;
  }

  .modal {
    width: 95%;
    padding: 1.25rem;
  }

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

/* --- Auth pages --- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.auth-title {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--backlog);
  text-decoration: none;
}

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

/* --- User banner / header --- */

.user-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.user-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-link {
  font-size: 0.8rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.user-link:hover {
  background: var(--surface);
}

.plain-link {
  color: inherit;
  text-decoration: none;
}

/* --- Received shares page --- */

.received-page,
.account-page {
  padding: 2rem;
  max-width: 880px;
  margin: 0 auto;
}

.received-intro {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.received-list {
  display: grid;
  gap: 1rem;
}

.received-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition), transform var(--transition);
}

.received-card:hover {
  border-color: var(--backlog);
  transform: translateY(-2px);
}

.received-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.received-card-title {
  font-weight: 600;
}

.received-card-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.received-empty {
  color: var(--text-muted);
  font-style: italic;
}

.badge-readonly {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.badge-collaborative {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* --- Account / API tokens --- */

.account-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.account-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.token-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.token-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.token-new {
  padding: 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.token-value {
  display: block;
  word-break: break-all;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.token-list {
  display: grid;
  gap: 0.5rem;
}

.token-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.token-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.hidden {
  display: none !important;
}

.cursor-setup-warning {
  padding: 0.75rem 1rem;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cursor-setup {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cursor-setup .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cursor-setup .field > span {
  font-weight: 600;
  font-size: 0.9rem;
}

.cursor-setup .field input {
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.cursor-setup-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cursor-setup-details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.cursor-setup-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.mcp-json-preview {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-elevated, #0d1117);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre;
  overflow-x: auto;
  max-height: 300px;
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.share-entry-invitee {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Groups page --- */

.groups-page {
  padding: 2rem;
  max-width: 980px;
  margin: 0 auto;
}

.groups-list {
  display: grid;
  gap: 1.25rem;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

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

.group-card-header h3 {
  margin-bottom: 0.4rem;
}

.group-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.group-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.group-section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0.75rem 0 0.5rem;
}

.group-members-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0;
  margin: 0;
}

.group-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.group-member.empty {
  color: var(--text-muted);
  font-style: italic;
  justify-content: flex-start;
}

.group-member.pending {
  border-style: dashed;
}

.group-add-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.group-add-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
}

/* --- Admin table --- */

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

