/* Apex Estimates — app shell, lists, editor. Brand tokens match the website + estimate sheet. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-var.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --teal: #42d1c1;
  --teal-hover: #5fdccd;
  --teal-ink: #0c7a70;
  --teal-wash: rgba(66, 209, 193, 0.1);
  --gold: #dea745;
  --ink: #0d1111;
  --ink-2: #1c2222;
  --paper: #f6f3ec;
  --white: #ffffff;
  --text: #1a2020;
  --muted: #5a6361;
  --lines: rgba(13, 17, 17, 0.12);
  --lines-strong: rgba(13, 17, 17, 0.2);
  --danger: #b23a2e;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(13, 17, 17, 0.06), 0 6px 20px rgba(13, 17, 17, 0.06);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --appbar-h: calc(64px + env(safe-area-inset-top));
  --tabbar-h: 0px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--paper); color: var(--text); }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: var(--teal-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* —— Buttons —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 40px; padding: 0.5rem 1rem;
  border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 650; font-size: 0.9rem; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-cta { background: var(--teal); color: var(--ink); }
.btn-cta:hover { background: var(--teal-hover); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--ink-2); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--lines-strong); }
.btn-ghost:hover { border-color: var(--teal-ink); color: var(--teal-ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(178, 58, 46, 0.35); }
.btn-danger:hover { background: rgba(178, 58, 46, 0.07); }
.btn-sm { min-height: 34px; padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-icon { width: 40px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* —— App bar —— */
.appbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--appbar-h);
  padding: env(safe-area-inset-top) max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 2px 10px rgba(13, 17, 17, 0.25);
}
.appbar-brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: inherit; min-width: 0; }
.appbar-brand img {
  width: 58px; height: 40px; object-fit: contain;
  background: var(--paper); border-radius: 9px; padding: 3px 5px;
  box-shadow: inset 0 -2px 0 var(--gold);
}
.appbar-title { display: flex; flex-direction: column; line-height: 1.1; }
.appbar-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: 0.01em; color: var(--white); }
.appbar-slogan { font-family: var(--font-display); font-weight: 600; font-size: 0.7rem; letter-spacing: 0.04em; color: var(--teal); margin-top: 2px; }
.appbar-nav { display: flex; gap: 0.25rem; margin-left: 0.5rem; flex: 1; }
.appbar-nav a {
  color: rgba(246, 243, 236, 0.72); text-decoration: none; font-weight: 600; font-size: 0.9rem;
  padding: 0.5rem 0.8rem; border-radius: 8px; position: relative;
}
.appbar-nav a:hover { color: var(--white); background: rgba(246, 243, 236, 0.06); }
.appbar-nav a.active { color: var(--white); }
.appbar-nav a.active::after {
  content: ""; position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.15rem; height: 2px; border-radius: 2px; background: var(--teal);
}

/* —— Bottom tab bar (phones) —— */
.tabbar { display: none; }

/* —— Views —— */
.view {
  max-width: 1180px; margin: 0 auto;
  padding: 1.75rem max(1.5rem, env(safe-area-inset-right)) calc(3rem + var(--tabbar-h)) max(1.5rem, env(safe-area-inset-left));
  outline: none;
}
.view.wide { max-width: none; padding-left: 0; padding-right: 0; padding-top: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.eyebrow { color: var(--teal-ink); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 0.3rem; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: 1.85rem; line-height: 1.1; color: var(--ink); margin: 0; letter-spacing: 0.005em; }
.page-sub { color: var(--muted); margin: 0.35rem 0 0; font-size: 0.92rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; margin-bottom: 1.25rem; }
.stat {
  background: var(--white); border: 1px solid var(--lines); border-radius: var(--radius-lg);
  padding: 0.9rem 1.05rem; box-shadow: var(--shadow); min-width: 0;
}
.stat-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal-ink); }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--ink); margin-top: 0.2rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-note { color: var(--muted); font-size: 0.8rem; margin-top: 0.1rem; }
.stat.accent .stat-value { color: var(--teal-ink); }
.stat.accent { border-top: 3px solid var(--gold); }

