@font-face {
  font-family: "Material Icons";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/material-icons.woff2") format("woff2");
}

.material-icons {
  font-family: "Material Icons";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.material-icons--small { font-size: 16px; }
.material-icons--large { font-size: 28px; }

:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef1f7;
  --ink: #192033;
  --ink-soft: #55617b;
  --ink-faint: #8690a5;
  --line: #e3e7f0;
  --line-strong: #cfd6e4;
  --accent: #4a68f5;
  --accent-hover: #3b57de;
  --accent-ink: #ffffff;
  --accent-soft: #e9edff;
  --danger: #d34b4b;
  --danger-hover: #b93b3b;
  --danger-soft: #fdebeb;
  --scrim: rgba(20, 26, 40, 0.42);
  --shadow-sm: 0 1px 2px rgba(19, 28, 48, 0.06), 0 3px 10px rgba(19, 28, 48, 0.04);
  --shadow-md: 0 10px 30px rgba(19, 28, 48, 0.13), 0 2px 8px rgba(19, 28, 48, 0.07);
  --radius: 12px;
  --radius-lg: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #11141d;
  --surface: #1a1f2c;
  --surface-2: #202637;
  --surface-3: #273044;
  --ink: #e8ecf7;
  --ink-soft: #aeb7ca;
  --ink-faint: #818ba2;
  --line: #2e3749;
  --line-strong: #3d485d;
  --accent: #8198ff;
  --accent-hover: #9aadff;
  --accent-ink: #111625;
  --accent-soft: #28325a;
  --danger: #ff8080;
  --danger-hover: #ff9c9c;
  --danger-soft: #3a252b;
  --scrim: rgba(3, 6, 12, 0.66);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22), 0 3px 10px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.44), 0 2px 8px rgba(0, 0, 0, 0.25);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 160ms ease, color 160ms ease;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app-shell { max-width: 1600px; margin: 0 auto; padding: 0 32px 20px; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  flex: none;
}
.brand__mark .material-icons { font-size: 22px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand__text strong { font-size: 17px; letter-spacing: -0.01em; }
.brand__text span { color: var(--ink-faint); font-size: 12px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .material-icons { font-size: 18px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-soft); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-hover); }
.btn--danger-text { background: transparent; color: var(--danger); padding-left: 8px; padding-right: 8px; }
.btn--danger-text:hover { background: var(--danger-soft); }
.text-btn {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
}
.text-btn:hover { background: var(--accent-soft); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn--tiny { width: 26px; height: 26px; border: 0; background: transparent; }
.icon-btn--tiny:hover { background: var(--surface-3); }
.icon-btn--tiny .material-icons { font-size: 17px; }

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 22px 0 18px;
}
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 100%);
  min-height: 40px;
  padding: 0 8px 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-field__icon { color: var(--ink-faint); flex: none; }
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: 0;
  font-size: 14px;
}
.search-field input::-webkit-search-cancel-button { display: none; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.menu-anchor { position: relative; }
.filter-btn, .filter-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.filter-btn:hover, .filter-select:hover { background: var(--surface-3); color: var(--ink); }
.filter-btn .material-icons { font-size: 18px; }
.filter-btn__caret { font-size: 16px !important; color: var(--ink-faint); }
.filter-select { cursor: pointer; max-width: 200px; }
.result-count { margin-left: auto; color: var(--ink-faint); font-size: 12px; white-space: nowrap; }

.popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: 232px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.popover__title { font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 8px 8px; }
.popover__row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.popover__row:hover { background: var(--surface-3); }
.popover__row input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.popover__row .label-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.popover__footer { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.popover__footer .text-btn { width: 100%; text-align: left; }

/* Board and columns */
.board {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 18px;
  min-height: 300px;
}
.column {
  display: flex;
  flex-direction: column;
  flex: 0 0 312px;
  max-height: calc(100vh - 210px);
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}
.column--drop-before::before, .column--drop-after::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.column--drop-before::before { left: -11px; }
.column--drop-after::after { right: -11px; }
.column__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 13px 10px 13px 9px;
  border-bottom: 1px solid var(--line);
}
.column__handle, .column__menu-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-faint);
  flex: none;
}
.column__handle { cursor: grab; color: var(--ink-faint); }
.column__handle:active { cursor: grabbing; }
.column__handle:hover, .column__menu-button:hover { background: var(--surface-3); color: var(--ink); }
.column__handle .material-icons { font-size: 19px; }
.column__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.column__count {
  min-width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}
