:root {
  --green-950: #06201a;
  --green-900: #0a2f24;
  --green-800: #124536;
  --green-700: #1a5c47;
  --green-600: #247a5c;
  --fairway: #3f9b6e;
  --sand: #e8dfc8;
  --sand-soft: #f3eee2;
  --ink: #14241e;
  --ink-soft: #4a5c54;
  --line: rgba(20, 36, 30, 0.1);
  --white: #fffdf8;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 12px 40px rgba(6, 32, 26, 0.18);
  --radius: 18px;
  --font: "Outfit", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--green-950);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

#app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: var(--sand-soft);
  box-shadow: var(--shadow);
}

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.is-active {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Splash */
.screen-splash {
  position: relative;
  overflow: hidden;
  background: var(--green-900);
  color: var(--sand);
}

.splash-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(63, 155, 110, 0.45), transparent 60%),
    linear-gradient(160deg, #0a2f24 0%, #124536 45%, #06201a 100%);
  animation: wash 4s ease-in-out infinite alternate;
}

@keyframes wash {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.splash-content {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem;
  animation: rise 0.8s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-mark {
  color: var(--sand);
  margin-bottom: 1rem;
}

.splash-eyebrow {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin: 0 0 0.4rem;
  opacity: 0.8;
}

.splash-title {
  font-family: var(--display);
  font-size: clamp(2.2rem, 8vw, 2.8rem);
  margin: 0;
  font-weight: 700;
}

.splash-sub {
  margin: 0.5rem 0 0;
  opacity: 0.75;
}

/* Login */
.screen-login {
  display: none;
  background: var(--sand-soft);
}

.screen-login.is-active {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.login-hero {
  position: relative;
  min-height: 42dvh;
  background:
    linear-gradient(180deg, rgba(6, 32, 26, 0.15), rgba(6, 32, 26, 0.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath fill='%23124536' d='M0 120c40-20 80-10 160-40v80H0z'/%3E%3Cpath fill='%230a2f24' d='M0 140c50-25 90-5 160-30v50H0z'/%3E%3C/svg%3E") center/cover,
    linear-gradient(145deg, #0a2f24, #1a5c47);
  color: var(--white);
  padding: calc(var(--safe-t) + 2.5rem) 1.5rem 2rem;
  display: flex;
  align-items: flex-end;
}

.login-hero h1 {
  font-family: var(--display);
  font-size: clamp(2.4rem, 10vw, 3.2rem);
  line-height: 1.05;
  margin: 0.35rem 0 0.6rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  opacity: 0.8;
}

.lede {
  margin: 0;
  max-width: 18rem;
  color: rgba(255, 253, 248, 0.82);
  font-size: 0.98rem;
  line-height: 1.45;
}

.login-sheet {
  margin-top: -1.25rem;
  background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 1.6rem 1.35rem calc(1.5rem + var(--safe-b));
  flex: 1;
  box-shadow: 0 -10px 40px rgba(6, 32, 26, 0.12);
  animation: sheet-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field span {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.field input,
.search-field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--sand-soft);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.search-field input:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(36, 122, 92, 0.15);
}

.form-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 0 0 0.8rem;
}

.login-hint {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin: 1rem 0 0;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--green-800);
  color: var(--white);
}

.btn-secondary {
  background: var(--sand);
  color: var(--green-900);
}

.btn-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.25);
}

.link-btn {
  background: none;
  border: 0;
  color: var(--green-700);
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

/* Main shell */
.screen-main.is-active {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 120% 40% at 50% -10%, rgba(36, 122, 92, 0.18), transparent 55%),
    var(--sand-soft);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(var(--safe-t) + 0.85rem) 1.15rem 0.85rem;
  backdrop-filter: blur(14px);
  background: rgba(243, 238, 226, 0.86);
  border-bottom: 1px solid var(--line);
}

.topbar-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.topbar-title {
  margin: 0.1rem 0 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
}

.avatar-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--green-800);
  color: var(--sand);
  font-weight: 700;
  cursor: pointer;
}

.page-stack {
  flex: 1;
  padding: 1rem 1.15rem calc(var(--tab-h) + var(--safe-b) + 1rem);
}

.page {
  display: none;
  animation: page-in 0.35s ease both;
}

