:root {
  color-scheme: light;
  --brand: #1c63d1;
  --brand-light: #478fec;
  --success: #2e9e6e;
  --warning: #e38c33;
  --danger: #d9453a;
  --background: #ffffff;
  --surface: #ffffff;
  --row: #f7f9fc;
  --stroke: #e5eaf2;
  --text: #1f2945;
  --subtle: #526180;
  --shadow: rgba(17, 24, 39, 0.09);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5ca3fc;
    --brand-light: #80bdff;
    --success: #59c58c;
    --warning: #f2b55a;
    --danger: #ff7366;
    --background: #ffffff;
    --surface: #ffffff;
    --row: #f7f9fc;
    --stroke: #e5eaf2;
    --text: #1f2945;
    --subtle: #526180;
    --shadow: rgba(17, 24, 39, 0.09);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
}

body.calendar-fullscreen {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 5px 12px rgba(17, 24, 39, 0.08);
  transition: box-shadow 140ms ease, transform 140ms ease;
}

button:not(:disabled):hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 8px 18px rgba(17, 24, 39, 0.12);
  transform: translateY(-1px);
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: 12px 16px 86px;
}

.top-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px var(--shadow);
}

.ad-banner {
  display: grid;
  height: 82px;
  min-height: 82px;
  align-items: center;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  background: var(--row);
  color: var(--subtle);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.ad-banner.is-configured {
  border-style: solid;
  background: var(--surface);
}

.ad-banner .adsbygoogle {
  height: 64px;
  min-height: 64px;
}

.app-shell[data-view="about"] .ad-banner,
.app-shell[data-view="subscriptions"] .ad-banner {
  margin-bottom: 4px;
}

.account-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: var(--row);
}

.account-button:hover,
.account-button:focus {
  color: var(--brand);
  outline: 2px solid color-mix(in srgb, var(--brand), transparent 72%);
  outline-offset: 2px;
}

.account-button .profile-icon {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 36%, currentColor 0 4px, transparent 4.5px),
    radial-gradient(ellipse at 50% 92%, currentColor 0 8px, transparent 8.5px);
  box-shadow: none;
  overflow: hidden;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-lockup span {
  display: block;
  margin-top: 2px;
  color: var(--subtle);
  font-size: 0.82rem;
}

.banner-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background:
    linear-gradient(90deg, transparent 46%, rgba(255, 255, 255, 0.56) 46% 54%, transparent 54%),
    linear-gradient(0deg, transparent 46%, rgba(255, 255, 255, 0.56) 46% 54%, transparent 54%),
    linear-gradient(135deg, var(--brand), var(--success));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.phone-frame {
  display: block;
}

.tab-view {
  display: none;
}

.tab-view.is-active {
  display: grid;
  gap: 16px;
}

#profile-view.tab-view.is-active {
  gap: 8px;
  min-height: min(620px, calc(100vh - 146px));
  align-content: start;
  justify-items: center;
}

.section-card,
.summary-card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px var(--shadow);
}

.section-card {
  padding: 14px;
}

.calendar-header,
.section-title-row,
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--subtle);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.22rem;
}

h2 {
  font-size: 1rem;
}

h3 {
  margin: 16px 0 10px;
  font-size: 0.98rem;
}

.subtle {
  color: var(--subtle);
  font-size: 0.86rem;
}

.month-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: var(--row);
  font-size: 1.2rem;
  font-weight: 800;
}

.calendar-fullscreen-close {
  display: none;
  position: fixed;
  top: 84px;
  left: 20px;
  z-index: 63;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 8px 20px var(--shadow);
  font-size: 1.1rem;
  font-weight: 900;
}

.calendar-grid-card {
  position: relative;
}

.calendar-fullscreen-toggle {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 1;
  border: 1px solid var(--stroke);
  background: var(--surface);
  box-shadow: 0 8px 20px var(--shadow);
}

.expand-icon {
  width: 20px;
  height: 20px;
}

.expand-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell.is-calendar-fullscreen {
  max-width: none;
  min-height: 100vh;
  padding: 88px 0 0;
}

.app-shell.is-calendar-fullscreen .daily-summary-card,
.app-shell.is-calendar-fullscreen .manual-bill-card,
.app-shell.is-calendar-fullscreen .manual-bill-trigger,
.app-shell.is-calendar-fullscreen .sync-dock {
  display: none;
}

