 :root {
  color-scheme: light;
  --background: #f4f4f4;
  --background-end: #f3f2f0;
  --surface: #f3f2f0;
  --surface-strong: #f5f5f5;
  --text: #141414;
  --muted: #7a7a7a;
  --border: #cfcfcf;
  --accent: #ffd00b;
  --dark: #242424;
  --page-x: clamp(15px, 5.35vw, 30px);
  --app-width: 560px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-10: 40px;
  --space-16: 64px;
  --income-row-hit: 32px;
  --accent-soft: rgba(255, 208, 11, 0.12);
  --shadow: none;
}

@font-face {
  font-family: "Onest";
  src: url("./assets/font/OnestRegular1602-hint.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Onest";
  src: url("./assets/font/OnestMedium1602-hint.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Onest";
  src: url("./assets/font/OnestBold1602-hint.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: linear-gradient(
    to bottom,
    #ffffff 0%,
    var(--background) 10%,
    var(--background-end) 100%
  );
  color: var(--text);
  font-family: "Onest", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

body.is-menu-open {
  overflow: hidden;
}

body.is-sheet-open {
  overflow: hidden;
}

body.is-sheet-open .app-shell {
  pointer-events: none;
}

body.is-sync-gate .menu-button {
  visibility: hidden;
}

body.is-sync-gate {
  background: #0e0e0e;
}

body.is-sync-gate .app-shell {
  width: 100%;
  max-width: none;
  padding: 0;
}

body.is-sync-gate .app-header {
  display: none;
}

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

input,
select,
textarea {
  font-size: 16px;
}

button {
  cursor: pointer;
}

button:focus {
  outline: 0;
}

button:focus-visible {
  outline: 2px solid rgba(36, 36, 36, 0.42);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, var(--app-width));
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) var(--page-x) 48px;
}

.app-header {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: clamp(12px, 7.45vw, 32px);
  margin-bottom: 74px;
}

body.is-finance-view .app-header {
  margin-bottom: var(--space-10);
}

body.is-finance-view.is-finance-empty .app-header {
  margin-bottom: 74px;
}

.app-header > div {
  display: none;
}

.update-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(calc(100% - 30px), var(--app-width));
  min-height: 54px;
  padding: 8px 8px 8px 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(18, 18, 18, 0.14);
  transform: translateX(-50%);
}

.update-toast span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.update-toast button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--dark);
  color: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: lowercase;
}

.update-toast button:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: default;
}

.menu-button,
.menu-close-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
}

.menu-button {
  background: var(--dark);
}

.menu-button img,
.menu-close-button img {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 100px;
  background: var(--dark);
}

.segment {
  min-height: 40px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: #f5f5f5;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-transform: uppercase;
}

.segment.is-active {
  background: #ffffff;
  color: var(--dark);
  box-shadow: none;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-header p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 1px 6px rgba(89, 68, 43, 0.06);
}

.button:hover {
  border-color: #ddcbb8;
  background: #fffdf8;
}

.quiet-button,
.add-week-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.quiet-button {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.week-header .quiet-button {
  min-height: 44px;
  margin: -14px -8px -14px 0;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-transform: uppercase;
}

.quiet-button:hover,
.icon-button:hover,
.add-week-button:hover {
  background: rgba(20, 20, 20, 0.04);
  color: var(--text);
}

.add-week-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 188px;
  min-height: 40px;
  margin: 64px auto 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-transform: uppercase;
}

.add-week-button.is-primary {
  width: 100%;
  min-height: 64px;
  margin-top: 36px;
  border-color: var(--dark);
  background: var(--dark);
  color: #f5f5f5;
}

.weeks-list {
  display: grid;
  gap: 32px;
}

.week-block {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.week-block.has-divider,
.week-delete-pending.has-divider {
  position: relative;
  margin-top: 18px;
}

.week-block.has-divider::before,
.week-delete-pending.has-divider::before {
  content: "";
  position: absolute;
  top: -23px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.week-delete-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 40px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
}

.delete-pending-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: -12px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.delete-pending-actions span:last-child {
  color: var(--muted);
}

.week-delete-pending h3 {
  min-width: 0;
}

.cancel-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
}

