/* MVP.css-based editorial theme for the server-hosted PolarMind web app. */
:root {
  --ui-font: "Manrope", "Avenir Next", "SF Pro Text", "Helvetica Neue", sans-serif;
  --reading-font: "Newsreader", "Iowan Old Style", "Georgia", serif;
  --ink: #2d241d;
  --muted: #7c6a57;
  --paper: #f6f0e8;
  --paper-strong: #fffaf4;
  --primary: #2f745e;
  --primary-hover: #235b49;
  --line: rgba(120, 95, 70, 0.18);
  --line-soft: rgba(128, 94, 60, 0.1);
  --card-shadow: 0 20px 50px rgba(91, 61, 28, 0.08);
  --radius-pill: 999px;
  --radius-card: 1.3rem;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--ui-font);
  background:
    radial-gradient(circle at top left, rgba(255, 244, 230, 0.9) 0, transparent 28rem),
    radial-gradient(circle at top right, rgba(222, 240, 230, 0.65) 0, transparent 24rem),
    linear-gradient(180deg, #fbf7f2 0%, #f6f0e8 100%);
}

h1,
h2,
h3,
h4,
h5,
h6,
button,
.button,
label,
.pill,
.meta,
.task-meta,
.summary-card-label,
.page-title,
.section-title {
  font-family: var(--ui-font);
}

p,
li,
blockquote,
.hero p,
.reflection-output,
.chirp-rich,
.summary-cardText,
.task-title,
.received-gift-sender,
.legal-page p {
  font-family: var(--reading-font);
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-hover);
}

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

button,
.button,
a[role="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.8rem;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(47, 116, 94, 0.16);
  background: linear-gradient(180deg, rgba(50, 122, 99, 0.97) 0%, rgba(39, 98, 79, 0.98) 100%);
  color: #fffaf4;
  box-shadow: 0 14px 30px rgba(47, 116, 94, 0.18);
  text-decoration: none;
  font-weight: 700;
}

button:hover,
.button:hover,
a[role="button"]:hover {
  background: linear-gradient(180deg, rgba(39, 98, 79, 0.97) 0%, rgba(31, 81, 65, 0.98) 100%);
  color: #fffaf4;
}

button.secondary,
.button.secondary,
a.secondary[role="button"] {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: #5a493b;
  box-shadow: none;
}

button.secondary:hover,
.button.secondary:hover,
a.secondary[role="button"]:hover {
  background: rgba(248, 242, 234, 0.96);
  color: #3f3228;
}

input,
select,
textarea {
  background: rgba(255, 252, 248, 0.9);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(47, 116, 94, 0.35);
  box-shadow: 0 0 0 4px rgba(47, 116, 94, 0.12);
}


#app {
  min-height: 100vh;
}

.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.15rem 1.2rem 1.6rem;
}

.hero,
.panel,
.task-card,
.chirp-card,
.summary-card,
.empty-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.92) 0%, rgba(255, 249, 241, 0.88) 100%);
  box-shadow:
    var(--card-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
}

.hero::after,
.panel::after {
  content: "";
  position: absolute;
  inset: auto auto -60px -60px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 239, 232, 0.9) 0, transparent 72%);
  pointer-events: none;
}

.hero {
  padding: 1.85rem;
  display: grid;
  gap: 0.9rem;
}

.hero h1,
.section-title,
.page-title {
  margin: 0;
  letter-spacing: -0.04em;
}

.hero h1 {
  max-width: 13ch;
  font-size: clamp(2rem, 4.8vw, 3.25rem);
  line-height: 1;
  font-weight: 800;
}

.hero p {
  max-width: 58ch;
  font-size: 1rem;
}

.hero p,
.hint,
.meta,
.empty-copy,
.task-meta,
.helper-text,
.pill,
.status-line {
  color: var(--muted);
}

.hero-actions,
.nav,
.archive-tabs,
.button-row,
.task-actions,
.profile-actions,
.style-grid,
.context-toggle,
.duration-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.app-shell {
  display: grid;
  gap: 1.1rem;
}

.topbar,
.composer,
.night-grid,
.archive-grid,
.reflection-grid,
.profile-grid {
  display: grid;
  gap: 1.1rem;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  padding: 1.05rem 1.15rem;
}

