@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --bg: #f4efe4;
  --surface: rgba(255, 251, 242, 0.82);
  --ink: #1a2a23;
  --muted: #6d7266;
  --line: rgba(23, 52, 42, 0.12);
  --brand: #103a30;
  --brand-soft: #d5e4de;
  --accent: #dd9d45;
  --accent-soft: #f6ddbc;
  --success: #1f7a53;
  --danger: #a64937;
  --shadow: 0 18px 50px rgba(28, 35, 29, 0.12);
  --radius-lg: 28px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(221, 157, 69, 0.3), transparent 28%),
    radial-gradient(circle at top right, rgba(16, 58, 48, 0.18), transparent 25%),
    linear-gradient(180deg, #f6f1e7 0%, var(--bg) 44%, #eee6d4 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(16px);
  opacity: 0.85;
}

body::before {
  width: 20rem;
  height: 20rem;
  left: -8rem;
  bottom: 4rem;
  background: rgba(16, 58, 48, 0.08);
}

body::after {
  width: 18rem;
  height: 18rem;
  right: -5rem;
  top: 6rem;
  background: rgba(221, 157, 69, 0.12);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 1.4rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise-in 420ms ease both;
}

.hero {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1.15fr 0.85fr;
  padding: 1.6rem;
  margin-bottom: 1rem;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -4rem -6rem auto;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(221, 157, 69, 0.18), transparent 60%);
}

.eyebrow,
.section-kicker,
.quote-label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.83rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1,
.section-head h2 {
  margin: 0;
  line-height: 1.04;
}

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

.hero-text,
.hero-tip,
.hero-summary,
.quote-text,
.backup-card p,
.setting-note,
.task-desc,
.resource-desc {
  color: var(--muted);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.2rem 0 0.9rem;
}

.primary-btn,
.ghost-btn,
.mini-btn {
  cursor: pointer;
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-btn:disabled,
.ghost-btn:disabled,
.mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.primary-btn,
.ghost-btn {
  padding: 0.82rem 1.1rem;
  border: 1px solid transparent;
}

.mini-btn {
  padding: 0.58rem 0.8rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.primary-btn {
  color: #fff7ee;
  background: linear-gradient(135deg, #114435, var(--brand));
  box-shadow: 0 14px 28px rgba(16, 58, 48, 0.22);
}

.ghost-btn {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.46);
  text-decoration: none;
}

.primary-btn:hover,
.ghost-btn:hover,
.mini-btn:hover,
.heatmap-cell:hover,
.resource-card:hover,
.task-card:hover {
  transform: translateY(-2px);
}

.hero-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(16, 58, 48, 0.98), rgba(18, 47, 38, 0.92));
  color: #f3efe6;
}

.hero-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.46rem 0.78rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.86rem;
}

.status-pill.muted {
  color: rgba(243, 239, 230, 0.82);
}

.hero-summary {
  margin: 0;
  color: #f5ecdb;
  font-size: 1.08rem;
}

.hero-progress {
  display: grid;
  gap: 0.5rem;
}

.hero-progress-bar,
.mini-progress {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.hero-progress-bar span,
.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f6cf91, var(--accent));
}

.hero-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: rgba(243, 239, 230, 0.78);
  font-size: 0.92rem;
}

.quote-card {
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
}

.quote-text {
  margin: 0;
  color: #ffeed1;
}

.layout {
  display: grid;
  gap: 1rem;
}

.layout > .panel {
  padding: 1.3rem;
}

.auth-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.2fr 0.8fr;
}

.auth-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
}

.auth-card-primary {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(213, 228, 222, 0.72));
}

.auth-status-line,
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.auth-form {
  margin-top: 1rem;
}

.auth-status-text,
.auth-meta,
.auth-hint {
  margin: 0.85rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.auth-meta {
  min-height: 3.3rem;
}

.auth-hint {
  font-size: 0.92rem;
}

.status-pill.is-good {
  background: rgba(31, 122, 83, 0.14);
  color: #17563c;
}

.status-pill.is-warn {
  background: rgba(221, 157, 69, 0.2);
  color: #8f5810;
}

.status-pill.is-danger {
  background: rgba(166, 73, 55, 0.16);
  color: #8d3324;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head.compact {
  margin-bottom: 0.85rem;
}

.stats-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
}

.stat-label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
}

