/* ═══════════════════════════════════════════════════════════════════
   Easy AI Kanban — Main Stylesheet
   Linear.app-inspired minimal design
═══════════════════════════════════════════════════════════════════ */

/* ── Theme tokens ─────────────────────────────────────────────────── */
:root {
  /* Light theme — Radix Slate / Blue / Green / Yellow / Red values */
  --bg-app:        #fcfcfd;
  --bg-surface:    #f9f9fb;
  --bg-card:       #f0f0f3;
  --bg-hover:      #e8e8ec;
  --bg-active:     #e0e1e6;

  --border-subtle: #d9d9e0;
  --border-base:   #cdced6;
  --border-strong: #b9bbc6;

  --text-primary:   #1c2024;
  --text-secondary: #60646c;
  --text-muted:     #8b8d98;
  --text-disabled:  #b9bbc6;

  --accent:         #0090ff;
  --accent-hover:   #0588f0;
  --accent-muted:   #d5efff;
  --accent-text:    #0d74ce;

  --priority-low:        #16a34a;
  --priority-medium:     #d97706;
  --priority-high:       #dc2626;
  --priority-low-bg:     #dcfce7;
  --priority-medium-bg:  #fef3c7;
  --priority-high-bg:    #fee2e2;

  --sidebar-width: 300px;
  --header-height: 48px;
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --duration: 150ms;
  --ease-ui: cubic-bezier(.25,0,.3,1);
}

/* Dark theme token overrides */
:root[data-theme="dark"],
[data-theme="dark"] {
  --bg-input: #2a2d31;
  --bg-app:        #111113;
  --bg-surface:    #18191b;
  --bg-card:       #212225;
  --bg-hover:      #272a2d;
  --bg-active:     #2e3135;

  --border-subtle: #363a3f;
  --border-base:   #43484e;
  --border-strong: #5a6169;

  --text-primary:   #edeef0;
  --text-secondary: #b0b4ba;
  --text-muted:     #696e77;
  --text-disabled:  #5a6169;

  --accent:         #0090ff;
  --accent-hover:   #3b9eff;
  --accent-muted:   #003362;
  --accent-text:    #70b8ff;

  --priority-low:        #30a46c;
  --priority-medium:     #ffe629;
  --priority-high:       #e5484d;
  --priority-low-bg:     #132d21;
  --priority-medium-bg:  #2d2305;
  --priority-high-bg:    #3b1219;
}

/* Follow OS dark mode if user has no saved preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-input: #2a2d31;
    --bg-app:        #111113;
    --bg-surface:    #18191b;
    --bg-card:       #212225;
    --bg-hover:      #272a2d;
    --bg-active:     #2e3135;

    --border-subtle: #363a3f;
    --border-base:   #43484e;
    --border-strong: #5a6169;

    --text-primary:   #edeef0;
    --text-secondary: #b0b4ba;
    --text-muted:     #696e77;
    --text-disabled:  #5a6169;

    --accent:         #0090ff;
    --accent-hover:   #3b9eff;
    --accent-muted:   #003362;
    --accent-text:    #70b8ff;

    --priority-low:        #30a46c;
    --priority-medium:     #ffe629;
    --priority-high:       #e5484d;
    --priority-low-bg:     #132d21;
    --priority-medium-bg:  #2d2305;
    --priority-high-bg:    #3b1219;
  }
}

/* ── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text-primary); }
ul, ol { list-style: none; }

/* ── Utilities ────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mobile-only { display: none !important; }

@media (max-width: 768px) {
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--duration) var(--ease-ui);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-weight: 500;
  transition: all var(--duration) var(--ease-ui);
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--priority-high);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-weight: 500;
  transition: opacity var(--duration);
}
.btn-danger:hover { opacity: 0.85; }
.btn-danger:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
#btn-delete-card {
  padding: 6px 12px;
}
.btn-sm {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--duration) var(--ease-ui);
  white-space: nowrap;
}
.btn-sm:hover { background: var(--accent-hover); }
.btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }
/* Secondary variant overrides */
.btn-secondary.btn-sm {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-base);
}
.btn-secondary.btn-sm:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-secondary.btn-sm:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.btn-full { width: 100%; justify-content: center; }
.btn-full-sm { width: 100%; justify-content: center; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background var(--duration) var(--ease-ui), color var(--duration);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-lang {
  width: auto; padding: 0 8px;
  font-size: 12px; font-weight: 600;
}

.btn-ai {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-muted);
  color: var(--accent-text);
  border-radius: var(--radius-md);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--duration);
}
.btn-ai:hover { background: var(--accent); color: #fff; }
.btn-ai:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ai.loading { opacity: 1; cursor: wait; pointer-events: none; }
.btn-ai.loading .btn-text { display: none; }
.btn-ai.loading i { display: none; }
.btn-ai.loading::after {
  content: '';
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form elements ────────────────────────────────────────────────── */
input[type="datetime-local"] { cursor: pointer; }
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  background: var(--bg-input, var(--bg-card));
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  width: 100%;
  outline: none;
  transition: border-color var(--duration);
}
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type="datetime-local"] { color-scheme: dark; }
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