.cancel-delete-button:hover {
  border-color: #ddcbb8;
  background: #fffdf8;
  color: var(--text);
}

.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 16px;
  margin-bottom: 24px;
  padding: 0;
  border-bottom: 0;
  border-radius: 0;
  background: transparent;
}

.week-kicker {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h3,
h4 {
  margin-top: 0;
  letter-spacing: 0;
}

.week-header h3,
.week-delete-pending h3 {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-transform: none;
}

.day-header h4 {
  margin-bottom: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.days-grid {
  display: grid;
  gap: 48px;
  grid-template-columns: 1fr;
}

.day-section {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
}

.day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  min-height: 28px;
  margin-bottom: 24px;
}

.day-header-meta {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

.day-progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 24px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
}

.day-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
  white-space: nowrap;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 26px;
  border-radius: 0;
}

.task-row:focus-within {
  background: transparent;
}

.task-row-new {
  grid-template-columns: 24px minmax(0, 1fr);
}

.task-checkbox,
.task-checkbox-placeholder {
  width: 24px;
  height: 24px;
  margin: 0;
}

.task-checkbox {
  display: grid;
  place-content: center;
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: var(--border);
}

.task-checkbox-placeholder {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  background: var(--border);
}

.task-checkbox:checked {
  background: var(--accent);
}

.task-checkbox:checked::before {
  content: "";
  width: 12px;
  height: 12px;
  background: url("./assets/icons/check.svg") center / contain no-repeat;
}

.task-input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.task-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.task-input.is-completed {
  color: var(--text);
  text-decoration: line-through;
}

.icon-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 13px;
  opacity: 0;
}

.task-row:hover .icon-button,
.task-row:focus-within .icon-button {
  opacity: 1;
}

