:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --ink: #1c1917;
  --muted: #78716c;
  --muted-2: #a8a29e;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --accent: #2f543e;
  --accent-hover: #234032;
  --accent-mid: #3d6b4f;
  --accent-soft: #f4f7f4;
  --info: #0b5ea8;
  --info-soft: #eff7ff;
  --success: #166534;
  --success-soft: #edfdf3;
  --warning: #92400e;
  --warning-soft: #fff7ed;
  --reminder: #d97706;
  --reminder-soft: rgba(217, 119, 6, 0.12);
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --page: 72rem;
  --tap: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

img {
  max-width: 100%;
  height: auto;
}

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

button {
  touch-action: manipulation;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 600;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.125rem;
}

p {
  margin: 0;
}

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

.muted-xs {
  color: var(--muted-2);
  font-size: 0.75rem;
}

.mt {
  margin-top: 0.75rem;
}

.mt-xs {
  margin-top: 0.35rem;
}

.mb {
  margin-bottom: 1.25rem;
}

.mb-xs {
  margin-bottom: 0.5rem;
}

.page-inner {
  width: min(100%, var(--page));
  margin-inline: auto;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.page-main {
  padding-top: 1.25rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.page-narrow {
  width: min(100%, 32rem);
  margin-inline: auto;
}

.page-auth {
  width: min(100%, 26rem);
  margin-inline: auto;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding-block: 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 42vw;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.household-chip,
.header-profile {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.2rem 0.45rem 0.2rem 0.2rem;
}

.household-chip {
  border: 1px solid var(--line);
  padding-left: 0.25rem;
}

.household-chip:hover,
.header-profile:hover {
  background: var(--bg);
  text-decoration: none;
}

.household-chip-logo {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}

.household-chip-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
}

.household-chip-name,
.header-profile-name {
  display: none;
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
}

.hh-switcher {
  position: relative;
}

.hh-switcher > summary {
  list-style: none;
  cursor: pointer;
}

.hh-switcher > summary::marker,
.hh-switcher > summary::-webkit-details-marker {
  display: none;
  content: "";
}

.hh-switcher[open] > summary {
  background: var(--bg);
}

.hh-caret {
  width: 0.4rem;
  height: 0.4rem;
  margin: 0 0.2rem 0 0.05rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.hh-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 40;
  min-width: 16rem;
  max-width: min(20rem, calc(100vw - 1.5rem));
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.1);
}

.hh-menu form {
  margin: 0;
}

.hh-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4rem 0.55rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.hh-menu-item:hover {
  background: var(--bg);
  text-decoration: none;
}

.hh-menu-item.is-current {
  background: var(--accent-soft);
}

.hh-menu-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.hh-menu-text > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hh-menu-sep {
  height: 1px;
  margin: 0.3rem 0.35rem;
  background: var(--line);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.alert-bell-wrap {
  position: relative;
}

.alert-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.alert-bell-btn:hover,
.alert-bell-btn[aria-expanded="true"] {
  color: var(--ink);
  background: var(--bg);
}

.alert-bell-icon {
  display: block;
}

.alert-badge {
  display: none;
  position: absolute;
  top: 0.15rem;
  right: 0.1rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
}

.alert-badge.is-on {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.alert-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 40;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(24rem, 70vh);
  overflow: auto;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.1);
}

.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.alert-item + .alert-item {
  border-top: 1px solid var(--line);
}

.alert-item a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 0.5rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.alert-item a:hover {
  background: var(--bg);
  text-decoration: none;
}

.alert-item.is-unread a {
  background: var(--accent-soft);
}

.alert-item strong {
  font-size: 0.875rem;
}

.alert-item span,
.alert-item time {
  font-size: 0.75rem;
  color: var(--muted);
}

.alert-empty {
  padding: 0.75rem 0.5rem;
}

#alert-toasts {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.reminder-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.875rem;
}

#create,
#join {
  scroll-margin-top: 4.5rem;
}

.logout-form {
  margin: 0;
}

.messages {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 4.25rem);
  right: max(1rem, env(safe-area-inset-right));
  z-index: 65;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.msg,
.alert-toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--info);
  box-shadow: 0 10px 24px rgba(28, 25, 23, 0.12);
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  animation: msg-in 180ms ease-out, msg-out 240ms ease-in 5.8s forwards;
}

.msg-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.msg-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.msg-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}

.msg-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.msg-body {
  color: var(--ink);
}

.msg-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: inherit;
  text-decoration: none;
}

