:root {
  --bg: #0f0f11;
  --bg-2: #17171b;
  --bg-3: #1f1f25;
  --ink: #f4f2ef;
  --muted: #9a9690;
  --line: #2c2c34;
  --card: #f7f5f1;
  --card-ink: #1a1816;
  --card-muted: #6b6560;
  --accent: #ff0033;
  --accent-soft: rgba(255, 0, 51, 0.16);
  --warn: #f5a524;
  --ok: #c8f04d;
  --display: "Oswald", sans-serif;
  --body: "Outfit", sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -12%, var(--accent-soft), transparent 55%),
    radial-gradient(700px 380px at 92% 0%, rgba(200, 240, 77, 0.05), transparent 50%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, textarea, select { font: inherit; color: inherit; }

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 5px;
  border-style: solid;
  border-width: 5px 0 5px 9px;
  border-color: transparent transparent transparent #fff;
}

.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.brand em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.top-search {
  flex: 1;
  min-width: 160px;
  max-width: 320px;
}

.top-search input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-3);
  border-radius: 999px;
  padding: 9px 14px;
  outline: none;
}

.top-search input:focus { border-color: color-mix(in srgb, var(--accent) 55%, #555); }

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
}

.ghost, .primary, .danger, .icon-btn, .file-btn, .seg-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ghost:hover, .file-btn:hover, .seg-btn:hover { border-color: #4a4a52; background: rgba(255,255,255,0.04); }

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.primary:hover { filter: brightness(1.06); }
.primary.block, .ghost.block { width: 100%; justify-content: center; margin-top: 8px; }
.ghost.tiny { padding: 4px 10px; font-size: 12px; }

.danger {
  border-color: #7a1f2e;
  color: #ff7a90;
}

.danger:hover { background: rgba(255, 0, 51, 0.1); }

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.seg-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 12px;
}

.seg-btn.on {
  background: var(--accent);
  color: #fff;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px 4px;
}

.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  color: var(--muted);
}

.stat b { color: var(--ink); font-weight: 600; }
.stat.accent b { color: var(--accent); }

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

.filters select {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 7px 12px;
  outline: none;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.board,
.calendar {
  flex: 1;
}

.board[hidden],
.calendar[hidden] {
  display: none !important;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: 12px;
  padding: 12px 18px 28px;
  overflow-x: auto;
  align-content: start;
}

.column {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 460px;
  display: flex;
  flex-direction: column;
  min-width: 260px;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.column-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.column-head .count {
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  padding: 3px 8px;
}

.column-body {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.column-body.drag-over {
  background: rgba(255, 0, 51, 0.06);
  outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: -6px;
  border-radius: 14px;
}

.column-empty {
  margin: 12px 4px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 22px 10px;
}

.card {
  background: var(--card);
  color: var(--card-ink);
  border-radius: 14px;
  padding: 12px;
  cursor: grab;
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
  display: grid;
  gap: 8px;
}

.card:hover { border-color: rgba(0,0,0,0.08); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.5; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.prio {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ebe7e0;
  color: #5a554f;
}

.prio.high { background: #ffe0e6; color: #b00020; }
.prio.med { background: #fff0d6; color: #8a5a00; }
.prio.low { background: #ebe7e0; color: #5a554f; }

.card p {
  margin: 0;
  font-size: 12px;
  color: var(--card-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ebe7e0;
  color: #4a4540;
}

.chip.format { background: #1a1a1e; color: #f4f2ef; }
.chip.date { background: #e8f0ff; color: #1a3a6b; }
.chip.check { background: #e8f8d8; color: #3a5a10; }

.progress {
  height: 3px;
  background: #e5e1da;
  border-radius: 99px;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

/* Calendar */
.calendar {
  padding: 12px 18px 28px;
  overflow: auto;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  min-width: 720px;
}

.cal-head {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
}

.cal-day {
  min-height: 110px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-day.muted { opacity: 0.45; }
.cal-day.today { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }

.cal-day .num {
  font-size: 12px;
  color: var(--muted);
}

.cal-pill {
  border: 0;
  border-radius: 8px;
  background: var(--card);
  color: var(--card-ink);
  padding: 6px 8px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  line-height: 1.25;
}

.cal-pill:hover { filter: brightness(0.97); }

.cal-empty {
  color: var(--muted);
  padding: 40px;
  text-align: center;
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  justify-content: flex-end;
  z-index: 50;
}

.drawer-backdrop[hidden] { display: none; }

.drawer {
  width: min(560px, 100%);
  height: 100%;
  background: #16161a;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer.narrow { width: min(420px, 100%); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 22px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.on {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.drawer-body {
  padding: 16px 18px 24px;
  overflow: auto;
  display: grid;
  gap: 12px;
  flex: 1;
}

.tab-panel { display: none; gap: 12px; }
.tab-panel.on { display: grid; }

.drawer-body label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.drawer-body input,
.drawer-body textarea,
.drawer-body select {
  width: 100%;
  border: 1px solid var(--line);
  background: #101014;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
}

.drawer-body input:focus,
.drawer-body textarea:focus,
.drawer-body select:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, #666);
}

.drawer-body textarea {
  resize: vertical;
  line-height: 1.45;
}

.hint { font-size: 11px; color: #6f6b66; }

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

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: #16161a;
}

.spacer { flex: 1; }

.checklist-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #101014;
}

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

.checklist-head strong {
  font-size: 13px;
  color: var(--ink);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.checklist li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.checklist li input[type="text"] {
  padding: 7px 10px;
  border-radius: 8px;
}

.checklist .x {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
}

.col-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.col-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  background: #101014;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}

.col-item .grip {
  cursor: grab;
  color: var(--muted);
  padding: 0 4px;
  user-select: none;
}

.col-item input {
  border: 1px solid var(--line);
  background: #16161a;
  border-radius: 8px;
  padding: 8px 10px;
}

@media (max-width: 900px) {
  .top-search { order: 3; max-width: none; flex: 1 1 100%; }
  .row-2 { grid-template-columns: 1fr; }
  .board { grid-auto-columns: minmax(260px, 82vw); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
