/* Palette lifted from the JayDB console so the example looks like it belongs. */
:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 26, 43, 0.75);
  --bg-card-hover: rgba(28, 38, 61, 0.85);
  --bg-input: #131b2e;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 10px;
}

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

body {
  min-height: 100vh;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(99, 102, 241, 0.16), transparent 70%),
    radial-gradient(700px 400px at 100% 0%, rgba(139, 92, 246, 0.1), transparent 70%),
    var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* --- Buttons ------------------------------------------------------------- */

.button {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease;
}

.button:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.16);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.button:disabled,
.button.is-loading {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.button--spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.spinner-icon {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: transparent;
  color: #fff;
}

.button--primary:hover {
  filter: brightness(1.08);
}

.button--ghost {
  background: transparent;
}

.button--danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
}

.button--danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.button--wide {
  width: 100%;
  padding: 11px 14px;
  margin-top: 4px;
}

/* --- Fields -------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.field__input {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  width: 100%;
}

.field__input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field__input--mono,
.field__textarea {
  font-family: var(--font-mono);
  font-size: 13px;
}

.field__textarea {
  resize: vertical;
  line-height: 1.55;
}

.field__select {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.field__select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field__select option {
  background: #0f1524;
  color: var(--text-primary);
}

.field__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.field__hint--warn {
  color: var(--warning);
}

.field-row {
  display: flex;
  gap: 12px;
}

/* --- Connect ------------------------------------------------------------- */

.connect {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.connect__card {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.connect__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: -4px;
}

.connect__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.connect__github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.connect__github:hover {
  color: var(--text-primary);
}

.connect__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.connect__lede {
  color: var(--text-secondary);
  margin-top: -8px;
}

.connect__features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.connect__feature-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.connect__feature-item strong {
  color: var(--text-primary);
}

.connect__feature-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: -1px;
}

.connect__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.connect__link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.connect__link:hover {
  color: var(--accent-primary);
}

.connect__error {
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-size: 13px;
}

.signin {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border-color);
}

.signin__label {
  font-size: 12px;
  color: var(--text-muted);
}

.signin__buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.signin__github {
  opacity: 0.55;
  cursor: not-allowed;
}

.signin__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.signin__as {
  font-size: 12px;
  color: var(--success);
}

.signin__name-field {
  margin-top: 4px;
}

/* --- Signin Loader ------------------------------------------------------- */

.signin-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.signin-loader__spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(99, 102, 241, 0.18);
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-secondary);
  border-radius: 50%;
  animation: spin 0.85s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.signin-loader__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.signin-loader__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.signin-loader__step {
  font-size: 13px;
  color: var(--text-secondary);
  transition: opacity 0.2s ease;
}

