/* ------------ CSS Variables ------------ */
:root {
  --bg: #f4f7ff;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #635fc7;
  --primary-contrast: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,.06);

  --blue: #635fc7;
  --purple: #a855f7;
  --green: #10b981;

  --sidebar-bg: #ffffff;
  --sidebar-border: #e5e7eb;
  --overlay: rgba(0,0,0,.5);
}

html[data-theme="dark"] {
  --bg: #20212c;
  --surface: #2b2c37;
  --surface-elevated: #2b2c37;
  --text: #ffffff;
  --text-muted: #a3a6b1;
  --border: #3e3f4e;
  --primary: #635fc7;
  --primary-contrast: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,.3);

  --sidebar-bg: #2b2c37;
  --sidebar-border: #3e3f4e;
  --overlay: rgba(0,0,0,.7);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ------------ Sidebar ------------ */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-bars {
  letter-spacing: 2px;
  color: var(--primary);
}

.boards-title {
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.board {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
}

.board.active {
  background: var(--primary);
  color: var(--primary-contrast);
}

.bottom-controls {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}
.switch input { display: none; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--primary);
  transition: .2s;
  border-radius: 999px;
}
.slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background: var(--primary-contrast);
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider:before {
  transform: translateX(22px);
}

.hide-sidebar,
.show-sidebar {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 0;
}

.show-sidebar {
  position: fixed;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 20;
  background: var(--primary);
  color: var(--primary-contrast);
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

/* ------------ Main ------------ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
}
.btn.primary {
  background: var(--primary);
  color: var(--primary-contrast);
}
.btn.block { width: 100%; }

.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 24px;
  min-height: calc(100vh - 88px);
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  font-size: 0.75rem;
  margin-bottom: 16px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-blue { background: var(--blue); }
.dot-purple { background: var(--purple); }
.dot-green { background: var(--green); }

.tasks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100px;
}

.task {
  background: var(--surface-elevated);
  color: var(--text);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 14px 12px;
  cursor: grab;
}
.task:active { cursor: grabbing; }

.task-title {
  font-weight: 600;
}

.task.dragging {
  opacity: .5;
}

.tasks.drag-over {
  outline: 2px dashed var(--primary);
  border-radius: 6px;
  padding: 10px;
}

/* ------------ Modal ------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(1px);
  z-index: 50;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  width: 90%;
  max-width: 520px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 60;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
input[type="text"],
textarea,
select {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  font-size: 0.9rem;
  color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }

.select-wrapper {
  position: relative;
}
.select-wrapper select { width: 100%; appearance: none; }
.select-wrapper .chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.btn.delete {
  background: #ea5555;
  color: #fff;
}

.btn.delete:hover {
  background: #ff6b6b;
}

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

/* ------------ Responsive ------------ */
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
}
