:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f9fbff;
  --muted: #6b7280;
  --text: #111827;
  --accent: #2563eb;
  --danger: #e11d48;
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  --radius: 16px;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(900px 420px at 10% -10%, #eef2ff 0, rgba(238, 242, 255, 0) 55%),
    radial-gradient(900px 420px at 110% -10%, #e0f2fe 0, rgba(224, 242, 254, 0) 55%), var(--bg);
}
header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(
    0deg,
    rgba(246, 248, 251, 0),
    rgba(246, 248, 251, 0.9) 30%,
    rgba(246, 248, 251, 0.98)
  );
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e5e7eb;
}
.bar {
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 12px;
  align-items: center;
}
h1 {
  font-size: 24px;
  margin: 0;
  letter-spacing: 0.2px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
}
h1 .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  display: inline-block;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.actions button,
.actions label.btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
  background: linear-gradient(180deg, #f3f6fb, #e9eef7);
  box-shadow: var(--shadow);
  font-family: inherit;
  text-decoration: none;
  outline: none;
}
.actions button:hover,
.actions label.btn:hover,
.actions button:focus,
.actions label.btn:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}
.search {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: var(--text);
  outline: none;
}
.search:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}
.search-hint {
  min-height: 18px; /* reserve space to avoid layout shift */
  text-align: center;
  font-size: 12px;
  padding-top: 6px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 120ms ease;
  overflow: hidden; /* clip wiggle to avoid horizontal scrollbar */
}
.search-hint.visible {
  opacity: 0.9;
}
.search-hint-inner {
  display: inline-block;
  will-change: transform;
}
@keyframes searchHintWiggle {
  0% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}
.search-hint-inner.wiggle {
  animation: searchHintWiggle 280ms ease;
}
.search-wrap {
  position: relative;
  width: 100%;
}
.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #6b7280;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.search-clear:hover,
.search-clear:focus {
  background: rgba(37, 99, 235, 0.08);
  outline: none;
}
.search.has-clear {
  padding-right: 36px;
}
[data-theme="dark"] .search-clear {
  color: #a1a1aa;
}
[data-theme="dark"] .search-clear:hover,
[data-theme="dark"] .search-clear:focus {
  background: rgba(255, 255, 255, 0.06);
}

/* Board */
.wrap {
  max-width: 1600px;
  margin: 22px auto;
  padding: 0 18px 80px;
}
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1280px) {
  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .board {
    grid-template-columns: 1fr;
  }
}
.col {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.col header {
  border-bottom: 1px solid #eef2f7;
}
.col h2 {
  font-size: 18px;
  margin: 0;
  padding: 10px 12px;
  letter-spacing: 0.2px;
  color: var(--text);
  font-weight: 650;
  text-align: center;
}
.list {
  list-style: none;
  margin: 0;
  padding: 10px;

  /* Fix bug that stretches cards to fill the column */
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
    /* Fix "dragging a card to open column area" bug, stretch list to fill the column */
  flex: 1 1 auto;


}

.card {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  cursor: grab;
}
.card:active {
  cursor: grabbing;
}
.card .icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f5f9;
  display: grid;
  place-items: center;
}
.card .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card .card-link-area {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.card .card-link-area:hover .title {
  text-decoration: underline;
}
.card .title {
  color: var(--text);
  font-weight: 600;
}
.card .meta {
  color: var(--muted);
  font-size: 12px;
}
.card .buttons {
  display: flex;
  gap: 6px;
}
.btn-icon {
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #64748b;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
}
.btn-icon:hover,
.btn-icon:focus {
  color: var(--text);
  border-color: #cbd5e1;
  outline: 2px solid rgba(37, 99, 235, 0.18);
}

.empty {
  opacity: 0.7;
  text-align: center;
  font-size: 13px;
  padding: 14px 10px 18px;
  color: #6b7280;
  pointer-events: none;
}

/* Dialog */
dialog {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 0;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: 560px;
  width: 96vw;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(4px);
}
.dlg-head {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dlg-head h3 {
  margin: 0;
  font-size: 16px;
}
.dlg-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}
.row {
  display: grid;
  gap: 6px;
}
label {
  font-size: 12px;
  color: var(--muted);
}
input[type="text"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: var(--text);
  outline: none;
}
input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}
textarea {
  min-height: 80px;
  resize: vertical;
}
.dlg-foot {
  padding: 14px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.pill {
  border-radius: 999px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #eff6ff, #e0ecff);
  color: var(--text);
  border: 1px solid #dbeafe;
  cursor: pointer;
  outline: none;
}
.pill:hover,
.pill:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}
.pill.alt {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}
.pill.danger {
  background: linear-gradient(180deg, #fee2e2, #fecaca);
  color: #7f1d1d;
  border: 1px solid #fecaca;
}
.pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}
.kbd {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
}