.app-shell.is-calendar-fullscreen .ad-banner {
  position: fixed;
  top: 88px;
  right: 20px;
  left: 20px;
  z-index: 62;
  margin: 0;
  height: 82px;
}

.app-shell.is-calendar-fullscreen .top-banner {
  position: fixed;
  top: 12px;
  right: 20px;
  left: 20px;
  z-index: 62;
  margin: 0;
}

.app-shell.is-calendar-fullscreen .phone-frame {
  display: block;
}

.app-shell.is-calendar-fullscreen #calendar-view.tab-view.is-active {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 180px 20px 20px;
  background: var(--background);
}

.app-shell.is-calendar-fullscreen .calendar-fullscreen-close {
  display: grid;
}

.app-shell.is-calendar-fullscreen .calendar-header,
.app-shell.is-calendar-fullscreen .summary-grid,
.app-shell.is-calendar-fullscreen .calendar-grid-card {
  grid-column: 1;
}

.app-shell.is-calendar-fullscreen .calendar-grid-card {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.app-shell.is-calendar-fullscreen .summary-grid {
  width: 100%;
}

.app-shell.is-calendar-fullscreen .calendar-grid {
  min-height: 0;
  grid-template-rows: repeat(6, minmax(0, 1fr));
}

.app-shell.is-calendar-fullscreen .day-cell {
  min-height: 0;
}

.app-shell.is-calendar-fullscreen .calendar-fullscreen-toggle {
  right: 24px;
  bottom: 24px;
}

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

.summary-card {
  padding: 12px;
}

.summary-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--subtle);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.weekday-grid,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-grid {
  margin-bottom: 8px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.day-cell {
  position: relative;
  min-height: 54px;
  padding: 6px;
  border: 0;
  border-radius: 12px;
  background: var(--row);
  color: var(--text);
  text-align: left;
  transform-origin: center;
}

.day-cell.is-muted {
  opacity: 0.38;
}

.day-cell:not(:disabled):hover,
.day-cell.is-selected {
  z-index: 2;
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.12);
  transform: scale(1.035);
}

.day-cell.is-selected {
  outline: 2px solid var(--brand);
  background: color-mix(in srgb, var(--brand), transparent 90%);
}

.day-cell strong,
.day-cell span {
  display: block;
}

.day-cell span {
  margin-top: 6px;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
}

.day-cell .today-label {
  margin-top: 0;
  margin-bottom: 1px;
  color: var(--success);
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.day-cell.is-today strong {
  color: var(--success);
}

.day-cell .day-amount {
  display: flex;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.day-amount.is-paid {
  color: #6b7280;
}

.day-amount.is-unpaid {
  color: var(--brand);
}

.day-amount-alert {
  flex: 0 0 auto;
  width: 0.21rem;
  height: 0.21rem;
  fill: var(--danger);
  transform: translateY(-0.08rem);
}

.form-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.manual-bill-card {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 88px;
  z-index: 30;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.manual-bill-trigger {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 34px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--brand);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 900;
}

.manual-bill-card.is-open {
  display: block;
}

#bill-form .primary-button {
  border: 1px solid var(--brand);
  background: #fff;
  color: var(--brand);
}

.daily-summary-card {
  display: grid;
  gap: 12px;
}

.daily-total-pill {
  min-width: 130px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--row);
}

.daily-total-pill span {
  display: block;
  color: var(--subtle);
  font-size: 0.68rem;
  font-weight: 800;
}

.daily-total-pill strong {
  display: block;
  margin-top: 2px;
}

.daily-summary-list {
  display: grid;
  gap: 8px;
}

.daily-row {
  display: grid;
  grid-template-columns: 78px 88px 88px minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: var(--row);
}

.daily-row span,
.daily-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.daily-row-header {
  padding-top: 0;
  padding-bottom: 0;
  color: var(--subtle);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-chip {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.68rem;
  font-weight: 900;
}

.status-chip.is-paid {
  color: var(--success);
  background: color-mix(in srgb, var(--success), transparent 86%);
}

.status-chip.is-unpaid {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning), transparent 84%);
}

.daily-delete-button {
  display: inline-grid;
  place-items: center;
  justify-self: end;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0;
  color: var(--danger);
  background: transparent;
}

.daily-delete-button:not(:disabled),
.daily-delete-button:not(:disabled):hover {
  box-shadow: none;
  transform: none;
}