.msg-link:hover {
  text-decoration: none;
}

.msg-link strong {
  font-size: 0.875rem;
}

.msg-link span {
  font-size: 0.75rem;
  color: var(--muted);
}

.msg-success,
.alert-toast-success {
  background: var(--success-soft);
  border-color: rgba(22, 101, 52, 0.22);
  border-left-color: var(--success);
}

.msg-success .msg-title,
.alert-toast-success .msg-title {
  color: var(--success);
}

.msg-info,
.msg-debug,
.alert-toast-info {
  background: var(--info-soft);
  border-color: rgba(11, 94, 168, 0.22);
  border-left-color: var(--info);
}

.msg-info .msg-title,
.msg-debug .msg-title,
.alert-toast-info .msg-title {
  color: var(--info);
}

.msg-warning,
.alert-toast-warning {
  background: var(--warning-soft);
  border-color: rgba(146, 64, 14, 0.22);
  border-left-color: var(--warning);
}

.msg-warning .msg-title,
.alert-toast-warning .msg-title {
  color: var(--warning);
}

.msg-error,
.alert-toast-error {
  background: var(--danger-bg);
  border-color: rgba(185, 28, 28, 0.22);
  border-left-color: var(--danger);
}

.msg-error .msg-title,
.alert-toast-error .msg-title {
  color: var(--danger);
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes msg-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg,
  .alert-toast {
    animation: none;
  }
}