/* Filters */
.filters { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search svg { position: absolute; left: 0.8rem; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 44px; padding: 0.55rem 0.9rem 0.55rem 2.4rem;
  background: var(--white); border: 1px solid var(--lines-strong); border-radius: 999px; outline: none;
  font-size: 0.95rem;
}
.search input:focus { border-color: var(--teal-ink); box-shadow: 0 0 0 3px rgba(12, 122, 112, 0.18); }
.chips { display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px; padding: 0.35rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--lines-strong); background: var(--white); color: var(--text);
  font-size: 0.84rem; font-weight: 600;
}
.chip:hover { border-color: var(--teal-ink); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .count { opacity: 0.6; font-weight: 600; margin-left: 0.25rem; font-variant-numeric: tabular-nums; }

/* Property / project type */
.filters-2 { margin-top: -0.35rem; }
.seg { display: inline-flex; background: var(--white); border: 1px solid var(--lines-strong); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: none; border-radius: 999px; min-height: 32px; padding: 0.25rem 0.85rem; font-size: 0.84rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.seg-btn:hover { color: var(--teal-ink); }
.seg-btn.active { background: var(--teal); color: var(--ink); }
.filters .filter-select { width: auto; flex: 0 0 auto; min-width: 12rem; min-height: 40px; border-radius: 999px; font-size: 0.86rem; font-weight: 600; padding-left: 0.9rem; }
.ptag {
  display: inline-block; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 6px; padding: 0.12rem 0.42rem; margin-right: 0.45rem; vertical-align: 0.08em;
}
.ptag.res { color: var(--teal-ink); background: var(--teal-wash); }
.ptag.com { color: #7a520c; background: rgba(222, 167, 69, 0.16); }
.custom-type { margin-top: 0.5rem; }

/* Status pill */
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.18rem 0.6rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; line-height: 1.5;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.draft { background: rgba(13, 17, 17, 0.06); color: #4a5250; }
.pill.sent { background: rgba(222, 167, 69, 0.16); color: #8a5f12; }
.pill.accepted { background: rgba(66, 209, 193, 0.18); color: var(--teal-ink); }
.pill.declined { background: rgba(178, 58, 46, 0.09); color: var(--danger); }

/* Estimates list */
.list { background: var(--white); border: 1px solid var(--lines); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.list-head, .est-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1.6fr) minmax(0, 1.2fr) 8rem 7rem 8rem;
  gap: 1rem; align-items: center; padding: 0.8rem 1.15rem;
}
.list-head {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal-ink);
  border-bottom: 2px solid var(--ink); padding-top: 0.7rem; padding-bottom: 0.55rem;
}
.list-head .r, .est-row .c-total { text-align: right; }
.est-row { text-decoration: none; color: inherit; border-bottom: 1px solid var(--lines); transition: background 0.12s; }
.est-row:last-child { border-bottom: none; }
.est-row:hover { background: rgba(66, 209, 193, 0.06); }
.c-num { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; font-size: 0.88rem; }
.c-cust { min-width: 0; }
.c-cust .name { font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.c-cust .co { color: var(--muted); font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.c-proj { color: var(--text); font-size: 0.88rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-date { color: var(--muted); font-size: 0.86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-total { font-family: var(--font-display); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

.empty {
  text-align: center; padding: 3rem 1.5rem; color: var(--muted);
  background: var(--white); border: 1px dashed var(--lines-strong); border-radius: var(--radius-lg);
}
.empty h3 { font-family: var(--font-display); color: var(--ink); margin: 0 0 0.35rem; font-size: 1.1rem; }
.empty p { margin: 0 0 1rem; }

/* Customers */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.85rem; }
.card {
  background: var(--white); border: 1px solid var(--lines); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.6rem; text-decoration: none; color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
a.card:hover { border-color: rgba(12, 122, 112, 0.45); }
.card-top { display: flex; gap: 0.75rem; align-items: center; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--ink); color: var(--teal);
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: 0.02em;
}
.card-name { font-weight: 700; color: var(--ink); font-size: 1rem; line-height: 1.25; }
.card-co { color: var(--muted); font-size: 0.86rem; }
.card-lines { font-size: 0.86rem; color: var(--text); display: grid; gap: 0.15rem; }
.card-lines span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-lines .dim { color: var(--muted); }
.card-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  border-top: 1px solid var(--lines); padding-top: 0.6rem; margin-top: auto; font-size: 0.84rem; color: var(--muted);
}
.card-foot strong { color: var(--ink); font-family: var(--font-display); }
.tag { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal-ink); background: var(--teal-wash); border-radius: 6px; padding: 0.1rem 0.4rem; }

/* Forms (customer editor, more screen) */
.panel {
  background: var(--white); border: 1px solid var(--lines); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1.25rem; margin-bottom: 1rem;
}
.panel h2 { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 0.25rem; color: var(--ink); }
.panel p { margin: 0 0 0.85rem; color: var(--muted); font-size: 0.9rem; }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.85rem; }
.form-grid .s2 { grid-column: span 2; } .form-grid .s3 { grid-column: span 3; } .form-grid .s4 { grid-column: span 4; } .form-grid .s6 { grid-column: span 6; }
.fld label, .lbl {
  display: block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-ink); margin-bottom: 0.3rem;
}
.inp {
  width: 100%; min-height: 40px; padding: 0.45rem 0.65rem;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--lines-strong); border-radius: var(--radius); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  font-size: 0.95rem;
}
.inp:focus { border-color: var(--teal-ink); box-shadow: 0 0 0 3px rgba(12, 122, 112, 0.18); }
.inp::placeholder { color: #9aa19f; }
textarea.inp { resize: vertical; line-height: 1.45; min-height: 5rem; }
select.inp {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230c7a70' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center;
}
textarea.inp.grow { resize: none; overflow: hidden; min-height: 38px; line-height: 1.4; display: block; }
.es-included textarea.inp.grow, .es-terms textarea.inp.grow { min-height: 2.4rem; }
.es-private textarea.inp.grow { min-height: 3.2rem; }
.es-summary.grow { min-height: 36px; }

.form-actions { display: flex; gap: 0.5rem; justify-content: space-between; flex-wrap: wrap; margin-top: 1rem; }
.form-actions .grow { flex: 1; }

/* —— Sub bar (per-screen actions, sticky under app bar) —— */
.subbar {
  position: sticky; top: var(--appbar-h); z-index: 40;
  background: rgba(246, 243, 236, 0.94);
  -webkit-backdrop-filter: saturate(1.2) blur(10px); backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--lines);
}
.subbar-inner {
  max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem max(1.5rem, env(safe-area-inset-right)) 0.6rem max(1.5rem, env(safe-area-inset-left));
}
.back {
  display: inline-flex; align-items: center; gap: 0.2rem; text-decoration: none; color: var(--teal-ink);
  font-weight: 650; font-size: 0.9rem; min-height: 40px; padding-right: 0.4rem;
}
.back svg { width: 20px; height: 20px; }
.subbar-title { font-family: var(--font-display); font-weight: 700; color: var(--ink); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.subbar-spacer { flex: 1; }
.save-state { font-size: 0.8rem; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 0.3rem; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.save-state.dirty::before { background: var(--gold); }
.status-select {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--lines-strong); border-radius: 999px;
  min-height: 36px; padding: 0.3rem 1.9rem 0.3rem 0.85rem; font-weight: 700; font-size: 0.84rem; cursor: pointer; outline: none;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath fill='%230d1111' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 0.7rem center;
}
.status-select.draft { background-color: #eceae4; color: #3d4442; border-color: transparent; }
.status-select.sent { background-color: #f7ead0; color: #7a520c; border-color: transparent; }
.status-select.accepted { background-color: #d3f3ee; color: var(--teal-ink); border-color: transparent; }
.status-select.declined { background-color: #f5dedb; color: var(--danger); border-color: transparent; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 200px;
  background: var(--white); border: 1px solid var(--lines); border-radius: 12px; box-shadow: 0 12px 32px rgba(13, 17, 17, 0.16);
  padding: 0.35rem; display: none;
}
.menu.open { display: block; }
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 0.5rem; text-align: left; border: 0; background: none;
  padding: 0.65rem 0.75rem; border-radius: 8px; font-size: 0.9rem; font-weight: 550; color: var(--ink); text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--paper); }
.menu .danger { color: var(--danger); }

/* —— Estimate editor (sheet look, touch-sized) —— */
.editor { max-width: 900px; margin: 0 auto; padding: 1.25rem max(1.25rem, env(safe-area-inset-right)) calc(3rem + var(--tabbar-h)) max(1.25rem, env(safe-area-inset-left)); }

.pickers {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0.85rem;
  padding: 0.85rem 0.95rem; margin-bottom: 1rem;
  background: rgba(66, 209, 193, 0.08); border: 1px dashed rgba(12, 122, 112, 0.32); border-radius: var(--radius-lg);
}
.pickers .hint { font-size: 0.76rem; color: var(--muted); margin: 0.3rem 0 0; }
.pickers .type-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.esheet {
  background: var(--white); border: 1px solid var(--lines); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(13, 17, 17, 0.06), 0 12px 32px rgba(13, 17, 17, 0.08); overflow: hidden;
}
.es-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.6rem 2rem 1.2rem; border-bottom: 2.5px solid var(--gold);
}
.es-brand img { width: 148px; height: auto; display: block; margin-bottom: 0.4rem; }
.es-company { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--ink); line-height: 1.15; }
.es-rule { display: block; max-width: 11.5rem; height: 2px; background: var(--gold); margin: 0.35rem 0 0.25rem; }
.es-slogan { font-family: var(--font-display); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.03em; color: var(--teal-ink); }
.es-contact { text-align: right; font-size: 0.8rem; color: var(--muted); line-height: 1.55; }
.es-contact strong { display: block; color: var(--ink); font-weight: 650; font-size: 0.9rem; }
.es-contact a { color: var(--teal-ink); text-decoration: none; font-weight: 600; }

.es-body { padding: 1.35rem 2rem 1rem; }
.es-h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: var(--ink); line-height: 1.05; margin: 0 0 0.35rem; }

/* Plain inputs read like text until touched; on touch screens they keep a faint box so it's obvious they're editable. */
.inp.plain { border-color: transparent; background: transparent; padding-left: 0.1rem; padding-right: 0.1rem; }
.inp.plain:hover { border-color: var(--lines); background: var(--white); padding-left: 0.65rem; padding-right: 0.65rem; }
.inp.plain:focus { border-color: var(--teal-ink); background: var(--white); padding-left: 0.65rem; padding-right: 0.65rem; }
@media (hover: none) {
  .inp.plain { border-color: var(--lines); background: rgba(255, 255, 255, 0.7); padding-left: 0.65rem; padding-right: 0.65rem; }
}
.es-summary { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.7rem; }

.es-meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem;
  background: var(--paper); border: 1px solid var(--lines); border-radius: 8px; padding: 0.6rem 0.75rem; margin-bottom: 1rem;
}
.es-meta .inp { font-weight: 650; min-height: 36px; }
.es-meta input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; }
.es-meta input[type="date"]::-webkit-date-and-time-value { text-align: left; }