.daily-delete-button:not(:disabled):hover {
  border-color: color-mix(in srgb, var(--danger), transparent 70%);
  background: color-mix(in srgb, var(--danger), transparent 90%);
}

.trash-icon {
  width: 17px;
  height: 17px;
}

.trash-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state {
  padding: 12px;
  border-radius: 12px;
  color: var(--subtle);
  background: var(--row);
}

label {
  display: grid;
  gap: 6px;
  color: var(--subtle);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--text);
  background: var(--row);
}

.readonly-date {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--text);
  background: var(--row);
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 1px solid color-mix(in srgb, var(--brand), #000 8%);
  border-radius: 12px;
  padding: 0 14px;
  color: #fff;
  background: var(--brand);
  font-size: 0.9rem;
  font-weight: 800;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.secondary-button.danger-button {
  color: var(--danger);
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, #fff);
}

#sign-out {
  color: var(--danger);
  background: #fff;
}

#delete-selected-subscriptions {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, #fff);
}

.compact-button {
  width: auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
}

#subscription-edit-toggle {
  width: auto;
  min-height: auto;
  padding: 0;
  border-color: transparent;
  color: var(--brand);
  background: transparent;
}

#subscription-edit-toggle:not(:disabled) {
  box-shadow: none;
}

#subscription-edit-toggle:not(:disabled):hover {
  background: transparent;
  transform: none;
}

#bill-form .primary-button::before,
#profile-sync-subscriptions::before,
#connect-bank::before,
#sign-out::before,
#delete-selected-subscriptions::before,
#manage-billing::before,
#upgrade-monthly::before {
  content: "";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  background: currentColor;
  -webkit-mask: var(--button-icon) center / contain no-repeat;
  mask: var(--button-icon) center / contain no-repeat;
}

#bill-form .primary-button {
  --button-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M12%205v14'/%3E%3Cpath%20d='M5%2012h14'/%3E%3C/svg%3E");
}

#profile-sync-subscriptions {
  --button-icon: url("/images/save_to_server.png");
}

#connect-bank {
  --button-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%2021h18'/%3E%3Cpath%20d='M5%2010h14'/%3E%3Cpath%20d='M5%2010l7-5%207%205'/%3E%3Cpath%20d='M6%2010v8'/%3E%3Cpath%20d='M10%2010v8'/%3E%3Cpath%20d='M14%2010v8'/%3E%3Cpath%20d='M18%2010v8'/%3E%3Cpath%20d='M4%2018h16'/%3E%3C/svg%3E");
}

#sign-out {
  --button-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M9%2021H5a2%202%200%200%201-2-2V5a2%202%200%200%201%202-2h4'/%3E%3Cpath%20d='M16%2017l5-5-5-5'/%3E%3Cpath%20d='M21%2012H9'/%3E%3C/svg%3E");
}

#delete-selected-subscriptions {
  --button-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M8%206V4h8v2'/%3E%3Cpath%20d='M19%206l-1%2014H6L5%206'/%3E%3Cpath%20d='M10%2011v5'/%3E%3Cpath%20d='M14%2011v5'/%3E%3C/svg%3E");
}

#manage-billing {
  --button-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M12%2015.5a3.5%203.5%200%201%200%200-7%203.5%203.5%200%200%200%200%207z'/%3E%3Cpath%20d='M19.4%2015a1.7%201.7%200%200%200%20.34%201.88l.06.06a2%202%200%201%201-2.83%202.83l-.06-.06a1.7%201.7%200%200%200-1.88-.34%201.7%201.7%200%200%200-1%201.55V21a2%202%200%201%201-4%200v-.09a1.7%201.7%200%200%200-1-1.55%201.7%201.7%200%200%200-1.88.34l-.06.06a2%202%200%201%201-2.83-2.83l.06-.06A1.7%201.7%200%200%200%204.6%2015a1.7%201.7%200%200%200-1.55-1H3a2%202%200%201%201%200-4h.09a1.7%201.7%200%200%200%201.55-1%201.7%201.7%200%200%200-.34-1.88l-.06-.06a2%202%200%201%201%202.83-2.83l.06.06A1.7%201.7%200%200%200%209%204.6a1.7%201.7%200%200%200%201-1.55V3a2%202%200%201%201%204%200v.09a1.7%201.7%200%200%200%201%201.55%201.7%201.7%200%200%200%201.88-.34l.06-.06a2%202%200%201%201%202.83%202.83l-.06.06A1.7%201.7%200%200%200%2019.4%209c.36.2.75.31%201.15.31H21a2%202%200%201%201%200%204h-.09A1.7%201.7%200%200%200%2019.4%2015z'/%3E%3C/svg%3E");
}

