:root {
  --primary: #0a8279;
  --primary-soft: #e4f5f1;
  --secondary: #2467b2;
  --surface: #fbfcfc;
  --surface-muted: #f0f5f4;
  --surface-bright: #fff;
  --text: #202124;
  --text-muted: #66706f;
  --outline: #e1e9e6;
  --error: #b3261e;
  --success: #1e8e3e;
  --warning: #e37400;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-full: 999px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, 0, 0, 1);
  font-family: "Google Sans", "Roboto", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  margin: 0;
  padding-bottom: calc(112px + var(--safe-bottom));
  background: linear-gradient(180deg, #fff 0, var(--surface) 45%, #f7faf9 100%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
body.sheet-open { overflow: hidden; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* Header */
.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 16px 8px 24px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}
.top-app-bar__eyebrow, .section-kicker {
  display: block;
  margin: 0 0 2px;
  color: var(--primary);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .11em;
  line-height: 1.2;
  text-transform: uppercase;
}
.top-app-bar__title h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -.035em;
}
.top-app-bar__actions { display: flex; align-items: center; gap: 2px; }
.icon-btn {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-muted); }
.icon-btn.syncing { color: var(--primary); }
.icon-btn.syncing svg { animation: spin .75s linear infinite; }
.icon-btn--soft { width: 42px; height: 42px; background: var(--primary-soft); color: var(--primary); }
.icon-btn--avatar {
  width: 42px;
  height: 42px;
  border: 2px solid #fff;
  background: conic-gradient(#ed685d 0 24%, #f7c948 24% 48%, #33aa75 48% 72%, #4285f4 72%);
  color: #fff;
  box-shadow: 0 1px 3px rgba(22, 53, 49, .16);
}
.icon-btn--avatar svg { width: 19px; height: 19px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15)); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Overview */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 4px 20px 18px;
}
.stat {
  position: relative;
  display: flex;
  min-height: 132px;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #eef4fc;
}
.stat:nth-child(1) {
  grid-column: 1 / -1;
  min-height: 184px;
  justify-content: flex-start;
  padding: 28px;
  background: linear-gradient(135deg, #e2f5f0, #eef8f7);
}
.stat:nth-child(1)::before, .stat:nth-child(1)::after {
  position: absolute;
  right: 26px;
  top: 23px;
  width: 126px;
  height: 126px;
  border: 9px solid rgba(8, 130, 121, .16);
  border-radius: 50%;
  content: "";
}
.stat:nth-child(1)::after {
  right: 43px;
  top: 40px;
  width: 92px;
  height: 92px;
  border-color: rgba(36, 103, 178, .18);
}
.stat:nth-child(3) { background: #f4f1fb; }
.stat__label { color: var(--text-muted); font-size: .78rem; font-weight: 600; letter-spacing: .01em; }
.stat__value { position: relative; z-index: 1; margin-top: 6px; font-size: 1.55rem; font-weight: 600; letter-spacing: -.045em; }
.stat:nth-child(1) .stat__value { margin-top: 10px; font-size: 2.5rem; }
.stat:nth-child(2) .stat__label::before, .stat:nth-child(3) .stat__label::before {
  display: inline-grid;
  width: 23px;
  height: 23px;
  margin-right: 7px;
  place-items: center;
  border-radius: 50%;
  background: rgba(36, 103, 178, .12);
  color: var(--secondary);
  content: "↗";
  font-size: .8rem;
}
.stat:nth-child(3) .stat__label::before { background: rgba(104, 69, 184, .11); color: #6845b8; content: "✦"; }

/* Activity and sales list */
.activity-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 24px 12px;
}
.activity-intro h2 { margin: 0; font-size: 1.34rem; letter-spacing: -.03em; }
.activity-intro > span { padding-bottom: 2px; color: var(--text-muted); font-size: .72rem; }
.search-bar {
  display: flex;
  height: 52px;
  align-items: center;
  gap: 10px;
  margin: 0 20px 10px;
  padding: 0 17px;
  border-radius: var(--radius-full);
  background: #eef3f2;
}
.search-bar:focus-within { background: #fff; box-shadow: 0 0 0 2px rgba(10, 130, 121, .22); }
.search-bar__icon { flex-shrink: 0; color: var(--text-muted); }
.search-bar input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-bar input::placeholder { color: var(--text-muted); }
.filters { display: flex; gap: 9px; overflow-x: auto; padding: 0 20px 18px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip-select {
  appearance: none;
  border: 0;
  border-radius: var(--radius-full);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%2366706f' d='m7 10 5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 7px center;
  box-shadow: 0 1px 2px rgba(26, 51, 47, .06);
  color: var(--text);
  font-size: .8125rem;
  font-weight: 600;
  padding: 9px 30px 9px 14px;
}
main { padding: 0 20px; }
.sale-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sale-card {
  display: flex;
  min-height: 86px;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 17px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 56, 51, .06);
  cursor: pointer;
  transition: transform .15s var(--ease), background .15s var(--ease);
}
.sale-card:active { transform: scale(.99); background: var(--primary-soft); }
.sale-product { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -.015em; }
.sale-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 6px 0 0; color: var(--text-muted); font-size: .8rem; }
.chip { display: inline-flex; padding: 3px 8px; border-radius: var(--radius-full); background: #e8f5f2; color: var(--primary); font-size: .7rem; font-weight: 600; }
.chip--pay { background: #edf3fc; color: var(--secondary); }
.sale-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.sale-amount { color: var(--text); font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #b9c3c0; }
.dot.pending { background: var(--warning); }
.dot.synced { background: var(--success); }
.empty-state { padding: 48px 28px; border-radius: var(--radius-md); background: #fff; color: var(--text-muted); text-align: center; line-height: 1.65; }
.empty-state strong { color: var(--primary); }

/* Persistent controls */
.fab {
  position: fixed;
  right: calc(50% - 28px);
  bottom: calc(93px + var(--safe-bottom));
  z-index: 30;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 6px 16px rgba(10, 130, 121, .28);
  color: #fff;
  cursor: pointer;
  transition: transform .15s var(--ease), filter .15s;
}
.fab:active { transform: scale(.96); filter: brightness(.93); }
.bottom-nav {
  position: fixed;
  right: 14px;
  bottom: calc(12px + var(--safe-bottom));
  left: 14px;
  z-index: 25;
  display: grid;
  min-height: 64px;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  padding: 5px;
  border: 1px solid rgba(222, 232, 229, .9);
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 28px rgba(26, 56, 50, .12);
  backdrop-filter: blur(14px);
}
.bottom-nav__item { display: grid; min-height: 52px; place-items: center; gap: 1px; border: 0; border-radius: 18px; background: transparent; color: var(--text-muted); font: 600 .68rem/1.15 inherit; cursor: pointer; }
.bottom-nav__item--active { background: var(--primary-soft); color: var(--primary); }
.bottom-nav__icon { font-size: 1.25rem; line-height: 1; }

/* Sheets */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(31, 31, 31, .36); animation: fade-in .2s ease; }
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  min-height: 100dvh;
  overflow: auto;
  padding: 0 0 calc(24px + var(--safe-bottom));
  border-radius: 0;
  background: #fff;
  animation: screen-in .24s var(--ease);
  -webkit-overflow-scrolling: touch;
}
.bottom-sheet__handle { display: none; }
.bottom-sheet__header { position: sticky; top: 0; z-index: 1; display: flex; min-height: 72px; align-items: center; justify-content: space-between; padding: calc(12px + var(--safe-top)) 8px 12px 24px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); }
.bottom-sheet__header h2 { margin: 0; font-size: 1.25rem; font-weight: 600; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes screen-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* Form, settings, and feedback */
.form { display: flex; flex-direction: column; gap: 14px; padding: 4px 20px 8px; }
.field { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 6px; }
.field--sm { flex: 0 0 72px; }
.field__label { padding-left: 2px; color: var(--text-muted); font-size: .75rem; font-weight: 600; }
.field input, .field select, .list-row--field input {
  width: 100%;
  min-height: 48px;
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field select:focus, .list-row--field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 2px rgba(10, 130, 121, .18); }
.field-row { display: flex; gap: 12px; }
.more-details { padding: 0; border: 0; }
.more-details summary { padding: 8px 2px; color: var(--primary); font-size: .875rem; font-weight: 600; cursor: pointer; list-style: none; }
.more-details summary::-webkit-details-marker { display: none; }
.more-details[open] { display: flex; flex-direction: column; gap: 12px; }
.form__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 4px; }
.btn { min-height: 40px; padding: 10px 20px; border: 0; border-radius: var(--radius-full); font-size: .875rem; font-weight: 600; cursor: pointer; }
.btn--filled { max-width: 200px; flex: 1; background: var(--primary); color: #fff; }
.btn--tonal { background: var(--primary-soft); color: var(--primary); }
.btn--text { padding: 10px 12px; background: transparent; color: var(--primary); }
.btn--danger { margin-right: auto; color: var(--error); }
.btn:disabled { opacity: .45; cursor: default; }
.settings { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 20px; }
.list-card { overflow: hidden; border: 1px solid var(--outline); border-radius: var(--radius-md); background: var(--surface); }
.list-row { padding: 16px; }
.list-row--stack { display: flex; flex-direction: column; gap: 12px; }
.list-row--field { display: flex; flex-direction: column; gap: 8px; }
.list-row__title { font-size: .95rem; font-weight: 600; }
.list-row__sub { margin-top: 2px; color: var(--text-muted); font-size: .8rem; }
.list-row__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.list-card__btn { margin: 0 8px 8px; }
.pad { padding: 12px 16px; }
.sheet-link { color: var(--primary); font-size: .875rem; font-weight: 600; text-decoration: none; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.footnote { margin: 0; padding: 0 4px; color: var(--text-muted); font-size: .75rem; line-height: 1.45; }
.snackbar { position: fixed; bottom: calc(84px + var(--safe-bottom)); left: 50%; z-index: 60; max-width: min(92vw, 360px); padding: 14px 18px; transform: translateX(-50%); border-radius: 8px; background: #323232; box-shadow: 0 8px 20px rgba(31, 31, 31, .16); color: #fff; font-size: .875rem; text-align: center; animation: snack-in .22s var(--ease); }
@keyframes snack-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }

@media (min-width: 700px) {
  body { max-width: 720px; margin: 0 auto; box-shadow: 0 0 48px rgba(18, 61, 54, .06); }
  .bottom-nav { right: calc(50% - 346px); left: calc(50% - 346px); }
}
