:root {
  --bg: #edf1e7;
  --ink: #10211f;
  --muted: #60706a;
  --card: #fbfcf5;
  --line: #d6ddce;
  --accent: #f0782f;
  --accent-strong: #c94d17;
  --forest: #18322f;
  --green: #2f9f5b;
  --orange: #e99a27;
  --danger: #c7412f;
  --shadow: 0 18px 50px rgba(24, 50, 47, 0.14);
  --radius: 24px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 0% 0%, rgba(240, 120, 47, 0.28), transparent 32rem),
    linear-gradient(140deg, #f9ead9 0%, var(--bg) 42%, #d9e6df 100%);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.topbar,
.section-heading,
.sheet-header,
.field-row,
.quick-actions,
.project-card,
.expense-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 7vw, 2.4rem);
}

h2 {
  font-size: clamp(1.45rem, 6vw, 2rem);
}

h3 {
  font-size: 1.15rem;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sync-pill {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(16, 33, 31, 0.12);
  border-radius: 999px;
  background: rgba(251, 252, 245, 0.74);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(24, 50, 47, 0.08);
}

.sync-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(233, 154, 39, 0.15);
}

.sync-pill.synced .sync-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(47, 159, 91, 0.15);
}

.view {
  display: none;
}

.active-view {
  display: block;
  animation: rise-in 260ms ease both;
}

.panel,
.project-card,
.expense-card,
.sheet-card {
  border: 1px solid rgba(16, 33, 31, 0.1);
  border-radius: var(--radius);
  background: rgba(251, 252, 245, 0.88);
  box-shadow: var(--shadow);
}

/* Skeleton Loading styles */
.skeleton-bar {
  background: linear-gradient(90deg, rgba(16, 33, 31, 0.08) 25%, rgba(16, 33, 31, 0.15) 50%, rgba(16, 33, 31, 0.08) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s infinite;
  border-radius: 8px;
  display: block;
}

@keyframes skeleton-pulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 80px;
}


.panel {
  padding: 18px;
}

.hero-panel,
.balance-panel {
  position: relative;
  overflow: hidden;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(24, 50, 47, 0.94), rgba(41, 85, 68, 0.9)),
    var(--forest);
  color: #fffdf0;
}

.hero-panel::after,
.balance-panel::after {
  position: absolute;
  right: -42px;
  bottom: -60px;
  width: 170px;
  height: 170px;
  border: 22px solid rgba(240, 120, 47, 0.26);
  border-radius: 999px;
  content: "";
}

.primary-action,
.secondary-action,
.ghost-button {
  min-height: 50px;
  border-radius: 17px;
  font-weight: 900;
}

.primary-action {
  padding: 0 18px;
  background: var(--accent);
  color: #fffaf0;
  box-shadow: 0 12px 26px rgba(201, 77, 23, 0.28);
}

.secondary-action {
  padding: 0 16px;
  border: 1px solid rgba(24, 50, 47, 0.14);
  background: #fffaf0;
  color: var(--forest);
}

.ghost-button {
  padding: 0 14px;
  background: transparent;
  color: var(--forest);
}

.back-button {
  margin: 0 0 10px -6px;
}

.full-width {
  width: 100%;
}

.square-action {
  align-self: end;
  min-width: 72px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 14px 0;
}

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

.stack-list.compact {
  margin-top: 14px;
}

.project-card,
.expense-card {
  width: 100%;
  padding: 16px;
  text-align: left;
}

.project-card {
  justify-content: space-between;
}

.project-card strong,
.expense-card strong {
  display: block;
  font-size: 1.05rem;
}

.project-meta,
.expense-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.amount-chip,
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(240, 120, 47, 0.13);
  color: var(--accent-strong);
  font-weight: 900;
}

.balance-panel {
  background:
    linear-gradient(145deg, rgba(251, 252, 245, 0.92), rgba(220, 232, 224, 0.9)),
    var(--card);
}

.balance-number {
  position: relative;
  z-index: 1;
  margin: 12px 0;
  font-size: clamp(2.5rem, 14vw, 4.4rem);
  font-weight: 950;
  letter-spacing: -0.08em;
}

.balance-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.balance-grid div {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.78);
}

.balance-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.section-heading {
  justify-content: space-between;
}

.expense-card {
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.expense-card:hover {
  background-color: rgba(251, 252, 245, 0.98);
  transform: translateY(-2px);
  box-shadow: 0 22px 55px rgba(24, 50, 47, 0.18);
}

.expense-card:active {
  transform: translateY(0);
}

.expense-left {
  display: grid;
  gap: 4px;
}

.receipt-tag {
  display: inline-block;
  width: fit-content;
  margin-top: 4px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(47, 159, 91, 0.12);
  color: #247744;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, filter 0.1s ease;
}

.receipt-tag:hover {
  filter: brightness(0.95);
  transform: scale(1.03);
}

.receipt-tag.missing {
  background: rgba(199, 65, 47, 0.11);
  color: var(--danger);
}

.receipt-tag.electronic {
  background: rgba(233, 154, 39, 0.14);
  color: #a3610a;
}

/* Switch Toggle Styling */
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--line);
  transition: 0.2s ease;
  border-radius: 22px;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch-toggle input:checked + .switch-slider {
  background-color: var(--green);
}
.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(20px);
}



.sheet-dialog {
  width: min(calc(100% - 18px), 520px);
  max-height: calc(100dvh - 18px);
  margin: auto auto 9px;
  padding: 0;
  border: 0;
  background: transparent;
}

.sheet-dialog::backdrop {
  background: rgba(16, 33, 31, 0.45);
  backdrop-filter: blur(5px);
}

.sheet-card {
  display: grid;
  gap: 14px;
  max-height: calc(100dvh - 18px);
  padding: 18px;
  overflow: auto;
}

.sheet-header {
  justify-content: space-between;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(16, 33, 31, 0.08);
  color: var(--forest);
  font-size: 1.5rem;
}

label,
.method-list {
  display: grid;
  gap: 7px;
}

label span,
legend {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 12px 14px;
  background: #fffdf7;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(240, 120, 47, 0.15);
}

.inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inline-grid label {
  min-width: 0;
}

.inline-grid input {
  min-width: 0;
  padding: 12px 10px;
}


.grow-field {
  flex: 1;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend {
  grid-column: 1 / -1;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.segmented label span {
  display: grid;
  min-height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fffdf7;
  color: var(--forest);
}

.segmented input:checked+span {
  border-color: var(--forest);
  background: var(--forest);
  color: #fffdf0;
}

.segmented input[value="received"]:checked+span {
  border-color: var(--green);
  background: var(--green);
  color: #fffdf0;
}

.segmented input[value="missing"]:checked+span {
  border-color: var(--danger);
  background: var(--danger);
  color: #fffdf0;
}

.hidden-field {
  display: none;
}

.file-picker {
  padding: 14px;
  border: 1px dashed rgba(24, 50, 47, 0.28);
  border-radius: 19px;
  background: rgba(255, 250, 240, 0.62);
}

.file-picker input {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.file-picker strong {
  color: var(--forest);
}

.file-picker small {
  color: var(--muted);
}

.method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf7;
}

.method-row button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(199, 65, 47, 0.1);
  color: var(--danger);
  font-weight: 900;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 24px 16px;
  border: 1px dashed rgba(24, 50, 47, 0.22);
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--forest);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {

  .inline-grid,
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}