#upgrade-monthly {
  --button-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='8'%20cy='21'%20r='1'/%3E%3Ccircle%20cx='19'%20cy='21'%20r='1'/%3E%3Cpath%20d='M2.05%202.05h2l2.66%2012.42a2%202%200%200%200%202%201.58h8.78a2%202%200%200%200%201.95-1.57L21%207H5.12'/%3E%3C/svg%3E");
}

.text-button {
  border: 0;
  padding: 12px 0 0;
  color: var(--brand);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 700;
}

.subscription-table {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.subscription-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subscription-edit-actions {
  display: grid;
  justify-content: end;
  margin-top: 12px;
}

.subscription-edit-actions .secondary-button {
  width: auto;
}

.subscription-section {
  display: grid;
  gap: 8px;
  border-left: 4px solid transparent;
  border-radius: 8px;
  padding: 2px 0 2px 10px;
}

.subscription-section h2 {
  margin: 4px 0 0;
  font-size: 0.92rem;
  font-weight: 900;
}

.subscription-section.is-included {
  border-left-color: #15803d;
}

.subscription-section.is-included h2 {
  color: #15803d;
}

.subscription-section.is-excluded {
  border-left-color: #b91c1c;
}

.subscription-section.is-excluded h2 {
  color: #b91c1c;
}

.subscription-empty {
  margin: 0;
}

.table-row {
  --subscription-table-columns: minmax(0, 1fr) 96px 104px;
  display: grid;
  grid-template-columns: var(--subscription-table-columns);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 10px;
  color: var(--text);
  background: var(--row);
  text-align: left;
  transition: box-shadow 140ms ease, transform 140ms ease;
}

.table-row:has(.subscription-row-button:not(:disabled)):hover {
  box-shadow: 0 4px 9px rgba(17, 24, 39, 0.06);
  transform: translateY(-1px);
}

.table-row.is-editing {
  grid-template-columns: 28px minmax(0, 1fr);
}

.subscription-row-button {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: var(--subscription-table-columns);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.subscription-row-button:not(:disabled),
.subscription-row-button:not(:disabled):hover {
  box-shadow: none;
  transform: none;
}

.subscription-row-button:disabled {
  cursor: default;
}

.row-select {
  display: grid;
  place-items: center;
}

.row-select input {
  width: 18px;
  height: 18px;
}

.table-row.header {
  min-height: 28px;
  padding: 0 10px;
  color: var(--subtle);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 800;
}

.table-row strong,
.table-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-row .amount,
.table-row .frequency {
  text-align: right;
}

.subscription-row-button .amount,
.subscription-row-button .frequency {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}

.table-row.is-inactive {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.06);
}

.profile-card {
  display: grid;
  width: min(100%, 980px);
  justify-items: center;
  text-align: center;
}

.profile-card .form-grid {
  width: min(100%, 420px);
}

.auth-shell {
  display: grid;
  gap: 14px;
  width: min(100%, 420px);
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--row);
}

.auth-mode-tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--subtle);
  background: transparent;
  font-weight: 900;
}

.auth-mode-tab.is-active {
  color: var(--text);
  border-color: var(--stroke);
  background: var(--surface);
}

.auth-panel {
  width: 100%;
}

.auth-panel-title {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
}

.auth-copy {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--subtle);
  font-size: 0.86rem;
  line-height: 1.4;
}

