:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --text: #111827;
  --text-strong: #030712;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --muted-soft: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --line-dark: #9ca3af;
  --primary: #2563eb;
  --primary-deep: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #047857;
  --danger: #b91c1c;
  --warning: #b45309;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
  font-family:
    "IBM Plex Sans",
    "Aptos",
    "Segoe UI",
    "Helvetica Neue",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

body.auth-pending .status-strip,
body.auth-pending .workspace,
body.auth-pending .service-actions,
body.auth-locked .status-strip,
body.auth-locked .workspace,
body.auth-locked .service-actions {
  display: none;
}

body.auth-ready .access-gate {
  display: none;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1220px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: 0;
}

.subtitle {
  max-width: 520px;
  margin: 12px 0 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.45;
}

.board-label {
  display: inline-flex;
  width: fit-content;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-strong);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.access-gate {
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.access-gate h2 {
  margin: 0 0 8px;
  color: var(--text-strong);
  font-size: 18px;
}

.access-gate p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.5;
}

.service-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.quiet-button,
.primary-button,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-strong);
  font-weight: 700;
}

.quiet-button {
  padding: 0 13px;
  color: var(--muted-strong);
  font-size: 13px;
}

.quiet-button.compact {
  min-height: 34px;
  padding-inline: 11px;
}

.quiet-button:hover,
.icon-button:hover {
  border-color: var(--line-dark);
  color: var(--text-strong);
}

.quiet-button.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.quiet-button.danger {
  color: var(--muted-strong);
}

.quiet-button.danger:hover {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 220px;
  min-height: 44px;
  border: 0;
  padding: 0 18px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  transition:
    background-color 120ms ease,
    transform 120ms ease;
}

.primary-button:hover {
  background: var(--primary-deep);
  transform: translateY(-1px);
}

.primary-button.compact {
  min-width: 0;
  padding-inline: 16px;
}

.primary-button.danger-action {
  background: var(--danger);
}

.primary-button.danger-action:hover {
  background: #991b1b;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 1fr)) minmax(170px, 220px);
  gap: 10px;
  margin-bottom: 20px;
}

.metric-card,
.focus-select-card,
.quick-add,
.board-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  min-height: 72px;
  padding: 13px 15px;
}

.metric-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-strong);
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
}

.metric-card p,
.section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.focus-select-card {
  display: grid;
  gap: 8px;
  min-height: 72px;
  padding: 12px 14px;
}

label {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #b8c3cf;
  border-radius: 0;
  background: transparent;
  color: var(--text-strong);
  padding: 8px 0 10px;
  outline: none;
  font-size: 15px;
  line-height: 1.5;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    color 120ms ease;
}

select {
  min-height: 42px;
}

textarea {
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-bottom-color: #7c8b9d;
}

input:focus,
select:focus,
textarea:focus {
  border-bottom-color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
}

#notesInput {
  min-height: 142px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.quick-add {
  position: sticky;
  top: 18px;
  padding: 16px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0 0 6px;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

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

.field-error {
  min-height: 16px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.paste-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 162px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #edf2f7;
  padding: 24px 22px;
  margin: 2px 0 10px;
  text-align: center;
  outline: none;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.paste-zone:hover,
.paste-zone:focus {
  border-color: #dbe3ee;
  background: #e8eef5;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.paste-zone.is-hot {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.paste-zone span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.paste-zone strong {
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 650;
}

.paste-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--primary);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

.draft-attachments,
.attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: var(--surface-muted);
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb button,
.thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}

.board-panel {
  min-height: 700px;
  padding: 14px;
}

.board-top {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.search-box {
  width: min(100%, 320px);
}

.focus-now {
  border: 0;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid var(--line);
  padding: 0 0 14px;
  margin-bottom: 14px;
}

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

.focus-now-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.focus-now-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.focus-now-list {
  display: grid;
  gap: 7px;
}

.focus-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  color: var(--text);
  font-size: 13px;
}

.focus-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.filters {
  display: grid;
  margin-bottom: 14px;
}

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

.filter-chip {
  position: relative;
  min-height: 32px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 0 8px;
  font-size: 14px;
  font-weight: 650;
}

.filter-chip:hover {
  color: var(--text-strong);
}

.filter-chip.is-active {
  border-bottom-color: var(--primary);
  color: var(--text-strong);
  font-weight: 750;
}

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