@media (max-width: 640px) {
  .messages {
    top: calc(env(safe-area-inset-top) + 3.95rem);
    right: max(0.65rem, env(safe-area-inset-right));
    width: calc(100vw - 1.3rem);
  }

  #alert-toasts {
    right: max(0.65rem, env(safe-area-inset-right));
    width: calc(100vw - 1.3rem);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-pad {
  padding: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: var(--tap);
  padding: 0 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-ghost {
  color: var(--muted);
  padding-inline: 0.55rem;
  font-weight: 500;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--bg);
}

.btn-danger {
  color: var(--danger);
  font-weight: 500;
  min-height: auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn-danger:hover {
  text-decoration: underline;
}

.btn-muted {
  color: var(--muted);
}

.btn-danger.btn-muted {
  color: var(--muted);
}

.btn-muted:hover {
  color: var(--ink);
}

form {
  margin: 0;
}

button.link {
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: normal;
  padding: 0;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.btn-block {
  width: 100%;
}

.link {
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.field {
  display: block;
}

.field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #44403c;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.field-help,
.field-error {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
}

.field-help {
  color: var(--muted-2);
}

.field-error {
  color: var(--danger);
}

.alert-error {
  background: var(--danger-bg);
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}

textarea.input {
  min-height: 6.5rem;
  resize: vertical;
}

.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px rgba(47, 84, 62, 0.15);
}

.input-file {
  display: block;
  width: 100%;
  font-size: 0.875rem;
  color: var(--muted);
}

.input-file::file-selector-button {
  margin-right: 0.75rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.input-check {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.input-code {
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.tabs {
  display: flex;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.tabs-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.4rem;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.8125rem;
  text-decoration: none;
  text-align: center;
  touch-action: manipulation;
}

.tabs-item:hover {
  background: var(--bg);
  text-decoration: none;
}

.tabs-item.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.tabs-item.is-active:hover {
  background: var(--accent);
}

.seg-nav {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.seg-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: 2.75rem;
  padding: 0 0.85rem;
  color: var(--ink);
  font-size: 0.875rem;
  text-decoration: none;
}

.seg-nav a + a {
  border-left: 1px solid var(--line);
}

.seg-nav a:hover {
  background: var(--bg);
  text-decoration: none;
}

.avatar {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  line-height: 0;
}

.avatar img,
.avatar-fallback {
  display: flex;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
  align-items: center;
  justify-content: center;
}

.avatar img {
  display: block;
  border: 1px solid var(--line);
}

.avatar-fallback {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

.avatar-7 { width: 1.75rem; height: 1.75rem; }
.avatar-8 { width: 2rem; height: 2rem; }
.avatar-10 { width: 2.5rem; height: 2.5rem; }
.avatar-14 { width: 3.5rem; height: 3.5rem; }
.avatar-14 .avatar-fallback { font-size: 1rem; }

.avatar-mood {
  position: absolute;
  right: -0.35rem;
  top: -0.35rem;
  font-size: 13px;
  line-height: 1;
}

.avatar-stack {
  display: flex;
  margin-top: 0.35rem;
}

.avatar-stack a {
  margin-left: -0.4rem;
}

.avatar-stack a:first-child {
  margin-left: 0;
}

.assignee-picker {
  display: block;
}

.assignee-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.assignee-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
}

.assignee-option:hover {
  border-color: var(--accent-mid);
  transform: translateY(-1px);
}

.assignee-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(47, 84, 62, 0.12);
}

.assignee-option-empty {
  width: 2.5rem;
  height: 2.5rem;
}

.assignee-option-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: var(--muted-2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.assignee-avatar-wrap {
  display: inline-flex;
}

.assignee-avatar-wrap .avatar {
  width: 2rem;
  height: 2rem;
}

.hh-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
}

.hh-logo {
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
  object-fit: cover;
}

.cal-heading-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  object-fit: cover;
}

.cal-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cal-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.cal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cal-nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.month {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.month-weekdays > div {
  padding: 0.55rem 0.15rem;
}

.wd-long {
  display: none;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-cell {
  min-width: 0;
  min-height: 3.4rem;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0.3rem;
}

.month-cell:nth-child(7n) {
  border-right: 0;
}

.month-cell.is-outside {
  background: #fafaf9;
  color: var(--muted-2);
}

.month-cell.is-today {
  background: var(--accent-soft);
}

.month-cell-top {
  display: flex;
  flex-shrink: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.15rem;
}

.day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  color: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
}

.day-num:hover {
  background: var(--bg);
  text-decoration: none;
}

.month-cell.is-today .day-num {
  background: var(--accent);
  color: #fff;
}

.month-cell.is-today .day-num:hover {
  background: var(--accent-hover);
}

.month-cell-tools {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.month-cell .mood-face {
  display: none;
}

.month-cell .icon-btn {
  display: none;
}

.month-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.2rem;
  padding-left: 0.2rem;
}

.month-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-mid);
}

.month-dot.is-done {
  background: var(--line-strong);
}

.month-cell-tasks {
  display: none;
  margin-top: 0.25rem;
  min-width: 0;
  min-height: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  touch-action: manipulation;
}

.icon-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.week-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.week-day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 0;
}

.week-day.is-today {
  background: var(--accent-soft);
}

.week-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.week-day-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.week-day-num {
  font-size: 1.125rem;
  font-weight: 600;
}

.week-day-body {
  min-height: 0;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.day-layout {
  display: grid;
  gap: 1.25rem;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-list-day {
  position: relative;
}

.task-list-day.is-sorting {
  user-select: none;
}

.task-list-day .task {
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease, border-color 180ms ease;
  transform-origin: center;
  will-change: transform;
}

[data-sortable-task].is-dragging {
  opacity: 0.92;
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.task-grip {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 1rem;
  flex-shrink: 0;
  color: var(--muted-2);
  font-size: 0.95rem;
  letter-spacing: -0.2rem;
  cursor: grab;
  user-select: none;
}

.task-grip:hover {
  color: var(--body);
}

[data-sortable-task].is-dragging .task-grip {
  cursor: grabbing;
  color: var(--accent);
}

.task {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.task.has-reminder {
  background: linear-gradient(90deg, var(--reminder-soft), var(--surface) 0.9rem);
  border-left: 3px solid var(--reminder);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.06);
}

.task.is-compact {
  padding: 0.2rem 0.35rem;
  gap: 0.25rem;
  font-size: 0.75rem;
}

.task.is-compact.has-reminder {
  border-left-width: 2px;
}

.task.is-compact .task-check {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.05rem;
}

.task.is-done {
  opacity: 0.55;
}

.task-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1rem;
}

.task.is-done .task-check {
  background: var(--accent);
  border-color: var(--accent);
}

.task-body {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.task-copy {
  min-width: 0;
  flex: 1;
}

.task-person {
  flex-shrink: 0;
}

.task-title {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
  line-height: 1.25;
}

.task-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task.is-done .task-title span:last-child {
  text-decoration: line-through;
}

.task-meta {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.mood-picker {
  --mood-shift: 4.2rem;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 5.4rem;
  max-width: min(16rem, 100%);
  margin: 0.35rem auto 0;
}

.mood-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3.65rem;
  height: 3.65rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 2.15rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.62;
  z-index: 1;
  transform: translate(-50%, -50%) scale(0.82);
  filter: brightness(0.62) saturate(0.82);
  transition: transform 260ms cubic-bezier(0.22, 0.8, 0.28, 1),
              filter 200ms ease,
              opacity 200ms ease,
              box-shadow 200ms ease,
              background-color 200ms ease;
  will-change: transform;
}

.mood-btn[data-mood-pos="left"] {
  transform: translate(-50%, -50%) translateX(calc(-1 * var(--mood-shift))) scale(0.82);
}

.mood-btn[data-mood-pos="right"] {
  transform: translate(-50%, -50%) translateX(var(--mood-shift)) scale(0.82);
}

.mood-btn[data-mood-pos="active"] {
  z-index: 3;
  transform: translate(-50%, -50%) scale(1.35);
  filter: none;
  opacity: 1;
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  box-shadow: 0 10px 20px color-mix(in oklab, var(--line) 55%, transparent);
}

.mood-btn:hover {
  opacity: 0.84;
  filter: brightness(0.85) saturate(0.95);
}

.mood-btn.is-active {
  opacity: 1;
}

.mood-picker .mood-btn:not(.is-active) {
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--line) 55%, transparent);
}

.mood-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.mood-face {
  line-height: 1;
}

.mood-stat-value {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.mood-stat-face {
  font-size: 1.75rem;
}

.mood-stat-num {
  font-size: 1.125rem;
  font-weight: 600;
}

.mood-board {
  overflow-x: visible;
}

.mood-board-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.mood-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.mood-row-meta {
  display: flex;
  width: auto;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  background: var(--surface);
}

.mood-row-chart {
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.15rem;
}

.mood-row-name {
  min-width: 0;
}

.mood-row-name .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
}

.hh-mini {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--bg);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.mood-month-labels,
.mood-day-labels {
  display: flex;
  gap: 2px;
  margin-bottom: 0.25rem;
  color: var(--muted-2);
  font-size: 9px;
}

.mood-month-labels > div {
  width: 10px;
}

.mood-day-labels > div {
  width: 1.5rem;
  text-align: center;
}

.mood-weekdays {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 0;
  font-size: 9px;
  line-height: 10px;
  color: var(--muted-2);
}

.mood-heatmap {
  display: flex;
  gap: 0.75rem;
}

.mood-weeks {
  display: flex;
  gap: 2px;
}

.mood-week {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mood-strip {
  display: flex;
  gap: 2px;
}

.mood-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #e7e5e4;
}

.mood-cell-lg {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.mood-cell.mood-happy { background: #86efac; }
.mood-cell.mood-normal { background: #fde68a; }
.mood-cell.mood-unhappy { background: #fca5a5; }
.mood-cell.mood-out { background: transparent; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(28, 25, 23, 0.45);
  padding: 0.75rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  overflow-y: auto;
}

.modal-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 1.5rem);
  min-height: 0;
  margin-top: 0.5rem;
  background: var(--surface);
  padding: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin: -0.5rem -0.5rem 0 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.modal-close:hover {
  color: var(--ink);
  background: var(--bg);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.more-options {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  overflow: hidden;
}

.more-options > summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.more-options > summary::-webkit-details-marker {
  display: none;
}

.more-options[open] > summary {
  margin-bottom: 0.85rem;
}

.more-options-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: min(40vh, 22rem);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
  gap: 0.25rem;
  max-height: 9.5rem;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.icon-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.2rem;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.icon-pick.is-auto {
  position: relative;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon-pick.is-auto.is-loading {
  color: transparent;
  pointer-events: none;
}

.icon-pick.is-auto.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: icon-spin 0.7s linear infinite;
}

@keyframes icon-spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-pick:hover {
  background: var(--bg);
}

.icon-pick.is-active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--accent);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  position: sticky;
  bottom: 0;
  padding-top: 1rem;
  background: var(--surface);
}

.form-page .modal-actions {
  position: static;
}

@media (max-width: 479px) {
  .modal-overlay {
    padding: 0.5rem;
  }

  .modal-sheet {
    max-height: calc(100vh - 0.75rem);
    padding: 0.9rem;
    border-radius: 0.875rem;
  }

  .modal-head {
    margin-bottom: 0.75rem;
  }

  .modal-head h2 {
    font-size: 1rem;
  }

  .modal-form {
    gap: 0.75rem;
  }

  .field-label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
  }

  .field-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .field-help,
  .field-error {
    font-size: 0.6875rem;
  }

  .input,
  select.input,
  textarea.input {
    min-height: 2.75rem;
    padding: 0.5rem 0.7rem;
    font-size: 15px;
  }

  textarea.input {
    min-height: 5rem;
  }

  .btn {
    min-height: 2.25rem;
    padding: 0 0.8rem;
    font-size: 0.8125rem;
  }

  button.link,
  .link {
    font-size: 0.75rem;
  }

  .more-options {
    padding: 0.5rem 0.65rem;
  }

  .more-options > summary {
    font-size: 0.8rem;
  }

  .more-options-fields {
    max-height: min(32vh, 16rem);
    gap: 0.75rem;
  }

  .assignee-option {
    width: 2.25rem;
    height: 2.25rem;
  }

  .assignee-option-empty {
    width: 2.25rem;
    height: 2.25rem;
  }

  .modal-actions {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions .cluster {
    display: flex;
    width: 100%;
    gap: 0.5rem;
  }

  .modal-actions .cluster > * {
    flex: 1;
  }

  .modal-actions .btn,
  .modal-actions .btn-primary,
  .modal-actions .btn-secondary,
  .modal-actions .btn-danger {
    width: 100%;
  }
}

.join-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.85rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.14em;
  overflow-wrap: anywhere;
}

.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.member-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.member-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.member-list li:last-child {
  padding-bottom: 0;
}

.member-id {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.member-id:hover {
  text-decoration: none;
}

.member-name {
  font-weight: 500;
}

.mood-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mood-log li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.mood-log li:first-child {
  border-top: 0;
}

.member-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
}

.task-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.task-group-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(47, 84, 62, 0.18);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-head,
.member-head,
.hh-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.setup-grid,
.manage-layout,
.mood-stats {
  display: grid;
  gap: 1.25rem;
}

.htmx-indicator {
  display: none;
}

.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator {
  display: block;
}

#calendar-main {
  position: relative;
}

#calendar-main.htmx-request {
  cursor: wait;
}

#calendar-main.htmx-request > :not(.cal-loading) {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s;
}

.cal-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4rem;
  pointer-events: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

#calendar-main.htmx-request .cal-loading {
  display: flex;
}