/* Bottom Actions */
.bottom-actions {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  margin-bottom: 20px;
}
.bottom-actions button,
.bottom-actions label.btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
  background: linear-gradient(180deg, #f3f6fb, #e9eef7);
  box-shadow: var(--shadow);
  font-family: inherit;
  text-decoration: none;
  outline: none;
}
.bottom-actions button:hover,
.bottom-actions label.btn:hover,
.bottom-actions button:focus,
.bottom-actions label.btn:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}

/* Shared danger button styles */
.actions button.danger,
.bottom-actions button.danger {
  background: linear-gradient(180deg, #ffe4e6, #fecaca);
  color: #7f1d1d;
  border-color: #fecaca;
}

/* Column Manager */
.cols-list {
  display: grid;
  gap: 10px;
}
.colmgr-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}
.colmgr-row .order {
  width: 80px;
  display: flex;
  gap: 6px;
}
.colmgr-row input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: var(--text);
  outline: none;
}
.colmgr-row input[type="text"]:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}
.colmgr-actions {
  display: flex;
  gap: 6px;
}
.colmgr-hint {
  margin-top: 6px;
}

/* ——— Dark theme (Neutral Glass, no blue) ——— */
[data-theme="dark"] {
  --bg: #222222; /* page background */
  --panel: #1f1f1f; /* main cards/panels */
  --panel-2: #1a1a1a; /* subdued surfaces */
  --text: #e9e9e9;
  --muted: #b8b8b8;
  --accent: #f3f3f3; /* neutral highlight */
  --danger: #f2b8b5;
  --border: #303030;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}
[data-theme="dark"] header {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.045),
    rgba(255, 255, 255, 0.02) 60%,
    rgba(0, 0, 0, 0.05)
  );
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .col {
  border-color: var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02));
  color: var(--text);
}
/* Dark theme - dialog with lighter colors to match column appearance */
[data-theme="dark"] dialog {
  background: linear-gradient(180deg, #2a2a2a, #282828);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
}
[data-theme="dark"] .col header {
  border-bottom: 1px solid var(--border);
  background: none;
}
[data-theme="dark"] .card,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
/* Style select dropdown options in dark mode */
[data-theme="dark"] select option {
  background: #2a2a2a;
  color: var(--text);
}
[data-theme="dark"] select option:hover,
[data-theme="dark"] select option:checked {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
}
/* Better focus state for select in dark mode */
[data-theme="dark"] select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}
[data-theme="dark"] .card .icon {
  background: #181818;
}
[data-theme="dark"] .btn-icon {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  color: #cfcfcf;
}
[data-theme="dark"] .btn-icon:hover {
  color: var(--text);
  border-color: #3a3a3a;
}
[data-theme="dark"] .actions button,
[data-theme="dark"] .actions label.btn,
[data-theme="dark"] .bottom-actions button,
[data-theme="dark"] .bottom-actions label.btn,
[data-theme="dark"] .pill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
  font-family: inherit;
  text-decoration: none;
}
/* Shared danger styles in dark mode */
[data-theme="dark"] .pill.danger,
[data-theme="dark"] .actions button.danger,
[data-theme="dark"] .bottom-actions button.danger {
  background: linear-gradient(180deg, rgba(255, 64, 64, 0.18), rgba(64, 0, 0, 0.08));
  color: #ffdada;
  border-color: #5a1d1d;
}
[data-theme="dark"] .pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
[data-theme="dark"] .search {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  color: var(--text);
}
[data-theme="dark"] .hint {
  color: var(--muted);
}
[data-theme="dark"] .kbd {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  color: var(--text);
}
[data-theme="dark"] .card .title {
  color: var(--text);
}
[data-theme="dark"] .card .meta {
  color: var(--muted);
}
/* Modal header/footer dividers in dark mode */
[data-theme="dark"] .dlg-head,
[data-theme="dark"] .dlg-foot {
  border-color: var(--border);
}

/* Loading indicator */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.3s ease;
}
#loading.loaded {
  opacity: 0;
  pointer-events: none;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(37, 99, 235, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
[data-theme="dark"] #loading {
  background: var(--bg);
}
[data-theme="dark"] .loading-spinner {
  border-color: rgba(243, 243, 243, 0.1);
  border-top-color: var(--accent);
}


