:root {
  --bg: #101116;
  --bg-soft: #151821;
  --panel: #141821;
  --panel-strong: #181d27;
  --panel-2: #10141c;
  --text: #f3f5f7;
  --muted: #8b93a7;
  --muted-2: #666f84;
  --accent: #e41951;
  --accent-strong: #ff0051;
  --line: #2a3140;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --success: #01dc84;
  --warning: #faf945;
  --danger: #ff6e67;
  --mira: #171d28;
  --other: #11161f;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
button {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  box-shadow: none;
}
button:hover { transform: translateY(-1px); background: var(--accent-strong); }
button:active { transform: translateY(0); }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
button.ghost:hover {
  background: rgba(255,255,255,0.03);
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.topbar,
.toolbar,
.column,
.detail,
dialog form,
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: 18px;
  margin-bottom: 18px;
  position: relative;
}
.brand-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.1;
}
.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 32rem;
}
.primary-action { min-width: 0; }
.compact-button {
  padding: 10px 14px;
  min-width: auto;
}
.toast {
  position: absolute;
  right: 28px;
  bottom: -56px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  padding: 10px 14px;
  border-radius: 999px;
  background: #191f2a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 5;
}
.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.toast.is-success {
  border-color: rgba(52, 211, 153, 0.28);
}
.toast.is-error {
  border-color: rgba(251, 113, 133, 0.28);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}
.board-panel {
  min-width: 0;
}

.toolbar {
  border-radius: 14px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.toolbar-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px;
  min-width: 0;
}
.toolbar-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
}
.toolbar-icon {
  color: var(--muted);
  font-size: 14px;
  flex: 0 0 auto;
}
.toolbar-search,
.toolbar-select {
  min-width: 0;
  height: 38px;
  border-radius: 999px;
}
.toolbar-search {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.toolbar-select {
  padding: 0 12px !important;
}
.toolbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  min-width: 38px;
  display: inline-grid;
  place-items: center;
}
label {
  color: #ced9ea;
  font-size: 13px;
  font-weight: 600;
}
.toolbar input,
.toolbar select,
.detail textarea,
.detail input,
.detail select,
dialog input,
dialog textarea,
dialog select,
.login-card input {
  width: 100%;
  background: rgba(14, 22, 37, 0.88);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
textarea { resize: vertical; min-height: 120px; }
input:focus,
textarea:focus,
select:focus {
  border-color: rgba(103, 232, 249, 0.44);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
  background: rgba(12, 21, 36, 0.96);
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 68vh;
}
.column {
  border-radius: 16px;
  padding: 12px;
  min-height: 420px;
  background: var(--panel-2);
}
.column.drag-over {
  outline: 2px dashed rgba(228, 25, 81, 0.55);
  outline-offset: -8px;
}
.column-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}
.column h2 {
  margin: 0;
  font-size: 18px;
}
.column-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.count {
  min-width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: #d8e4f4;
  font-size: 13px;
  font-weight: 700;
}
.dropzone {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 320px;
}
.column-empty,
.empty-state {
  color: var(--muted);
}
.column-empty {
  border: 1px dashed rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  background: rgba(255,255,255,0.015);
}
.card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 13px;
  background: #171c25;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.card:hover {
  border-color: rgba(228, 25, 81, 0.32);
  transform: translateY(-1px);
  background: #1a202a;
}
.card.is-selected {
  border-color: rgba(228, 25, 81, 0.55);
  box-shadow: inset 0 0 0 1px rgba(228, 25, 81, 0.24);
}
.card.dragging { opacity: 0.45; }
.card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.14);
}
.priority-low .priority-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14); }
.priority-medium .priority-dot { background: var(--warning); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.14); }
.priority-high .priority-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.16); }
.card-priority {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
}
.card-description {
  margin: 0 0 12px;
  color: #c5d2e6;
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.meta-pill,
.badge {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 5px 9px;
  color: #d7dbe3;
  background: transparent;
  font-size: 11px;
}
.badge.priority-low { border-color: rgba(1, 220, 132, 0.3); color: #90f0c4; }
.badge.priority-medium { border-color: rgba(250, 249, 69, 0.3); color: #f5f19b; }
.badge.priority-high { border-color: rgba(255, 110, 103, 0.34); color: #ffb2ad; }
.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 12px;
}

.detail {
  border-radius: 18px;
  padding: 20px;
  min-height: calc(100vh - 170px);
  position: sticky;
  top: 20px;
}
.detail.empty {
  display: grid;
  place-items: center;
}
.detail-empty-state {
  max-width: 320px;
  text-align: center;
}
.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border: 1px solid rgba(103, 232, 249, 0.18);
  background: rgba(103, 232, 249, 0.08);
  color: var(--accent);
  font-size: 24px;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}
.detail-head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.detail-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.detail h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}
.detail-description-preview {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.detail-badges { justify-content: end; }
.detail-section {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 18px;
  margin-top: 18px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}
.section-head h3 {
  margin: 0;
  font-size: 18px;
}
.section-head span {
  color: var(--muted);
  font-size: 12px;
}
label {
  display: block;
  margin: 12px 0;
}
.detail-grid,
.dialog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.dialog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inline-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.inline-empty {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(148, 163, 184, 0.16);
}
.note {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  padding: 12px 14px;
  max-width: 92%;
}
.note.is-mira {
  background: var(--mira);
  border-left: 2px solid rgba(228, 25, 81, 0.8);
  align-self: flex-end;
}
.note.is-other {
  background: var(--other);
  align-self: flex-start;
}
.note .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.note-body { line-height: 1.55; }
.composer {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 20px;
  padding: 14px;
}
.composer-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
}
.composer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}
.note-attachment {
  margin-top: 10px;
}
.note-attachment img {
  display: block;
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  margin-top: 16px;
}
dialog {
  border: 0;
  padding: 0;
  border-radius: 24px;
  background: transparent;
  width: min(680px, 94vw);
}
dialog::backdrop { background: rgba(2, 8, 23, 0.72); }
dialog form {
  border-radius: 24px;
  padding: 24px;
}
.dialog-head h2 {
  margin: 8px 0 0;
  font-size: 28px;
}

.login-page { min-height: 100vh; display:grid; place-items:center; }
.login-card {
  width:min(420px, 92vw);
  border-radius: 24px;
  padding: 24px;
}
.login-error { color: #fca5a5; min-height: 1.2em; }

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 1fr; }
  .detail {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 980px) {
  .app-shell { padding: 14px; }
  .topbar {
    padding: 16px;
    flex-direction: column;
    align-items: start;
  }
  .toast {
    position: static;
    margin-top: 10px;
  }
  .toolbar,
  .toolbar-main,
  .detail-grid,
  .dialog-grid,
  .composer-footer {
    grid-template-columns: 1fr;
  }
  .toolbar-meta {
    order: 3;
    white-space: normal;
  }
  .toolbar-actions {
    justify-content: stretch;
  }
  .toolbar-actions button:first-child { flex: 1; }
  .board {
    grid-template-columns: repeat(5, minmax(280px, 1fr));
    padding-bottom: 2px;
  }
}

@media (max-width: 640px) {
  .topbar,
  .toolbar,
  .column,
  .detail,
  dialog form { border-radius: 18px; }
  h1 { font-size: 28px; }
  .detail h2 { font-size: 24px; }
  .card-footer,
  .detail-head,
  .section-head,
  .detail-head-actions {
    flex-direction: column;
    align-items: start;
  }
  .detail-badges { justify-content: start; }
  .note { max-width: 100%; }
}