.auth-status {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--success), var(--stroke) 40%);
  border-radius: 12px;
  padding: 10px 12px;
  color: color-mix(in srgb, var(--success), #000 28%);
  background: color-mix(in srgb, var(--success) 10%, #fff);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
}

.auth-panel-footer {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.auth-link-button {
  width: auto;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 2px;
  color: var(--brand);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 800;
}

.auth-link-button:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.profile-account-id {
  max-width: min(100%, 520px);
  margin: 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.profile-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.billing-return-panel {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.billing-return-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.billing-return-panel p {
  margin: 0;
  color: var(--subtle);
  font-size: 0.84rem;
  line-height: 1.35;
}

.billing-return-panel .compact-button {
  justify-self: start;
  margin-top: 4px;
}

.billing-return-panel.is-success {
  border-left-color: var(--success);
}

.billing-return-panel.is-cancel {
  border-left-color: var(--warning);
}

.profile-account-actions {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: 100%;
  margin-top: 22px;
}

.email-verification-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--warning), var(--stroke) 42%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warning) 10%, #fff);
  text-align: left;
}

.email-verification-panel h2,
.email-verification-panel p {
  margin: 0;
}

.email-verification-panel h2 {
  font-size: 1rem;
}

.email-verification-panel p {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 0.84rem;
  line-height: 1.35;
}

.email-verification-panel .compact-button {
  flex: 0 0 auto;
  border-color: color-mix(in srgb, var(--warning), #000 8%);
  background: color-mix(in srgb, var(--warning) 16%, #fff);
}

.account-level-panel {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.account-level-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-level-header p {
  margin: 4px 0 0;
  color: var(--subtle);
  font-size: 0.84rem;
  line-height: 1.35;
}

.account-level-chip {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--subtle);
  background: var(--row);
  font-size: 0.74rem;
  font-weight: 900;
}

.account-level-chip.is-premium {
  color: var(--success);
  background: color-mix(in srgb, var(--success), transparent 88%);
}

.upgrade-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.plan-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 14px;
  min-height: 420px;
  padding: 18px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface);
}

.plan-card.is-premium {
  border-color: color-mix(in srgb, var(--brand), var(--stroke) 58%);
}

.plan-card.is-recommended {
  box-shadow: 0 12px 28px var(--shadow);
}

.plan-card-top {
  display: grid;
  gap: 8px;
}

.plan-card h3,
.plan-card p,
.plan-feature-list {
  margin: 0;
}

.plan-card h3 {
  font-size: 1.05rem;
}

.plan-card p {
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.35;
}

.plan-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--success);
  background: color-mix(in srgb, var(--success), transparent 88%);
  font-size: 0.72rem;
  font-weight: 900;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.plan-price strong {
  font-size: 2rem;
  letter-spacing: 0;
}

.plan-price span {
  color: var(--subtle);
  font-size: 0.82rem;
  font-weight: 800;
}

.plan-card .primary-button,
.plan-card .secondary-button {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.84rem;
}

.plan-card .primary-button {
  color: #fff;
  background: var(--brand);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 18px rgba(66, 133, 244, 0.22);
}

.plan-card .secondary-button {
  color: var(--text);
  background: color-mix(in srgb, var(--brand) 8%, #fff);
}

.plan-original-price {
  justify-self: start;
  border-radius: 10px;
  padding: 6px 8px;
  color: var(--subtle);
  background: var(--row);
  font-size: 0.78rem;
  font-weight: 900;
}

.plan-original-price s {
  color: var(--danger);
  text-decoration-thickness: 2px;
}

.plan-original-price.is-placeholder {
  visibility: hidden;
}

.plan-feature-list {
  display: grid;
  gap: 9px;
  padding: 14px 0 0;
  border-top: 1px solid var(--stroke);
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.35;
  list-style: none;
}

.plan-feature-list li {
  position: relative;
  padding-left: 20px;
}

.plan-feature-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 900;
}

.upgrade-actions.is-premium-active .plan-card {
  opacity: 0.72;
}

.upgrade-actions.is-premium-active .plan-card.is-premium {
  opacity: 1;
}

.upgrade-actions.is-premium-active .plan-card .primary-button {
  color: var(--subtle);
  background: var(--row);
}

#manage-billing {
  width: auto;
  min-height: 34px;
  margin-top: 2px;
  border-color: var(--stroke);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  background: #fff;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-top: 10px;
  border-radius: 14px;
  background: var(--row);
}

.info-row span {
  color: var(--subtle);
}

.profile-save-control {
  position: relative;
  width: 100%;
}

.save-button {
  width: 100%;
  border: 1px solid var(--success);
  background: color-mix(in srgb, var(--success) 14%, #fff);
  color: color-mix(in srgb, var(--success), #000 24%);
}

.save-help {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  color: var(--brand);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: help;
  box-shadow: 0 6px 14px var(--shadow);
}

.save-tooltip {
  position: absolute;
  left: 74px;
  top: 0;
  z-index: 12;
  display: none;
  width: min(240px, calc(100vw - 132px));
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 10px 24px var(--shadow);
}

.save-help:hover + .save-tooltip,
.save-help:focus + .save-tooltip {
  display: block;
}

.tab-bar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(calc(100% - 32px), 728px);
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: 0 10px 24px var(--shadow);
  overflow: hidden;
}

.tab-button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 58px;
  border: 0;
  color: var(--subtle);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.tab-button.is-active {
  color: var(--brand);
}

.tab-icon {
  width: 18px;
  height: 18px;
  display: block;
  border: 2px solid currentColor;
}

.calendar-icon {
  border-radius: 4px;
  box-shadow: inset 0 5px 0 color-mix(in srgb, currentColor, transparent 76%);
}

.add-icon {
  position: relative;
  border-radius: 50%;
}

.add-icon::before,
.add-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 999px;
}