.input-sm {
  padding: 4px 8px;
  font-size: 13px;
  background: var(--bg-input, var(--bg-card));
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--duration);
}
.input-sm:focus { border-color: var(--accent); }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.char-counter {
  font-size: 11px;
  color: var(--text-muted);
}
.char-counter.warning { color: var(--priority-medium); }
.char-counter.danger  { color: var(--priority-high); }

/* ── Avatar ───────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--accent);
}
.avatar--sm  { width: 32px; height: 32px; font-size: 12px; }
.avatar--md  { width: 32px; height: 32px; font-size: 13px; }
.avatar--lg  { width: 40px; height: 40px; font-size: 16px; }
.avatar--xl  { width: 64px; height: 64px; font-size: 24px; }
.avatar img  { width: 100%; height: 100%; object-fit: cover; }

/* ── Login ────────────────────────────────────────────────────────── */
.page-login {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-app);
}
.page-login:not(.hidden) {
  display: flex;
}
.login-container {
  width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.logo-easy   { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.logo-kanban { font-size: 16px; font-weight: 700; color: var(--accent); }
.login-error {
  color: var(--priority-high);
  font-size: 13px;
  padding: 8px 12px;
  background: var(--priority-high-bg);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

/* ── App shell ────────────────────────────────────────────────────── */
.app-shell {
  height: 100vh;
  overflow: hidden;
}
.app-shell:not(.hidden) {
  display: flex;
}
.page { display: block; }

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 12px 4px 0;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar-section-header-actions {
  display: flex; align-items: center; gap: 2px;
}
.btn-toggle-own.active {
  color: var(--accent) !important;
  opacity: 1 !important;
}

/* ── Project color popup ─────────────────────────────────────────── */
.project-color-opt {
  transition: transform 120ms, border-color 120ms;
}
.project-color-opt:hover {
  transform: scale(1.15);
}
.project-color-opt.active {
  border-color: var(--text-primary) !important;
  transform: scale(1.15);
}
.sidebar-section-link {
  display: flex; align-items: center;
  padding: 6px 12px;
  margin: 0 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  transition: background var(--duration), color var(--duration);
  border: 1px solid var(--border-base);
}
.sidebar-section-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-section-link.active { background: var(--bg-active); color: var(--text-primary); }
.projects-list { padding: 2px 8px; }
.project-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--duration), color var(--duration);
}
.project-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.project-item.active { background: var(--bg-active); color: var(--text-primary); }
.project-item-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px;
}
.project-item-color-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-right: 8px;
  display: none;
}
.project-item-color-dot.visible { display: inline-block; }
.project-item-actions {
  display: flex; gap: 2px;
  opacity: 0.4;
  transition: opacity var(--duration);
}
.project-item:hover .project-item-actions { opacity: 1; }
.project-item:hover .btn-edit-project { opacity: 1 !important; }
.btn-edit-project {
  transition: opacity var(--duration);
}

/* ── Project drag handle and drag states ─────────────────────────── */
.project-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 4px 0 0;
  user-select: none;
  flex-shrink: 0;
  touch-action: none;
  transition: color var(--duration);
}
.project-drag-handle:hover {
  color: var(--text-secondary);
}
.projects-separator {
  height: 1px;
  background: var(--border-base);
  margin: 8px 0;
  pointer-events: none;
}
.project-item.dragging {
  opacity: 0.3;
}
.project-item.project-ghost {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
  border-radius: var(--radius-md);
  opacity: 0.95;
  background: var(--bg-card);
  transform: rotate(1deg);
  transition: none;
  pointer-events: none;
}
.project-ghost .project-drag-handle {
  cursor: grabbing;
}
.project-placeholder {
  background: var(--bg-hover) !important;
  border: 2px dashed var(--border-strong) !important;
  border-radius: var(--radius-sm);
  margin: 2px 0;
  display: flex !important;
}