.column__menu { position: absolute; top: 54px; right: 8px; z-index: 15; width: 212px; }
.column__menu .popover__action {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 13px;
}
.column__menu .popover__action:hover { background: var(--surface-3); }
.column__menu .popover__action .material-icons { font-size: 18px; color: var(--ink-faint); }
.column__menu .popover__action--danger { color: var(--danger); }
.column__cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 108px;
}
.column__cards.drop-at-end { box-shadow: inset 0 -3px 0 var(--accent); }
.column__empty {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 4px;
  min-height: 104px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.4;
}
.column__empty .material-icons { font-size: 22px; opacity: 0.7; }
.column__add {
  display: flex;
  align-items: center;
  gap: 7px;
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.column__add:hover { background: var(--surface-3); color: var(--ink); }
.add-column {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 220px;
  min-height: 62px;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.add-column:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Cards */
.card {
  position: relative;
  padding: 12px 13px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card:active { cursor: grabbing; }
.card.is-dragging { opacity: 0.45; transform: rotate(1deg); }
.card.drop-before { box-shadow: 0 -3px 0 var(--accent), var(--shadow-sm); }
.card.drop-after { box-shadow: 0 3px 0 var(--accent), var(--shadow-sm); }
.card__labels { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.card__labels:empty { display: none; }
.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}
.label-chip .material-icons { font-size: 13px; }
.card__title { margin: 0; font-size: 13.5px; font-weight: 650; line-height: 1.4; }
.card__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.card__meta { display: flex; align-items: center; gap: 7px; margin-top: 10px; min-height: 24px; }
.card__assignee { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 11.5px; }
.avatar {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.card__done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  border-radius: 6px;
}
.card__done.is-done { color: #2e9b7a; }
html[data-theme="dark"] .card__done { color: #6ddcb7; }
.card__done .material-icons { font-size: 17px; }
.card--done .card__title { color: var(--ink-soft); }

/* Empty board */
.board-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 340px;
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.board-empty__art {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 6px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}
.board-empty__art .material-icons { font-size: 30px; }
.board-empty h2 { margin: 0; font-size: 19px; }
.board-empty p { margin: 0 0 12px; color: var(--ink-soft); max-width: 380px; font-size: 13px; }
.app-footer { padding: 14px 0 0; color: var(--ink-faint); font-size: 11.5px; }

/* Modals */
.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(90vh, 820px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal--small { width: min(440px, calc(100vw - 28px)); }
.modal::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.modal__form { display: flex; flex-direction: column; max-height: inherit; }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.modal__body { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; padding: 20px; }
.modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.modal__foot-right { display: flex; gap: 9px; margin-left: auto; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field legend {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-soft);
  padding: 0;
}
.field em { color: var(--danger); font-style: normal; }
.field small { color: var(--ink-faint); font-weight: 400; }
.field input[type="text"], .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  font-size: 14px;
  outline: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.label-picker { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.label-option { position: relative; cursor: pointer; }
.label-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.label-option .label-chip { transition: box-shadow 120ms ease, transform 120ms ease; cursor: pointer; }
.label-option input:checked + .label-chip { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--surface); }
.label-option input:focus-visible + .label-chip { outline: 2px solid var(--accent); outline-offset: 3px; }
.check-field { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check-field input { margin: 3px 0 0; accent-color: var(--accent); width: 16px; height: 16px; }
.check-field span { display: flex; flex-direction: column; }
.check-field strong { font-size: 13px; }
.check-field small { color: var(--ink-faint); font-size: 12px; }
.confirm-message { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }

/* Archive drawer */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  width: min(430px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: translateX(100%);
  transition: transform 180ms ease;
}
.drawer.is-open { transform: translateX(0); }
.drawer__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.drawer__head h2 { margin: 0; font-size: 18px; }
.drawer__head p { margin: 3px 0 0; color: var(--ink-faint); font-size: 12px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }
.archive__empty { text-align: center; color: var(--ink-faint); padding: 48px 12px; }
.archive__empty .material-icons { font-size: 34px; }
.archive__empty p { font-size: 13px; }
.archive__group + .archive__group { margin-top: 24px; }
.archive__heading {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 9px;
}
.archive__item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  margin-bottom: 8px;
}
.archive__item-title { font-size: 13px; font-weight: 650; word-break: break-word; }
.archive__item-meta { color: var(--ink-faint); font-size: 11.5px; margin-top: 3px; }
.archive__item-actions { display: flex; gap: 8px; margin-top: 10px; }
.archive__item-actions .btn { min-height: 32px; padding: 5px 10px; font-size: 12px; }

/* Toasts */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font-size: 13px;
  animation: toast-in 180ms ease both;
}
.toast .material-icons { font-size: 18px; color: var(--accent); }
.toast--warning .material-icons { color: var(--danger); }
.toast.is-leaving { animation: toast-out 160ms ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* Responsive */
@media (max-width: 780px) {
  .app-shell { padding: 0 14px 16px; }
  .topbar { padding: 14px 0; flex-wrap: wrap; }
  .brand__text span { display: none; }
  .toolbar { padding: 16px 0 14px; }
  .search-field { width: 100%; }
  .result-count { width: 100%; margin-left: 0; }
  .column { flex-basis: 286px; max-height: calc(100vh - 260px); }
  .toast-region { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
