:root {
  --bg: #efefec;
  --surface: #e6e5df;
  --card: #f3f3f1;
  --stroke: #c8c7c1;
  --text: #202225;
  --muted: #6a6c68;
  --brand: #2566ab;
  --green: #159a69;
  --blue: #3d87d5;
  --orange: #e59f2f;
  --olive: #689d20;
  --danger: #d9504b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  padding: 34px 38px 28px;
  max-width: 1540px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

h1 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1;
}

.brand-heading {
  display: inline-flex;
  align-items: center;
  gap: 0;
  line-height: 1;
}

.app-logo {
  display: block;
  width: auto;
  height: 96px;
  max-width: min(48vw, 461px);
  object-fit: contain;
}

.header-actions {
  display: flex;
  gap: 14px;
}

button {
  font: inherit;
  border: 1px solid var(--stroke);
  cursor: pointer;
}

.outline-btn,
.solid-btn {
  border-radius: 18px;
  padding: 14px 30px;
  font-weight: 700;
  font-size: 0.92rem;
}

.outline-btn {
  background: transparent;
  color: var(--text);
}

.outline-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.solid-btn {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.danger-btn {
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff2f1;
  color: #a9302d;
  border-color: #e5a4a1;
  font-weight: 600;
}

.danger-btn:hover {
  background: #ffe7e5;
}

.text-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 600;
  padding: 4px;
}

.view-menu {
  display: inline-flex;
  gap: 8px;
  border: 1px solid var(--stroke);
  background: #f4f4f2;
  border-radius: 999px;
  padding: 5px;
  margin-bottom: 16px;
}

.menu-btn {
  border: none;
  background: transparent;
  color: #4e514d;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 14px;
}

.menu-btn.active {
  background: #ffffff;
  color: #212325;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 24px 28px;
}

.stat-card h3 {
  margin: 0;
  font-size: 2.1rem;
  line-height: 1.06;
}

.stat-card .label {
  margin-top: 4px;
  font-weight: 600;
  font-size: 1.35rem;
}

.stat-card .desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.desc.active {
  color: var(--green);
}

.project-tabs {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.project-pill {
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: #f4f4f2;
  color: #404240;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 9px 20px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.project-pill.selected {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.project-pill[draggable="true"] {
  cursor: grab;
}

.project-pill.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.project-pill.drop-before {
  box-shadow: inset 3px 0 0 var(--brand);
}

.project-pill.drop-after {
  box-shadow: inset -3px 0 0 var(--brand);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot.active {
  background: var(--green);
}

.dot.planning {
  background: #92968d;
}

.dot.on_hold {
  background: var(--orange);
}

.dot.completed {
  background: var(--olive);
}

.project-line {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.status-word {
  font-weight: 700;
}

.status-word.active {
  color: var(--green);
}

.status-word.planning {
  color: #6f7268;
}

.status-word.on_hold {
  color: #ba6a1c;
}

.status-word.completed {
  color: #4b7d1b;
}

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

.compact-btn {
  border-radius: 999px;
  padding: 7px 16px;
  background: transparent;
  font-weight: 600;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(270px, 1fr));
  gap: 18px;
}

.data-tools {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.data-tools-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mini-btn {
  border: 1px solid var(--stroke);
  background: #f5f5f3;
  color: #3a3d3a;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mini-select {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: #fdfdfc;
  color: #3a3d3a;
  padding: 4px 10px;
  font-size: 0.78rem;
  max-width: 220px;
}

.backup-status {
  color: var(--muted);
  font-size: 0.76rem;
  min-height: 16px;
}

.board-col {
  background: var(--surface);
  border-radius: 18px;
  padding: 20px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.col-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.count-pill {
  border: 1px solid var(--stroke);
  background: #f4f4f2;
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.tasks {
  display: grid;
  gap: 12px;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.task-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 16px;
}

.task-card[draggable="true"] {
  cursor: grab;
}

.task-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.task-card.drop-before {
  border-top: 3px solid var(--brand);
}

.task-card.drop-after {
  border-bottom: 3px solid var(--brand);
}

.tasks.drop-column {
  outline: 2px dashed #8eaed8;
  outline-offset: 4px;
  border-radius: 14px;
}

.task-card h4 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.05;
}

.task-desc {
  margin: 10px 0;
  color: #414340;
  font-size: 0.95rem;
  line-height: 1.35;
}

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

.type-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.type-task {
  background: #cde5db;
  color: #166d52;
}

.type-feat {
  background: #d7d7f3;
  color: #5655b8;
}

.type-bug {
  background: #efd4d0;
  color: #9b3e39;
}

.type-chore {
  background: #ebe9ce;
  color: #6d6b1a;
}

.priority {
  color: #5f625e;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.priority-dot.low {
  background: #52b856;
}

.priority-dot.medium {
  background: var(--orange);
}

.priority-dot.high {
  background: var(--danger);
}

.task-progress {
  margin-top: 10px;
}

.bar {
  height: 6px;
  width: 100%;
  border-radius: 10px;
  background: #c8c7c3;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 10px;
  background: var(--brand);
}

.progress-label {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 600;
}

.progress-detail {
  margin-top: 4px;
  color: #585b58;
  font-size: 0.84rem;
}

.task-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.link-btn {
  border: 1px solid var(--stroke);
  background: transparent;
  border-radius: 11px;
  padding: 4px 10px;
  font-weight: 600;
  color: #454845;
}

.add-task-col {
  border-radius: 14px;
  border: 1px solid #adaca6;
  background: transparent;
  padding: 10px;
  font-size: 0.92rem;
  font-weight: 600;
}

.modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  width: min(740px, calc(100vw - 24px));
  background: #f8f8f5;
}

.modal::backdrop {
  background: rgba(8, 13, 18, 0.4);
}

.modal-content {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h2 {
  margin: 0;
}

label {
  display: grid;
  gap: 6px;
  color: #565955;
  font-weight: 600;
}

input,
textarea,
select {
  border: 1px solid var(--stroke);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.danger-note {
  margin: 0;
  border: 1px solid #e5a4a1;
  background: #fff4f3;
  color: #7d2d2a;
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.4;
}

.error-text {
  min-height: 20px;
  color: #b12a24;
  font-weight: 600;
}

.action-right {
  display: flex;
  gap: 10px;
}

@media (max-width: 1250px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }

  .board-grid {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }

  h1 {
    font-size: 2rem;
  }

  .app-logo {
    height: 80px;
    max-width: min(52vw, 374px);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px;
  }

  .header {
    flex-direction: column;
    gap: 14px;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
  }

  .outline-btn,
  .solid-btn {
    width: 100%;
  }

  .stats-grid,
  .board-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .data-tools {
    justify-content: flex-start;
  }
}