.project-name-input {
  font-size: 13px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 2px 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-footer-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  transition: background var(--duration);
  width: 100%; text-align: left;
}
.sidebar-footer-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  transition: background var(--duration);
  width: 100%; text-align: left;
}
.sidebar-user:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-username {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Sidebar mobile ───────────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    height: 100dvh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 200ms var(--ease-ui);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .sidebar.open { transform: translateX(0); }
}

/* ── Header ───────────────────────────────────────────────────────── */
.app-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
}
.header-breadcrumb {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary);
  overflow: hidden;
}
.header-breadcrumb .breadcrumb-project { color: var(--text-muted); }
.header-breadcrumb .breadcrumb-sep { color: var(--text-muted); }
.header-breadcrumb .breadcrumb-board { color: var(--text-primary); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 4px; }

/* ── Main content ─────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: block;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 20px; font-weight: 600; }

/* ── Projects grid ────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--duration), box-shadow var(--duration);
}
.project-card:hover {
  border-color: var(--border-base);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.project-card-name {
  font-weight: 600; font-size: 15px;
  margin-bottom: 8px;
}
.project-card-color-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.project-card-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
}
.project-card-actions {
  display: flex; gap: 4px; margin-top: 12px;
}

/* ── Board ────────────────────────────────────────────────────────── */
.board-header {
  padding: 16px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
}
.board-title-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 0;
}
@media(max-width: 768px) {
  .board-title-row {
    overflow-y: auto;
    padding-bottom: 12px;
    margin-left: -16px;
  }
}
.board-title { font-size: 18px; font-weight: 600; }

#page-board {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.board-columns {
  display: flex;
  gap: 0;
  padding: 0;
  overflow-x: auto;
  flex: 1;
  align-items: stretch;
  min-height: 0;
}

/* ── Column (List) ────────────────────────────────────────────────── */
.list-column {
  background: var(--bg-surface);
  border: none;
  border-radius: 0;
  width: 320px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  transition: background var(--duration);
}
.list-column {
  border-right: 1px solid var(--border-subtle);
}
.list-column.locked { opacity: 0.75; }
.list-column.drag-over { background: var(--accent-muted); }

.list-header {
  padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.list-title {
  flex: 1;
  font-weight: 600; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: text;
}
.list-title-input {
  flex: 1;
  background: var(--bg-hover);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 13px; font-weight: 600;
}
.list-card-count {
  font-size: 11px; color: var(--text-muted);
  background: var(--bg-hover);
  padding: 1px 6px;
  border-radius: 10px;
}
.list-actions { display: flex; gap: 2px; }

.list-locked-badge {
  font-size: 11px;
  color: var(--accent-text);
  padding: 1px 6px;
  background: var(--accent-muted);
  border-radius: 10px;
}

.list-cards {
  padding: 8px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 40px;
  min-height: 0;
}

.list-footer {
  padding: 6px 8px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.btn-add-card {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  transition: background var(--duration), color var(--duration);
}
.btn-add-card:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Add list column */
.add-list-column {
  width: 240px; min-width: 200px;
  display: flex; align-items: flex-start;
  padding: 12px 12px;
}
.btn-add-list-inline {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 13px;
  border: 2px dashed var(--border-subtle);
  width: 100%;
  transition: border-color var(--duration), color var(--duration), opacity var(--duration), cursor var(--duration);
}
.btn-add-list-inline:hover { border-color: var(--border-base); color: var(--text-primary); }
.btn-add-list-inline:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Card ─────────────────────────────────────────────────────────── */
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease-ui),
              box-shadow var(--duration) var(--ease-ui),
              opacity var(--duration);
  position: relative;
  user-select: none;
}
.kanban-card:hover {
  border-color: var(--border-base);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.kanban-card.dragging { opacity: 0; }
.kanban-card.drag-placeholder {
  border: 2px dashed var(--accent);
  background: var(--accent-muted);
  opacity: 0.6;
}

/* Ghost card shown during save */
.kanban-card.drag-ghost {
  opacity: 0.7;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.kanban-card.drag-ghost.saving::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kanban-card.drag-ghost.saving::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1;
}

/* Hidden original card during move */
.kanban-card.moving {
  opacity: 0;
  pointer-events: none;
}

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

.card-color-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.card-color-bar.green  { background: var(--priority-low); }
.card-color-bar.yellow { background: var(--priority-medium); }
.card-color-bar.red    { background: var(--priority-high); }

.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.card-title-text {
  font-size: 13px; font-weight: 500;
  line-height: 1.4;
  margin-left: 6px;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.card-duplicate-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration) var(--ease-ui), color var(--duration) var(--ease-ui);
  margin-top: 1px;
}
.card-duplicate-btn:hover {
  background: var(--bg-muted);
  color: var(--accent);
}