.topbar-title {
  display: grid;
  gap: 0.45rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  justify-content: flex-end;
}

.topbar-nav {
  align-items: center;
  justify-content: center;
  grid-column: auto;
}

.pebble-stats-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  border-radius: var(--radius-pill);
  padding: 0.55rem 0.95rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: #2d241d;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: none;
}

.pebble-stats-main {
  color: #2d241d;
}

.pebble-stats-side {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-left: 1px solid var(--line);
  padding-left: 0.75rem;
}

.topbar-day-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.95rem;
  height: 1.95rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.topbar-day-stat-good,
.stat-good {
  color: #255744;
}

.topbar-day-stat-good {
  background: rgba(226, 239, 232, 0.95);
}

.topbar-day-stat-alert,
.stat-alert {
  color: #a23d2a;
}

.topbar-day-stat-alert {
  background: rgba(248, 225, 221, 0.95);
}

.stats-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(45, 36, 29, 0.18);
}

.stats-modal-card {
  width: min(100%, 34rem);
  padding: 1.25rem;
}

.stats-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stats-modal-close {
  padding-inline: 0.85rem;
  box-shadow: none;
}

.stats-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding: 1rem;
  border: 1px solid rgba(120, 95, 70, 0.14);
  border-radius: 1.4rem;
  background: rgba(245, 238, 228, 0.92);
}

.stats-hero-icon {
  font-size: 2rem;
  line-height: 1;
}

.stats-hero-value {
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.stats-summary {
  align-items: center;
  text-align: center;
}

.stats-summary-good {
  background: rgba(226, 239, 232, 0.95);
}

.stats-summary-alert {
  background: rgba(248, 225, 221, 0.95);
}

.stats-summary-icon {
  font-size: 1.2rem;
  font-weight: 800;
  color: #5a493b;
}

.gift-amount-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.gift-amount-button {
  margin: 0;
  border-radius: 1rem;
  background: rgba(245, 238, 228, 0.96);
  border-color: var(--line);
  color: #5a493b;
  box-shadow: none;
  font-weight: 800;
}

.gift-amount-button.is-active {
  background: #2f745e;
  border-color: #2f745e;
  color: #fffaf4;
}

.gift-message-input {
  min-height: 6rem;
  margin-bottom: 0.9rem;
}

.received-gift-summary {
  margin-top: 0.9rem;
  padding: 0.85rem 0.9rem;
  border-radius: 1rem;
  border: 1px solid rgba(120, 95, 70, 0.14);
  background: rgba(245, 238, 228, 0.92);
}

.received-gift-sender {
  margin-top: 0.35rem;
  color: #5a493b;
  font-size: 0.9rem;
  line-height: 1.4;
}

.nav {
  align-items: center;
  justify-content: flex-end;
}

.panel {
  padding: 1.1rem 1.15rem;
}

.composer,
.reflection-grid,
.archive-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
}

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

.field {
  display: grid;
  gap: 0.5rem;
}

.field label,
.stack-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #4b3a2d;
}

.field textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.task-list,
.archive-list,
.chirp-list,
.style-grid,
.night-status-row {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: stretch;
}

.night-status-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.night-status-pill strong {
  font-size: 1.1rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.night-status-pill-good {
  background: rgba(226, 239, 232, 0.95);
  color: #255744;
}

.night-status-pill-alert {
  background: rgba(248, 225, 221, 0.95);
  color: #a23d2a;
}

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

.task-card,
.chirp-card,
.summary-card,
.empty-card {
  padding: 0.9rem 0.95rem;
  border-radius: var(--radius-card);
}

.task-card.done {
  opacity: 0.72;
}

.task-card.overdue {
  border-color: rgba(182, 69, 44, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 244, 241, 0.96) 0%, rgba(251, 230, 225, 0.92) 100%);
}

.task-body {
  display: grid;
  gap: 0.75rem;
}

.task-top,
.profile-line {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: flex-start;
}

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

.day-panel .section-header .button {
  flex-shrink: 0;
}

.task-title,
.summary-card h3,
.chirp-card h3,
.page-title {
  margin: 0;
}

