body {
  font-family: "Manrope", sans-serif;
  background: var(--bg-accent);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.brand-button {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand__badge {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #4a91ff 100%);
  box-shadow: 0 18px 30px rgba(29, 102, 242, 0.25);
}

.brand__badge svg {
  width: 28px;
  height: 28px;
}

.brand h1 {
  font-size: 1.16rem;
  font-weight: 800;
  line-height: 1.15;
}

.brand p {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 0.18rem;
  letter-spacing: 0.01em;
}

.topbar__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar__actions button {
  padding: 0.8rem 1rem;
}

.app {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 1.6rem auto 2rem;
}

.hidden {
  display: none !important;
}

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

.lock-screen {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}

.lock-card {
  width: min(100%, 440px);
  padding: 2rem;
  border-radius: 30px;
  text-align: center;
}

.lock-card__icon {
  width: 92px;
  height: 92px;
  margin: 0 auto 1.2rem;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(29, 102, 242, 0.16), rgba(29, 102, 242, 0.05));
  color: var(--primary);
}

.lock-card__icon svg {
  width: 52px;
  height: 52px;
}

.lock-card h2 {
  font-size: 2rem;
  font-weight: 800;
}

.lock-card p {
  margin-top: 0.7rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.pin-pad button {
  min-height: 56px;
  padding: 0.8rem;
}

.unlock-actions {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.unlock-actions button {
  min-height: 54px;
}

.dashboard-layout,
.form-layout {
  display: grid;
  gap: 1.25rem;
}

.dashboard-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.95fr);
}

.panel,
.month-detail,
.preview-card,
.sidebar-card,
.history-card {
  padding: 1.2rem;
  border-radius: 24px;
}

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

.section-header h2 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 800;
}

.section-header p {
  margin-top: 0.35rem;
  color: var(--text-muted);
}

.month-switcher {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.month-switcher button,
.month-switcher .month-pill {
  min-height: 48px;
}

.month-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-weight: 700;
}

.summary-grid,
.status-grid,
.details-grid,
.history-grid {
  display: grid;
  gap: 1rem;
}

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

.summary-card,
.status-card {
  padding: 1rem;
  border-radius: 20px;
}

.summary-card {
  min-height: 188px;
  display: flex;
  flex-direction: column;
}

.summary-card__top,
.status-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.summary-card__icon,
.status-card__icon,
.payment-card__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
}

.summary-card__icon svg,
.status-card__icon svg,
.payment-card__icon svg,
.meta-icon svg {
  width: 22px;
  height: 22px;
}

.summary-card h3,
.status-card h3 {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.summary-card strong,
.status-card strong {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.85rem;
  font-weight: 800;
}

.summary-card p,
.status-card p,
.preview-card p,
.sidebar-card p,
.history-card p,
.meta-copy p {
  color: var(--text-muted);
}

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

.calendar {
  padding: 1rem;
  border-radius: 24px;
}

.calendar__weekdays,
.calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
}

.calendar__weekdays {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.calendar__day {
  min-height: 70px;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
}

.calendar__day[disabled] {
  cursor: default;
  opacity: 0;
}

.calendar__day.is-selected {
  border-color: var(--primary);
  background: rgba(29, 102, 242, 0.12);
}

.calendar__day.is-today {
  box-shadow: inset 0 0 0 1px rgba(29, 102, 242, 0.18);
}

.calendar__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.calendar__dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--primary);
}

.calendar__count {
  font-size: 0.76rem;
  color: var(--text-subtle);
}

.payments-header,
.history-toolbar,
.receipt-actions,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-header > .payments-header {
  align-items: center;
  gap: 0.9rem;
}

.section-header > .payments-header .primary-button,
.section-header > .payments-header .ghost-button {
  min-height: 56px;
  padding-inline: 1.4rem;
  border-radius: 999px;
  font-size: 1.05rem;
}

.section-header > .payments-header .ghost-button {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.94);
}

.payments-list,
.history-list {
  display: grid;
  gap: 0.9rem;
}

.payment-card {
  padding: 1rem;
  border-radius: 22px;
  display: grid;
  gap: 0.9rem;
}

.payment-card__header,
.payment-card__footer,
.payment-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.payment-card__title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.payment-card__title h3 {
  font-size: 1.02rem;
}

.payment-card__title p,
.payment-card__note {
  color: var(--text-muted);
}

.payment-card__amount {
  font-size: 1.45rem;
  font-weight: 800;
}

.meta-stack {
  display: grid;
  gap: 0.7rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.meta-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.preview-card img,
.receipt-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  margin-top: 1rem;
  background: #eef2f7;
}

.upload-box {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
  border-radius: 18px;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.72);
}

.upload-box input {
  margin-top: 0.8rem;
}

.receipt-stage {
  display: grid;
  gap: 0.85rem;
}

.receipt-stage__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.receipt-stage__header strong {
  font-size: 0.96rem;
}