.es-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.1rem; }
.stack { display: grid; gap: 0.4rem; }
.row3 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.6fr) minmax(0, 0.9fr); gap: 0.4rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.inp.name { font-weight: 700; font-size: 1rem; }
.inp.detail { color: var(--text); font-size: 0.9rem; }
.ptype-display { font-weight: 700; font-size: 1rem; color: var(--ink); padding: 0.45rem 0.1rem 0.25rem; }
.link-note { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); min-height: 30px; }
.link-note .ok { color: var(--teal-ink); font-weight: 650; }
.link-btn { border: 0; background: none; color: var(--teal-ink); font-weight: 700; font-size: 0.78rem; padding: 0.25rem 0; text-decoration: underline; text-underline-offset: 2px; }

/* Line items */
.li-head, .li-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.2rem 5.6rem 6.4rem 7rem 2.1rem;
  grid-template-areas: "title qty unit rate amt del" "note qty unit rate amt del";
  column-gap: 0.45rem; row-gap: 0.3rem;
}
.li-head {
  grid-template-areas: "title qty unit rate amt del";
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-ink);
  border-bottom: 2px solid var(--ink); padding: 0 0.1rem 0.35rem;
}
.li-head .r { text-align: right; }
.li-head .c { text-align: center; }
.li-row { padding: 0.55rem 0; border-bottom: 1px solid var(--lines); align-items: start; }
.li-title { grid-area: title; } .li-note { grid-area: note; }
.li-qty { grid-area: qty; } .li-unit { grid-area: unit; } .li-rate { grid-area: rate; } .li-amt { grid-area: amt; } .li-del { grid-area: del; }
.li-row .inp { min-height: 38px; font-size: 0.9rem; padding: 0.4rem 0.5rem; }
.li-title .inp { font-weight: 650; }
.li-note .inp { color: var(--muted); font-size: 0.84rem; min-height: 34px; }
.li-note .inp:placeholder-shown:not(:focus) { border-style: dashed; border-color: var(--lines); background: transparent; }
.li-qty .inp { text-align: center; }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.88rem; pointer-events: none; }
.money .inp { padding-left: 1.15rem; text-align: right; font-variant-numeric: tabular-nums; }
.li-amt .inp { font-weight: 700; color: var(--ink); }
.li-amt .inp[readonly] { background: var(--paper); border-color: transparent; cursor: default; }
.li-amt .inp[readonly]:focus { box-shadow: none; }
.mini { display: none; }
.li-del button {
  width: 34px; height: 38px; border: 0; background: none; border-radius: 8px; color: var(--muted);
  display: grid; place-items: center;
}
.li-del button:hover { color: var(--danger); background: rgba(178, 58, 46, 0.08); }
.li-del svg { width: 16px; height: 16px; }
.li-tools { display: flex; gap: 0.5rem; margin: 0.7rem 0 0.9rem; flex-wrap: wrap; }
.dash-btn {
  border: 1px dashed rgba(12, 122, 112, 0.45); background: rgba(66, 209, 193, 0.08); color: var(--teal-ink);
  border-radius: 9px; min-height: 40px; padding: 0.4rem 0.9rem; font-size: 0.86rem; font-weight: 700;
}
.dash-btn:hover { background: rgba(66, 209, 193, 0.18); }
.li-hint { font-size: 0.76rem; color: var(--muted); align-self: center; }

