:root {
  --bg: #0f172a;
  --panel: #111827;
  --surface: #0b1221;
  --border: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #a855f7;
  --card: #0f1628;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08), transparent 25%),
              radial-gradient(circle at 80% 0%, rgba(168, 85, 247, 0.1), transparent 25%),
              var(--bg);
}

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

body {
  margin: 0;
  min-height: 100vh;
}

.app {
  /* max-width: 1400px; */
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.8), rgba(17, 24, 39, 0.8));
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-wordmark {
  width: 140px;
  max-width: 100%;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.4));
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar select,
.toolbar input[type="search"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  min-width: 180px;
}

.toolbar input[type="search"] {
  min-width: 220px;
}

.toolbar button {
  padding: 10px 12px;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

button:active {
  transform: translateY(0);
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1221;
  border: none;
  font-weight: 700;
}

.ghost {
  background: transparent;
}

.btn-edit {
  background: transparent;
  padding: 10px 16px;
}

.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.board-meta {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.meta-card {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 16px;
  border-radius: 14px;
}

.meta-label {
  color: var(--muted);
  font-size: 13px;
}

.meta-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 6px;
}

.board {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-behavior: smooth;
}

.board::-webkit-scrollbar {
  height: 8px;
}

.board::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 999px;
}

.column {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 320px;
  min-width: 320px;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.column-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.card:active {
  cursor: grabbing;
}

.card-title {
  font-weight: 700;
}

.card-desc {
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.md p {
  margin: 0 0 8px 0;
}

.md ul,
.md ol {
  margin: 0 0 8px 18px;
  padding: 0 0 0 12px;
}

.md code {
  background: rgba(148, 163, 184, 0.2);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
}

.md pre {
  background: rgba(148, 163, 184, 0.15);
  padding: 8px 10px;
  border-radius: 10px;
  overflow: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: rgba(168, 85, 247, 0.1);
  color: var(--accent-2);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.badge {
  padding: 4px 8px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge.low {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.badge.medium {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.badge.high {
  background: rgba(239, 68, 68, 0.18);
  color: var(--danger);
}

.add-card-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
}

.add-card-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.column.drop-target {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 10;
}

.modal.hidden {
  display: none;
}
.hidden {
  display: none !important;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  width: min(640px, 100%);
  box-shadow: var(--shadow);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-wide {
  width: min(960px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}

textarea {
  resize: vertical;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

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

.modal-actions .actions-right {
  display: flex;
  gap: 8px;
}

.column-actions {
  display: flex;
  gap: 6px;
}

.muted {
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
}

.detail-body {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
}

.detail-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 70vh;
  padding-right: 6px;
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.detail-value {
  margin-top: 6px;
  color: var(--text);
}

@media (max-width: 768px) {
  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar select,
  .toolbar input[type="search"],
  .toolbar button {
    width: 100%;
  }

  .board {
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}