.receipt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.95rem;
  border-radius: 16px;
  background: rgba(217, 119, 6, 0.08);
  color: var(--text);
  font-weight: 600;
}

.receipt-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--warning);
}

.receipt-empty {
  padding: 0.15rem 0 0.25rem;
}

.form-shell {
  display: grid;
  gap: 1rem;
}

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

.textarea {
  min-height: 120px;
}

.history-card summary {
  list-style: none;
  cursor: pointer;
}

.history-card summary::-webkit-details-marker {
  display: none;
}

.history-card__summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 0.8fr)) auto;
  gap: 0.75rem;
  align-items: center;
}

.history-card__items {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.fab {
  position: fixed;
  right: max(1rem, calc((100vw - var(--max-width)) / 2 + 1rem));
  bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 1.1rem;
  color: #fff;
  background: linear-gradient(135deg, #0f172a 0%, #1d66f2 100%);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.25);
}

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.75rem;
  width: min(100%, 360px);
  z-index: 30;
}

@media (max-width: 1024px) {
  .dashboard-layout,
  .form-layout,
  .summary-grid,
  .status-grid,
  .form-grid,
  .history-card__summary,
  .history-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app {
    width: min(var(--max-width), calc(100% - 1rem));
    margin-top: 0.85rem;
    margin-bottom: 5.75rem;
  }

  .topbar {
    padding: 0.9rem;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.9rem;
  }

  .brand {
    flex: 1 1 100%;
    align-items: flex-start;
  }

  .brand > div:last-child {
    max-width: 220px;
  }

  .brand h1 {
    font-size: 1.05rem;
  }

  .brand p {
    display: block;
    font-size: 0.72rem;
  }

  .topbar__actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar__actions button {
    width: 100%;
    min-height: 50px;
    border-radius: 18px;
    padding-inline: 0.85rem;
    font-size: 0.94rem;
  }

  .section-header {
    margin-bottom: 0.5rem;
  }

  .section-header h2 {
    font-size: 2rem;
  }

  .section-header > div:first-child {
    width: 100%;
  }

  .month-switcher {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    gap: 0.8rem;
    align-items: stretch;
  }

  .month-switcher .icon-button,
  .month-switcher .month-pill {
    min-height: 64px;
    border-radius: 22px;
  }

  .month-pill {
    justify-content: center;
    padding: 0.8rem 0.9rem;
    font-size: 1.2rem;
  }

  .month-pill svg {
    width: 24px;
    height: 24px;
  }

  .panel,
  .month-detail,
  .preview-card,
  .sidebar-card,
  .history-card,
  .calendar {
    padding: 1rem;
    border-radius: 26px;
  }

  .summary-grid,
  .status-grid,
  .screen-grid,
  .payments-list,
  .history-list {
    gap: 0.9rem;
  }

  .summary-card,
  .status-card,
  .payment-card {
    border-radius: 24px;
  }

  .summary-card {
    min-height: 0;
    padding: 1.15rem;
  }

  .summary-card h3,
  .status-card h3 {
    margin-top: 0.85rem;
    font-size: 0.92rem;
  }

  .summary-card strong,
  .status-card strong {
    font-size: 2rem;
    line-height: 1.05;
  }

  .summary-card p,
  .status-card p {
    margin-top: auto;
    padding-top: 0.55rem;
  }

  .calendar__weekdays {
    gap: 0.35rem;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
  }

  .calendar__day {
    min-height: 56px;
    padding: 0.55rem 0.45rem;
    border-radius: 16px;
  }

  .calendar__meta {
    font-size: 0.9rem;
  }

  .calendar__count {
    font-size: 0.67rem;
  }

  .payments-header,
  .payment-card__header,
  .payment-card__footer,
  .payment-card__meta,
  .receipt-actions,
  .form-actions {
    align-items: stretch;
  }

  .payment-card__title {
    align-items: flex-start;
  }

  .payment-card__amount {
    font-size: 1.7rem;
  }

  .payment-card__footer .payments-header,
  .receipt-actions,
  .form-actions {
    width: 100%;
  }

  .payment-card__footer button,
  .receipt-actions button,
  .form-actions button,
  .payments-header button {
    flex: 1 1 0;
    justify-content: center;
  }

  .preview-card img,
  .receipt-preview {
    border-radius: 20px;
  }

  .modal {
    width: calc(100vw - 1rem);
  }

  .modal__surface {
    padding: 1rem;
  }

  .fab {
    left: 1rem;
    right: 1rem;
    justify-content: center;
    min-height: 58px;
    border-radius: 20px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0.8rem;
  }

  .brand__badge {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }

  .brand h1 {
    font-size: 0.98rem;
  }

  .section-header h2 {
    font-size: 1.85rem;
  }

  .section-header p {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .month-pill {
    font-size: 1.08rem;
  }

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