/* Totals */
.es-totals { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.es-totals-box { width: 300px; max-width: 100%; }
.t-row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--lines); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.t-row.tax { color: var(--muted); font-size: 0.86rem; border-bottom: 0; }
.t-row.tax .tax-in { display: inline-flex; align-items: center; gap: 0.3rem; }
.t-row.tax .inp { width: 4.6rem; min-height: 32px; padding: 0.2rem 0.4rem; text-align: right; font-size: 0.86rem; }
.t-row.total { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 0.2rem; padding-top: 0.55rem; align-items: baseline; }
.t-row.total .label { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.t-row.total .amount { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--teal-ink); }

.es-included {
  display: flex; gap: 0.6rem; align-items: flex-start;
  background: rgba(66, 209, 193, 0.1); border: 1px solid rgba(12, 122, 112, 0.22); border-radius: 8px;
  padding: 0.55rem 0.7rem; margin-bottom: 0.8rem;
}
.es-included strong { color: var(--teal-ink); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; flex: none; padding-top: 0.55rem; }
.es-included .inp, .es-terms .inp { background: transparent; min-height: 2.6rem; font-size: 0.9rem; }
.es-terms {
  background: var(--paper); border: 1px solid var(--lines); border-radius: 8px; padding: 0.6rem 0.7rem; margin-bottom: 0.8rem;
}
.es-terms h3, .es-accept h3, .es-private h3 {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal-ink); margin: 0 0 0.35rem;
}
.es-terms .inp { min-height: 7.5rem; }
.es-terms .hint { font-size: 0.74rem; color: var(--muted); margin: 0.3rem 0 0; }
.es-private {
  border: 1px dashed rgba(222, 167, 69, 0.8); background: rgba(222, 167, 69, 0.07); border-radius: 8px; padding: 0.6rem 0.7rem; margin-bottom: 0.8rem;
}
.es-private h3 { color: #8a5f12; display: flex; justify-content: space-between; gap: 0.5rem; }
.es-private h3 span { font-weight: 600; letter-spacing: 0.04em; text-transform: none; color: var(--muted); }
.es-private .inp { background: rgba(255, 255, 255, 0.75); min-height: 3.5rem; font-size: 0.9rem; }
.es-accept { margin-bottom: 0.3rem; }
.es-accept p { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.6rem; }
.sig { display: grid; grid-template-columns: 1.4fr 1.4fr 0.9fr; gap: 1rem; }
.sig label { display: block; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.sig div div { border-bottom: 1.5px solid var(--ink); height: 1.1rem; }
.es-footer {
  background: var(--ink); color: rgba(246, 243, 236, 0.82); padding: 1rem 2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.78rem;
}
.es-footer .tagline { font-family: var(--font-display); font-weight: 600; font-size: 0.88rem; color: var(--white); letter-spacing: 0.02em; }
.es-footer .r { text-align: right; line-height: 1.5; }
.es-footer strong { color: var(--teal); }
.es-footer a { color: var(--teal); text-decoration: none; font-weight: 600; }

.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.editor-foot .meta-note { font-size: 0.8rem; color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 90;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 0.65rem 1rem; border-radius: 12px; font-size: 0.88rem; font-weight: 550;
  box-shadow: 0 10px 30px rgba(13, 17, 17, 0.3); transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 2rem);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--teal); }