.card-text-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 4px 6px 0;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.card-labels { display: flex; gap: 4px; flex-wrap: wrap; }
.card-label {
  font-size: 10px; font-weight: 500;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

.card-badges {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.card-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-muted);
}

.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; gap: 15px;
}
.card-completed-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border: 1.5px solid var(--priority-low);
  border-radius: 50%;
  color: var(--priority-low);
  flex-shrink: 0;
}
.card-completed-badge svg {
  width: 16px; height: 16px;
}
.card-deadline {
  font-size: 11px;
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-muted);
}
.card-deadline.overdue { color: var(--priority-high); }
.card-deadline.soon    { color: var(--priority-medium); }

.card-creator-avatar { margin-left: auto; }

/* ── Card checklist inline preview on board ──────────────────────── */
.card-checklist-preview {
  margin: 6px 0 2px;
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}
.card-checklist-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.35;
}
.card-checklist-row.checked .card-checklist-text {
  text-decoration: line-through; color: var(--text-muted);
}
.card-checklist-check {
  flex-shrink: 0; font-size: 11px;
  color: var(--text-muted);
  width: 14px; text-align: center;
}
.card-checklist-row.checked .card-checklist-check { color: var(--priority-low); }
.card-checklist-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-checklist-more { font-size: 11px; color: var(--text-muted); padding-left: 20px; }

/* ── Board add-list input ─────────────────────────────────────────── */
.add-list-input-group {
  width: 280px; min-width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.add-list-input-group input {
  font-size: 13px; font-weight: 600;
  background: var(--bg-hover);
}
.add-list-btns { display: flex; gap: 6px; }

/* ── Mobile tabs ──────────────────────────────────────────────────── */
.mobile-tabs {
  display: none;
  overflow-x: auto;
  gap: 4px;
  padding-top: 0;
  margin-top: 15px;
  border-top: 1px solid var(--border-subtle);
  width: 100%;
}
.mobile-tab {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 16px; font-weight: 500;
  white-space: nowrap;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration);
  flex-shrink: 0;
}
.mobile-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
@media (max-width: 768px) {
  .page-content { padding: 12px; }
  .board-header { padding: 16px 16px 0px; }
  .mobile-tabs {
    display: flex;
    margin-left: -16px;
    margin-right: -16px;
    width: calc(100% + 32px);
    padding: 15px 12px;
    margin-top: 0;
  }
  .mobile-tab {
    padding: 6px 15px;
    font-size: 14px;
  }
  .board-columns {
    padding: 0;
    overflow-x: hidden;
    align-items: stretch;
  }
  .list-column {
    width: 100%;
    min-width: 100%;
    border-right: none;
  }
  .list-column.mobile-hidden { display: none !important; }
  .add-list-column {
    display: none;
  }
  .add-list-input-group {
    position: absolute;
    z-index: 10;
    width: calc(100% - 24px);
    min-width: auto;
    top: 8px;
    left: 12px;
    right: 12px;
  }
  #board-columns {
    position: relative;
  }
  #board-columns:has(.add-list-input-group)::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9;
  }
}

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  display: flex; flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  width: 100%;
}
.modal-card  { max-width: 820px; }
.modal-sm    { max-width: 440px; }
.modal-confirm { max-width: 400px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header { gap: 12px; }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex; align-items: center;
  background: var(--bg-hover);
  transition: background var(--duration), color var(--duration);
}
.modal-close:hover { background: var(--bg-active); color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Card modal ───────────────────────────────────────────────────── */
.card-modal-title-row {
  display: flex; align-items: center; gap: 8px; flex: 1;
}
.card-color-indicator {
  width: 12px; height: 12px; border-radius: 50%;
  flex-shrink: 0;
}
.card-color-indicator.green  { background: var(--priority-low); }
.card-color-indicator.yellow { background: var(--priority-medium); }
.card-color-indicator.red    { background: var(--priority-high); }

.card-title-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 16px; font-weight: 600;
  padding: 0;
  outline: none;
  color: var(--text-primary);
}
.card-title-input:focus { border-bottom: 1px solid var(--accent); }

.card-modal-body {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 24px;
  padding: 20px;
}
.card-modal-main { min-width: 0; }
.card-modal-sidebar {
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 0; align-self: flex-start;
}

.card-section { margin-bottom: 16px; }
.card-section-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 8px;
  margin-bottom: 8px;
}

