:root {
  --bg-top: #fbf3ea;
  --bg-bottom: #f4e0d2;
  --paper: rgba(255, 251, 247, 0.82);
  --paper-strong: rgba(255, 251, 247, 0.96);
  --ink: #3d2231;
  --muted: #7a5a63;
  --line: rgba(103, 63, 78, 0.14);
  --shadow: rgba(92, 48, 63, 0.14);
  --accent: #bf5b6f;
  --accent-soft: #f3cad3;
  --balance-accent: #df5d9a;
  --balance-soft: #f8d1e4;
  --good: #5d8a63;
  --warn: #d59d33;
  --bad: #c85b54;
}

* {
  box-sizing: border-box;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(191, 91, 111, 0.18), transparent 24%),
    radial-gradient(circle at right center, rgba(213, 157, 51, 0.14), transparent 18%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

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

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
  display: grid;
  gap: 24px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 24px 60px -40px var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 6px 2px 2px;
}

.hero-kicker,
.section-kicker,
.card-kicker,
.timeline-tag {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: var(--muted);
}

.hero-card h1,
.panel h2 {
  font-family: "Fraunces", serif;
}

.hero-card h1 {
  margin-top: 10px;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 0.95;
}

.hero-title {
  display: flex;
  align-items: center;
  gap: 0.35em;
  flex-wrap: wrap;
}

.hero-title-mausi {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  white-space: nowrap;
}

.hero-title-icon {
  width: 0.9em;
  height: 0.9em;
  display: block;
}

.daily-quote {
  margin: 0;
  max-width: 56rem;
  font-size: 1.62rem;
  line-height: 1.55;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.quote-box {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.quote-mark {
  font-family: "Fraunces", serif;
  font-size: 4.8rem;
  line-height: 0.8;
  color: rgba(191, 91, 111, 0.45);
  flex: 0 0 auto;
}

.panel {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.panel-header h2 {
  margin-top: 6px;
  font-size: 1.75rem;
}

.section-copy {
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.5;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

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

.priority-column {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 251, 247, 0.72);
  border: 1px solid var(--line);
}

.priority-heading {
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
}

.priority-list {
  display: grid;
  gap: 12px;
}

.priority-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid rgba(103, 63, 78, 0.1);
}

.priority-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.priority-dot {
  width: 14px;
  height: 14px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--priority-color, var(--accent));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--priority-color, var(--accent)) 16%, transparent);
}

.priority-copy {
  display: grid;
  gap: 4px;
}

.priority-title {
  font-weight: 700;
  line-height: 1.35;
}

.priority-status {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.priority-meta {
  color: var(--muted);
  line-height: 1.45;
}

.card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper-strong);
  padding: 18px;
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto auto auto 1fr auto auto;
  position: relative;
  overflow: hidden;
}

.card.is-expanded {
  grid-column: 1 / -1;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--status-color, var(--accent));
}

.balance-card {
  background:
    linear-gradient(180deg, rgba(248, 209, 228, 0.42) 0%, rgba(255, 251, 247, 0.96) 34%),
    var(--paper-strong);
}

.balance-card .status-pill {
  background: var(--balance-accent);
}

.card-header {
  display: grid;
  gap: 8px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.card-title {
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 700;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--status-color, var(--accent));
}

.card-main {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
}

.card-sub {
  color: var(--muted);
  line-height: 1.45;
}

.card-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.94rem;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.card > .primary-button,
.card > .secondary-button {
  width: 100%;
  height: 56px;
  min-height: 56px;
  align-self: end;
}

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

