:root {
  color-scheme: light;
  --brand: #167642;
  --brand-dark: #0d5730;
  --brand-soft: #dff2e7;
  --surface: #ffffff;
  --canvas: #ffffff;
  --ink: #17221c;
  --muted: #52635a;
  --line: #cfdcd4;
  --focus: #ffb21c;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.portal-shell {
  width: min(440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.portal-header {
  display: grid;
  gap: 24px;
  padding: 12px 6px 34px;
}

.portal-logo {
  display: block;
  width: min(210px, 62vw);
  height: auto;
}

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

h1,
p { margin: 0; }

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.portal-header p {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.7;
}

[hidden] { display: none !important; }

.login-panel {
  display: grid;
  gap: 22px;
  border-radius: 14px;
  background: var(--surface);
  padding: 22px;
  box-shadow: 0 6px 8px rgba(23, 34, 28, .08);
}

.login-copy {
  display: grid;
  gap: 7px;
}

.login-copy h2 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.35;
}

.login-copy p {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.65;
}

.login-form,
.login-form label {
  display: grid;
  gap: 8px;
}

.login-form { gap: 18px; }

.login-form label > span:first-child {
  font-size: .92rem;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #9fb1a6;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  padding: 0 13px;
}

.login-form input:focus-visible,
.token-visibility:focus-visible,
.login-button:focus-visible,
.session-bar button:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}

.token-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.token-visibility,
.session-bar button {
  min-width: 68px;
  border: 0;
  border-radius: 10px;
  background: #e1e9e4;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.login-button {
  min-height: 54px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.login-button:hover { background: var(--brand-dark); }

.login-button:disabled {
  background: #74857b;
  cursor: wait;
}

.login-result {
  min-height: 24px;
  color: #a12626;
  font-size: .9rem;
  font-weight: 800;
  line-height: 1.6;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.session-bar button {
  min-height: 38px;
  padding: 0 12px;
}

.push-invite {
  display: grid;
  gap: 10px;
  margin: 0 0 22px;
  padding: 18px;
  border: 2px solid var(--brand);
  border-radius: 16px;
  background: var(--brand-soft);
}

.push-invite h2 { margin: 0; font-size: 1.15rem; }
.push-invite p { line-height: 1.6; }
.push-invite-status { color: var(--brand-dark); font-size: .88rem; font-weight: 800; }
.push-invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.push-invite-actions button {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.push-invite-actions button:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.push-invite-actions button:disabled { opacity: .65; cursor: default; }
#pushNoticeButton { background: var(--brand); color: #fff; }
#pushLaterButton { background: #fff; color: var(--brand-dark); }

.app-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 18px;
}

.menu-item {
  display: flex;
  aspect-ratio: 1.08 / 1;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 26px;
  text-decoration: none;
  padding: 18px 14px;
  box-shadow: 0 8px 10px rgba(40, 49, 44, .17);
  transition: transform 180ms cubic-bezier(.16, 1, .3, 1), filter 180ms ease, box-shadow 180ms ease;
}

.menu-item:hover {
  filter: brightness(.97);
  transform: translateY(-2px);
  box-shadow: 0 10px 12px rgba(40, 49, 44, .2);
}

.menu-item:active { transform: scale(.985); }

.menu-item:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.menu-item-switch { background: #ff857d; color: #501d19; }
.menu-item-closed { background: #ffda5c; color: #4d3a00; }
.menu-item-memo { background: #82dec1; color: #123f33; }

.menu-copy {
  display: grid;
  min-width: 0;
  gap: 8px;
  text-align: center;
}

.menu-copy strong {
  font-size: 1.18rem;
  line-height: 1.35;
  text-wrap: balance;
}

.menu-copy small {
  color: currentColor;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.5;
  text-wrap: pretty;
  opacity: .82;
}

.portal-shop {
  min-height: 20px;
  margin-top: 24px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 380px) {
  .portal-shell { padding-inline: 12px; }
  .login-panel { padding: 18px; }
  .menu-item {
    border-radius: 22px;
    padding: 14px 10px;
  }
  .menu-copy strong { font-size: 1rem; }
  .menu-copy small { font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-item { transition: none; }
}
