:root {
  color-scheme: light;
  --bg: #e8ebe2;
  --panel: #f3f1e7;
  --ink: #2f3530;
  --muted: #8a938a;
  --green: #5f7f63;
  --green-dark: #4c6b50;
  --accent: #c4762b;
  --card: #fbfaf4;
  --bubble-happy: #dce8db;
  --bubble-ok: #f4e4c6;
  --bubble-sad: #f3d8d3;
  font-family: system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--panel);
  padding: 1.5rem 1.25rem 6rem;
  box-sizing: border-box;
  position: relative;
}

.page-loading,
.page-error {
  padding: 2rem 0;
  text-align: center;
  color: var(--muted);
}

.page-error {
  color: #b3492f;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

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

/* ----- Home header ----- */

.home-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.date-line {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.greeting {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: 1.75rem;
  margin: 0;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dfe4d5;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
}

/* ----- Banner ----- */

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--green);
  color: #fff;
  border-radius: 18px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.banner.logged {
  background: #7a937e;
}

.banner-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.banner-sub {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.2rem;
}

.banner-btn {
  background: #fff;
  color: var(--green-dark);
  font-weight: 700;
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  white-space: nowrap;
}

/* ----- History ----- */

.history-title {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.month {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  color: #6b7a6c;
  font-size: 1.1rem;
  margin: 1.25rem 0 0.5rem;
}

.rows {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem 0;
}

.row + .row {
  border-top: 1px solid rgba(47, 53, 48, 0.07);
}

.date-col {
  width: 3.2rem;
  text-align: center;
  flex-shrink: 0;
}

.dow {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.dom {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.1;
}

.bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e4e6dc;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.bubble-happy { background: var(--bubble-happy); }
.bubble-ok { background: var(--bubble-ok); }
.bubble-sad { background: var(--bubble-sad); }

.row-text {
  flex: 1;
  min-width: 0;
}

.line-primary {
  font-size: 1rem;
}

.line-primary .num {
  color: var(--accent);
  font-weight: 700;
}

.line-primary .unit-strong {
  font-weight: 700;
}

.sep {
  color: var(--muted);
  padding: 0 0.3rem;
}

.line-secondary {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.chev {
  color: var(--muted);
  font-size: 1.3rem;
}

.empty {
  color: var(--muted);
  padding: 1.5rem 0;
}

/* ----- FAB ----- */

.fab {
  position: fixed;
  bottom: 24px;
  right: max(24px, calc(50vw - 240px + 24px));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.9rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(47, 53, 48, 0.25);
  z-index: 10;
}

/* ----- Login ----- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-sizing: border-box;
}

.auth-logo {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 1.5rem;
}

/* ----- Forms ----- */

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #57635a;
  margin: 1rem 0 0.4rem;
}

input {
  font: inherit;
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(47, 53, 48, 0.18);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}

input:focus {
  outline: 2px solid var(--green);
  outline-offset: -1px;
  border-color: transparent;
}

input:disabled {
  opacity: 0.55;
}

.auth-card input {
  margin-bottom: 0.5rem;
}

.num-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.num-wrap input {
  padding-right: 6.5rem;
}

.unit-suffix {
  position: absolute;
  right: 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option {
  border: 1.5px solid rgba(47, 53, 48, 0.15);
  background: var(--card);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 1.25rem;
  min-height: 2.6rem;
}

.option:not(:has(emoji)) {
  font-size: 0.95rem;
}

.option.selected {
  border-color: var(--green);
  background: #e3e9e0;
  box-shadow: inset 0 0 0 1px var(--green);
}

.form-page {
  max-width: 480px;
  margin: 0 auto;
}

.form-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.form-head h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  margin: 0;
}

.back {
  font-size: 1.6rem;
  color: var(--muted);
  padding: 0 0.25rem;
}

.form-error {
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: #f6e2dc;
  color: #b3492f;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

button.primary {
  background: var(--green);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  flex: 1;
}

button.primary:disabled {
  opacity: 0.6;
  cursor: default;
}

button.danger {
  background: none;
  color: #b3492f;
  font-weight: 600;
  border: 1px solid rgba(179, 73, 47, 0.4);
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
}