.primary-button {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.secondary-button {
  background: rgba(61, 34, 49, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.export-button {
  white-space: normal;
  justify-self: start;
  padding-inline: 18px;
  background: rgba(61, 34, 49, 0.18);
  color: var(--ink);
  text-align: center;
}

.danger-button {
  background: rgba(200, 91, 84, 0.14);
  color: var(--bad);
}

.timeline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.entry-panel {
  display: none;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(243, 202, 211, 0.18);
  border: 1px solid rgba(191, 91, 111, 0.16);
}

.entry-panel.is-open {
  display: grid;
}

.entry-hint {
  color: var(--muted);
  font-size: 0.93rem;
}

.entry-panel textarea {
  min-height: 96px;
  width: 100%;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.entry-panel textarea:focus {
  outline: 2px solid rgba(191, 91, 111, 0.25);
  border-color: rgba(191, 91, 111, 0.35);
}

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

.entry-actions button {
  flex: 1 1 180px;
}

.timeline-panel {
  min-height: 360px;
}

.timeline-scroll {
  min-height: 260px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 4px 2px;
}

.timeline-item,
.timeline-empty {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
  background: var(--paper-strong);
}

.timeline-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 8px;
  align-items: start;
}

.timeline-marker {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin-top: 7px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(191, 91, 111, 0.12);
}

.timeline-marker.is-category {
  background: var(--good);
  box-shadow: 0 0 0 5px rgba(93, 138, 99, 0.14);
}

.timeline-marker.is-balance {
  background: var(--balance-accent);
  box-shadow: 0 0 0 5px rgba(223, 93, 154, 0.14);
}

.timeline-marker.is-note {
  background: var(--warn);
  box-shadow: 0 0 0 5px rgba(213, 157, 51, 0.14);
}

.timeline-marker.is-occasion {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(191, 91, 111, 0.12);
}

.timeline-top,
.timeline-note {
  grid-column: 2;
}

.timeline-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.timeline-meta {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.timeline-title {
  font-weight: 700;
}

.timeline-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 251, 247, 0.96);
  border: 1px solid rgba(191, 91, 111, 0.14);
  white-space: nowrap;
  margin-bottom: 8px;
}

.timeline-time {
  color: var(--muted);
  font-size: 0.92rem;
}

.timeline-delete-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.timeline-delete-button:hover {
  color: var(--bad);
}

.timeline-note {
  color: var(--muted);
  line-height: 1.5;
}

.timeline-empty {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 24px, 1280px);
    padding-top: 24px;
    gap: 20px;
  }

  .hero-card h1 {
    font-size: clamp(2.3rem, 8vw, 3.5rem);
  }

  .panel-header {
    flex-direction: column;
    align-items: start;
  }

  .section-copy {
    max-width: none;
  }

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

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

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .panel,
  .hero-card {
    padding: 18px;
  }

  .panel {
    border-radius: 22px;
  }

  .card-title-row,
  .timeline-top {
    flex-direction: column;
    align-items: start;
  }

  .timeline-meta {
    justify-items: start;
  }

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

  .card {
    padding: 16px;
    border-radius: 20px;
  }

  .priority-column {
    padding: 16px;
    border-radius: 20px;
  }

  .card-main {
    font-size: 1.45rem;
  }

  .status-pill {
    align-self: start;
  }

  .timeline-panel {
    min-height: auto;
  }

  .timeline-scroll {
    max-height: 360px;
  }

  .entry-actions {
    flex-direction: column;
  }

  .entry-actions button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .timeline-actions {
    display: grid;
  }
}

@media (max-width: 560px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(191, 91, 111, 0.16), transparent 30%),
      linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  }

  .app-shell {
    width: calc(100% - 16px);
    padding: 14px 0 28px;
    gap: 16px;
  }

  .hero-card,
  .panel {
    padding: 16px;
  }

  .panel {
    border-radius: 18px;
  }

  .hero-kicker,
  .section-kicker,
  .card-kicker,
  .timeline-tag {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
  }

  .hero-card h1 {
    font-size: clamp(2rem, 11vw, 2.7rem);
    line-height: 1.02;
  }

  .hero-card {
    text-align: left;
  }

  .hero-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.16em;
  }

  .daily-quote {
    max-width: none;
    font-size: 1.08rem;
    line-height: 1.45;
    text-align: left;
  }

  .quote-box {
    margin-top: 14px;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 8px;
  }

  .quote-mark {
    font-size: 2.6rem;
    line-height: 1;
    margin-top: -2px;
  }

  .panel-header h2 {
    font-size: 1.45rem;
  }

  .section-copy {
    font-size: 0.95rem;
  }

  .card {
    gap: 12px;
    padding: 15px;
  }

  .card-title {
    font-size: 1rem;
  }

  .priority-heading {
    font-size: 1.1rem;
  }

  .card-main {
    font-size: 1.3rem;
  }

  .card-sub,
  .card-meta,
  .entry-hint,
  .priority-meta,
  .timeline-note,
  .timeline-time {
    font-size: 0.92rem;
  }

  .entry-panel {
    padding: 12px;
  }

  .entry-panel textarea {
    min-height: 84px;
    padding: 10px 12px;
  }

  .timeline-item,
  .timeline-empty {
    padding: 12px 14px;
    border-radius: 16px;
  }

  .timeline-scroll {
    min-height: 220px;
    max-height: 320px;
    padding: 4px 2px;
  }

  .timeline-tag {
    margin-bottom: 4px;
  }

  .export-button,
  .danger-button {
    white-space: normal;
    min-width: 0;
  }
}