.color-picker { display: flex; gap: 6px; }
.color-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--duration);
  background: var(--bg-hover);
  color: var(--text-muted);
}
.color-btn.active { border-color: var(--border-strong); }
.color-btn.color-green { background: var(--priority-low-bg); color: var(--priority-low); }
.color-btn.color-yellow { background: var(--priority-medium-bg); color: var(--priority-medium); }
.color-btn.color-red { background: var(--priority-high-bg); color: var(--priority-high); }

.card-content-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.card-tab {
  padding: 5px 12px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--duration), color var(--duration);
}
.card-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.card-tab.active { background: var(--bg-active); color: var(--text-primary); }

.textarea-wrapper { position: relative; }
.card-textarea {
  width: 100%;
  resize: vertical;
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-app);
}
.textarea-counter {
  position: absolute;
  bottom: 6px; right: 8px;
}
.ai-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.ai-preview {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ai-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-hover);
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.ai-preview-actions { display: flex; gap: 6px; }
.ai-preview-text {
  padding: 12px 14px;
  font-size: 13px; white-space: pre-wrap; line-height: 1.6;
}

/* AI suggested title */
.ai-preview-title-container {
  padding: 12px 14px 6px 14px;
}
.ai-preview-title {
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

/* Checklist diff */
.checklist-diff-list { padding: 8px 14px; display: flex; flex-direction: column; gap: 6px; }
.checklist-diff-item { display: flex; gap: 8px; font-size: 13px; }
.diff-old { color: var(--text-muted); text-decoration: line-through; flex: 1; }
.diff-arrow { color: var(--text-muted); }
.diff-new { color: var(--text-primary); flex: 1; }

/* Checklist items */
.checklist-header-row {
  display: flex; align-items: center; justify-content: flex-end;
  margin-bottom: 8px;
}
.checklist-items {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.checklist-items:empty { display: none; }
.checklist-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: var(--bg-hover); }
.checklist-item input[type="checkbox"] {
  width: 16px; height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.checklist-item-text {
  flex: 1; min-width: 0; font-size: 13px;
  overflow-wrap: break-word;
  word-break: break-word;
  transition: color var(--duration);
}
.checklist-item-text.checked { text-decoration: line-through; color: var(--text-muted); }
.checklist-item input[type="text"] {
  flex: 1; padding: 2px 6px; font-size: 13px;
  background: var(--bg-hover);
}
.checklist-item-del {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--duration), background var(--duration);
}
.checklist-item-del:hover {
  color: var(--priority-high);
  background: var(--priority-high-bg);
}
.checklist-item-edit {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--duration), background var(--duration);
}
.checklist-item-edit:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

/* Checklist drag handle */
.checklist-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 2px;
  user-select: none;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  line-height: 1;
  transition: color var(--duration);
  touch-action: none;
}
.checklist-drag-handle:hover {
  color: var(--text-secondary);
}
.checklist-item.dragging {
  opacity: 0.3;
}
.checklist-item.checklist-ghost {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
  border-radius: var(--radius-md);
  opacity: 0.95;
  background: var(--bg-card);
  transform: rotate(1deg);
  transition: none;
  pointer-events: none;
}
.checklist-ghost .checklist-drag-handle {
  cursor: grabbing;
}
.checklist-placeholder {
  background: var(--bg-hover) !important;
  border: 2px dashed var(--border-strong) !important;
  border-radius: var(--radius-sm);
  margin: 0;
  display: flex !important;
}

.checklist-add-row { display: flex; gap: 8px; align-items: center; }
.checklist-add-row .input-sm { flex: 1; }

.checklist-preview { margin-top: 12px; border: 1px solid var(--border-base); border-radius: var(--radius-md); overflow: hidden; }
.checklist-preview-list { padding: 8px 14px; }
.checklist-preview-list li { font-size: 13px; padding: 3px 0; display: flex; align-items: center; gap: 6px; }
.checklist-preview-list li::before { content: "☐"; color: var(--text-muted); }
.truncate-warning { font-size: 12px; color: var(--priority-medium); padding: 0 14px 10px; }

/* Labels / Tags */
.labels-container {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 32px;
  padding: 6px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
}
.label-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  opacity: 0.6;
  transition: all var(--duration);
  position: relative;
}
.label-chip:hover { opacity: 0.85; }
.label-chip.selected {
  opacity: 1;
  border: 1px solid var(--text-primary);
  box-shadow: 0 0 0 1px var(--text-primary);
}
.label-chip::after {
  content: '+';
  margin-left: 2px;
  font-size: 10px;
  opacity: 0.6;
}
.label-chip.selected::after {
  content: '✓';
}

