:root {
  --sidebar-width: 304px;
  --bg: #fffaf0;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --line: #f5d8bf;
  --text: #2c241d;
  --muted: #7d6d5e;
  --brand-50: #fff7ef;
  --brand-100: #fdf2e9;
  --brand-300: #f5cba7;
  --brand-400: #f0b27a;
  --brand-500: #eb984e;
  --brand-600: #e67e22;
  --danger: #d95d48;
  --success: #2f8a62;
  --shadow: 0 18px 50px rgba(181, 114, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Noto Sans TC", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(240, 178, 122, 0.18), transparent 30%),
    linear-gradient(180deg, #fffaf0 0%, #fff4e8 100%);
}

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

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.5rem;
}

.sidebar-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.9rem;
  padding: 1.9rem 1.65rem 1.6rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.content-shell {
  padding: 2rem;
  width: 100%;
  max-width: 1600px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1.1rem;
  font-weight: 700;
}

.brand-desktop {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 0.55rem;
  padding: 0 2rem 0 0;
}

.brand-copy strong {
  line-height: 1.15;
  font-size: 2rem;
}

.brand-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.6;
  max-width: 12rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 1.1rem;
  color: white;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  box-shadow: 0 10px 25px rgba(230, 126, 34, 0.28);
  flex: 0 0 auto;
}

.brand-mark-compact {
  width: 2.5rem;
  height: 2.5rem;
}

.brand-icon {
  width: 1.35rem;
  height: 1.35rem;
  fill: currentColor;
}

.brand-icon-home {
  transform: translateX(0.04rem);
}

.mobile-brand-text {
  font-size: 1rem;
}

.sidebar-toggle {
  position: absolute;
  top: 1.7rem;
  right: -1.15rem;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  color: var(--brand-600);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(181, 114, 37, 0.16);
  z-index: 2;
}

.toggle-collapse {
  display: none;
}

.nav-list {
  display: grid;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  color: var(--muted);
  transition: 160ms ease;
}

.nav-icon {
  flex: 0 0 auto;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  color: currentColor;
}

.nav-icon-svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.nav-label {
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.is-active {
  color: white;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(230, 126, 34, 0.22);
}

.quote-card,
.card,
.summary-card,
.placeholder-panel,
.empty-card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(245, 203, 167, 0.65);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.quote-card {
  margin-top: auto;
  padding: 1.25rem;
}

body.sidebar-collapsed {
  --sidebar-width: 112px;
}

body.sidebar-collapsed .sidebar-inner {
  padding: 1.5rem 1rem;
}

body.sidebar-collapsed .brand-desktop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .quote-card,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .toggle-expand {
  display: none;
}

body.sidebar-collapsed .toggle-collapse {
  display: inline;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding-inline: 0.6rem;
}

body.sidebar-collapsed .nav-icon {
  width: 1.2rem;
  height: 1.2rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero {
  position: relative;
  min-height: 320px;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 26px 52px rgba(73, 42, 16, 0.18);
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.34) 100%);
  color: white;
}

.hero h1,
.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero-text,
.page-header p,
.section-head p,
.card p,
.muted {
  color: var(--muted);
}