.signin-loader__bar {
  width: 100%;
  max-width: 200px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.signin-loader__bar-inner {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 999px;
  animation: signin-progress 1.5s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes signin-progress {
  0% {
    left: -40%;
    width: 30%;
  }
  50% {
    left: 30%;
    width: 50%;
  }
  100% {
    left: 100%;
    width: 30%;
  }
}

.advanced {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.advanced[open] {
  gap: 14px;
}

.advanced__summary {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: revert;
}

.advanced__summary:hover {
  color: var(--text-secondary);
}

.connect__footnote {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Board chrome -------------------------------------------------------- */

.board {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.topbar__logo {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.topbar__logo:hover {
  filter: brightness(1.15);
}

.topbar__divider {
  color: var(--border-color);
  font-size: 14px;
}

.topbar__app {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.topbar__title {
  font-size: 17px;
  font-weight: 700;
}

.topbar__github {
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
}

.topbar__key {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.presence {
  display: flex;
  align-items: center;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: -6px;
  border-radius: 50%;
  border: 2px solid var(--bg-main);
  background: hsl(var(--hue, 240) 60% 45%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.avatar--self {
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
}

.pill--ok {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.pill--sync {
  color: var(--accent-primary);
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.12);
}

.pill--warn {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.12);
}

.pill--error {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
}

.banner {
  padding: 10px 20px;
  font-size: 13px;
  border-bottom: 1px solid transparent;
}

.banner--error {
  background: rgba(239, 68, 68, 0.12);
  border-bottom-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.banner--warn {
  background: rgba(245, 158, 11, 0.12);
  border-bottom-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

.banner--info {
  background: rgba(99, 102, 241, 0.12);
  border-bottom-color: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
}

/* --- Workspace ----------------------------------------------------------- */

.workspace {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-height: 0;
}

.columns {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--column-count, 3), minmax(240px, 1fr));
  gap: 16px;
  padding: 20px;
  align-items: start;
  overflow-x: auto;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: rgba(18, 26, 43, 0.45);
}

.column__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.column__title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  cursor: text;
  border-radius: 4px;
}

.column__title:hover {
  color: var(--text-primary);
}

.column__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.column__drop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.column__drop--over {
  background: var(--accent-glow);
  box-shadow: inset 0 0 0 1px var(--accent-primary);
}

.column__add {
  padding: 8px;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.column__add:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* --- Cards --------------------------------------------------------------- */

.card {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: grab;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

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

.card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.card__notes {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.card__meta-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.card__author {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__etag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.14);
  color: #a5b4fc;
  flex-shrink: 0;
}

.card__move-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.card__move-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}

.card__move-btn:hover:not(:disabled) {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  transform: translateY(-1px);
}

.card__move-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.card__move-btn:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

/* --- Stats Panel --------------------------------------------------------- */

.stats-panel,
.inspector {
  width: 290px;
  flex: 0 0 290px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 18px;
  border-left: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.6);
}

.stats-panel__heading,
.inspector__heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stats-panel__note,
.inspector__note {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.stats__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}

.stats__row dt {
  color: var(--text-secondary);
}

.stats__row dd {
  font-family: var(--font-mono);
  font-weight: 600;
}

.stats__row--accent dd {
  color: var(--warning);
}

.stats__row--good dd {
  color: var(--success);
}

.activity {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.activity__item {
  font-size: 12px;
  line-height: 1.45;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.activity__actor {
  font-weight: 600;
  color: #a5b4fc;
}

.activity__text {
  color: var(--text-secondary);
}

.activity__time {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}

/* --- Dialogs ------------------------------------------------------------- */

.dialog {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: #0f1524;
  color: var(--text-primary);
  padding: 0;
  max-width: 620px;
  width: calc(100vw - 40px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: rgba(3, 6, 14, 0.7);
  backdrop-filter: blur(3px);
}

.dialog__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
}

.dialog__title {
  font-size: 17px;
  font-weight: 700;
}

.dialog__title--warn {
  color: var(--warning);
}

.dialog__lede {
  color: var(--text-secondary);
  margin-top: -8px;
}

.dialog__meta,
.dialog__note {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.dialog__note {
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
}

.dialog__note code {
  font-family: var(--font-mono);
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

.dialog__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.dialog__spacer {
  flex: 1;
}

.diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.diff__heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.diff__body {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow-y: auto;
}


/* --- Tree ACL & Role Badges --------------------------------------------- */

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.role-badge--own {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.role-badge--write {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.role-badge--read {
  background: rgba(156, 163, 175, 0.15);
  color: #d1d5db;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.invite-roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.invite-role-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.invite-role-option:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-card-hover);
}

.invite-role-option input[type="radio"] {
  margin-top: 3px;
}

.invite-role-option__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invite-role-option__info strong {
  font-size: 13px;
  color: var(--text-primary);
}

.invite-role-option__info span {
  font-size: 12px;
  color: var(--text-muted);
}

.invite-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field__input--mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.invite-feedback {
  font-size: 12px;
  color: var(--success);
  margin-top: 4px;
}

.card--readonly {
  cursor: pointer;
}

.column__title--readonly {
  cursor: default !important;
}

/* --- Mobile Column Navigation Tabs -------------------------------------- */

.column-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(11, 15, 25, 0.95);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 57px;
  z-index: 9;
  backdrop-filter: blur(12px);
}

.column-tabs::-webkit-scrollbar {
  display: none;
}

.column-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
  touch-action: manipulation;
}

.column-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.column-tab--active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.column-tab__title {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.column-tab--active .column-tab__count {
  background: var(--accent-primary);
  color: #fff;
}

@media (min-width: 769px) {
  .column-tabs {
    display: none !important;
  }
}

/* --- Responsive Layout for Tablets & Mobile ----------------------------- */

@media (max-width: 860px) {
  .workspace {
    flex-direction: column;
  }

  .stats-panel,
  .inspector {
    width: 100%;
    flex: none;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }

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

@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }

  .topbar__identity {
    flex: 1 1 auto;
    gap: 8px;
    min-width: 0;
  }

  .topbar__title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar__key {
    display: none; /* Hide verbose path on small screens */
  }

  .topbar__right {
    flex: 0 0 auto;
    gap: 6px;
  }

  .topbar__github-text {
    display: none; /* Icon-only button on mobile to save space */
  }

  .topbar__github svg {
    margin-right: 0 !important;
  }

  .button {
    padding: 7px 11px;
    font-size: 13px;
  }

  .pill {
    padding: 3px 8px;
    font-size: 10.5px;
  }

  .avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
    margin-left: -4px;
  }

  .columns {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-padding: 0 16px;
    padding: 16px;
    gap: 16px;
    width: 100%;
    align-items: stretch;
  }

  .column {
    flex: 0 0 calc(100vw - 48px);
    max-width: 360px;
    min-width: 280px;
    scroll-snap-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }

  .column__add {
    min-height: 42px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .card {
    padding: 12px 14px;
  }

  .card__title {
    font-size: 14.5px;
  }

  .card__move-btn {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
}

@media (max-width: 540px) {
  .topbar {
    padding: 8px 12px;
    gap: 8px;
  }

  .topbar__identity {
    width: 100%;
    justify-content: space-between;
  }

  .topbar__right {
    width: 100%;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  .column-tabs {
    top: 92px; /* adjust for two-row mobile header */
    padding: 8px 12px;
  }

  .columns {
    padding: 12px;
    scroll-padding: 0 12px;
    gap: 12px;
  }

  .column {
    flex: 0 0 calc(100vw - 32px);
    max-width: none;
    min-width: 0;
    padding: 12px 10px;
  }

  /* Prevent iOS Safari auto-zoom when tapping inputs */
  .field__input,
  .field__select,
  .field__textarea {
    font-size: 16px;
  }

  .dialog {
    width: calc(100vw - 20px);
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 16px;
    margin: auto 10px 10px 10px;
  }

  .dialog__body {
    padding: 18px 16px;
    gap: 12px;
  }

  .dialog__actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .dialog__actions .dialog__spacer {
    display: none;
  }

  .dialog__actions button {
    flex: 1 1 calc(50% - 4px);
    min-height: 42px;
  }

  .dialog__actions button.button--primary {
    flex: 1 1 100%;
    order: -1;
  }

  .connect {
    padding: 16px 12px;
  }

  .connect__card {
    padding: 20px 16px;
    gap: 14px;
    border-radius: 14px;
  }

  .connect__title {
    font-size: 20px;
  }

  .connect__lede {
    font-size: 13px;
    margin-top: -4px;
  }

  .signin__buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .signin__buttons button,
  .signin__buttons div {
    width: 100% !important;
  }

  #github-signin {
    width: 100%;
    text-align: center;
    justify-content: center;
    min-height: 40px;
  }
}