/* Trash bin button — same style as "Add card" */
.btn-clear-trash-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  color: #cf222e;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration);
}
.btn-clear-trash-text:hover {
  background: rgba(207, 34, 46, 0.08);
}
.btn-clear-trash-text svg {
  flex-shrink: 0;
}
.btn-clear-trash {
  color: #cf222e;
  background: transparent;
}
.btn-clear-trash:hover {
  background: rgba(207, 34, 46, 0.08);
}

/* Dark mode trash button */
[data-theme="dark"] .btn-clear-trash-text,
:root:not([data-theme="light"]) .btn-clear-trash-text {
  color: #ff6b6b;
}
[data-theme="dark"] .btn-clear-trash-text:hover,
:root:not([data-theme="light"]) .btn-clear-trash-text:hover {
  background: rgba(255, 107, 107, 0.1);
}
[data-theme="dark"] .btn-clear-trash,
:root:not([data-theme="light"]) .btn-clear-trash {
  color: #ff6b6b;
}
[data-theme="dark"] .btn-clear-trash:hover,
:root:not([data-theme="light"]) .btn-clear-trash:hover {
  background: rgba(255, 107, 107, 0.1);
}

/* Attachments */
.attachments-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.attachment-thumb {
  width: 72px; height: 72px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
}
.attachment-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.attachment-thumb-content {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
}
.attachment-thumb-icon { color: var(--text-muted); }
.attachment-thumb-name {
  font-size: 9px; color: var(--text-muted);
  text-align: center; padding: 0 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%;
}
.attachment-delete {
  position: absolute; top: 2px; right: 2px;
  width: 15px; height: 15px;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  color: white;
  display: none; align-items: center; justify-content: center;
  font-size: 12px;
  padding-bottom: 3px;
}
.attachment-thumb:hover .attachment-delete { display: flex; }
.attachment-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px dashed var(--border-base);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px; cursor: pointer;
  transition: border-color var(--duration), color var(--duration);
}
.attachment-upload-btn:hover { border-color: var(--accent); color: var(--accent-text); }

/* Comments */
.comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.comment-item { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-date { font-size: 11px; color: var(--text-muted); }
.comment-text { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.comment-actions { display: flex; gap: 4px; margin-top: 4px; }
.comment-btn {
  font-size: 11px; color: var(--text-muted);
  padding: 2px 6px; border-radius: var(--radius-sm);
  transition: background var(--duration), color var(--duration);
}
.comment-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.comment-input-row {
  display: flex; gap: 8px; align-items: flex-start;
}
.comment-textarea {
  flex: 1; resize: none;
  font-size: 13px;
  background: var(--bg-app);
}

/* Card sidebar */
.card-meta-section { margin-bottom: 12px; }
.card-section-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-section-label-row .card-section-label { margin-bottom: 0; }
.btn-icon-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  transition: background var(--duration), color var(--duration);
  flex-shrink: 0;
}
.btn-icon-sm:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Notifications */
.notifications-list { display: flex; flex-direction: column; gap: 6px; }
.notification-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 12px;
}
.notification-item.inactive { opacity: 0.5; }
.notification-item-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notification-item-type { font-weight: 600; color: var(--text-primary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.notification-item-detail { color: var(--text-secondary); }
.notification-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.notification-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.notification-form .form-group { margin-bottom: 0; }

/* Notification channels */
.notif-channels { display: flex; flex-direction: column; gap: 4px; }
.notif-channel-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer; padding: 2px 0;
}
.notif-channel-label input[type="checkbox"] { accent-color: var(--accent); }

/* Cron builder rows */
.cron-hours-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}
.cron-hour-chip {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-muted);
  padding: 2px 4px; border-radius: 4px;
  cursor: pointer; user-select: none;
}
.cron-hour-chip input[type="checkbox"] {
  margin: 0; accent-color: var(--accent);
}
.cron-hour-chip.checked {
  background: var(--bg-hover);
}
.cron-btn {
  color: var(--text-base) !important;
}

/* History panel */
.card-history-panel { margin-top: 4px; }
.card-history-entry {
  font-size: 12px; color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; flex-direction: row; align-items: center; gap: 6px; flex-wrap: wrap;
}
.card-history-entry:last-child { border-bottom: none; }
.card-history-action { font-weight: 500; color: var(--text-primary); }
.card-history-user { color: var(--accent); font-size: 11px; font-weight: 500; }
.card-history-meta { color: var(--text-muted); font-size: 11px; margin-left: auto; }