.task-title {
  font-size: 0.98rem;
  line-height: 1.3;
}

.page-title,
.section-title {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.1;
  font-weight: 800;
}

.task-actions,
.button-row,
.profile-actions {
  margin-top: 0.15rem;
}

.task-actions button,
.archive-tabs button,
.nav button,
.button-row button,
.profile-actions button,
.style-grid button,
.context-toggle button,
.duration-scale button {
  margin: 0;
  border-radius: var(--radius-pill);
  padding-inline: 1rem;
}

.task-actions button,
.archive-tabs button,
.nav button,
.ghost-button,
.context-button,
.duration-dot {
  background: rgba(255, 255, 255, 0.58);
  border-color: var(--line);
  color: #5a493b;
  box-shadow: none;
  font-size: 0.88rem;
}

.task-actions button:hover,
.archive-tabs button:hover,
.nav button:hover,
.ghost-button:hover,
.context-button:hover,
.duration-dot:hover {
  background: rgba(248, 242, 234, 0.96);
  color: #5a493b;
}

.tab-button.is-active,
.archive-tab.is-active,
.context-button.is-active,
.duration-dot.is-active {
  background: rgba(226, 239, 232, 0.95);
  border-color: rgba(47, 116, 94, 0.2);
  color: #255744;
}

.task-composer-modal {
  width: min(100%, 42rem);
}

.task-composer-textarea {
  min-height: 8.5rem;
  resize: vertical;
}

.task-composer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.task-duration-value {
  font-size: 0.95rem;
  color: #255744;
}

input[type="range"] {
  width: 100%;
  margin: 0.4rem 0 0.2rem;
}

.duration-scale {
  gap: 0.55rem;
}

.duration-dot {
  padding-inline: 0.9rem;
  min-height: 2.4rem;
  font-size: 0.82rem;
}

.context-toggle {
  gap: 0.75rem;
}

.context-button {
  min-width: 8rem;
}

.summary-card {
  gap: 0.3rem;
}

.summary-card strong {
  display: block;
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.05em;
  font-family: var(--ui-font);
}

.reflection-output,
.chirp-rich {
  white-space: pre-wrap;
  line-height: 1.78;
  font-size: 1.05rem;
}

.chirp-rich p,
.chirp-rich h1,
.chirp-rich h2 {
  margin: 0 0 0.85rem;
}

.chirp-rich h1,
.chirp-rich h2 {
  font-size: 1.14rem;
  letter-spacing: -0.03em;
}

.rich-plum {
  color: #7654a8;
}

.rich-rose {
  color: #c25678;
}

.rich-gold {
  color: #a67b16;
}

.rich-sky {
  color: #2f6ca4;
}

.rich-mint {
  color: #2f7e5f;
}

.status-line {
  min-height: 1.3rem;
}

.status-line.error {
  color: #b14d42;
}

.status-line.success {
  color: #2f745e;
}

.apple-button {
  background: #111;
  border-color: #111;
  color: #fff;
  min-height: 3rem;
  padding-inline: 1.2rem;
  font-weight: 700;
  box-shadow: none;
}

.mac-hint {
  border-radius: 1.1rem;
  padding: 0.9rem 1rem;
  background: rgba(226, 239, 232, 0.76);
  color: #2b654f;
  border: 1px solid rgba(47, 116, 94, 0.12);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(120, 95, 70, 0.14);
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.empty-card {
  text-align: center;
}

.empty-copy {
  margin: 0;
}

.hero-actions .apple-button,
.button-row .button,
.profile-actions .button {
  box-shadow: 0 14px 30px rgba(47, 116, 94, 0.18);
}

.legal-page {
  padding: 1.35rem;
}

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

.legal-stack {
  display: grid;
  gap: 1rem;
}

.legal-page h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.legal-page p {
  margin: 0;
}

.legal-footer {
  margin-top: 1rem;
}

@media (max-width: 920px) {
  .composer,
  .night-grid,
  .archive-grid,
  .reflection-grid,
  .profile-grid,
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

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

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

@media (max-width: 640px) {
  .shell {
    padding: 0.85rem;
  }

  .hero,
  .panel {
    padding: 1.05rem;
  }

  .hero h1 {
    max-width: none;
  }
}