.hero-text {
  max-width: 40rem;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero .eyebrow,
.hero h1 {
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.section-head,
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 1.25rem;
}

.section-head h2,
.page-header h2,
.page-header p,
.section-head p {
  margin: 0;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack-tight {
  gap: 0.75rem;
}

.card {
  padding: 1.35rem;
}

.card h3,
.card h2 {
  margin: 0 0 0.55rem;
}

.card-footer,
.meta-row,
.button-row,
.trip-meta-row,
.person-share-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-footer,
.trip-meta-row,
.person-share-head {
  justify-content: space-between;
}

.announcement-card p:last-child {
  margin-bottom: 0;
}

.announcement-body {
  white-space: pre-line;
  line-height: 1.8;
}

.trip-overview {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.overview-card {
  padding: 1.35rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(245, 203, 167, 0.65);
  box-shadow: var(--shadow);
}

.overview-card strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1.15rem;
}

.overview-card-primary {
  background: linear-gradient(135deg, rgba(255, 249, 240, 0.98), rgba(255, 239, 224, 0.94));
}

.trip-board {
  display: grid;
  gap: 1.25rem;
}

.itinerary-panel-home {
  padding: 1.5rem;
}

.itinerary-card-head {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.itinerary-summary {
  max-width: 45rem;
  margin: 0;
}

.announcement-accordion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.announcement-accordion-copy {
  min-width: 0;
  display: grid;
  gap: 0.75rem;
}

.announcement-toggle {
  flex: 0 0 auto;
  min-width: 108px;
}

.announcement-accordion-panel {
  margin-top: 1.1rem;
}

.day-chip,
.disabled-pill,
.theme-badge,
.feature-disabled-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.9rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.day-chip {
  background: var(--brand-100);
  color: var(--brand-600);
}

.theme-badge {
  background: rgba(230, 126, 34, 0.12);
  color: var(--brand-600);
  white-space: nowrap;
}

.itinerary-sections {
  display: grid;
  gap: 1rem;
}

.itinerary-block {
  padding: 1rem 1.05rem;
  border-radius: 20px;
  background: rgba(255, 248, 240, 0.88);
  border: 1px solid rgba(245, 203, 167, 0.6);
}

.itinerary-block h4,
.trip-tip-box h4,
.disabled-card h3,
.feature-disabled h1 {
  margin: 0 0 0.65rem;
}

.info-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.1rem;
}

.info-list li {
  color: var(--text);
  line-height: 1.65;
}

.info-list-compact {
  gap: 0.4rem;
}

.trip-tip-box {
  padding: 1rem 1.05rem;
  border-radius: 20px;
  background: #fff2e8;
  border: 1px solid #f3c4a0;
}

.disabled-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 1440px) {
  .content-shell {
    max-width: min(1680px, calc(100vw - var(--sidebar-width) - 3rem));
  }

  .trip-overview {
    grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
  }

  .disabled-grid {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
  }
}

.disabled-card {
  padding: 1.25rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed rgba(230, 126, 34, 0.35);
  color: var(--muted);
}

.disabled-pill {
  margin-bottom: 0.8rem;
  background: rgba(125, 109, 94, 0.12);
  color: var(--muted);
}

.feature-disabled {
  padding: 3rem 1.5rem;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(245, 203, 167, 0.65);
  box-shadow: var(--shadow);
}

.feature-disabled-mark {
  margin: 0 auto 1rem;
  width: fit-content;
  background: var(--brand-100);
  color: var(--brand-600);
}

.feature-disabled p {
  max-width: 34rem;
  margin: 0 auto 1.25rem;
}

.feature-disabled-button {
  display: inline-flex;
  text-decoration: none;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--brand-100);
  color: var(--brand-600);
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.8rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill-重要 {
  background: #fde8e6;
  color: #c54b36;
}

.pill-活動 {
  background: #eaf3ff;
  color: #356bb0;
}

.pill-閒聊,
.pill-soft {
  background: var(--brand-100);
  color: var(--brand-600);
}

.card-grid {
  display: grid;
  gap: 1.25rem;
}

.card-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.member-card {
  display: flex;
  gap: 1rem;
}

.member-card img {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 22px;
  object-fit: cover;
  border: 2px solid var(--brand-300);
}

.member-info,
.ancestor-body,
.album-body,
.trip-body {
  display: grid;
  gap: 0.45rem;
}

.member-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.detail-line {
  font-size: 0.92rem;
}

.placeholder-panel {
  margin-top: 1.75rem;
  padding: 2rem;
  text-align: center;
}

.ghost-button,
.primary-button,
.tab-button,
.day-pill,
.menu-toggle,
.lightbox-close {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  transition: 160ms ease;
}

.ghost-button,
.menu-toggle {
  padding: 0.85rem 1rem;
  color: var(--brand-600);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.primary-button {
  padding: 0.85rem 1.1rem;
  color: white;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  box-shadow: 0 12px 24px rgba(230, 126, 34, 0.22);
}

.ghost-button[disabled],
.primary-button[disabled] {
  opacity: 0.72;
  cursor: not-allowed;
}

.album-card,
.trip-card {
  display: block;
  overflow: hidden;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid rgba(245, 203, 167, 0.65);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.album-card:hover,
.trip-card:hover,
.photo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 40px rgba(181, 114, 37, 0.18);
}

.album-cover,
.trip-cover,
.ancestor-cover {
  position: relative;
  overflow: hidden;
}

.album-cover img,
.trip-cover img,
.ancestor-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-cover {
  aspect-ratio: 4 / 3;
}

.trip-cover {
  height: 220px;
}

.ancestor-cover {
  height: 240px;
}

.floating-count,
.trip-cover-copy {
  position: absolute;
}

.floating-count {
  top: 1rem;
  right: 1rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: white;
  backdrop-filter: blur(18px);
}

.trip-cover-copy {
  inset: auto 1.2rem 1.2rem;
  color: white;
}

.trip-cover::after,
.ancestor-cover::after,
.photo-overlay {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 15, 15, 0.05), rgba(15, 15, 15, 0.68));
}