/* Deadline field */
.deadline-field {
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  padding: 4px 5px;
  background: var(--bg-input, var(--bg-card));
  border: 1px solid var(--border-base);
}
#card-deadline-input {
  background: transparent;
  border: none;
}
.deadline-icon { color: var(--accent); flex-shrink: 0; }
.deadline-input {
  border: none; background: transparent; outline: none;
  font-size: 13px; color: var(--text-primary);
  flex: 1; min-width: 0;
}
.deadline-clear {
  border: none;
  background: var(--bg-hover);
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration);
  width: 24px;
  height: 24px;
}
.deadline-clear:hover {
  color: var(--priority-high);
  background: var(--priority-high-bg);
}
.deadline-clear.hidden {
  display: none !important;
}

/* Label color picker in modal */
.label-add-section { display: flex; flex-direction: column; gap: 8px; }
.label-color-picker {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0;
}
.label-color-dot {
  width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; flex-shrink: 0;
  border: 2px solid transparent;
  transition: transform 120ms, border-color 120ms;
}
.label-color-dot:hover { transform: scale(1.15); }
.label-color-dot.active { border-color: var(--text-primary); transform: scale(1.15); }

/* Card labels on board - ensure visibility and spacing */
.kanban-card .card-labels { margin-top: 5px; }

/* Cron builder */
.cron-builder { display: flex; flex-direction: column; gap: 8px; }
.cron-days-row { display: flex; flex-direction: column; gap: 4px; }
.cron-day-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.cron-day-btn {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border-base);
  border-radius: var(--radius-md);
  background: var(--bg-hover); color: var(--text-secondary);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all 120ms;
}
.cron-day-btn:hover { border-color: var(--accent); color: var(--accent); }
.cron-day-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.cron-time-row { display: flex; flex-direction: column; gap: 4px; }
.cron-time-inputs { display: flex; align-items: center; gap: 4px; }
.cron-time-sel { width: 68px; }
.cron-colon { font-weight: 700; font-size: 15px; color: var(--text-secondary); }
.cron-preview {
  font-size: 12px; color: var(--accent-text);
  background: var(--accent-muted);
  border-radius: var(--radius-sm);
  padding: 5px 8px; margin-top: 2px;
  min-height: 28px;
  font-style: italic;
}

/* Label management modal */
.label-manager-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.label-manager-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
.label-color-swatch { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.label-color-swatch.editable { width: 20px; height: 20px; cursor: pointer; transition: transform 120ms; }
.label-color-swatch.editable:hover { transform: scale(1.2); }
.label-manager-input { flex: 1; font-size: 13px; padding: 4px 6px; border: 1px solid var(--border-base); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-primary); outline: none; }
.label-manager-input:focus { border-color: var(--accent); }
.label-manager-name { flex: 1; font-size: 13px; }
.label-manager-actions { display: flex; gap: 4px; }
.label-add-row { display: flex; gap: 8px; align-items: center; }
.label-color-input { width: 36px; height: 30px; padding: 2px; border-radius: var(--radius-md); border: 1px solid var(--border-base); cursor: pointer; }
.card-meta-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.card-meta-value { font-size: 13px; color: var(--text-secondary); }
.card-meta-input { font-size: 13px; color: var(--text-secondary); background: transparent; border: none; border-bottom: 1px dashed var(--border); padding: 2px 0; width: 100%; outline: none; cursor: text; }
.card-meta-input:focus { border-bottom-color: var(--accent); color: var(--text-primary); }
.card-creator-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

@media (max-width: 640px) {
  .card-modal-body { grid-template-columns: 1fr; }
  .card-modal-sidebar { flex-direction: row; flex-wrap: wrap; }
}

/* ── Bottom sheet drag handle ────────────────────────────────────── */
.bottom-sheet-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--border-base);
  margin: 8px auto 0;
  flex-shrink: 0;
}

/* ── Bottom sheet (mobile card modal) ────────────────────────────── */
@media (max-width: 768px) {
  #modal-card.modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  #modal-card .modal-card {
    max-width: 100%;
    max-height: 92vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    animation: slide-in-up 220ms var(--ease-ui) both;
  }
}