.add-icon::before {
  width: 12px;
  height: 2px;
  left: 3px;
  top: 8px;
}

.add-icon::after {
  width: 2px;
  height: 12px;
  left: 8px;
  top: 3px;
}

.list-icon {
  border-width: 0;
  background: linear-gradient(currentColor 0 2px, transparent 2px 7px, currentColor 7px 9px, transparent 9px 14px, currentColor 14px 16px);
}

.profile-icon {
  border-radius: 50%;
  box-shadow: 0 8px 0 -3px currentColor;
}

.about-icon {
  border-radius: 50%;
  font-size: 0;
  position: relative;
}

.about-icon::before {
  content: "i";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.about-card,
.about-note {
  display: grid;
  gap: 10px;
}

.about-card {
  min-height: min(520px, calc(100vh - 190px));
  align-content: space-between;
  justify-items: center;
  text-align: center;
}

.about-concept {
  max-width: 620px;
  margin: 0;
  color: var(--subtle);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.45;
}

.about-lede,
.about-point p,
.about-note p {
  margin: 0;
  color: var(--subtle);
  line-height: 1.55;
}

.about-grid {
  display: grid;
  gap: 12px;
}

.about-point {
  display: grid;
  gap: 8px;
  align-content: start;
}

.text-link {
  color: var(--brand);
  font-weight: 900;
  text-decoration: none;
}

.text-link:hover,
.text-link:focus {
  text-decoration: underline;
}

.mobile-version {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.mobile-version h2 {
  font-size: 1rem;
}

.primary-link-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  color: #fff;
  background: var(--brand);
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
}

.store-badge {
  display: inline-grid;
  min-width: 162px;
  min-height: 54px;
  align-content: center;
  align-items: center;
  border: 1px solid #2f3337;
  border-radius: 9px;
  padding: 0 13px;
  color: #fff;
  background: #000;
  line-height: 1.05;
  text-align: left;
  text-decoration: none;
}

.official-store-badge {
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
}

.store-badge-image {
  display: block;
  width: 162px;
  height: 54px;
  object-fit: contain;
}

.store-badge-copy {
  display: grid;
  gap: 2px;
}

.store-badge-copy span {
  font-size: 0.66rem;
  font-weight: 700;
  opacity: 0.86;
}

.store-badge-copy strong {
  font-size: 1.02rem;
  font-weight: 900;
}

.primary-link-button:hover,
.primary-link-button:focus {
  color: #374151;
  background: var(--row);
}

.store-badge:hover,
.store-badge:focus {
  background: #1f2937;
}

.ios-badge strong {
  color: #fff;
}

.android-badge {
  grid-template-columns: 26px 1fr;
  column-gap: 9px;
  border-color: #4b5563;
  background: #000;
}

.store-badge-symbol {
  display: block;
  width: 24px;
  height: 26px;
}

.play-symbol {
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  background: #3ddc84;
}

.android-badge .store-badge-copy strong {
  color: #fff;
}

.android-badge:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.download-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.about-footer {
  margin: 0;
  color: var(--subtle);
  font-size: 0.78rem;
  font-weight: 800;
}

.sync-dock {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 82px;
  z-index: 9;
  width: min(calc(100% - 32px), 728px);
  transform: translateX(-50%);
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px var(--shadow);
}

.sync-dock .primary-button {
  display: flex;
  width: min(50%, 360px);
  margin: 0 auto;
  border: 1px solid var(--success);
  background: #fff;
  color: color-mix(in srgb, var(--success), #000 24%);
}

.sync-status {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--subtle);
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: center;
}

.sync-progress {
  display: grid;
  gap: 8px;
  width: min(100%, 420px);
  margin: 12px auto 0;
}

.sync-progress-header {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--subtle);
  font-size: 0.82rem;
  font-weight: 800;
}