/* —— Tablet —— */
@media (max-width: 1020px) {
  .list-head, .est-row { grid-template-columns: 8.5rem minmax(0, 1.5fr) minmax(0, 1fr) 7rem 7.5rem; }
  .list-head .h-date, .est-row .c-date { display: none; }
  .li-row { grid-template-areas: "title qty unit rate amt del" "note note note note note ."; }
  .pickers { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}

/* —— Phone —— */
@media (max-width: 719px) {
  :root { --appbar-h: calc(56px + env(safe-area-inset-top)); --tabbar-h: calc(62px + env(safe-area-inset-bottom)); }
  body { font-size: 15px; }
  .appbar { gap: 0.75rem; padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .appbar-nav, .appbar-new { display: none; }
  .appbar-brand img { width: 50px; height: 34px; }
  .appbar-name { font-size: 0.98rem; }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: var(--tabbar-h); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: rgba(13, 17, 17, 0.97); border-top: 1px solid rgba(246, 243, 236, 0.08);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: rgba(246, 243, 236, 0.6); text-decoration: none; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.01em;
  }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--teal); }
  .tab-new-dot { width: 34px; height: 26px; border-radius: 9px; background: var(--teal); color: var(--ink); display: grid; place-items: center; }
  .tab-new-dot svg { width: 18px !important; height: 18px !important; }
  .tabbar a.tab-new { color: var(--paper); }

  .view { padding: 1.1rem max(1rem, env(safe-area-inset-right)) calc(2rem + var(--tabbar-h)) max(1rem, env(safe-area-inset-left)); }
  .page-head { margin-bottom: 0.9rem; align-items: center; }
  .page-title { font-size: 1.5rem; }
  .page-actions .btn-cta { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.9rem; }
  .stat { padding: 0.7rem 0.85rem; }
  .stat:first-child { grid-column: span 2; }
  .stat-value { font-size: 1.25rem; }
  .filters { gap: 0.6rem; }
  .search { flex-basis: 100%; max-width: none; }
  .chips { margin: 0 -1rem; padding: 2px 1rem; }
  .filters-2 { margin-top: -0.2rem; }
  .seg { flex: 1 1 100%; }
  .seg-btn { flex: 1; padding: 0.25rem 0.5rem; }
  .filters .filter-select { flex: 1 1 100%; width: 100%; }

  .list { background: transparent; border: 0; box-shadow: none; overflow: visible; display: grid; gap: 0.6rem; }
  .list-head { display: none; }
  .est-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "cust cust total" "proj proj proj" "num date status";
    gap: 0.2rem 0.5rem; padding: 0.85rem 0.95rem;
    background: var(--white); border: 1px solid var(--lines); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  }
  .est-row:last-child { border-bottom: 1px solid var(--lines); }
  .est-row .c-cust { grid-area: cust; display: flex; align-items: baseline; gap: 0.4rem; min-width: 0; }
  .est-row .c-cust .name { font-size: 1rem; flex: none; max-width: 60%; }
  .est-row .c-cust .co { font-size: 0.86rem; }
  .est-row .c-total { grid-area: total; font-size: 1.05rem; }
  .est-row .c-proj { grid-area: proj; color: var(--muted); font-size: 0.86rem; }
  .est-row .c-num { grid-area: num; font-size: 0.8rem; color: var(--muted); font-weight: 600; align-self: center; }
  .est-row .c-date { grid-area: date; display: block; font-size: 0.8rem; align-self: center; }
  .est-row .c-date::before { content: "· "; }
  .est-row .c-status { grid-area: status; justify-self: end; margin-top: 0.15rem; }

  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .form-grid .s2, .form-grid .s3, .form-grid .s4, .form-grid .s6 { grid-column: span 2; }
  .form-grid .h1 { grid-column: span 1; }
  .panel { padding: 1rem; }

  .subbar-inner { padding: 0.45rem max(0.75rem, env(safe-area-inset-right)) 0.45rem max(0.5rem, env(safe-area-inset-left)); gap: 0.4rem; }
  .back span { display: none; }
  .subbar-title { font-size: 0.92rem; }
  .save-state .txt { display: none; }
  .hide-phone { display: none !important; }

  .editor { padding: 0.8rem max(0.6rem, env(safe-area-inset-right)) calc(2rem + var(--tabbar-h)) max(0.6rem, env(safe-area-inset-left)); }
  .pickers { grid-template-columns: 1fr; padding: 0.75rem; gap: 0.75rem; }
  .es-header { padding: 1rem 1rem 0.85rem; }
  .es-brand img { width: 104px; }
  .es-company { font-size: 1.05rem; }
  .es-slogan { font-size: 0.72rem; }
  .es-contact { font-size: 0.7rem; }
  .es-contact .addr, .es-contact .mail { display: none; }
  .es-body { padding: 1rem 0.9rem 0.8rem; }
  .es-h1 { font-size: 1.3rem; }
  .es-meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; padding: 0.55rem; }
  .es-meta .inp { min-width: 0; max-width: 100%; }
  .es-meta > :first-child { grid-column: span 2; }
  .es-parties { grid-template-columns: 1fr; gap: 1rem; }

  .li-head { display: none; }
  .li-row {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 0.85fr) minmax(0, 1.3fr) minmax(0, 1.3fr) 2.1rem;
    grid-template-areas: "title title title title del" "note note note note note" "qty unit rate amt amt";
    padding: 0.75rem 0.1rem;
  }
  .mini { display: block; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-ink); margin: 0.15rem 0 0.2rem; }
  .li-amt .mini { text-align: right; }
  .li-row .money .inp { padding-left: 1.05rem; padding-right: 0.4rem; }
  .li-row .money::before { left: 0.4rem; }
  .li-qty .inp, .li-unit .inp { padding-left: 0.3rem; padding-right: 0.3rem; }
  .status-select { padding: 0.25rem 1.5rem 0.25rem 0.7rem; background-position: right 0.55rem center; min-height: 34px; }
  .subbar .btn-icon, .subbar .btn-cta { min-height: 36px; }
  .subbar .btn-icon { width: 36px; }
  .subbar .btn-cta { padding: 0 0.6rem; }
  .es-totals-box { width: 100%; }
  .es-included { flex-direction: column; gap: 0.1rem; }
  .es-included strong { padding-top: 0; }
  .sig { grid-template-columns: 1fr 1fr; }
  .sig > :first-child { grid-column: span 2; }
  .es-footer { padding: 0.9rem 1rem; flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .es-footer .r { text-align: left; }
}