.trip-cover-copy,
.ancestor-cover h2,
.photo-overlay > * {
  position: relative;
  z-index: 1;
}

.album-body,
.trip-body {
  padding: 1.1rem 1.2rem 1.3rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.8rem;
  color: var(--muted);
}

.masonry-grid {
  column-count: 3;
  column-gap: 1rem;
}

.photo-card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 1rem;
  border-radius: 26px;
  overflow: hidden;
  cursor: pointer;
}

.photo-card img {
  width: 100%;
}

.photo-overlay {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.2rem;
  color: white;
  opacity: 0;
  transition: opacity 180ms ease;
}

.photo-card:hover .photo-overlay,
.photo-overlay.is-static {
  opacity: 1;
}

.photo-overlay.is-static::before {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgba(18, 15, 12, 0.88);
}

.lightbox-body {
  max-width: min(1000px, 100%);
  display: grid;
  gap: 1rem;
}

.lightbox img {
  max-height: 75vh;
  border-radius: 24px;
}

.lightbox-copy {
  color: white;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.7rem 0.95rem;
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

.tab-row,
.day-pills,
.summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tab-row {
  margin-bottom: 1rem;
}

.tab-button,
.day-pill {
  padding: 0.8rem 1rem;
  background: var(--brand-100);
  color: var(--muted);
}

.tab-button.is-active,
.day-pill.is-active {
  background: var(--panel-strong);
  color: var(--brand-600);
  box-shadow: 0 8px 20px rgba(181, 114, 37, 0.12);
}

.tab-panel,
.itinerary-panel {
  display: none;
}

.tab-panel.is-active,
.itinerary-panel.is-active {
  display: block;
}

.itinerary-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.time-badge {
  display: inline-grid;
  place-items: center;
  min-height: 4rem;
  border-radius: 18px;
  background: var(--brand-100);
  color: var(--brand-600);
  font-weight: 700;
}

.summary-grid {
  margin-bottom: 1rem;
}

.summary-card {
  flex: 1 1 180px;
  padding: 1.2rem;
}

.summary-card strong {
  font-size: 1.8rem;
}

.split-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.expense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid rgba(245, 203, 167, 0.6);
}

.expense-row:last-child {
  border-bottom: 0;
}

.share-bar {
  width: 100%;
  height: 0.7rem;
  background: var(--brand-100);
  border-radius: 999px;
  overflow: hidden;
}

.share-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
  border-radius: inherit;
}

.balance-positive {
  color: var(--success);
}

.balance-negative {
  color: var(--danger);
}

.info-block {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: var(--brand-50);
}

.empty-card {
  padding: 2rem;
  text-align: center;
}

.empty-inline {
  color: var(--muted);
}

.page-header-actions {
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

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

.expense-detail-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}

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

.expense-detail-toggle {
  white-space: nowrap;
}

[data-collapsible-panel][hidden] {
  display: none !important;
}

.data-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.95rem 0.8rem;
  border-bottom: 1px solid rgba(245, 203, 167, 0.7);
  vertical-align: top;
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 0.88rem;
}

