/* Parsley Mobile — design system. Native-app feel, Parsley's own blue identity. */

@view-transition { navigation: auto; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; }
button { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }

.app-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
  position: relative;
}
@media (min-width: 900px) { .app-shell { max-width: 720px; } }

.page-header {
  padding: calc(var(--safe-top) + 18px) 20px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.page-header .sub { font-size: 0.85rem; color: var(--ink-muted); margin-top: 2px; }
.header-action {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface); display: flex; align-items: center; justify-content: center; flex: none;
}
.header-action svg { width: 19px; height: 19px; }

.content { padding: 8px 16px 0; display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
}
.card-tight { padding: 14px 16px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 0.8rem; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card-link { text-decoration: none; color: inherit; display: block; }

.stat-hero { text-align: center; padding: 22px 18px; }
.stat-hero .label { color: var(--ink-muted); font-size: 0.85rem; font-weight: 600; }
.stat-hero .amount { font-size: 2.3rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.stat-hero .subtitle { color: var(--ink-muted); font-size: 0.9rem; margin-top: 6px; }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { padding: 16px; }
.tile .label { font-size: 0.78rem; color: var(--ink-muted); font-weight: 600; }
.tile .value { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.tile .meta { font-size: 0.75rem; color: var(--ink-faint); margin-top: 4px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-pill); font-size: 0.78rem; font-weight: 600; }
.pill-positive { background: var(--positive-tint); color: var(--positive); }
.pill-warning { background: var(--warning-tint); color: var(--warning); }
.pill-danger { background: var(--danger-tint); color: var(--danger); }
.pill-neutral { background: var(--surface-alt); color: var(--ink-muted); }
.pill-accent { background: var(--accent-tint); color: var(--accent-deep); }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item .avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; background: var(--accent-tint); color: var(--accent-deep);
}
.list-item .lines { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { font-size: 0.78rem; color: var(--ink-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .trail { flex: none; font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); text-align: right; }
.list-item .chevron { flex: none; width: 18px; height: 18px; color: var(--ink-faint); }

.section-link { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; font-weight: 600; color: var(--accent-deep); padding-top: 2px; text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-md); border: none; padding: 13px 20px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; min-height: 48px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-alt); color: var(--ink); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; }
.btn-icon { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }

input, select, textarea {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink); font-size: 1rem; font-family: inherit;
}
textarea { resize: vertical; min-height: 100px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field-hint { font-size: 0.78rem; color: var(--ink-faint); margin-top: 5px; }

.search-bar { position: relative; }
.search-bar svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-faint); }
.search-bar input { padding-left: 42px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav-inner { max-width: 560px; margin: 0 auto; display: flex; height: var(--nav-height); }
@media (min-width: 900px) { .bottom-nav-inner { max-width: 720px; } }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--ink-faint); font-size: 0.68rem; font-weight: 600;
  min-height: 48px; background: none; border: none; cursor: pointer;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--accent); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 37%, var(--surface-alt) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  * { scroll-behavior: auto !important; }
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-card { height: 74px; border-radius: var(--radius-lg); }

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(10, 15, 30, 0.45); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + var(--safe-bottom));
  max-height: 86vh; overflow-y: auto;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 14px; }
.sheet h2 { font-size: 1.15rem; margin-bottom: 14px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-muted); }
.empty-state .icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--ink-faint); }
.empty-state h3 { color: var(--ink); font-size: 1.05rem; margin-bottom: 6px; }
.empty-state p { font-size: 0.88rem; line-height: 1.4; }

.error-state { text-align: center; padding: 30px 20px; color: var(--ink-muted); }
.error-state h3 { color: var(--danger); font-size: 1rem; margin-bottom: 6px; }
.error-state p { font-size: 0.88rem; line-height: 1.4; }

.filter-chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.filter-chip-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: none; padding: 8px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 0.82rem; font-weight: 600; color: var(--ink-muted); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.segmented { display: flex; background: var(--surface-alt); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.segmented button { flex: 1; border: none; background: transparent; padding: 9px 12px; border-radius: var(--radius-pill); font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-pill); font-size: 0.85rem; font-weight: 600;
  box-shadow: var(--shadow-float); z-index: 80; opacity: 0; transition: all 0.25s ease; pointer-events: none;
  max-width: calc(100% - 40px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.pull-indicator { display: flex; align-items: center; justify-content: center; padding: 0; color: var(--ink-faint); font-size: 0.8rem; height: 0; overflow: hidden; transition: height 0.15s ease; }
.pull-indicator.visible { height: 32px; padding: 6px 0; }

/* Swipe-queue cards (receipt matching / bank suggestions) */
.queue-stack { position: relative; min-height: 260px; }
.queue-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float); padding: 20px; touch-action: pan-y;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.queue-card.dragging { transition: none; }
.queue-card .amount { font-size: 1.6rem; font-weight: 700; margin: 6px 0; }
.queue-actions { display: flex; gap: 10px; margin-top: 16px; }
.queue-actions .btn { flex: 1; }
.queue-progress { text-align: center; font-size: 0.8rem; color: var(--ink-muted); margin-bottom: 10px; }

/* Login screen */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card img { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px; display: block; }
.login-card h1 { font-size: 1.3rem; margin-bottom: 6px; }
.login-card p { color: var(--ink-muted); font-size: 0.9rem; margin-bottom: 24px; line-height: 1.5; }
.google-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #fff; color: #1f1f1f; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 13px 20px; font-size: 0.95rem; font-weight: 600; cursor: pointer; min-height: 48px;
}
.login-status { margin-top: 16px; font-size: 0.82rem; color: var(--ink-muted); min-height: 18px; }

.muted { color: var(--ink-muted); }
.small { font-size: 0.82rem; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.hidden { display: none !important; }

.tel-link { color: var(--accent-deep); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tel-link svg { width: 16px; height: 16px; }

.fab {
  position: fixed; right: 20px; bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff;
  border: none; box-shadow: var(--shadow-float); display: flex; align-items: center; justify-content: center;
  z-index: 30; cursor: pointer;
}
.fab svg { width: 24px; height: 24px; }