/* iOS zooms into any focused field under 16px — keep touch inputs at 16px. */
@media (pointer: coarse) {
  .inp, .search input, .status-select, .li-row .inp, .t-row.tax .inp, .es-meta .inp { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* —— Cloud sync status (cloud mode only) —— */
.sync-state {
  display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap;
  border: 0; background: transparent; padding: 0.2rem 0.45rem; border-radius: 999px; min-height: 28px;
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
}
.sync-state:hover { background: rgba(13, 17, 17, 0.05); }
.sync-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex: none; box-sizing: border-box; }
.sync-state[data-state="synced"] { color: var(--teal-ink); }
.sync-state[data-state="syncing"] .dot { background: transparent; border: 2px solid var(--teal); border-right-color: transparent; animation: apex-spin 0.8s linear infinite; width: 10px; height: 10px; }
.sync-state[data-state="offline"] .dot { background: #9aa19f; }
.sync-state[data-state="error"] { color: var(--danger); }
.sync-state[data-state="error"] .dot { background: var(--danger); }
.sync-state.in-appbar { color: rgba(246, 243, 236, 0.75); margin-left: auto; }
.sync-state.in-appbar:hover { background: rgba(246, 243, 236, 0.08); }
.sync-state.in-appbar[data-state="synced"] { color: var(--teal); }
.sync-state.in-appbar[data-state="error"] { color: #ff9b8f; }
.sync-state.in-appbar[data-state="error"] .dot { background: #ff9b8f; }
.acct-sync { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.acct-sync .sync-state { padding-left: 0; }
@keyframes apex-spin { to { transform: rotate(360deg); } }

/* —— Sign-in screen (cloud mode) —— */
body.auth-open .appbar, body.auth-open .tabbar, body.auth-open #view { display: none !important; }
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.1fr);
  background: var(--paper);
}
.auth-brand {
  background: var(--ink); color: var(--paper); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: max(3rem, env(safe-area-inset-top)) 3rem 2rem max(3rem, env(safe-area-inset-left));
}
.auth-brand::after { /* soft teal glow, bottom-left */
  content: ""; position: absolute; width: 520px; height: 520px; left: -200px; bottom: -260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(66, 209, 193, 0.16), rgba(66, 209, 193, 0) 70%); pointer-events: none;
}
.auth-brand-inner { margin: auto 0; max-width: 26rem; position: relative; z-index: 1; }
.auth-logo {
  width: 172px; background: var(--paper); border-radius: 18px; padding: 14px 18px 12px;
  box-shadow: inset 0 -3px 0 var(--gold), 0 18px 40px rgba(0, 0, 0, 0.35);
}
.auth-logo img { display: block; width: 100%; height: auto; }
.auth-brand-text { margin-top: 1.6rem; }
.auth-name { font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; line-height: 1.1; color: var(--white); letter-spacing: 0.005em; }
.auth-rule { display: block; width: 4.5rem; height: 3px; border-radius: 2px; background: var(--gold); margin: 0.7rem 0 0.55rem; }
.auth-slogan { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.05em; color: var(--teal); }
.auth-blurb { color: rgba(246, 243, 236, 0.72); font-size: 1rem; line-height: 1.6; margin: 1.4rem 0 0; }
.auth-foot { color: rgba(246, 243, 236, 0.45); font-size: 0.8rem; position: relative; z-index: 1; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 2.5rem max(2rem, env(safe-area-inset-right)) 2.5rem 2rem; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--lines);
  border-radius: 18px; box-shadow: 0 1px 2px rgba(13, 17, 17, 0.05), 0 18px 48px rgba(13, 17, 17, 0.1);
  padding: 2.1rem 2rem 1.7rem;
}
.auth-eyebrow { color: var(--teal-ink); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 0.35rem; }
.auth-title { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; line-height: 1.15; color: var(--ink); margin: 0 0 0.4rem; }
.auth-sub { color: var(--muted); font-size: 0.93rem; margin: 0 0 1.25rem; line-height: 1.5; }
.auth-sub p { margin: 0 0 0.7rem; }
.auth-sub strong { color: var(--ink); }
.auth-form { display: grid; gap: 0.35rem; }
.auth-lbl { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-ink); margin-top: 0.55rem; }
.auth-lbl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.auth-inp { min-height: 48px; font-size: 16px; padding: 0.6rem 0.8rem; }
.auth-pw { position: relative; }
.auth-pw .auth-inp { padding-right: 3rem; }
.auth-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; background: none; border-radius: 8px; color: var(--muted); display: grid; place-items: center;
}
.auth-eye svg { width: 20px; height: 20px; }
.auth-eye[aria-pressed="true"] { color: var(--teal-ink); }
.auth-eye:hover { background: var(--paper); }
.auth-link, .auth-back {
  border: 0; background: none; padding: 0.25rem 0; color: var(--teal-ink); font-weight: 650; font-size: 0.85rem; cursor: pointer;
}
.auth-link:hover, .auth-back:hover { text-decoration: underline; }
.auth-back { margin: -0.4rem 0 0.9rem; font-size: 0.9rem; }
.auth-submit { width: 100%; min-height: 50px; font-size: 1rem; margin-top: 1.05rem; border-radius: 12px; }
.auth-submit:disabled { opacity: 0.75; cursor: progress; }
.auth-actions { display: grid; gap: 0.1rem; }
.auth-actions .auth-submit + .auth-submit { margin-top: 0.6rem; }
.auth-note { margin: 1.3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--lines); color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.auth-msg { border-radius: 10px; padding: 0.7rem 0.85rem; font-size: 0.88rem; line-height: 1.45; margin: 0 0 0.5rem; }
.auth-msg.error { background: #fbeceb; color: #8f2c22; border: 1px solid rgba(178, 58, 46, 0.25); }
.auth-msg.ok { background: rgba(66, 209, 193, 0.12); color: var(--teal-ink); border: 1px solid rgba(12, 122, 112, 0.25); }
.auth-spin {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(13, 17, 17, 0.25); border-top-color: var(--ink);
  animation: apex-spin 0.7s linear infinite; display: inline-block;
}

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: max(1.4rem, env(safe-area-inset-top)) 1.25rem 1.5rem; flex-direction: row; }
  .auth-brand::after { width: 300px; height: 300px; left: auto; right: -120px; bottom: -180px; }
  .auth-brand-inner { margin: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 1rem; max-width: none; }
  .auth-logo { width: 92px; padding: 8px 10px 7px; border-radius: 13px; }
  .auth-brand-text { margin-top: 0; }
  .auth-name { font-size: 1.4rem; }
  .auth-rule { width: 3rem; margin: 0.45rem 0 0.35rem; }
  .auth-slogan { font-size: 0.8rem; }
  .auth-blurb, .auth-foot { display: none; }
  .auth-main { align-items: flex-start; padding: 1.25rem max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
  .auth-card { padding: 1.5rem 1.25rem 1.3rem; border-radius: 16px; }
  .auth-title { font-size: 1.5rem; }
}

@media (max-width: 719px) {
  .sync-state.in-subbar .txt { display: none; }
  .sync-state.in-subbar { padding: 0.2rem; }
  .sync-state.in-appbar { font-size: 0.74rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sync-state[data-state="syncing"] .dot, .auth-spin { animation: none; }
}