.soft-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.empty-state,
.empty-tasks,
.empty-finance {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 12px;
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state-title,
.empty-tasks-title,
.empty-finance-title {
  margin: 0;
  font-size: clamp(22px, 6vw, 24px);
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.empty-state-title span {
  display: block;
}

.empty-card {
  padding: 28px;
  text-align: center;
}

.empty-title {
  margin-bottom: 6px;
  font-size: 17px;
  font-weight: 700;
}

.empty-text {
  max-width: 520px;
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.sync-error {
  margin-bottom: 0;
  color: #9a3f28;
  font-size: 13px;
  font-weight: 700;
}

.app-error {
  margin: -10px 0 18px;
  text-align: center;
}

.sync-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: -8px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.sync-status strong {
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0;
}

.sync-gate {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  min-height: 100svh;
  padding: calc(env(safe-area-inset-top, 0px) + 56px) 0
    calc(env(safe-area-inset-bottom, 0px) + clamp(40px, 9.45svh, 88px));
  overflow-x: hidden;
  overflow-y: auto;
  background: #0e0e0e;
  color: #f5f5f5;
}

.sync-gate::before,
.sync-gate::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.sync-gate::before {
  background: #0e0e0e;
}

.sync-gate::after {
  z-index: -1;
  background: url("./assets/images/BackgroundBase2.png") top center / auto 100%
    no-repeat;
}

.sync-gate[data-auth-mode="login"]::after {
  background-image: url("./assets/images/BackgroundLogin2.png");
}

.auth-visual {
  align-self: start;
  justify-self: center;
  width: min(100%, var(--app-width));
  padding-top: 11px;
  pointer-events: none;
}

.auth-logo {
  display: block;
  width: clamp(116px, 28vw, 150px);
  height: clamp(48px, 12vw, 64px);
  margin: 0 auto;
  object-fit: cover;
  object-position: center;
  mix-blend-mode: lighten;
}

.auth-panel {
  display: grid;
  gap: 24px;
  width: min(calc(100% - 30px), 400px);
  margin: 0 auto;
}

.auth-panel[hidden] {
  display: none;
}

.auth-login-form {
  display: grid;
  gap: 24px;
}

.auth-login-card {
  margin-bottom: 15px;
}

.auth-save-panel {
  gap: 40px;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 24px;
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  text-align: center;
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 100px;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-pill-primary {
  background: #ffffff;
  color: #141414;
}

.auth-pill-secondary {
  border-color: #f5f5f5;
  color: #f5f5f5;
}

.auth-pill:disabled {
  border-color: transparent;
  background: #3a3a3a;
  color: #7a7a7a;
  cursor: default;
}

.auth-sync-field {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.auth-sync-field span {
  color: #7a7a7a;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}

.auth-sync-field input {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  outline: 0;
  background: #f2f2f2;
  color: #141414;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}

.auth-sync-field input::placeholder {
  color: #7a7a7a;
  opacity: 1;
}

.auth-back-button {
  justify-self: center;
  min-height: 64px;
  padding: 0 18px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: #7a7a7a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-save-card h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-save-card p {
  margin: 0;
  color: #7a7a7a;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0;
}

.auth-save-code-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 54px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  background: #f2f2f2;
  color: #141414;
  text-align: left;
}

.auth-save-code-copy span:first-child {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-error {
  position: absolute;
  right: 15px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  left: 15px;
  z-index: 1;
  color: #f1a29a;
  text-align: center;
}

.app-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: auto;
  background: #ffffff;
}

.app-menu-inner {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(100%, var(--app-width));
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) var(--page-x)
    calc(env(safe-area-inset-bottom, 0px) + 36px);
}

.menu-close-button {
  position: relative;
  margin-bottom: 64px;
  background: var(--surface);
}

.sync-code-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
}

.sync-code-card h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(32px, 8vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.sync-code-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.sync-code-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 48px;
  padding: 12px;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.sync-code-copy span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  line-height: 1.4;
  white-space: nowrap;
}

.copy-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  background: url("./assets/icons/copy.svg") center / contain no-repeat;
}

.copy-feedback {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-transform: lowercase;
}

.menu-bottom {
  display: grid;
  align-self: end;
  gap: 34px;
  padding-top: 56px;
}

.menu-info-list {
  display: grid;
  gap: 12px;
}

.menu-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
}

.menu-info-row:disabled {
  opacity: 1;
}

.menu-info-row strong {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.menu-actions {
  display: grid;
  gap: 16px;
}

.menu-action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  text-transform: uppercase;
}

.menu-action-primary {
  border: 1px solid var(--dark);
  background: var(--dark);
  color: #f5f5f5;
}

.menu-action-secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--muted);
}

.menu-signature {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.add-income-button {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(
    calc(100vw - (var(--page-x) * 2)),
    calc(var(--app-width) - (var(--page-x) * 2))
  );
  min-height: 64px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid var(--dark);
  border-radius: 999px;
  background: var(--dark);
  color: #f5f5f5;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-transform: uppercase;
  transform: translateX(-50%);
  box-shadow: none;
}

.add-income-button:hover {
  background: var(--dark);
  color: #f5f5f5;
}

.view[data-view-panel="finance"] {
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

.view[data-view-panel="finance"].is-empty {
  padding-bottom: 0;
}

.view[data-view-panel="finance"].is-empty .add-income-button {
  position: static;
  width: 100%;
  margin: 36px auto 0;
  transform: none;
}

.finance-list {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.finance-list:empty {
  display: none;
}

.finance-active-list,
.payment-history {
  display: grid;
  gap: var(--space-6);
}

.finance-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

.finance-stats div {
  display: grid;
  align-content: space-between;
  gap: var(--space-4);
  min-width: 0;
  min-height: 80px;
  padding: var(--space-4);
  border-radius: 16px;
  background: #ffffff;
}

.finance-stats span,
.finance-section-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.finance-stats strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 15px;
}

.finance-active-list {
  gap: var(--space-4);
  margin-bottom: var(--space-16);
}

.finance-active-list .finance-section-header {
  margin-bottom: var(--space-2);
}

.finance-stats + .archive-block {
  margin-top: var(--space-6);
}

.archive-block {
  display: grid;
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-10);
}

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  min-height: 80px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.archive-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
}

