:root {
  --bg: #f6f8fc;
  --bg-soft: #eef2fa;
  --card: rgba(255, 255, 255, 0.96);
  --border: rgba(210, 218, 232, 0.55);
  --shadow: 0 18px 34px rgba(33, 38, 54, 0.12);
  --ink: #1c2333;
  --muted: #6d778b;
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.14);
  --item-height: 52px;
  --page-max-width: 1280px;
  --page-padding: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Avenir Next", "Avenir", "SF Pro Rounded", "SF Pro Text", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, rgba(47, 111, 237, 0.14) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  min-height: 100vh;
  overflow: hidden;
}

body.matrix-loading .matrix-grid {
  visibility: hidden;
}

body.matrix-locked .matrix-grid {
  display: none;
}

body.matrix-locked .topbar__actions {
  opacity: 0.4;
  pointer-events: none;
}

.access-notice {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.82);
  border: 1px dashed var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
}

.page {
  width: min(100%, var(--page-max-width));
  margin: 0 auto;
  padding: var(--page-padding);
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
}

.topbar__meta {
  display: none;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 111, 237, 0.12);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pill--ghost {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  color: var(--muted);
}

.pill--status {
  border-color: rgba(10, 132, 255, 0.2);
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent);
}

.pill--warning {
  border-color: rgba(226, 85, 90, 0.25);
  background: rgba(226, 85, 90, 0.12);
  color: #b4232b;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  padding: 4px;
  gap: 4px;
}

.view-toggle__btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.view-toggle__btn.is-active {
  background: rgba(47, 111, 237, 0.14);
  color: var(--accent);
}

.btn {
  border: none;
  background: linear-gradient(135deg, #3b7bff, #2f6fed);
  color: #ffffff;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(10, 132, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 22px rgba(10, 132, 255, 0.28);
}

.btn:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.4);
  outline-offset: 2px;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn--ghost:hover {
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.status {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  position: absolute;
  top: 74px;
  right: var(--page-padding);
  z-index: 10;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.status--error {
  border-color: rgba(226, 85, 90, 0.5);
  color: #b4232b;
  background: rgba(253, 236, 238, 0.6);
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
}

.quadrant {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.quadrant--dragover {
  border-color: rgba(10, 132, 255, 0.35);
  box-shadow: 0 18px 34px rgba(10, 132, 255, 0.2);
}

.quadrant__header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.quadrant__tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, var(--ink));
  letter-spacing: 0.04em;
}

.quadrant__title {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}

.quadrant__meta {
  font-size: 11px;
  color: var(--muted);
}

.quadrant__list {
  display: grid;
  grid-auto-rows: minmax(var(--item-height), auto);
  align-content: start;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.quadrant__list.has-scroll {
  padding-right: 6px;
}

.quadrant__list.has-scroll::after {
  content: "";
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 18px;
  background: linear-gradient(180deg, rgba(246, 248, 252, 0), rgba(246, 248, 252, 0.8));
  pointer-events: none;
  display: block;
}

.item {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  border: 1px solid rgba(210, 218, 232, 0.6);
  padding: 8px 12px 8px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  min-height: var(--item-height);
  overflow: hidden;
  position: relative;
  cursor: grab;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.item:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.item:active {
  cursor: grabbing;
}

.item__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.item__meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}

.item__time {
  font-size: 10px;
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item__tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.14);
  color: var(--accent);
  flex: 0 0 auto;
}

.item__tag--tasks {
  border: 1px dashed currentColor;
  background: rgba(10, 132, 255, 0.08);
}

.item--task .item__title {
  letter-spacing: 0.01em;
}

.item--dragging {
  opacity: 0.6;
}

.item--done {
  opacity: 0.7;
}

.item--done .item__title {
  color: var(--muted);
  text-decoration: line-through;
}

.item--done .item__check {
  border-color: rgba(15, 23, 42, 0.25);
}

.item__action {
  border: none;
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: auto;
}

.item__check {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1.5px solid rgba(15, 23, 42, 0.35);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.item__check:hover {
  border-color: var(--accent);
  background: rgba(10, 132, 255, 0.08);
}

.item__check:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.4);
  outline-offset: 2px;
}

.item__check[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.item__check-icon {
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.item--done .item__check {
  border-color: rgba(47, 111, 237, 0.6);
  background: rgba(47, 111, 237, 0.12);
}

.item--done .item__check-icon {
  opacity: 1;
}

.item__drag {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 8px;
  height: calc(100% - 16px);
  opacity: 0.35;
  background-image: radial-gradient(circle, rgba(15, 23, 42, 0.4) 1px, transparent 1.2px);
  background-size: 4px 6px;
  background-position: center;
  border-radius: 6px;
  pointer-events: none;
}

.item:hover .item__drag {
  opacity: 0.6;
}

.item__action[disabled] {
  opacity: 0.6;
  cursor: default;
}

.empty {
  border-radius: 12px;
  border: 1px dashed var(--border);
  padding: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

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

  .topbar__actions {
    justify-content: flex-start;
  }

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