@keyframes slide-in-up {
  from { transform: translateY(100%); opacity: 0.8; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Admin ────────────────────────────────────────────────────────── */
.admin-layout { display: flex; flex-direction: column; gap: 20px; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0; }
.admin-tab {
  padding: 8px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color var(--duration), border-color var(--duration);
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.settings-form { max-width: 480px; }
.settings-form h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; margin-top: 8px; color: var(--text-secondary); }
.settings-form h3:first-child { margin-top: 0; }

.admin-users-header { margin-bottom: 16px; }
.admin-users-list { display: flex; flex-direction: column; gap: 8px; }
.admin-user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.admin-user-info { flex: 1; }
.admin-user-name { font-weight: 500; font-size: 14px; }
.admin-user-meta { font-size: 12px; color: var(--text-muted); }
.admin-user-role {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.admin-user-role.admin { background: var(--accent-muted); color: var(--accent-text); }
.admin-user-actions { display: flex; gap: 4px; }

/* ── User menu popup ──────────────────────────────────────────────── */
.user-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px;
  z-index: 200;
  min-width: 160px;
}
.user-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  width: 100%;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--duration), color var(--duration);
}
.user-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.user-menu-danger:hover { background: var(--priority-high-bg); color: var(--priority-high); }
.user-menu-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ── Toast ────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 300;
}
@media(min-width:769px) { .toast-container { bottom: 24px; } }
@media(max-width:768px) { .toast-container { top: 24px; } }
.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex; align-items: center; gap: 8px;
  animation: slideInUp 200ms var(--ease-ui);
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--priority-low); }
.toast.error   { border-left: 3px solid var(--priority-high); }
.toast.info    { border-left: 3px solid var(--accent); }

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

/* ── Profile ──────────────────────────────────────────────────────── */
.profile-avatar-section {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px;
}
.avatar-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.avatar-preset-option {
  width: 52px; height: 52px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color var(--duration), transform var(--duration);
  object-fit: cover;
}
.avatar-preset-option:hover {
  border-color: var(--accent);
  transform: scale(1.1);
}

/* ── Members ──────────────────────────────────────────────────────── */
#members-list-body { display: flex; flex-direction: column; gap: 8px; }
.member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.member-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; }

/* ── Confirm modal ────────────────────────────────────────────────── */
.modal-confirm .modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-confirm p { font-size: 14px; color: var(--text-secondary); }
.confirm-name {
  background: var(--bg-active);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-family: monospace;
  font-size: 13px;
  color: var(--text-primary);
  font-style: normal;
}

/* ── AI disabled state ───────────────────────────────────────────── */
.ai-disabled { opacity: 0.4; cursor: not-allowed !important; }
.ai-disabled:hover { background: transparent !important; }

/* ── WebSocket — List lock indicator ─────────────────────────────── */
.list-column.list--locked { border-color: var(--accent); opacity: 0.75; }
.list-lock-badge {
  font-size: 11px;
  color: var(--accent-text);
  background: var(--accent-muted);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  margin-left: 4px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

/* ── Tag Filter ──────────────────────────────────────────────────── */
#modal-tag-filter {
  z-index: 200;
}

.btn-tag-filter.active {
  color: var(--accent);
  background: var(--accent-muted);
}

.tag-filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.tag-filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--duration);
  user-select: none;
  max-width: calc(100% - 10px);
}
.tag-filter-option:hover {
  background: var(--bg-hover);
}
.tag-filter-option.selected {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.tag-filter-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.tag-filter-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* ── Manage Lists Modal ─────────────────────────────────────────── */
.manage-lists-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px 0;
}

.manage-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  transition: background var(--duration), border-color var(--duration);
  user-select: none;
}
.manage-list-item:hover {
  background: var(--bg-hover);
}
.manage-list-item.dragging {
  opacity: 0.3;
}
.manage-list-item.manage-list-ghost {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
  border-radius: var(--radius-md);
  opacity: 0.95;
  background: var(--bg-card);
  transform: rotate(1deg);
  transition: none;
  pointer-events: none;
  position: fixed;
  z-index: 10000;
}
.manage-list-ghost .manage-list-drag-handle {
  cursor: grabbing;
}
.manage-list-placeholder {
  background: var(--bg-hover) !important;
  border: 2px dashed var(--border-strong) !important;
  border-radius: var(--radius-sm);
  display: flex !important;
}

.manage-list-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 4px 0 0;
  user-select: none;
  flex-shrink: 0;
  touch-action: none;
  transition: color var(--duration);
  line-height: 1;
}
.manage-list-drag-handle:hover {
  color: var(--text-secondary);
}

.manage-list-name {
  flex: 1;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-list-name-input {
  flex: 1;
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  outline: none;
}

.manage-list-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.manage-list-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--duration), color var(--duration);
  flex-shrink: 0;
}
.manage-list-btn:hover {
  background: var(--bg-hover);
}
.manage-list-btn.rename:hover {
  color: var(--accent);
}
.manage-list-btn.delete:hover {
  color: var(--priority-high);
  background: var(--priority-high-bg);
}

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-base); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
