:root {
  --bg: #f5eddc;
  --bg-deep: #ecdfc7;
  --ink: #17211d;
  --muted: #5f675f;
  --panel: rgba(255, 250, 240, 0.85);
  --panel-strong: rgba(255, 251, 244, 0.96);
  --line: rgba(23, 33, 29, 0.12);
  --accent: #205c4b;
  --accent-warm: #d96141;
  --gold: #c39b31;
  --done: #7f8f87;
  --shadow: 0 24px 60px rgba(46, 36, 24, 0.16);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 14%, rgba(217, 97, 65, 0.20), transparent 26%),
    radial-gradient(circle at 84% 18%, rgba(32, 92, 75, 0.20), transparent 24%),
    linear-gradient(180deg, #faf4e6 0%, var(--bg) 42%, var(--bg-deep) 100%);
  padding: 32px;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(23, 33, 29, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 33, 29, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent 90%);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
}

.hidden {
  display: none !important;
}

.backdrop-orbit {
  position: fixed;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.55;
  pointer-events: none;
}

.orbit-a {
  width: 300px;
  height: 300px;
  top: -90px;
  right: 6%;
  background: radial-gradient(circle, rgba(217, 97, 65, 0.42), transparent 70%);
}

.orbit-b {
  width: 340px;
  height: 340px;
  left: -80px;
  bottom: 10%;
  background: radial-gradient(circle, rgba(32, 92, 75, 0.32), transparent 72%);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  opacity: 0.35;
}

.auth-screen {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card,
.panel-surface,
.hero-shell {
  border: 1px solid rgba(23, 33, 29, 0.1);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(560px, 100%);
  padding: 40px;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.auth-card::after,
.hero-shell::after,
.panel-surface::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(217, 97, 65, 0.75), rgba(32, 92, 75, 0.75));
}

.auth-kicker,
.hero-kicker,
.panel-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.auth-card h1,
.hero-shell h1,
.board-head h2,
.panel-head h2 {
  font-family: 'Literata', serif;
  margin: 10px 0 0;
}

.auth-card h1 {
  font-size: clamp(2.3rem, 4vw, 3.8rem);
}

.auth-copy,
#app-subtitle,
.auth-status,
.form-context {
  color: var(--muted);
  line-height: 1.7;
}

.auth-form,
.todo-form,
.filters-panel {
  display: grid;
  gap: 16px;
}

.relation-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(23, 33, 29, 0.08);
}

.relation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

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

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  background: rgba(255, 255, 255, 0.7);
  padding: 14px 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(32, 92, 75, 0.5);
  box-shadow: 0 0 0 4px rgba(32, 92, 75, 0.08);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.primary-button,
.ghost-button,
.action-button {
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button:hover,
.ghost-button:hover,
.action-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  color: #fff8f0;
  background: linear-gradient(135deg, var(--accent), #102b24);
  box-shadow: 0 16px 28px rgba(32, 92, 75, 0.24);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(23, 33, 29, 0.12);
}

.app-shell {
  display: grid;
  gap: 24px;
}

.hero-shell {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 34px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.hero-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 36%),
    radial-gradient(circle at bottom right, rgba(32, 92, 75, 0.08), transparent 42%);
  pointer-events: none;
}

.hero-copy,
.hero-aside,
.composer-panel,
.board-panel {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 700px;
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 4vw, 4.5rem);
}

.hero-aside {
  min-width: 280px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.hero-pulse {
  align-self: start;
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(32, 92, 75, 0.18);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 22px;
}

.panel-surface {
  position: relative;
  border-radius: var(--radius-xl);
  padding: 26px;
  overflow: hidden;
}

.composer-panel {
  display: grid;
  gap: 22px;
  align-content: start;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.panel-head,
.board-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

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

.form-context {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(23, 33, 29, 0.14);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.46));
  border: 1px solid rgba(23, 33, 29, 0.08);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Literata', serif;
  font-size: 30px;
}

.board-head {
  margin-bottom: 20px;
}

.flash-message {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(32, 92, 75, 0.12);
  color: var(--accent);
}

.flash-message.error {
  color: #9b2f1a;
  background: rgba(217, 97, 65, 0.12);
}

.todo-list {
  display: grid;
  gap: 14px;
}

.todo-node {
  display: grid;
  gap: 12px;
}

.todo-node[data-depth='1'],
.todo-node[data-depth='2'],
.todo-node[data-depth='3'] {
  margin-left: 18px;
}

.todo-children {
  display: grid;
  gap: 12px;
  padding-left: 18px;
  border-left: 1px dashed rgba(23, 33, 29, 0.14);
}

.todo-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px 18px 18px 22px;
  border-radius: 24px;
  border: 1px solid rgba(23, 33, 29, 0.1);
  background: var(--panel-strong);
  box-shadow: 0 16px 34px rgba(58, 44, 22, 0.08);
}

.todo-card::before {
  content: '';
  position: absolute;
  inset: 14px auto 14px 10px;
  width: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.todo-card.priority-critical::before {
  background: #ac2d12;
}

.todo-card.priority-high::before {
  background: var(--accent-warm);
}

.todo-card.priority-medium::before {
  background: var(--gold);
}

.todo-card.priority-low::before {
  background: #6a8b7a;
}

.todo-card.is-complete {
  opacity: 0.72;
  background: rgba(250, 249, 245, 0.76);
}

.todo-card.is-complete .todo-title {
  text-decoration: line-through;
}

.todo-topline,
.todo-footer,
.todo-actions,
.todo-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.todo-topline {
  justify-content: space-between;
}

.todo-title-group {
  display: grid;
  gap: 6px;
}

.todo-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.todo-description {
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

.todo-chip,
.todo-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  border: 1px solid rgba(23, 33, 29, 0.08);
}

.todo-chip.priority-critical {
  color: #8c220a;
  background: rgba(172, 45, 18, 0.12);
}

.todo-chip.priority-high {
  color: #b64a2f;
  background: rgba(217, 97, 65, 0.14);
}

.todo-chip.priority-medium {
  color: #8d6510;
  background: rgba(195, 155, 49, 0.18);
}

.todo-chip.priority-low {
  color: #406456;
  background: rgba(64, 100, 86, 0.14);
}

.todo-chip.status-doing {
  color: var(--accent);
}

.todo-chip.status-blocked {
  color: #8c220a;
}

.todo-chip.status-done {
  color: var(--done);
}

.todo-type-chip {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.todo-actions {
  justify-content: flex-end;
}

.action-button {
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(23, 33, 29, 0.08);
  color: var(--ink);
}

.action-button.danger {
  color: #8f260f;
}

.empty-state {
  padding: 34px 26px;
  border-radius: 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(23, 33, 29, 0.14);
  color: var(--muted);
}

@media (max-width: 1040px) {
  body {
    padding: 18px;
  }

  .hero-shell,
  .command-grid,
  .dual-row {
    grid-template-columns: 1fr;
  }

  .hero-shell {
    flex-direction: column;
  }

  .composer-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .panel-surface,
  .hero-shell,
  .auth-card {
    padding: 20px;
    border-radius: 24px;
  }

  .hero-actions,
  .todo-actions,
  .todo-topline {
    justify-content: flex-start;
  }

  .todo-title {
    font-size: 19px;
  }
}