.kanban-board.is-archive-view {
  grid-template-columns: minmax(280px, 1fr);
}

.kanban-column {
  min-width: 0;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 9px;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    border-color 120ms ease;
}

.kanban-column.is-drop-target {
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

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

.column-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.column-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.column-list {
  display: grid;
  gap: 8px;
  min-height: 450px;
  border-radius: 6px;
  align-content: start;
}

.column-empty {
  margin: 4px 2px 6px;
  color: var(--muted-soft);
  font-size: 12px;
  line-height: 1.45;
}

.task-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: grab;
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    border-color 120ms ease;
}

.task-card:hover {
  border-color: var(--line-strong);
}

.task-card.is-dragging {
  opacity: 0.52;
  cursor: grabbing;
  transform: rotate(0.4deg);
}

.task-card.done {
  opacity: 0.76;
}

.task-card.archived {
  cursor: default;
  opacity: 0.72;
}

.task-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.task-check {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.task-notes {
  display: -webkit-box;
  margin: 10px 0 10px 25px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-notes-main {
  margin: 0;
  padding-top: 0;
  border-top: 0;
  color: var(--text-strong);
}

.task-notes-button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.task-notes-button:hover .task-notes-main,
.task-notes-button:focus-visible .task-notes-main {
  color: var(--primary-deep);
}

.task-notes-button:disabled {
  cursor: default;
}

.task-notes-button:disabled:hover .task-notes-main {
  color: var(--text-strong);
}

.task-notes-button:focus-visible {
  outline: none;
}

.task-notes-main.is-empty {
  color: var(--muted-soft);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  margin-left: 25px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
}

.pill.type-bug {
  color: var(--danger);
}

.pill.type-feature,
.pill.type-improvement {
  color: var(--primary);
}

.pill.critical {
  background: #fff1f2;
  color: var(--danger);
}

.pill.high {
  background: #fff7ed;
  color: var(--warning);
}

.pill.medium {
  background: #fffbeb;
  color: #92400e;
}

.pill.low {
  background: #ecfdf5;
  color: var(--success);
}

.task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  margin-left: 25px;
}

.task-date {
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 500;
}

.task-actions {
  display: flex;
  gap: 5px;
}

.mini-button {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
}

.mini-button:hover {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--text-strong);
}

.mini-button.delete {
  color: var(--muted-soft);
}

.mini-button.delete:hover {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.task-card .attachments {
  grid-template-columns: repeat(auto-fill, minmax(72px, 72px));
  margin: 12px 0 0 25px;
}

.task-card .thumb {
  width: 72px;
  border-radius: 8px;
  cursor: pointer;
}

.empty-state {
  display: none;
  padding: 28px 0;
  color: var(--muted);
  text-align: left;
}

.empty-state h2 {
  margin: 0 0 6px;
  color: var(--text-strong);
  font-size: 15px;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

.edit-dialog,
.image-dialog {
  border: 0;
  border-radius: 10px;
  padding: 0;
}

.edit-dialog {
  width: min(620px, calc(100% - 28px));
}

.edit-dialog::backdrop,
.image-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
}

.edit-dialog form {
  padding: 22px;
  background: var(--surface);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head {
  margin-bottom: 22px;
}

.dialog-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 18px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.icon-button {
  width: 36px;
  padding: 0;
  color: var(--muted);
  font-size: 22px;
}

.image-dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 24px;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.82);
  overflow: hidden;
}

.image-dialog img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  margin: auto;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 24px;
}

.toast-host {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  display: grid;
  width: min(360px, calc(100vw - 28px));
  gap: 10px;
}

.toast-card {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 13px;
}

.toast-card p {
  margin: 0 0 12px;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.toast-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1120px) {
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .focus-select-card {
    grid-column: span 2;
  }

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

  .quick-add {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 28px, 720px);
    padding-top: 32px;
  }

  .app-header,
  .board-top {
    flex-direction: column;
    align-items: stretch;
  }

  .service-actions {
    justify-content: flex-start;
  }

  .search-box {
    width: 100%;
  }

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

@media (max-width: 560px) {
  .status-strip,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .focus-select-card {
    grid-column: auto;
  }

  .service-actions > * {
    width: 100%;
  }

  .primary-button {
    width: 100%;
  }

  .focus-item {
    grid-template-columns: auto 1fr;
  }

  .focus-item .pill {
    width: max-content;
  }
}
