:root {
  color-scheme: dark;
  --text: #eeeeee;
  --base: #d2d2d5;
  --mantle: #3d3db6;
  --crust: #181825;
  --back: rgba(3, 3, 25, 0.8);
  --panel: #0f111a;
  --panel-2: #141724;
  --border: #2a2f38;
  --muted: #9aa3b2;
  --card: #cbcbcb;
  --card-2: #e5e7eb;
  --ink: #1f2937;
  --danger: #7f1d1d;
  --danger-border: #991b1b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family: russiangothic, ms ui gothic, nec_apc3, Tahoma, serif;
  background: #070817;
  color: var(--text);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed;
  width: 46vw;
  height: 46vw;
  border-radius: 999px;
  filter: blur(110px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-one {
  left: -18vw;
  top: -12vw;
  background: var(--mantle);
}

.ambient-two {
  right: -22vw;
  bottom: -20vw;
  background: #5757d6;
}

.back-button {
  position: fixed;
  top: 18px;
  left: 24px;
  z-index: 20;
  min-width: 118px;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mantle);
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 15px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.title-wrapper {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  pointer-events: none;
}

.page-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 12px;
  letter-spacing: 0.42em;
  font-weight: 700;
  color: #9aa3b2;
  background: #0f1115;
  border: 1px solid #2a2f38;
  border-radius: 10px;
  padding: 14px 10px;
  text-transform: uppercase;
  opacity: 0.92;
}

.app-shell {
  position: relative;
  height: 100%;
  padding: 18px 24px 18px 76px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-left: 92px;
}

.brand-block {
  min-width: 180px;
}

.eyebrow {
  color: #8c95a5;
  font-size: 10px;
  letter-spacing: 0.23em;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  margin-top: 5px;
  font-size: 24px;
  letter-spacing: 0.03em;
}

h2 {
  margin-top: 5px;
  font-size: 20px;
}

.status-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-line.editing {
  color: #c7c7ff;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.search-wrap {
  width: min(29vw, 330px);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(15, 17, 26, 0.88);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.search-icon {
  color: #8c95a5;
  font-size: 20px;
  transform: translateY(-1px);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.search-wrap input::placeholder {
  color: #707887;
}

.btn,
.icon-btn {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.btn:active,
.icon-btn:active {
  transform: translateY(0);
}

.btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.btn {
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

.btn-primary {
  background: var(--mantle);
  color: var(--text);
  border-color: #5555ca;
}

.btn-primary:hover {
  background: #4747c3;
}

.btn-light {
  background: var(--base);
  color: var(--crust);
  border-color: #e5e7eb;
}

.btn-light:hover {
  background: #e2e2e5;
}

.btn-ghost {
  background: #111827;
  color: #e5e7eb;
  border-color: #394356;
}

.btn-danger {
  background: #2b1216;
  color: #fecaca;
  border-color: #65252e;
}

.board-frame {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #202636;
  border-radius: 14px;
  background: rgba(7, 8, 23, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.board {
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #34384a #0d0f18;
  scrollbar-width: thin;
}

.column {
  width: 300px;
  min-width: 300px;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(15, 17, 26, 0.94);
  border: 1px solid #2a2f38;
  border-radius: 12px;
  overflow: hidden;
}

.column.dragging-column {
  opacity: 0.58;
}

.column.drag-over-column {
  border-color: #6262df;
}

.column-head {
  padding: 13px 13px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #202636;
  background: rgba(24, 24, 37, 0.8);
}

.column-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.default-pill,
.count-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.default-pill {
  padding: 5px 7px;
  color: #c9c9ff;
  background: rgba(61, 61, 182, 0.24);
  border: 1px solid rgba(104, 104, 224, 0.44);
}

.count-pill {
  min-width: 24px;
  padding: 5px 7px;
  text-align: center;
  color: #c3c8d0;
  background: #1a1e2a;
  border: 1px solid #303746;
}

.column-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #cfd4dc;
  border-color: #303746;
  border-radius: 7px;
  font-size: 15px;
}

.cards {
  min-height: 58px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-color: #34384a transparent;
  scrollbar-width: thin;
}

.cards.drop-target {
  background: rgba(61, 61, 182, 0.09);
}

.name-card {
  position: relative;
  width: 100%;
  min-height: 86px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid #d8d8da;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
}

.name-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

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

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

.card-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.card-secondary {
  color: #5f6875;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-note-preview {
  color: #737b86;
  font-size: 16px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: 1px;
}

.drag-mark {
  position: absolute;
  right: 9px;
  top: 8px;
  color: #8a9099;
  font-size: 13px;
  opacity: 0.55;
}

.column-foot {
  padding: 10px;
  border-top: 1px solid #202636;
}

.add-to-column {
  width: 100%;
  min-height: 36px;
  border: 1px dashed #394356;
  border-radius: 8px;
  background: transparent;
  color: #9da5b1;
  cursor: pointer;
  font-weight: 700;
}

.add-to-column:hover {
  color: var(--text);
  border-color: #5a63a8;
  background: rgba(61, 61, 182, 0.08);
}

.empty-column {
  min-height: 74px;
  display: grid;
  place-items: center;
  border: 1px dashed #282e3a;
  border-radius: 9px;
  color: #697181;
  font-size: 12px;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8d95a3;
  pointer-events: none;
}

.edit-only {
  display: none;
}

body.is-editing .edit-only {
  display: inline-flex;
}

body.is-editing .column .edit-only {
  display: grid;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10000;
  max-width: min(90vw, 560px);
  transform: translate(-50%, 18px);
  padding: 10px 14px;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #394356;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: #71333c;
  color: #fecaca;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  padding: 18px;
}

.modal.show {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 18, 0.76);
  backdrop-filter: blur(7px);
}

.modal-card {
  position: relative;
  width: min(92vw, 560px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  background: #0f111a;
  border: 1px solid #303746;
  border-radius: 12px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
}

.modal-card.compact {
  width: min(92vw, 420px);
}

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

.field-label {
  display: block;
  margin: 13px 0 6px;
  color: #aab1bc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #343b49;
  border-radius: 8px;
  outline: 0;
  background: #171b27;
  color: #f1f3f5;
}

.field-input:focus {
  border-color: #6363dd;
  box-shadow: 0 0 0 3px rgba(61, 61, 182, 0.16);
}

.field-input:disabled {
  color: #c6cbd3;
  background: #11141d;
  opacity: 0.9;
}

.textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.45;
}

.form-error {
  margin: 10px 0 0;
  color: #fca5a5;
  font-size: 12px;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-actions.spread {
  justify-content: space-between;
}

.modal-actions-right {
  display: flex;
  gap: 8px;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 76px 12px 12px;
  }

  .back-button {
    left: 12px;
    top: 12px;
    min-width: 92px;
    padding: 9px 12px;
  }

  .title-wrapper {
    display: none;
  }

  .topbar {
    min-height: auto;
    padding-left: 0;
    align-items: flex-start;
  }

  .brand-block {
    display: none;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-wrap {
    width: 100%;
    order: 2;
  }

  .board-frame {
    border-radius: 10px;
  }

  .column {
    width: min(84vw, 300px);
    min-width: min(84vw, 300px);
  }
}

@media (max-width: 520px) {
  .btn {
    padding-inline: 11px;
  }

  .modal-actions.spread {
    flex-direction: column-reverse;
  }

  .modal-actions-right {
    width: 100%;
  }

  .modal-actions-right .btn,
  .modal-actions.spread > .btn {
    flex: 1;
  }
}

.mobile-card-arrows {
  display: none;
}

body.is-editing .mobile-card-arrows {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
}

.mobile-card-arrow {
  width: 46px;
  height: 34px;
  border: 1px solid #aeb2bb;
  border-radius: 7px;
  background: #e1e1e3;
  color: #1f2937;
  font-size: 20px;
  cursor: pointer;
}