.page.is-active {
  display: block;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.hero-kicker {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.hero-greeting {
  margin: 0.2rem 0 0;
  font-family: var(--display);
  font-size: 1.7rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(6, 118, 71, 0.12);
  color: var(--ok);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(6, 118, 71, 0.15);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--white);
  border-radius: var(--radius);
  padding: 0.9rem 0.75rem;
  text-align: center;
  border: 1px solid var(--line);
}

.stat-value {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  color: var(--green-800);
}

.stat-label {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
  margin-bottom: 0.9rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.panel-head h3 {
  margin: 0;
  font-size: 1rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.action-tile {
  border: 1px solid var(--line);
  background: var(--sand-soft);
  border-radius: 16px;
  padding: 1rem 0.8rem;
  text-align: left;
  display: grid;
  gap: 0.55rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.action-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--green-800);
  color: var(--sand);
  font-size: 0.95rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.list.dense {
  gap: 0.45rem;
}

.list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
}

.panel .list-item {
  background: var(--sand-soft);
}

.time-badge {
  min-width: 52px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--green-800);
}

.item-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.item-meta {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-open {
  background: rgba(36, 122, 92, 0.12);
  color: var(--green-700);
}

.badge-done {
  background: rgba(6, 118, 71, 0.12);
  color: var(--ok);
}

.badge-wait {
  background: rgba(181, 71, 8, 0.12);
  color: var(--warn);
}

.alert-list,
.notice-list,
.settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.alert-list li,
.notice-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.alert-list li:last-child,
.notice-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.alert-list strong,
.notice-list strong {
  display: block;
  margin-bottom: 0.2rem;
}

.alert-list p,
.notice-list p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.4;
}

.filter-row {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  margin-bottom: 0.9rem;
  padding-bottom: 0.15rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip.is-active {
  background: var(--green-800);
  color: var(--white);
  border-color: var(--green-800);
}

.search-field {
  display: block;
  margin-bottom: 0.9rem;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--green-900);
  color: var(--sand);
  border-radius: 22px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.profile-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
}

.profile-card p {
  margin: 0.25rem 0 0;
  opacity: 0.8;
  font-size: 0.9rem;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.14);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.settings-list {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 1rem;
}

.settings-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.settings-list li:last-child {
  border-bottom: 0;
}

.settings-list span {
  color: var(--ink-soft);
}

.settings-list strong {
  font-weight: 600;
  text-align: right;
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.15rem;
  padding: 0.45rem 0.4rem calc(0.45rem + var(--safe-b));
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 30;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}

.tab svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.tab.is-active {
  color: var(--green-800);
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 32, 26, 0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-overlay[hidden] {
  display: none;
}

.sheet {
  width: min(480px, 100%);
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 0.75rem 1.2rem calc(1.2rem + var(--safe-b));
  animation: sheet-up 0.35s ease both;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto 0.9rem;
}

.sheet h2 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
}

.sheet-meta {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.sheet-meta div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.sheet-meta span {
  color: var(--ink-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 1rem);
  transform: translateX(-50%);
  background: var(--green-950);
  color: var(--sand);
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 60;
  max-width: calc(100% - 2rem);
  box-shadow: var(--shadow);
}

.toast[hidden] {
  display: none;
}

/* Install screen */
.screen-install {
  position: relative;
  overflow: hidden;
  background: var(--green-900);
  color: var(--sand);
}

.screen-install.is-active {
  display: block;
}

.install-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(63, 155, 110, 0.35), transparent 55%),
    linear-gradient(165deg, #0a2f24, #124536 50%, #06201a);
}

.install-content {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--safe-t) + 2rem) 1.4rem calc(1.5rem + var(--safe-b));
  animation: rise 0.7s ease both;
}

.install-icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  margin-bottom: 1.2rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.install-content h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 8vw, 2.6rem);
  margin: 0.35rem 0 0.75rem;
  line-height: 1.1;
}

.install-content .lede {
  margin: 0 0 1.4rem;
  color: rgba(255, 253, 248, 0.82);
  line-height: 1.45;
}

.install-steps {
  margin: 0 0 1.4rem;
  padding-left: 1.2rem;
  color: rgba(255, 253, 248, 0.9);
  line-height: 1.55;
}

.install-steps li + li {
  margin-top: 0.45rem;
}

.install-content .btn-secondary {
  margin-top: 0.65rem;
  background: rgba(255, 253, 248, 0.12);
  color: var(--sand);
}

.install-note {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  color: rgba(255, 253, 248, 0.65);
  text-align: center;
}

.install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 0.75rem);
  transform: translateX(-50%);
  width: min(440px, calc(100% - 1.5rem));
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.75rem 0.85rem;
  box-shadow: var(--shadow);
  z-index: 55;
}

.install-banner[hidden] {
  display: none;
}

.install-banner-copy {
  display: grid;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.install-banner-copy strong {
  font-size: 0.9rem;
}

.install-banner-copy span {
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.install-banner .btn {
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.banner-close {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
}

@media (min-width: 760px) {
  body {
    background:
      radial-gradient(ellipse at top, #124536, #06201a 60%);
  }

  #app {
    min-height: 100dvh;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }
}