@media (min-width: 640px) {
  h1 {
    font-size: 1.75rem;
  }

  .brand-name,
  .household-chip-name,
  .header-profile-name {
    display: inline;
    max-width: 12rem;
  }

  .card,
  .card-pad {
    padding: 1.5rem;
  }

  .btn {
    min-height: 2.25rem;
  }

  .seg-nav a {
    min-height: 2.25rem;
  }

  .wd-short {
    display: none;
  }

  .wd-long {
    display: inline;
  }

  .month {
    height: auto;
    max-height: none;
  }

  .month-grid {
    overflow: visible;
    grid-auto-rows: auto;
  }

  .month-cell {
    min-height: 3.4rem;
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
  }

  .month-cell .icon-btn {
    display: inline-flex;
  }

  .month-cell .mood-face {
    display: inline;
    font-size: 0.9rem;
  }

  .icon-btn {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1.1rem;
  }

  .month-dots {
    display: none;
  }

  .month-cell-tasks {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 0.2rem;
    min-height: auto;
    overflow: visible;
  }

  .month-cell-tasks .task {
    flex-shrink: 0;
    min-width: 0;
  }

  .month-cell-tasks .task-person {
    display: none;
  }

  .mood-stats {
    grid-template-columns: 1fr 1fr;
  }

  .mood-board {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mood-board-inner {
    min-width: max-content;
    gap: 1rem;
  }

  .mood-row {
    flex-direction: row;
    align-items: stretch;
    gap: 0.75rem;
  }

  .mood-row-meta {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 9rem;
    align-items: flex-start;
    padding: 0.15rem 0.65rem 0.15rem 0;
  }

  .mood-row-chart {
    overflow-x: visible;
    padding-bottom: 0;
  }

  .modal-overlay {
    align-items: flex-start;
    padding: 1rem;
    overflow-y: auto;
  }

  .modal-sheet {
    width: 100%;
    max-width: 32rem;
    min-height: 0;
    margin-top: 2.5rem;
    border-radius: var(--radius-lg);
    height: auto;
  }
}

@media (min-width: 768px) {
  .cal-toolbar {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .cal-actions {
    align-items: flex-end;
  }

  .tabs {
    width: auto;
  }

  .tabs-item {
    flex: none;
    min-width: 4.25rem;
    font-size: 0.875rem;
    padding: 0.4rem 0.65rem;
  }

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

@media (min-width: 1024px) {
  .week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .week-day {
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
  }

  .week-day:last-child {
    border-right: 0;
  }

  .week-day-body {
    min-height: 22rem;
  }

  .day-layout,
  .manage-layout {
    grid-template-columns: 2fr 1fr;
  }
}
