:root {
  --radius: 8px;
  --shadow: 0 24px 80px rgba(18, 12, 32, 0.2);
  --logo-opacity: 0.055;
}

body[data-theme="dark"] {
  --ink: #f6f2ff;
  --muted: #b9afd1;
  --paper: #160f24;
  --panel: rgba(36, 25, 58, 0.92);
  --panel-strong: rgba(51, 35, 82, 0.96);
  --line: rgba(224, 209, 255, 0.16);
  --coal: #f4edf8;
  --forest: #b394ff;
  --mint: #75e0c4;
  --amber: #f7bf5b;
  --coral: #ff6b6b;
  --blue: #75a7ff;
  --violet: #6e3bb8;
  --surface: rgba(255, 255, 255, 0.08);
  --field: rgba(255, 255, 255, 0.1);
  --button-ink: #201432;
  --sidebar-bg: linear-gradient(180deg, #1a102b 0%, #3e1d66 100%);
  --app-bg:
    linear-gradient(135deg, rgba(117, 224, 196, 0.08) 1px, transparent 1px) 0 0 / 22px 22px,
    radial-gradient(circle at 16% 8%, rgba(179, 148, 255, 0.24), transparent 26rem),
    radial-gradient(circle at 84% 22%, rgba(247, 191, 91, 0.12), transparent 22rem),
    linear-gradient(145deg, #140c22 0%, #2f184c 48%, #170f24 100%);
}

body[data-theme="light"] {
  --ink: #1e2230;
  --muted: #657083;
  --paper: #eef0f5;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(246, 247, 251, 0.96);
  --line: rgba(64, 68, 82, 0.16);
  --coal: #30204f;
  --forest: #6b46b2;
  --mint: #34b99a;
  --amber: #df9d28;
  --coral: #d7534a;
  --blue: #316fc4;
  --violet: #7d55c7;
  --surface: rgba(255, 255, 255, 0.7);
  --field: rgba(255, 255, 255, 0.92);
  --button-ink: #f8f6ff;
  --sidebar-bg: linear-gradient(180deg, #e4e7ee 0%, #d5d9e3 100%);
  --app-bg:
    linear-gradient(135deg, rgba(107, 70, 178, 0.07) 1px, transparent 1px) 0 0 / 22px 22px,
    radial-gradient(circle at 18% 10%, rgba(107, 70, 178, 0.14), transparent 26rem),
    radial-gradient(circle at 86% 22%, rgba(52, 185, 154, 0.12), transparent 22rem),
    linear-gradient(145deg, #eff1f6 0%, #e4e7ee 54%, #f7f7fa 100%);
  --logo-opacity: 0.045;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 15px;
  background: var(--app-bg);
  transition:
    background 0.25s ease,
    color 0.25s ease;
}

body::before {
  position: fixed;
  right: clamp(-90px, -8vw, -30px);
  bottom: clamp(-90px, -8vw, -30px);
  width: min(52vw, 560px);
  aspect-ratio: 1;
  background: url("./assets/amona-logo.png") center / contain no-repeat;
  content: "";
  opacity: var(--logo-opacity);
  pointer-events: none;
  z-index: 0;
}

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

button {
  cursor: pointer;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  color: var(--ink);
  background: var(--sidebar-bg);
  box-shadow: var(--shadow);
}

.brand,
.section-heading,
.topbar,
.topbar-actions,
.dialog-header,
.dialog-actions,
.column-header,
.task-meta,
.task-actions,
.member-row,
.tag-row,
.task-buttons,
.avatar-stack {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  margin-bottom: 32px;
}

.brand p,
.eyebrow,
.pulse-panel p,
.metric span,
label span {
  margin: 0;
  color: inherit;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  margin-top: 2px;
  font-size: 19px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.pulse-panel {
  position: relative;
  display: block;
  width: 100%;
  padding: 18px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-align: left;
}

.pulse-panel:hover,
.member-row:hover,
.member-row.active {
  border-color: rgba(117, 224, 196, 0.72);
  box-shadow: 0 16px 34px rgba(26, 16, 43, 0.2);
  transform: translateY(-1px);
}

.pulse-panel strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.pulse-dot {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(117, 224, 196, 0.62);
  animation: pulse 1.9s infinite;
}

.view-tabs {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}

.tab-button,
.ghost-button,
.primary-button,
.danger-button,
.icon-button,
.mini-button,
.member-row,
.pulse-panel {
  border-radius: var(--radius);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.tab-button.active,
.tab-button:hover {
  color: var(--button-ink);
  background: var(--mint);
}

.team-panel {
  margin-top: 8px;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 15px;
}

.team-list {
  display: grid;
  gap: 10px;
}

.member-row {
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  text-align: left;
}

.member-row em {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: rgba(117, 224, 196, 0.16);
  color: var(--mint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.member-avatar,
.avatar-chip {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--amber);
  color: #1d1326;
  font-weight: 900;
}

.member-avatar {
  width: 32px;
  height: 32px;
}

.member-main {
  min-width: 0;
  flex: 1;
}

.member-main strong,
.member-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-main span {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--forest);
}

h1 {
  max-width: 760px;
  margin: 2px 0 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
  letter-spacing: 0;
}

.topbar-actions,
.dialog-actions > div {
  gap: 10px;
}

.theme-switch {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-switch b {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--coal);
}

.theme-switch b::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  content: "";
  transition: transform 0.2s ease;
}

.theme-switch input:checked + b::after {
  transform: translateX(18px);
}

.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  white-space: nowrap;
}

.primary-button {
  background: var(--coal);
  color: var(--button-ink);
  box-shadow: 0 10px 24px rgba(18, 12, 32, 0.22);
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.danger-button {
  background: rgba(236, 93, 77, 0.14);
  color: var(--coral);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  background: var(--surface);
  color: inherit;
}

button:hover {
  transform: translateY(-1px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 34px rgba(18, 12, 32, 0.09);
  animation: liftIn 0.55s ease both;
}

.metric:nth-child(2) {
  animation-delay: 0.06s;
}

.metric:nth-child(3) {
  animation-delay: 0.12s;
}

.metric:nth-child(4) {
  animation-delay: 0.18s;
}

.metric span {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 42px;
  line-height: 1;
}

.metric-urgent {
  border-top: 5px solid var(--coral);
}

.metric-today {
  border-top: 5px solid var(--amber);
}

.metric-progress {
  border-top: 5px solid var(--blue);
}

.metric-done {
  border-top: 5px solid var(--mint);
}

.controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(150px, 190px));
  gap: 12px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--field);
  color: var(--ink);
}

input,
select {
  padding: 0 12px;
}

textarea {
  padding: 11px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(179, 148, 255, 0.28);
}

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  bottom: 11px;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-box input {
  padding-left: 38px;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.column-header {
  justify-content: space-between;
  min-height: 38px;
  padding: 0 2px 10px;
}

.column-header h2 {
  margin: 0;
  font-size: 16px;
}

.column-header span {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--coal);
  color: var(--button-ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.task-list {
  display: grid;
  gap: 10px;
  min-height: 140px;
}

.task-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(18, 12, 32, 0.1);
  animation: liftIn 0.35s ease both;
}

.task-card[data-priority="urgent"] {
  border-left: 5px solid var(--coral);
}

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

.task-card[data-priority="normal"] {
  border-left: 5px solid var(--blue);
}

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

.task-card h3 {
  margin: 0 0 9px;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.task-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tag-row {
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  background: rgba(179, 148, 255, 0.16);
  color: var(--forest);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
}

.tag.overdue {
  background: rgba(236, 93, 77, 0.16);
  color: var(--coral);
}

.task-meta,
.task-actions {
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.task-meta {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.task-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-meta span:first-child {
  flex: 1 1 160px;
}

.task-actions {
  flex-wrap: wrap;
  margin-top: 12px;
}

.task-buttons {
  gap: 7px;
}

.mini-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.avatar-stack {
  flex: 1 1 76px;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  min-height: 28px;
}

.avatar-chip {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid var(--panel);
  font-size: 10px;
}

.avatar-chip + .avatar-chip {
  margin-left: 0;
}

.assignee-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.assignee-choice {
  position: relative;
  display: block;
}

.assignee-choice input {
  position: absolute;
  opacity: 0;
}

.assignee-choice span {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  text-transform: none;
}

.assignee-choice input:checked + span {
  border-color: var(--mint);
  background: rgba(117, 224, 196, 0.18);
  color: var(--ink);
}

.empty-state {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
}

dialog {
  width: min(680px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(18, 12, 32, 0.38);
}

dialog::backdrop {
  background: rgba(18, 12, 32, 0.58);
  backdrop-filter: blur(4px);
}

.dialog-body {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.compact-dialog {
  width: min(460px, calc(100vw - 28px));
}

.dialog-header,
.dialog-actions {
  justify-content: space-between;
  gap: 12px;
}

.dialog-header h2 {
  margin: 0;
}

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

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 3;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--coal);
  color: var(--button-ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.22s ease;
}

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

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

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 12px rgba(117, 224, 196, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(117, 224, 196, 0);
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .view-tabs,
  .team-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }
}

@media (max-width: 1500px), (max-height: 850px) {
  body {
    font-size: 14px;
  }

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

  .sidebar {
    padding: 18px;
  }

  .brand {
    margin-bottom: 22px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .brand strong {
    font-size: 17px;
  }

  .pulse-panel {
    padding: 14px;
    margin-bottom: 18px;
  }

  .pulse-panel strong {
    font-size: 23px;
  }

  .view-tabs {
    gap: 6px;
    margin-bottom: 20px;
  }

  .tab-button {
    min-height: 38px;
  }

  .member-row {
    padding: 8px;
  }

  .member-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .workspace {
    padding: 20px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  h1 {
    font-size: clamp(30px, 3.2vw, 42px);
    line-height: 1;
  }

  .metrics {
    gap: 10px;
    margin-bottom: 14px;
  }

  .metric {
    min-height: 92px;
    padding: 14px;
  }

  .metric strong {
    margin-top: 8px;
    font-size: 32px;
  }

  .controls {
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, 170px));
    gap: 10px;
    margin-bottom: 14px;
  }

  input,
  select,
  textarea,
  .primary-button,
  .ghost-button,
  .danger-button,
  .theme-switch {
    min-height: 38px;
  }

  .board {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
    gap: 10px;
  }

  .column {
    padding: 10px;
  }

  .column-header {
    min-height: 34px;
    padding-bottom: 8px;
  }

  .task-list {
    gap: 8px;
  }

  .task-card {
    padding: 11px;
  }

  .task-card h3 {
    font-size: 14px;
  }

  .task-card p {
    font-size: 12px;
  }

  .tag-row {
    margin-bottom: 9px;
  }
}

@media (max-width: 760px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .topbar-actions,
  .controls,
  .metrics,
  .board,
  .form-grid,
  .dialog-actions,
  .assignee-choices {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions,
  .dialog-actions > div {
    display: grid;
  }

  .metrics,
  .board,
  .controls {
    display: grid;
  }

  .view-tabs,
  .team-list {
    grid-template-columns: 1fr;
  }
}
