:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(18, 27, 43, 0.72);
  --panel-strong: rgba(26, 38, 59, 0.86);
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.32);
  --ink: #edf4ff;
  --muted: #91a1b8;
  --accent: #2ea6ff;
  --accent-2: #8b5cf6;
  --new: #60a5fa;
  --active: #f59e0b;
  --done: #22c55e;
  --low: #22c55e;
  --medium: #facc15;
  --high: #ef4444;
  --danger: #fb7185;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(46, 166, 255, 0.18), transparent 34rem),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.16), transparent 30rem),
    linear-gradient(180deg, #070b12 0%, #08111d 58%, #05070c 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 14px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(46, 166, 255, 0.22), rgba(139, 92, 246, 0.18));
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
  line-height: 1.1;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions,
.dialog-actions,
.dialog-actions > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  white-space: nowrap;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
}

.ghost-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
}

.icon-button {
  width: 36px;
  padding: 0;
}

.danger,
.ghost-button.danger {
  color: var(--danger);
}

.focus-panel,
.mode-switcher,
.command-row,
.analytics,
.toolbar,
.column,
.task-card,
.task-dialog,
.chart-panel,
.stat-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.focus-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.focus-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mode-dot {
  width: 12px;
  height: 42px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 24px currentColor;
}

.focus-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.focus-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.focus-text span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.focus-timers {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
}

.focus-timers div {
  min-width: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  padding: 8px 10px;
}

.focus-timers span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.focus-timers strong {
  display: block;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
}

.mode-switcher {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}

.mode-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
}

.mode-button.active {
  color: #fff;
  border-color: color-mix(in srgb, var(--mode-color) 70%, transparent);
  background: color-mix(in srgb, var(--mode-color) 22%, rgba(255, 255, 255, 0.07));
}

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.command-input-wrap,
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 0 11px;
}

.command-input-wrap {
  min-height: 40px;
}

.command-input-wrap input,
.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: #69778e;
}

.analytics {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(320px, 1.25fr) minmax(220px, 0.7fr);
  gap: 10px;
  margin-bottom: 10px;
}

.chart-panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
}

.chart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.chart-panel h2 {
  font-size: 13px;
}

.chart-panel-header span {
  color: var(--muted);
  font-size: 11px;
}

.chart-frame {
  position: relative;
  min-height: 180px;
}

.chart-frame.compact canvas {
  width: 100%;
  height: 180px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-card {
  min-height: 76px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 142px 150px 130px auto;
  gap: 8px;
  margin-bottom: 10px;
}

.search-wrap {
  min-height: 38px;
}

.toolbar input[type="date"],
.toolbar select,
.field input,
.field select,
.field textarea,
.comment-compose textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  outline: 0;
}

.toolbar input[type="date"],
.toolbar select,
.field input,
.field select {
  min-height: 38px;
  padding: 0 10px;
}

.toolbar select,
.field select {
  color-scheme: dark;
}

.toolbar select option,
.field select option {
  background: #0f172a;
  color: var(--ink);
}

.toolbar select option:checked,
.field select option:checked {
  background: #1d4ed8;
  color: #ffffff;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 0 10px;
  white-space: nowrap;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 10px;
  align-items: start;
}

.column {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.column.drag-over {
  border-color: var(--accent);
  background: rgba(46, 166, 255, 0.1);
}

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

.column-header > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.column h2 {
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-dot.new {
  background: var(--new);
}

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

.status-dot.done {
  background: var(--done);
}

.column-count {
  display: grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-list {
  display: grid;
  gap: 8px;
  min-height: 240px;
  padding: 9px;
}

.task-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--medium);
  border-radius: var(--radius);
  background: rgba(13, 20, 32, 0.82);
  padding: 10px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.task-card[data-priority="low"] {
  border-left-color: var(--low);
}

.task-card[data-priority="medium"] {
  border-left-color: var(--medium);
}

.task-card[data-priority="high"] {
  border-left-color: var(--high);
}

.task-card.is-running {
  outline: 1px solid rgba(46, 166, 255, 0.7);
  box-shadow:
    0 0 0 3px rgba(46, 166, 255, 0.1),
    0 14px 30px rgba(0, 0, 0, 0.24);
}

.task-topline,
.task-meta,
.task-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.task-topline {
  justify-content: space-between;
}

.task-project {
  display: inline-flex;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(46, 166, 255, 0.12);
  color: #9bd7ff;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}

.task-title {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
}

.task-description {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.task-meta {
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  padding: 0 7px;
  font-size: 11px;
}

.meta-pill.hot {
  color: #ffd1d1;
  border-color: rgba(239, 68, 68, 0.38);
}

.task-actions {
  justify-content: space-between;
}

.task-actions-left,
.task-actions-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-actions .icon-button {
  width: 32px;
  min-height: 32px;
}

.icon-button[data-fallback] {
  position: relative;
}

.icon-button[data-fallback]::after {
  content: attr(data-fallback);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: currentColor;
  font-size: 14px;
  font-weight: 800;
}

.icon-button[data-fallback]:has(svg)::after {
  display: none;
}

.empty-column {
  display: grid;
  min-height: 110px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
}

.task-dialog {
  width: min(720px, calc(100vw - 20px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 16, 27, 0.96);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow);
}

.task-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.task-dialog form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.dialog-header h2 {
  font-size: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.full {
  width: 100%;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.field textarea,
.comment-compose textarea {
  resize: vertical;
  min-height: 78px;
  padding: 9px 10px;
}

.comments-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.comments-header h3 {
  color: var(--ink);
  font-size: 13px;
}

.comments-list {
  display: grid;
  gap: 7px;
  max-height: 180px;
  overflow: auto;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
}

.comment-item p {
  color: var(--ink);
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.comment-item time {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.comment-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.dialog-actions {
  justify-content: space-between;
  padding-top: 2px;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 10;
  max-width: min(390px, calc(100vw - 28px));
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--line);
  color: #fff;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

@media (max-width: 920px) {
  .analytics {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) 140px 1fr;
  }

  .toggle-pill {
    justify-content: flex-start;
  }

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

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

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions .ghost-button {
    display: none;
  }

  .focus-panel {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .focus-timers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .focus-timers div {
    min-width: 0;
    padding: 7px;
  }

  .focus-timers strong {
    font-size: 14px;
  }

  .mode-switcher {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .mode-button {
    min-height: 34px;
    padding: 0 4px;
    font-size: 11px;
  }

  .command-row {
    grid-template-columns: 1fr auto;
  }

  .analytics {
    gap: 8px;
  }

  .chart-frame,
  .chart-frame.compact canvas {
    min-height: 150px;
    height: 150px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card {
    min-height: 62px;
    padding: 9px;
  }

  .stat-card strong {
    font-size: 19px;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .search-wrap,
  .toggle-pill {
    grid-column: 1 / -1;
  }

  .field-grid,
  .comment-compose {
    grid-template-columns: 1fr;
  }

  .dialog-actions,
  .dialog-actions > div {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }
}