.archive-toggle-icon,
.month-toggle-icon {
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  background: url("./assets/icons/Pluspaymentopen.svg") center / contain
    no-repeat;
  color: var(--muted);
}

.archive-toggle-icon::before,
.month-toggle-icon::before {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 2px;
  opacity: 0;
}

.archive-toggle-icon::before,
.month-toggle-icon::before {
  top: 7px;
  right: 1px;
  left: 1px;
  height: 2px;
}

.archive-block.is-open .archive-toggle-icon,
.month-block.is-open .month-toggle-icon {
  background: none;
}

.archive-block.is-open .archive-toggle-icon::before,
.month-block.is-open .month-toggle-icon::before {
  opacity: 1;
}

.archive-block > .income-list {
  display: grid;
  gap: var(--space-4);
  padding: 0 0 var(--space-10);
}

.payment-history {
  margin: 0;
}

.year-block {
  display: grid;
  gap: var(--space-2);
}

.year-header {
  display: grid;
  gap: var(--space-1);
  width: 100%;
  min-height: 96px;
  padding: var(--space-4);
  border: 0;
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.year-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  min-width: 0;
}

.year-label {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}

.year-header-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  min-width: 0;
  color: var(--muted);
  font-weight: 500;
}

.year-total {
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.15;
  white-space: nowrap;
}

.year-growth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 22px;
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  background: var(--dark);
  color: #f5f5f5;
}

.year-growth span,
.year-average {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
}

.year-growth img {
  width: 12px;
  height: 12px;
}

.year-average {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  background: #f2f2f2;
  color: var(--muted);
  white-space: nowrap;
}

.months-list {
  display: grid;
  gap: var(--space-2);
}

.month-block {
  display: grid;
  gap: 0;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: 16px;
  background: #ffffff;
}

.month-block.is-open {
  gap: var(--space-6);
  padding: var(--space-4);
}

.month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 56px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.month-block.is-open .month-header {
  min-height: 15px;
}

.month-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  font-size: 17px;
  line-height: 1.15;
}

.month-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.income-list {
  display: grid;
  gap: var(--space-6);
}

.income-item,
.payment-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.income-item {
  min-height: var(--income-row-hit);
}

.swipe-content {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  background: transparent;
  transition: transform 180ms ease;
}

.income-swipe-content,
.payment-swipe-content {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--space-3);
}

.income-swipe-content {
  align-items: center;
  min-height: var(--income-row-hit);
}

.payment-swipe-content {
  align-items: start;
}

.swipe-delete-button {
  position: absolute;
  top: 50%;
  right: 0;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e84343;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 160ms ease;
}

.swipe-row.is-swiped .swipe-delete-button {
  opacity: 1;
  pointer-events: auto;
}

.swipe-delete-button img {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.income-content,
.payment-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
  min-height: var(--income-row-hit);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.payment-content {
  align-items: start;
  min-height: 54px;
}

.income-main {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.payment-content .income-main {
  gap: var(--space-1);
}

.income-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-width: 0;
}

.income-title,
.income-amount {
  font-size: 16px;
  font-weight: 400;
}

.income-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.income-amount,
.income-date {
  justify-self: end;
  text-align: right;
}

.income-amount {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
}

.payment-content .income-amount {
  align-self: start;
  padding-top: 0;
}

.amount-paid,
.payment-history-amount {
  font-weight: 500;
}

.amount-divider,
.amount-total {
  color: var(--muted);
}

.income-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f2f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
}

.status-tag {
  justify-self: start;
  min-height: 22px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
}

.status-unpaid {
  color: var(--muted);
  background: #f2f2f2;
}

.status-partial {
  color: #ffffff;
  background: #f28c28;
}

.status-paid {
  color: #ffffff;
  background: #4caf50;
}

.finance-check {
  flex: 0 0 auto;
}

.finance-check:checked {
  background: var(--dark);
}

.finance-check:checked::before,
.finance-check-static::before {
  content: "";
  width: 12px;
  height: 12px;
  background: url("./assets/icons/checkiconpayment.svg") center / contain
    no-repeat;
}