.stat-footnote {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.date-tools,
.checkin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.date-input,
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.date-input,
.field input {
  min-height: 46px;
  padding: 0.78rem 0.92rem;
}

.field textarea {
  padding: 0.9rem 0.92rem;
  resize: vertical;
  min-height: 150px;
}

.field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.field span {
  font-size: 0.92rem;
  color: var(--muted);
}

.checkin-toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(213, 228, 222, 0.72));
}

.checkin-summary {
  display: flex;
  align-items: center;
  font-size: 0.96rem;
}

.task-grid,
.resource-grid,
.backup-grid {
  display: grid;
  gap: 0.9rem;
}

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

.task-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
}

.task-card.is-done {
  border-color: rgba(31, 122, 83, 0.32);
  background: linear-gradient(180deg, rgba(213, 228, 222, 0.86), rgba(255, 255, 255, 0.72));
}

.task-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.task-index {
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: 0.65rem;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.95rem;
  font-weight: 700;
}

.task-title {
  margin: 0;
  font-size: 1.1rem;
}

.task-target {
  display: inline-flex;
  padding: 0.35rem 0.68rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #834d06;
  font-size: 0.82rem;
}

.task-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.task-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--success);
}

.task-metrics {
  display: grid;
  gap: 0.55rem;
}

.task-stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 0.45rem;
}

.task-stepper input {
  min-width: 0;
  min-height: 44px;
  padding: 0.6rem 0.72rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf0;
}

.task-stepper button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f6efe2;
}

.task-note {
  min-height: 100px;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  resize: vertical;
}

.split-panel {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.formula-card,
.backup-card,
.resource-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.formula-title,
.resource-title,
.backup-card h3 {
  margin: 0 0 0.35rem;
}

.formula-text {
  margin: 0;
  color: var(--brand);
  font-weight: 700;
}

.setting-note {
  margin: 0.2rem 0 1rem;
  font-size: 0.92rem;
}

.heatmap-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.heatmap-cell {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(16, 58, 48, 0.08);
  border-radius: 14px;
  background: #f1eadc;
}

.heatmap-cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.heatmap-cell.level-1 {
  background: #dce8e2;
}

.heatmap-cell.level-2 {
  background: #a9cbbd;
}

.heatmap-cell.level-3 {
  background: #5b947d;
}

.heatmap-cell.level-4 {
  background: #1a5d4a;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-steps {
  display: inline-flex;
  gap: 0.25rem;
}

.legend-steps i {
  width: 16px;
  height: 16px;
  border-radius: 6px;
  display: inline-block;
}

.legend-steps .level-0 {
  background: #f1eadc;
}

.legend-steps .level-1 {
  background: #dce8e2;
}

.legend-steps .level-2 {
  background: #a9cbbd;
}

.legend-steps .level-3 {
  background: #5b947d;
}

.legend-steps .level-4 {
  background: #1a5d4a;
}

.resource-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 1rem;
}

.resource-card {
  display: grid;
  gap: 0.65rem;
  text-decoration: none;
}

.resource-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.resource-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.58rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.8rem;
}

.resource-link {
  color: var(--brand);
  font-size: 0.92rem;
  font-weight: 700;
}

.resource-tools {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
}

.delete-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
}

.resource-form {
  padding: 1rem;
  border: 1px dashed rgba(16, 58, 48, 0.24);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.4);
}

.full-width {
  width: 100%;
}

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

.sync-note-card {
  background: linear-gradient(180deg, rgba(16, 58, 48, 0.94), rgba(18, 47, 38, 0.92));
  color: #f2ede3;
}

.sync-note-card p {
  color: rgba(242, 237, 227, 0.8);
}

.footer-note {
  padding: 1rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%) translateY(120%);
  min-width: 180px;
  max-width: calc(100% - 2rem);
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: rgba(16, 58, 48, 0.94);
  color: #fff6ea;
  text-align: center;
  box-shadow: 0 12px 28px rgba(16, 58, 48, 0.26);
  transition: transform 180ms ease, opacity 180ms ease;
  opacity: 0;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero,
  .split-panel,
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 1rem, 1180px);
  }

  .hero,
  .layout > .panel {
    padding: 1rem;
  }

  .section-head,
  .checkin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .date-tools,
  .checkin-actions,
  .hero-actions {
    width: 100%;
  }

  .date-tools > *,
  .checkin-actions > *,
  .hero-actions > * {
    flex: 1 1 auto;
  }

  .task-grid,
  .resource-grid,
  .backup-grid {
    grid-template-columns: 1fr;
  }
}