.sync-progress-header strong {
  color: var(--text);
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, var(--brand), transparent 72%);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

.sync-progress.is-complete .loading-spinner {
  border-color: var(--success);
  animation: none;
}

.sync-progress.is-complete .loading-spinner::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  margin: 1px auto 0;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--row);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--success));
  transition: width 220ms ease;
}

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

.app-shell[data-view="subscriptions"] .sync-dock {
  display: block;
}

.app-shell[data-view="subscriptions"] {
  padding-bottom: 150px;
}

.detail-dialog {
  width: min(calc(100% - 32px), 520px);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 16px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
}

.detail-dialog::backdrop {
  background: rgba(10, 16, 28, 0.42);
}

.detail-grid,
.history-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.detail-row,
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--row);
}

.detail-row span,
.history-row span {
  color: var(--subtle);
}

.detail-status-button {
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 154px;
  z-index: 20;
  max-width: min(92vw, 520px);
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 12px;
  border-radius: 12px;
  color: #fff;
  background: #1f2945;
  box-shadow: 0 8px 20px var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.is-hidden {
  display: none;
}

@media (min-width: 720px) {
  .app-shell {
    width: min(100%, 1120px);
    padding: 20px 24px 32px;
  }

  .top-banner {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    padding: 12px 8px;
    border-color: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .tab-bar {
    position: static;
    display: flex;
    grid-column: 2;
    justify-self: center;
    gap: 8px;
    width: auto;
    min-width: 0;
    transform: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .account-button {
    justify-self: end;
  }

  .tab-button {
    min-width: 0;
    min-height: 32px;
    justify-content: center;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--text);
    font-size: 0.82rem;
  }

  .tab-button.is-active,
  .tab-button:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--text), transparent 92%);
  }

  .tab-icon {
    display: none;
  }

  .profile-tab-button {
    display: none;
  }

  .add-bill-tab-button {
    display: none;
  }

  .manual-bill-card:not(.is-open) {
    display: block;
    min-height: 44px;
    border: 0;
    padding: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }

  .manual-bill-card:not(.is-open) > :not(.manual-bill-trigger) {
    display: none;
  }

  .manual-bill-card:not(.is-open) .manual-bill-trigger {
    position: static;
  }

  .brand-lockup span {
    display: none;
  }

  .brand-lockup {
    justify-self: start;
  }

  .banner-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .tab-view.is-active {
    gap: 18px;
  }

  .section-card {
    padding: 18px;
  }

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

  .form-grid .primary-button {
    grid-column: 1 / -1;
  }

  .form-grid .profile-actions {
    grid-column: 1 / -1;
  }

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

  .profile-card .form-grid .primary-button,
  .profile-card .form-grid .profile-actions {
    grid-column: auto;
  }

  .sync-dock {
    bottom: 28px;
    width: min(calc(100% - 48px), 1072px);
  }
}

@media (min-width: 960px) {
  .phone-frame {
    display: grid;
  }

  #calendar-view.tab-view.is-active {
    position: relative;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    align-items: start;
  }

  #calendar-view .calendar-header,
  #calendar-view .summary-grid,
  #calendar-view .calendar-grid-card {
    grid-column: 1;
  }

  #calendar-view .daily-summary-card {
    grid-column: 1;
  }

  #calendar-view .manual-bill-card {
    position: relative;
    inset: auto;
    z-index: auto;
    width: auto;
    max-height: none;
    overflow: visible;
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  #calendar-view .manual-bill-card.is-open {
    display: block;
  }
}

@media (min-width: 960px) {
  .about-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 719px) {
  .upgrade-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .email-verification-panel {
    display: grid;
  }

  .email-verification-panel .compact-button {
    width: 100%;
  }

  .plan-card {
    min-height: auto;
  }

  .top-banner {
    align-items: flex-start;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-lockup > div:last-child {
    display: none;
  }
}

.app-shell.is-calendar-fullscreen #calendar-view.tab-view.is-active {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.app-shell.is-calendar-fullscreen .calendar-header,
.app-shell.is-calendar-fullscreen .calendar-grid-card {
  width: 100%;
}

.app-shell.is-calendar-fullscreen .calendar-grid-card {
  height: 100%;
}

.app-shell.is-calendar-fullscreen #calendar-view .manual-bill-card {
  display: none;
  visibility: visible;
  pointer-events: auto;
}