.finance-check-static {
  display: grid;
  place-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--dark);
}

.field,
.partial-fields {
  display: grid;
  gap: 12px;
}

.partial-fields {
  grid-template-columns: 1fr;
  gap: 22px;
}

.field span {
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  outline: 0;
  background: var(--background);
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
}

.field select {
  appearance: none;
  text-align: center;
  text-align-last: center;
}

.field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field.is-invalid input,
.field.is-invalid select {
  border-color: #da4545;
  background: #ffffff;
}

.field-error {
  display: none;
  margin-top: -6px;
  color: #da4545;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}

.field.is-invalid .field-error {
  display: block;
}

.status-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--background);
}

.status-toggle button {
  min-width: 0;
  min-height: 46px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: lowercase;
}

.status-toggle button.is-active {
  background: var(--dark);
  color: #f5f5f5;
  box-shadow: none;
}

.date-parts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.date-parts input,
.date-parts select {
  text-align: center;
}

.row-delete-button,
.payment-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.row-delete-button:hover,
.payment-chip button:hover {
  border-color: #ddcbb8;
  background: #fffdf8;
  color: var(--text);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 120px 15px calc(env(safe-area-inset-bottom, 0px) + 48px);
  overflow: auto;
  background: rgba(18, 18, 18, 0.08);
  overscroll-behavior: contain;
}

.sheet-backdrop[hidden] {
  display: none;
}

.income-sheet {
  position: relative;
  display: grid;
  gap: 24px;
  width: min(100%, var(--app-width));
  padding: 16px;
  border: 0;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 0 20px rgba(18, 18, 18, 0.1);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.sheet-header h2 {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}

.sheet-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.sheet-add-button {
  min-width: clamp(120px, 38vw, 148px);
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--dark);
  color: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.sheet-add-button:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: default;
}

.sheet-circle-button,
.sheet-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 24px 24px;
}

.sheet-delete-button {
  background-color: #da4545;
  background-image: url("./assets/icons/Bucket.svg");
}

.sheet-cancel-button {
  background-color: var(--border);
  background-image: url("./assets/icons/Close.svg");
}

.sheet-save-button {
  background-color: var(--dark);
  background-image: url("./assets/icons/Done.svg");
}

.sheet-circle-button:disabled {
  background-color: var(--border);
  cursor: default;
  filter: none;
}

.sheet-add-button:hover:not(:disabled),
.sheet-circle-button:hover:not(:disabled),
.sheet-delete-button:hover {
  filter: brightness(0.98);
}

.payments-preview {
  display: grid;
  gap: 12px;
  padding-top: 10px;
}

.payments-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.payments-preview div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.payment-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.payment-chip-separator {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
}

.payment-chip-status-partial {
  color: #f28a1a;
}

.payment-chip-status-paid {
  color: #3fa151;
}

.payment-chip button {
  width: 36px;
  height: 36px;
  border: 0;
  background: var(--dark) url("./assets/icons/Close partial.svg") center / 18px
    18px no-repeat;
  font-size: 0;
}

.payment-chip button:hover {
  border: 0;
  background: var(--dark) url("./assets/icons/Close partial.svg") center / 18px
    18px no-repeat;
  filter: brightness(0.98);
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100%, var(--app-width));
    padding: calc(env(safe-area-inset-top, 0px) + 24px) var(--page-x) 48px;
  }

  .app-header,
  .section-header {
    align-items: center;
    flex-direction: row;
  }

  .segmented-control {
    width: auto;
    min-width: 0;
  }

  h1 {
    font-size: 30px;
  }

  .button {
    width: 100%;
  }

  .add-week-button {
    width: 188px;
  }

  .add-week-button.is-primary {
    width: 100%;
  }

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

  .icon-button {
    opacity: 0;
  }

  .week-delete-pending {
    flex-direction: row;
  }

  .partial-fields {
    grid-template-columns: 1fr;
  }

  .income-sheet {
    width: 100%;
  }

}
