:root {
  --turquoise: #0097a7;
  --turquoise-dark: #006c75;
  --green: #2e8f70;
  --sand: #f3dfbd;
  --sand-light: #fff8ea;
  --white: #ffffff;
  --ink: #17323a;
  --muted: #5b7075;
  --line: #d9e7e3;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(15, 68, 74, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fffd 0%, var(--sand-light) 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

a {
  color: inherit;
}

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

.hero {
  min-height: 72vh;
  background-image: url("assets/alagoas-hero.png");
  background-position: center;
  background-size: cover;
}

.hero__shade {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(4, 55, 62, 0.74), rgba(0, 93, 101, 0.32), rgba(255, 248, 234, 0.08));
  padding: 20px clamp(18px, 5vw, 64px) 56px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.topbar a,
.auth-entry,
.bottom-nav a {
  min-height: 44px;
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  padding: 10px 16px;
  text-decoration: none;
}

.topbar a {
  background: rgba(255, 255, 255, 0.86);
  color: var(--turquoise-dark);
}

.auth-entry {
  background: var(--white);
  border: 0;
  color: var(--turquoise-dark);
  cursor: pointer;
}

.hero__content {
  color: var(--white);
  max-width: 780px;
  padding-top: 20vh;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.eyebrow {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 12px;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.7rem, 7vw, 5.7rem);
  line-height: 0.98;
  margin-bottom: 18px;
  max-width: 860px;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.12;
  margin-bottom: 14px;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

h4 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.hero__summary {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  max-width: 660px;
}

.auth-status {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 22px;
  max-width: 720px;
  padding: 12px 14px;
  text-shadow: none;
}

.auth-status strong {
  display: block;
}

.auth-status small {
  color: var(--muted);
}

.section {
  margin: 0 auto;
  max-width: 1180px;
  padding: 52px clamp(16px, 4vw, 36px);
}

.section--tight {
  padding-top: 32px;
}

.section-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.summary-grid,
.expense-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.expense-layout {
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.highlight {
  border-top: 6px solid var(--turquoise);
}

.plain-list,
.totals-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plain-list li,
.totals-list li {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.plain-list li:last-child,
.totals-list li:last-child {
  border-bottom: 0;
}

.progress-block {
  margin-top: 22px;
}

.progress-label {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-track {
  background: #d8f0ed;
  border-radius: 999px;
  height: 16px;
  overflow: hidden;
}

.progress-track span {
  background: linear-gradient(90deg, var(--green), var(--turquoise));
  display: block;
  height: 100%;
  transition: width 0.25s ease;
  width: 0%;
}

.tide-alert,
.sync-alert {
  align-items: flex-start;
  background: #fff3cd;
  border: 1px solid #f6cf6c;
  border-radius: 8px;
  display: flex;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
}

.sync-alert {
  background: #e9f7f4;
  border-color: #9edbd2;
}

.tide-alert strong,
.sync-alert strong {
  color: #795400;
  min-width: 180px;
}

.sync-alert strong {
  color: var(--turquoise-dark);
}

.day-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.day-nav button {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--turquoise-dark);
  cursor: pointer;
  flex: 0 0 auto;
  font-weight: 900;
  min-height: 44px;
  padding: 10px 16px;
}

.day-nav button.active {
  background: var(--turquoise);
  color: var(--white);
}

.day-panel {
  display: none;
}

.day-panel.active {
  display: block;
}

.day-title {
  background: var(--white);
  border-left: 8px solid var(--green);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 22px;
}

.day-title p {
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 0;
}

.timeline {
  display: grid;
  gap: 16px;
}

.period {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.period__heading {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.period__time {
  background: var(--sand);
  border-radius: 999px;
  color: #674c17;
  font-weight: 900;
  padding: 5px 12px;
}

.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.item-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 100%;
  padding: 16px;
}

.item-card__top {
  align-items: flex-start;
  display: flex;
  gap: 12px;
}

.checkline {
  align-items: flex-start;
  display: flex;
  gap: 10px;
}

.checkline input {
  accent-color: var(--green);
  flex: 0 0 auto;
  height: 22px;
  margin-top: 3px;
  width: 22px;
}

.tag {
  background: #e9f7f4;
  border-radius: 999px;
  color: var(--turquoise-dark);
  display: inline-flex;
  font-size: 0.84rem;
  font-weight: 900;
  margin-bottom: 10px;
  padding: 4px 10px;
}

.details {
  margin: 10px 0 0;
  padding-left: 22px;
}

.price {
  color: var(--green);
  font-weight: 900;
  margin-top: 10px;
}

.map-link,
.primary,
.danger,
.delete-button {
  align-items: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  text-decoration: none;
}

.map-link {
  background: var(--turquoise);
  color: var(--white);
  margin-top: 14px;
}

.primary {
  background: var(--green);
  color: var(--white);
}

.danger {
  background: var(--danger);
  color: var(--white);
}

.subtle {
  background: #fff1ef;
  border: 1px solid #f1b8b1;
  color: var(--danger);
}

.delete-button {
  background: #fff1ef;
  color: var(--danger);
}

.notes {
  margin-top: 18px;
}

.notes label {
  display: block;
  font-weight: 900;
}

.notes textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 130px;
  padding: 14px;
  resize: vertical;
  width: 100%;
}

.expense-form {
  display: grid;
  gap: 14px;
}

.expense-form label {
  color: var(--muted);
  display: grid;
  font-weight: 900;
  gap: 6px;
}

.expense-form input,
.expense-form select {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 46px;
  padding: 10px 12px;
}

.total {
  color: var(--turquoise-dark);
  font-size: 2rem;
  font-weight: 950;
}

.totals-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.expense-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.expense-row {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto auto;
  padding: 14px 16px;
}

.expense-row strong {
  display: block;
}

.expense-row span {
  color: var(--muted);
  font-size: 0.95rem;
}

.install {
  background: var(--turquoise-dark);
  color: var(--white);
  max-width: none;
  padding-bottom: 92px;
  text-align: center;
}

.install h2,
.install p {
  margin-left: auto;
  margin-right: auto;
  max-width: 760px;
}

.bottom-nav {
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  bottom: 0;
  display: none;
  gap: 4px;
  grid-template-columns: repeat(5, 1fr);
  left: 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 10;
}

.bottom-nav a {
  color: var(--turquoise-dark);
  font-size: 0.88rem;
  padding: 8px 6px;
}

.bottom-nav button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--turquoise-dark);
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 8px 6px;
}

.toast {
  background: var(--ink);
  border-radius: 8px;
  bottom: 86px;
  box-shadow: var(--shadow);
  color: var(--white);
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  opacity: 0;
  padding: 14px 16px;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%) translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

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

.auth-modal {
  border: 0;
  border-radius: 8px;
  max-width: min(520px, calc(100vw - 24px));
  padding: 0;
  width: 100%;
}

.auth-modal::backdrop {
  background: rgba(8, 43, 48, 0.58);
}

.auth-card {
  display: grid;
  gap: 13px;
  padding: 26px;
  position: relative;
}

.auth-card label {
  color: var(--muted);
  display: grid;
  font-weight: 900;
  gap: 6px;
}

.auth-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 46px;
  padding: 10px 12px;
}

.auth-eyebrow {
  color: var(--green);
  margin-bottom: -4px;
  text-shadow: none;
}

.auth-help {
  color: var(--muted);
  margin-bottom: 4px;
}

.auth-tabs {
  background: #eef8f6;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  padding: 6px;
}

.auth-tabs button,
.google-button,
.link-button,
.icon-close {
  border: 0;
  cursor: pointer;
  font-weight: 900;
}

.auth-tabs button {
  background: transparent;
  border-radius: 7px;
  color: var(--turquoise-dark);
  min-height: 42px;
}

.auth-tabs button.active {
  background: var(--white);
  box-shadow: 0 6px 18px rgba(15, 68, 74, 0.12);
}

.google-button {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  min-height: 44px;
}

.link-button {
  background: transparent;
  color: var(--turquoise-dark);
  min-height: 40px;
}

.icon-close {
  background: #eef8f6;
  border-radius: 999px;
  color: var(--ink);
  font-size: 1.5rem;
  height: 40px;
  line-height: 1;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 40px;
}

.auth-message {
  color: var(--danger);
  font-weight: 800;
  margin-bottom: 0;
  min-height: 24px;
}

.auth-card[data-mode="login"] .signup-only {
  display: none;
}

.auth-card.loading {
  opacity: 0.72;
  pointer-events: none;
}

@media (max-width: 860px) {
  body {
    font-size: 16px;
    padding-bottom: 74px;
  }

  .topbar {
    display: none;
  }

  .bottom-nav {
    display: grid;
  }

  .hero,
  .hero__shade {
    min-height: 64vh;
  }

  .hero__shade {
    padding-bottom: 42px;
  }

  .hero__content {
    padding-top: 18vh;
  }

  .summary-grid,
  .expense-layout,
  .totals-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tide-alert,
  .sync-alert {
    display: block;
  }

  .tide-alert strong,
  .sync-alert strong {
    display: block;
    margin-bottom: 6px;
  }

  .auth-status {
    align-items: stretch;
  }

  .auth-status .auth-entry {
    width: 100%;
  }

  .expense-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