.table-note {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.group-row td:first-child {
  border-left: 4px solid transparent;
}

.group-row-parents td:first-child {
  border-left-color: rgba(98, 147, 197, 0.9);
}

.group-row-elder-home td:first-child {
  border-left-color: rgba(237, 153, 79, 0.9);
}

.group-row-tongwei td:first-child {
  border-left-color: rgba(112, 151, 123, 0.9);
}

.group-row-ken-home td:first-child {
  border-left-color: rgba(189, 112, 105, 0.9);
}

.group-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.group-badge-parents {
  background: rgba(226, 239, 249, 0.95);
  color: #456886;
  border-color: rgba(98, 147, 197, 0.25);
}

.group-badge-elder-home {
  background: rgba(255, 237, 214, 0.95);
  color: #9a5c1d;
  border-color: rgba(237, 153, 79, 0.3);
}

.group-badge-tongwei {
  background: rgba(228, 239, 229, 0.95);
  color: #4d6c53;
  border-color: rgba(112, 151, 123, 0.28);
}

.group-badge-ken-home {
  background: rgba(246, 229, 226, 0.95);
  color: #8f524c;
  border-color: rgba(189, 112, 105, 0.28);
}

.table-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.small-button {
  padding: 0.45rem 0.75rem;
  font-size: 0.92rem;
}

.danger-button {
  color: var(--danger);
  border-color: rgba(186, 67, 52, 0.2);
}

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

.auth-shell {
  max-width: 38rem;
}

.auth-card,
.form-card {
  max-width: 52rem;
}

.form-field,
.checkbox-field {
  display: grid;
  gap: 0.45rem;
}

.form-field span,
.checkbox-field span {
  font-weight: 600;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(245, 203, 167, 0.95);
  border-radius: 16px;
  background: rgba(255, 250, 244, 0.9);
  color: var(--text);
  font: inherit;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.form-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.input-mode-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid rgba(245, 203, 167, 0.95);
  border-radius: 22px;
  background: rgba(255, 250, 244, 0.72);
}

.mode-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.mode-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: rgba(247, 236, 224, 0.95);
  border: 1px solid rgba(245, 203, 167, 0.95);
  cursor: pointer;
}

.mode-option input {
  margin: 0;
}

.mode-hint {
  margin: 0;
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-field input {
  width: 1rem;
  height: 1rem;
}

.form-error {
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(186, 67, 52, 0.1);
  color: var(--danger);
}

.sidebar-auth {
  margin-top: auto;
}

.sidebar-auth-link,
.sidebar-auth-button {
  width: 100%;
  justify-content: center;
}

.budget-card {
  padding: 1.2rem;
  border-radius: 24px;
  background: rgba(255, 250, 244, 0.84);
  border: 1px solid rgba(245, 203, 167, 0.95);
  box-shadow: 0 16px 40px rgba(219, 152, 78, 0.09);
}

.budget-card-head,
.budget-stats {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.budget-stats {
  margin-top: 1rem;
  flex-wrap: wrap;
}

.delete-name {
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border-radius: 16px;
  background: var(--brand-50);
  font-weight: 700;
}

.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  -webkit-line-clamp: 3;
}

@media (max-width: 1024px) {
  .trip-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .disabled-grid,
  .card-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .masonry-grid {
    column-count: 2;
  }
}

@media (max-width: 820px) {
  .mobile-topbar {
    display: flex;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 4.5rem 1rem auto;
    z-index: 60;
    height: auto;
    padding: 0;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: 160ms ease;
  }

  .sidebar.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar-inner {
    max-height: calc(100vh - 6rem);
    overflow: auto;
  }

  .content-shell {
    padding: 1.25rem;
  }

  .card-grid-2,
  .card-grid-3,
  .trip-overview,
  .disabled-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .section-head,
  .page-header,
  .button-row,
  .member-head,
  .expense-row,
  .announcement-accordion-head,
  .itinerary-card-head,
  .section-inline-head,
  .budget-card-head,
  .budget-stats {
    flex-direction: column;
    align-items: stretch;
  }

  .masonry-grid {
    column-count: 1;
  }

  .hero {
    min-height: 260px;
  }

  .day-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
  }

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