:root {
  color-scheme: light;
  --bg: #f4f4f0;
  --surface: #ffffff;
  --surface-soft: #f7f7f3;
  --text: #000000;
  --muted: #666666;
  --border: #000000;
  --red: #e60000;
  --blue: #0055ff;
  --orange: #ff6b00;
  --green: #00a600;
  --danger: #bf000f;
  --shadow: 4px 4px 0 #000000;
  --shadow-lg: 6px 6px 0 #000000;
  --max: 1200px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Heiti SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  border-radius: 0;
  font: inherit;
}

button {
  cursor: pointer;
}

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

.shell {
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 54px;
  padding: 18px 0;
  border-bottom: 2px solid var(--border);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-mark {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border);
  background: var(--red);
  box-shadow: 2px 2px 0 var(--border);
}

.nav-actions,
.button-row,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: end;
  margin-bottom: 38px;
}

.eyebrow,
.pill,
.panel-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--border);
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 18px;
}

h1 {
  max-width: 820px;
  font-size: clamp(44px, 7vw, 82px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.15;
}

h3 {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.headline-accent {
  position: relative;
  display: inline-block;
}

.headline-accent::after {
  position: absolute;
  right: 0;
  bottom: 5px;
  left: 0;
  z-index: -1;
  height: 8px;
  background: var(--red);
  content: "";
}

.muted {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
}

.hero .muted {
  max-width: 640px;
  margin-top: 18px;
  font-size: 17px;
}

.divider {
  height: 4px;
  margin: 34px 0;
  background: var(--border);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 20px;
  align-items: start;
}

.view-panel {
  animation: viewIn 180ms ease both;
}

.admin-grid {
  display: grid;
  gap: 20px;
  align-items: start;
}

.grid.wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.panel,
.list-card,
.task-card,
.empty,
.stat-card {
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 2px solid var(--border);
}

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

.lists,
.tasks,
.stack {
  display: grid;
  gap: 14px;
}

.list-card,
.task-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

a.list-card:hover,
a.list-card:focus-visible {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border);
  outline: none;
}

.list-card h3 {
  font-size: 22px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill {
  color: var(--text);
  box-shadow: none;
}

.pill.admin {
  background: var(--red);
  color: var(--surface);
}

.pill.editor {
  background: var(--orange);
  color: var(--surface);
}

.pill.viewer {
  background: var(--blue);
  color: var(--surface);
}

.pill.access {
  background: var(--green);
  color: var(--surface);
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: 2px 2px 0 var(--border);
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, color 150ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border);
  outline: none;
}

.button.primary {
  background: var(--text);
  color: var(--surface);
}

.button.primary:hover {
  background: var(--red);
  border-color: var(--red);
}

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

.button.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--surface);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--border);
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, color 150ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--border);
  outline: none;
}

.empty {
  padding: 34px 24px;
  border-style: dashed;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.7;
  text-align: center;
}

.loading {
  min-height: 280px;
  display: grid;
  place-items: center;
}

.task-card.done {
  background: #f0f0ea;
}

.task-card.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-card.moving {
  animation: taskMove 340ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.task-view-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

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

.task-column {
  min-height: 360px;
}

.task-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.task-head input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  margin-top: 3px;
  box-shadow: none;
}

.task-title {
  font-size: 18px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.task-toolbar {
  justify-content: space-between;
}

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

.stat-card {
  padding: 16px;
}

.stat-number {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 240ms ease, transform 240ms ease;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(-8px);
}

.toast[data-tone="error"] {
  background: #fff1f1;
  color: var(--danger);
}

.toast[data-tone="success"] {
  background: #f0fff2;
  color: #006b18;
}

.status-box {
  padding: 14px 16px;
  border: 2px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
  white-space: pre-wrap;
}

.status-box[data-tone="error"] {
  background: #fff1f1;
  color: var(--danger);
}

.status-box[data-tone="success"] {
  background: #f0fff2;
  color: #006b18;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.28);
}

.modal {
  width: min(640px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modalIn 180ms ease both;
}

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

.admin-bottom-grid {
  margin-top: 20px;
}

[hidden] {
  display: none !important;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes taskMove {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 940px) {
  .shell {
    width: min(100% - 28px, var(--max));
    padding-top: 24px;
  }

  .topbar,
  .hero,
  .panel-header,
  .task-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .grid,
  .grid.wide,
  .admin-grid,
  .task-board,
  .form-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 40px;
  }

  .nav-actions,
  .button-row,
  .toolbar,
  .task-view-toolbar,
  .button {
    width: 100%;
  }

  .task-view-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 34px;
  }

  .panel-body,
  .panel-header,
  .list-card,
  .task-card {
    padding: 16px;
  }

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

  .toast {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
  }

  .modal-backdrop {
    align-items: end;
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }
}
