/* ============================================================
   Zaeger CRM — styles (mobile-first, responsive)
   ============================================================ */
:root {
  /* Brand */
  --ink: #15161a;            /* near-black: sidebar, primary buttons, headings */
  --ink-2: #1e1f24;
  --gold: #bf9a5e;           /* signature accent */
  --gold-dark: #a07d44;
  --gold-soft: #f4ecdc;
  /* Surfaces */
  --bg: #f4f3f1;             /* warm off-white */
  --card: #ffffff;
  --text: #1b1c20;
  --muted: #8c8c93;
  --border: #ebe8e3;
  /* Status */
  --danger: #d24b41;
  --green: #2f9d6a;
  --amber: #d4983c;
  /* Shape */
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.03), 0 8px 24px rgba(20, 22, 26, 0.06);
  --shadow-lg: 0 16px 48px rgba(20, 22, 26, 0.14);
  /* Back-compat aliases (existing classes reference --blue) */
  --blue: var(--ink);
  --blue-dark: #000000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 0.4rem; letter-spacing: -0.02em; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.page-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 1rem; }
.page-title__count { font-size: 0.95rem; font-weight: 500; }

/* ---- Buttons ---- */
.btn {
  font: inherit; font-weight: 600; font-size: 0.9rem;
  padding: 0.6rem 1rem; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer;
  background: var(--card); color: var(--text);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  display: inline-flex; align-items: center; gap: 0.4rem; line-height: 1.1; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover { background: #000; }
.btn--ghost { background: var(--card); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--bg); border-color: #ddd9d1; }
.btn--danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn--danger-ghost:hover { background: rgba(210, 75, 65, 0.08); }
.btn--gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn--gold:hover { background: var(--gold-dark); }
.btn--sm { padding: 0.42rem 0.7rem; font-size: 0.82rem; border-radius: 8px; }
.btn--block { width: 100%; justify-content: center; }
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 0.9rem; color: var(--muted); padding: 0.25rem; border-radius: 6px;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ---- Inputs ---- */
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(191, 154, 94, 0.18);
}
label { display: block; font-weight: 600; font-size: 0.85rem; }
label input, label select, label textarea { margin-top: 0.3rem; font-weight: 400; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--gold); }

/* ---- Centered (auth / setup) ---- */
.centered {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.75rem;
}
.auth-card, .setup-card { width: 100%; max-width: 400px; text-align: center; }
.auth-logo { width: 210px; max-width: 72%; height: auto; margin: 0.2rem auto 0.6rem; display: block; }
.auth-card label { text-align: left; margin-top: 0.8rem; }
.btn--google { display: flex; align-items: center; justify-content: center; gap: 0.5rem; border: 1px solid var(--border); background: #fff; font-weight: 600; margin-top: 0.5rem; }
.btn--google:hover { background: var(--bg); }
.auth-fallback { margin-top: 1rem; text-align: left; }
.auth-fallback summary { cursor: pointer; text-align: center; }
.auth-fallback form { margin-top: 0.6rem; }
.auth-card .btn { margin-top: 1.2rem; }
.logo { font-size: 2.5rem; }
.auth-toggle { margin-top: 1rem; font-size: 0.9rem; }
.setup-card code {
  background: var(--bg); padding: 0.1rem 0.35rem; border-radius: 5px; font-size: 0.85em;
}

/* ---- Topbar (over the content, right of the sidebar) ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 0.8rem;
  background: rgba(244, 243, 241, 0.82); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.5rem; padding-top: max(0.7rem, env(safe-area-inset-top));
}

.topbar__logo-mobile { display: none; height: 26px; width: auto; }

/* ---- Global search ---- */
.topbar__search { position: relative; flex: 1; max-width: 460px; }
.topbar__search input { width: 100%; padding: 0.55rem 0.95rem; border-radius: 999px; background: #fff; border: 1px solid var(--border); }
.global-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; display: none;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16); max-height: 70vh; overflow-y: auto; z-index: 50; padding: 0.4rem;
}
.global-results.open { display: block; }
.gr-group + .gr-group { border-top: 1px solid var(--border); margin-top: 0.3rem; padding-top: 0.3rem; }
.gr-title { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 0.3rem 0.5rem 0.2rem; }
.gr-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; border: none; background: none; font: inherit; text-align: left; padding: 0.45rem 0.5rem; border-radius: 8px; cursor: pointer; }
.gr-item:hover { background: var(--bg); }
.gr-ic { font-size: 1rem; flex-shrink: 0; }
.gr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gr-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-right { flex-shrink: 0; }
.gr-empty { padding: 0.8rem; text-align: center; }
.topbar__user { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }

/* ---- App layout: dark sidebar + main column ---- */
.layout { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar {
  width: 246px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--ink); color: #c9c9cf;
  padding: 1rem 0.7rem;
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; justify-content: center; padding: 0.8rem 0.4rem 1.3rem; }
.sidebar__logo { width: 100%; max-width: 190px; height: auto; display: block; }
.sidebar__nav { display: flex; flex-direction: column; gap: 0.12rem; flex: 1; overflow-y: auto; }
.navlink {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  border: none; background: none; font: inherit; font-weight: 500; font-size: 0.92rem;
  color: #a3a3ab; padding: 0.62rem 0.7rem; cursor: pointer;
  border-radius: 10px; text-align: left;
}
.navlink:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.navlink--active { background: rgba(191, 154, 94, 0.18); color: #fff; }
.navlink__icon { font-size: 1.05rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.navlink__label { flex: 1; }
.pill { background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 0.7rem; padding: 0.05rem 0.45rem; border-radius: 999px; }
.navlink--active .pill { background: var(--gold); color: #fff; }
/* Notifications: a red, gently-pulsing count so @-mentions get noticed */
.pill--alert { background: #e5484d; color: #fff; font-weight: 700; }
.navlink--alert .pill--alert { animation: notif-pulse 1.8s ease-in-out infinite; }
@keyframes notif-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.55); } 50% { box-shadow: 0 0 0 5px rgba(229, 72, 77, 0); } }
.navlink__dot { display: inline-block; width: 8px; height: 8px; margin-left: 3px; border-radius: 50%; background: #e5484d; vertical-align: middle; }
.notif-view { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.notif-view .notif { cursor: pointer; }
/* The "More" overflow button + sheet are mobile-only — hidden on desktop */
.navlink--more { display: none; }
.more-sheet { display: none; }
.sidebar__user {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left;
  border: none; background: rgba(255, 255, 255, 0.05); cursor: pointer; color: inherit; font: inherit;
  border-radius: 12px; padding: 0.5rem 0.55rem; margin-top: 0.5rem;
}
.sidebar__user:hover { background: rgba(255, 255, 255, 0.09); }
.sidebar__user .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.sidebar__user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar__user-info b { color: #fff; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-info span { color: #84848c; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Main column + content ---- */
.appmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; min-width: 0; width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.6rem 4rem; overflow-x: hidden; }
/* Prevent long text (emails, addresses, URLs) from pushing the layout wide */
.field__value, .mini-deal, .detail__notes p, .activity__body { overflow-wrap: anywhere; min-width: 0; }

/* ---- Buyer Matching Engine ---- */
.buyer-ops { background: linear-gradient(135deg, #fffdf8 0%, var(--gold-soft) 100%); border: 1px solid #ece0c8; }
.buyer-ops__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.7rem; margin-top: 0.3rem; }
.buyer-op {
  text-align: left; border: 1px solid #ece0c8; background: #fff; border-radius: 12px;
  padding: 0.75rem 0.85rem; cursor: pointer; display: flex; flex-direction: column; gap: 0.1rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s; font: inherit; color: inherit;
}
.buyer-op:hover { border-color: var(--gold); box-shadow: 0 4px 16px rgba(191, 154, 94, 0.18); transform: translateY(-1px); }
.buyer-op__title { font-weight: 600; font-size: 0.9rem; line-height: 1.25; }
.buyer-op__count { margin-top: 0.4rem; font-size: 0.82rem; color: var(--gold-dark); }
.buyer-op__count b { font-size: 1.05rem; font-weight: 700; }

.buyer {
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: 0.85rem 0; border-bottom: 1px solid #eceae6;
}
.buyer:last-child { border-bottom: none; }
.buyer:first-child { padding-top: 0.3rem; }
.buyer__name { font-weight: 600; }
.buyer__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.45rem; }
.buyer__reason {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  color: var(--gold-dark); background: var(--gold-soft); padding: 0.14rem 0.55rem; border-radius: 999px;
}
.buyer__value { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: #5c5c64; }
.buyer__value--new { color: #9a9aa2; font-style: italic; }
.buyer__vip {
  font-size: 0.66rem; font-weight: 700; color: #fff; background: var(--ink);
  padding: 0.1rem 0.4rem; border-radius: 999px; letter-spacing: 0.02em;
}
.buyer__side { display: flex; align-items: center; gap: 0.85rem; flex-shrink: 0; }
.buyer__actions { display: flex; flex-direction: column; gap: 0.3rem; }
.buyer-score {
  display: flex; align-items: center; justify-content: center; width: 46px; height: 46px;
  border-radius: 50%; font-weight: 700; font-size: 0.95rem; color: #fff; flex-shrink: 0;
}
.buyer-score--hot { background: #2e9e6b; }
.buyer-score--warm { background: var(--gold); }
.buyer-score--cool { background: #9a9aa2; }
@media (max-width: 640px) {
  .buyer { flex-direction: column; gap: 0.5rem; }
  .buyer__side { width: 100%; justify-content: space-between; }
  .buyer__actions { flex-direction: row; flex-wrap: wrap; }
}

/* ---- @-mention autocomplete popup ---- */
.mention-pop {
  position: fixed; z-index: 200; background: #fff; border: 1px solid #e4e2de;
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16); overflow: hidden; max-height: 260px; overflow-y: auto;
}
.mention-opt {
  display: flex; align-items: center; gap: 0.55rem; width: 100%; text-align: left;
  border: none; background: none; cursor: pointer; font: inherit; padding: 0.45rem 0.6rem; border-bottom: 1px solid #f2f0ec;
}
.mention-opt:last-child { border-bottom: none; }
.mention-opt--active, .mention-opt:hover { background: var(--gold-soft); }
.mention-opt__main { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.mention-opt__main b { font-size: 0.86rem; }

/* ---- Notifications ---- */
.notif-panel { padding: 0.3rem 0.4rem; }
.notif {
  display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.8rem 0.7rem;
  border-bottom: 1px solid #eceae6; cursor: pointer; position: relative; border-radius: 8px;
}
.notif:last-child { border-bottom: none; }
.notif:hover { background: var(--bg); }
.notif--new { background: rgba(191, 154, 94, 0.07); }
.notif__dot { position: absolute; left: 0.15rem; top: 1.1rem; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.notif__icon { font-size: 1.15rem; line-height: 1.4; flex-shrink: 0; }
.notif__main { flex: 1; min-width: 0; }
.notif__title { font-size: 0.9rem; line-height: 1.3; }
.notif__preview { margin-top: 0.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif__when { flex-shrink: 0; white-space: nowrap; padding-top: 0.1rem; }
.notif__tick { flex-shrink: 0; color: var(--green); font-weight: 700; font-size: 0.85rem; padding-top: 0.1rem; }

/* New / Earlier section break on notification lists */
.notif-sep {
  padding: 0.65rem 0.7rem 0.3rem; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-dark);
}
.notif-sep--earlier { color: var(--muted, #8a8578); border-top: 1px solid #eceae6; margin-top: 0.3rem; }

/* Bell + dropdown (top-right) */
.notif-bell { position: relative; display: inline-flex; }
.notif-bell__btn { position: relative; font-size: 1.4rem; line-height: 1; padding: 0.45rem 0.6rem; }
.notif-bell__btn--active { color: var(--gold-dark); border-color: var(--gold); background: var(--gold-soft); }
.notif-badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #d8483f; color: #fff; font-size: 0.66rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-sizing: border-box; box-shadow: 0 0 0 2px #fff;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 360px; max-width: 90vw;
  background: #fff; border: 1px solid #e4e2de; border-radius: 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.16);
  z-index: 80; overflow: hidden;
}
.notif-dropdown[hidden] { display: none; }
.notif-dd__head { padding: 0.7rem 0.9rem; font-weight: 700; font-size: 0.85rem; border-bottom: 1px solid #eceae6; }
.notif-dd__list { max-height: 60vh; overflow-y: auto; padding: 0.2rem 0.4rem; }
.notif-dd__empty { padding: 1.4rem 1rem; text-align: center; }
@media (max-width: 640px) { .notif-dropdown { position: fixed; top: 56px; right: 8px; left: 8px; width: auto; } }

/* ---- Invoice → inventory "Linked watch" picker ---- */
.inv-picker { position: relative; margin-top: 0.3rem; }
.inv-picker__chosen:not(:empty) { margin-top: 0.1rem; }
.inv-picker__tag {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; font-weight: 600;
  background: var(--gold-soft); color: var(--gold-dark); padding: 0.3rem 0.6rem; border-radius: 10px;
}
.inv-picker__tag button {
  border: none; background: rgba(0, 0, 0, 0.12); color: inherit; cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; font-size: 0.7rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.inv-picker__results:not(:empty) {
  position: absolute; z-index: 5; left: 0; right: 0; margin-top: 0.25rem; background: #fff;
  border: 1px solid #e4e2de; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); overflow: hidden; max-height: 260px; overflow-y: auto;
}
.inv-picker__opt {
  display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer;
  padding: 0.55rem 0.7rem; font: inherit; font-size: 0.85rem; border-bottom: 1px solid #f0eee9;
}
.inv-picker__opt:last-child { border-bottom: none; }
.inv-picker__opt:hover { background: var(--gold-soft); }
.inv-picker__empty { padding: 0.6rem 0.7rem; }
.invoice-row__link { margin-left: 0.5rem; font-size: 0.74rem; font-weight: 600; color: var(--gold-dark); }

/* ---- Find duplicates ---- */
.dup-section { margin-top: 1.1rem; }
.dup-section__head { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.55rem; }
.dup-group { border: 1px solid #e7e5e1; border-radius: 10px; padding: 0.55rem 0.75rem; margin-bottom: 0.7rem; }
.dup-row { display: flex; align-items: center; gap: 0.55rem; padding: 0.32rem 0; cursor: pointer; }
.dup-row input { width: auto; flex-shrink: 0; }
.dup-row__main { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.dup-group .btn { margin-top: 0.45rem; }

/* ---- Record-sale dialog ---- */
.sale-section { margin-top: 1rem; }
.sale-section__head { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #8a8a92; margin-bottom: 0.5rem; }
.sale-or { text-align: center; color: #b0b0b6; font-size: 0.78rem; margin: 0.9rem 0 0.2rem; }
.sale-invoice {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; width: 100%;
  text-align: left; border: 1px solid #e7e5e1; background: #fff; border-radius: 10px;
  padding: 0.6rem 0.75rem; margin-bottom: 0.4rem; cursor: pointer; font: inherit; font-size: 0.85rem;
  transition: border-color 0.15s, background 0.15s;
}
.sale-invoice:hover { border-color: var(--gold); background: var(--gold-soft); }

/* Narrow screens: nav becomes a dark bottom tab bar */
@media (max-width: 640px) {
  .layout { display: block; min-height: 0; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; padding: 0.2rem;
    padding-bottom: max(0.2rem, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 18px rgba(0, 0, 0, 0.28); z-index: 40;
  }
  .sidebar__brand, .sidebar__user { display: none; }
  .sidebar__nav { flex-direction: row; gap: 0; overflow: visible; }
  .navlink {
    flex: 1; min-width: 0; flex-direction: column; gap: 0.1rem;
    justify-content: center; padding: 0.35rem 0.05rem; border-radius: 8px;
  }
  .navlink__icon { font-size: 1.22rem; width: auto; }
  .navlink__label {
    display: block; flex: none; font-size: 0.53rem; line-height: 1; text-align: center; letter-spacing: -0.01em;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .navlink .pill { display: none; }
  /* Bottom bar shows primary tabs + More; the rest go in the sheet */
  .navlink--secondary { display: none; }
  .navlink--more { display: flex; }
  .more-sheet[hidden] { display: none; }
  .more-sheet {
    display: block; position: fixed; inset: 0; z-index: 60;
  }
  .more-sheet__backdrop {
    position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45);
    opacity: 0; transition: opacity 0.2s ease;
  }
  .more-sheet--open .more-sheet__backdrop { opacity: 1; }
  .more-sheet__panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: var(--ink); border-radius: 18px 18px 0 0;
    padding: 0.5rem 0.7rem calc(0.8rem + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.4);
    transform: translateY(100%); transition: transform 0.22s ease;
  }
  .more-sheet--open .more-sheet__panel { transform: translateY(0); }
  .more-sheet__grip {
    width: 38px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.25);
    margin: 0.5rem auto 0.7rem;
  }
  .more-sheet__item {
    display: flex; align-items: center; gap: 0.8rem; width: 100%;
    border: none; background: none; cursor: pointer; color: #cfcfd6; font: inherit;
    padding: 0.85rem 0.8rem; border-radius: 12px; text-align: left;
  }
  .more-sheet__item:active { background: rgba(255, 255, 255, 0.06); }
  .more-sheet__item--active { background: rgba(191, 154, 94, 0.18); color: #fff; }
  .more-sheet__icon { font-size: 1.25rem; width: 1.6rem; text-align: center; }
  .more-sheet__label { flex: 1; font-size: 0.95rem; }
  .more-sheet__item .pill { display: inline-block; background: var(--gold); color: #fff; }
  /* Topbar: show the logo, hide the global search */
  .topbar { padding: 0.6rem 0.95rem; gap: 0.5rem; }
  .topbar__logo-mobile { display: block; }
  .topbar__search { display: none; }
  .content { padding: 0.95rem; padding-bottom: 5rem; }
  .detail { padding: 1.1rem 1.15rem; }
  .toast { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
}
.toolbar {
  display: flex; gap: 0.6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap;
}
.toolbar .search { flex: 1; min-width: 160px; }
.empty {
  text-align: center; color: var(--muted); padding: 3rem 1rem;
  background: var(--card); border-radius: var(--radius); border: 1px dashed var(--border);
}
.empty--sm { padding: 0.8rem; border: none; background: transparent; }

/* ---- Contact cards ---- */
.cards { display: flex; flex-direction: column; gap: 0.6rem; }
.contact-card {
  display: flex; align-items: center; gap: 0.8rem; background: var(--card);
  padding: 0.8rem; border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.1s;
}
.contact-card:hover { transform: translateY(-1px); }
.contact-card__main { flex: 1; min-width: 0; }
.contact-card__name { font-weight: 600; }
.contact-card__sub { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #c6a064, #a07d44); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem;
}
.avatar--lg { width: 60px; height: 60px; font-size: 1.3rem; }

/* ---- Status badges ---- */
.status {
  font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px;
  background: var(--bg); color: var(--muted); white-space: nowrap;
}
.status--lead { background: #fef9c3; color: #854d0e; }
.status--prospect { background: #dbeafe; color: #1e40af; }
.status--customer { background: #dcfce7; color: #166534; }
.status--inactive { background: #f1f5f9; color: #64748b; }

/* ---- Contact detail ---- */
.back { margin-bottom: 0.8rem; }
.detail { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.6rem; }
.detail__header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.detail__header h2 { margin: 0; font-size: 1.35rem; }
.detail__actions { margin-left: auto; display: flex; gap: 0.45rem; flex-wrap: wrap; }
.detail__fields {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.4rem;
  margin: 1.3rem 0; padding: 1.3rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.field__label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.field__value { margin-top: 0.2rem; font-weight: 500; }
.detail__notes { margin: 1rem 0; }
.detail__notes p { white-space: pre-wrap; }
.detail__section { margin-top: 1.6rem; }
.detail__section h4 { color: var(--muted); text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 0.6rem; }
/* Collapsible section (e.g. Potential buyers) — a tidy rectangle you can expand */
.collapse > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.85rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary:hover { background: #f1ede4; }
.collapse > summary h4 { margin-bottom: 0; }
.collapse__meta { margin-left: auto; }
.collapse > summary::after { content: "▸"; color: var(--muted); transition: transform 0.15s ease; }
.collapse[open] > summary::after { transform: rotate(90deg); }
.collapse__body { margin-top: 0.7rem; }
.mini-deal {
  display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border);
}
.mini-deal:last-child { border-bottom: none; }

/* ---- Activities ---- */
.activity-form { display: flex; gap: 0.5rem; margin: 0.6rem 0 1rem; flex-wrap: wrap; }
.activity-form select { width: auto; }
.activity-form input { flex: 1; min-width: 140px; }
.activity-form textarea { flex: 1 1 100%; min-height: 4.6rem; resize: vertical; line-height: 1.45; }
.activity-form .inv-picker { flex: 1 1 200px; min-width: 180px; }
.task-add .inv-picker { flex: 1 1 160px; min-width: 140px; }
.inv-picker__opt--new { color: var(--gold-dark); font-weight: 600; }
.tl-edit { width: 100%; min-height: 4.2rem; resize: vertical; line-height: 1.45; }
.tl-edit__actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.tl-item__actions { display: flex; gap: 0.15rem; flex-shrink: 0; }
.money-cost { color: #b7791f; font-weight: 700; }  /* purchase price + total cost — amber */
.money-sell { color: #2e9e6b; font-weight: 700; }  /* selling price — green */
.online-badge { font-weight: 700; padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.82rem; display: inline-block; }
.online-badge--yes { color: #2e9e6b; background: rgba(46, 158, 107, 0.13); }
.online-badge--no { color: #d8483f; background: rgba(216, 72, 63, 0.13); }
.activity-list { display: flex; flex-direction: column; gap: 0.5rem; }
.activity {
  display: flex; gap: 0.6rem; align-items: flex-start; background: var(--bg);
  padding: 0.6rem 0.7rem; border-radius: 10px;
}
.activity__icon { font-size: 1.1rem; }
.activity__body { flex: 1; }
.mention { color: var(--gold-dark); font-weight: 600; background: var(--gold-soft); padding: 0 3px; border-radius: 4px; }
.mention--chip { cursor: pointer; transition: background 0.12s, color 0.12s; }
.mention--chip:hover { background: var(--gold); color: #fff; }
.auth-note { margin-top: 1rem; }

/* ---- Owner chips & assignment ---- */
.owner {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--gold-soft); color: var(--gold-dark); font-size: 0.68rem; font-weight: 700;
  border: none; cursor: default;
}
.owner--me { cursor: pointer; background: var(--gold); color: #fff; }
.deal-card__owner { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.4rem; }

/* ---- Segmented toggle (Mine / Everyone) ---- */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px; flex-shrink: 0; }
.seg__btn {
  border: none; background: none; font: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--muted); padding: 0.32rem 0.8rem; border-radius: 999px; cursor: pointer;
}
.seg__btn--active { background: var(--card); color: var(--blue); box-shadow: var(--shadow); }
.toolbar--right { justify-content: flex-end; }

/* ---- Contacts table ---- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table thead th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 700; padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: #faf9f6;
  position: sticky; top: 0;
}
.table tbody td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table tbody tr:nth-child(even) { background: var(--bg); }
.td-strong { font-weight: 600; }
.widget__body--scroll { max-height: 340px; overflow-y: auto; }
.audit-entry { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.audit-entry:last-child { border-bottom: none; }
.audit-meta { margin-bottom: 0.25rem; }
.audit-op { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.audit-op--add { color: var(--green); }
.audit-op--del { color: var(--danger); }
.audit-changes { margin: 0.3rem 0 0; padding-left: 1rem; font-size: 0.88rem; }
.audit-changes li { margin: 0.15rem 0; overflow-wrap: anywhere; }

/* ---- Sell inquiries + valuation ---- */
.sell-status { font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.sell-status--new { background: var(--gold-soft); color: var(--gold-dark); }
.sell-status--accepted { background: #dcfce7; color: #166534; }
.sell-status--declined, .sell-status--no-response { background: #f3f4f6; color: #6b7280; }
.repair-status { font-size: 0.72rem; font-weight: 600; padding: 0.12rem 0.55rem; border-radius: 999px; background: var(--gold-soft); color: var(--gold-dark); white-space: nowrap; }
.repair-status--done { background: #e7f3ec; color: #2c8f60; }
.repair-status--off { background: #f0efec; color: #7a7a80; }
.inline-status { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.valuation { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.val-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.7rem; }
.val-head h4 { margin: 0; }
.val-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.val-card { background: var(--bg); border-radius: 10px; padding: 0.7rem; text-align: center; }
.val-card__t { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 0.3rem; }
.val-card__big { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.val-suggest { margin: 0.8rem 0 0; padding: 0.6rem 0.8rem; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: 0.9rem; }
.val-list { margin-top: 0.8rem; }
.val-links { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.val-record { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.7rem 0 1.1rem; }
.val-record input { width: 170px; }

/* ---- Vault Intelligence (AI chat) ---- */
.ai-page { display: flex; flex-direction: column; height: calc(100dvh - 150px); max-width: 880px; margin: 0 auto; }
.ai-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.ai-thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.9rem; padding: 0.5rem 0.2rem 1rem; }
.ai-msg { display: flex; }
.ai-msg--me { justify-content: flex-end; }
.ai-msg--ai { justify-content: flex-start; }
.ai-bubble { max-width: 90%; padding: 0.8rem 1rem; border-radius: 16px; line-height: 1.55; font-size: 0.94rem; }
.ai-msg--me .ai-bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.ai-msg--ai .ai-bubble { background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); border-bottom-left-radius: 5px; }
.ai-table-wrap { margin-top: 0.7rem; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.ai-table { font-size: 0.82rem; }
.ai-table th { background: var(--bg); }
.ai-table tbody tr { cursor: default; }
.ai-table tbody tr:hover { background: transparent; }
.ai-input { display: flex; gap: 0.5rem; padding-top: 0.7rem; border-top: 1px solid var(--border); }
.ai-input input { flex: 1; border-radius: 999px; padding: 0.75rem 1.1rem; }
.ai-welcome { text-align: center; margin: auto 0; padding: 1.5rem 1rem; }
.ai-welcome__icon { font-size: 2.6rem; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 1.3rem; }
.ai-chip { border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 0.85rem; padding: 0.5rem 0.9rem; border-radius: 999px; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.ai-chip:hover { border-color: var(--gold); background: var(--gold-soft); }
.ai-typing { display: inline-flex; gap: 5px; align-items: center; }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: aiblink 1.2s infinite both; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiblink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
@media (max-width: 640px) { .ai-page { height: calc(100dvh - 165px); } }
.inline-status input, .inline-status select { width: auto; }
.val-buyers { margin-top: 0.8rem; padding: 0.7rem 0.8rem; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 10px; }
.val-buyers__head { font-weight: 700; color: #166534; margin-bottom: 0.4rem; }
@media (max-width: 560px) { .val-grid { grid-template-columns: 1fr; } }
.pager { display: flex; align-items: center; justify-content: center; gap: 0.85rem; margin: 1rem 0 0.5rem; }
.pager button[disabled] { opacity: 0.4; cursor: default; }
.bf-voided td { opacity: 0.45; }
.void-badge { background: #fee2e2; color: #991b1b; font-size: 0.62rem; font-weight: 800; padding: 0.05rem 0.35rem; border-radius: 4px; vertical-align: middle; }
.void-banner { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 0.6rem 0.8rem; border-radius: 8px; font-weight: 600; margin-bottom: 0.8rem; }
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--text); }
.th-sort--active { color: var(--gold-dark); }
.th-arrow { font-size: 0.7em; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; transition: background 0.12s; }
.table tbody tr:hover { background: #f8f4ec; }
.cell-name { font-weight: 600; white-space: nowrap; }
.cell-name .avatar { display: inline-flex; vertical-align: middle; margin-right: 0.5rem; }
.cell-owner { text-align: right; }
.avatar--sm { width: 30px; height: 30px; font-size: 0.72rem; }
.table-count { margin-top: 0.6rem; padding-left: 0.2rem; }

/* ---- Detail: section head + small button ---- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.btn--sm { padding: 0.35rem 0.65rem; font-size: 0.82rem; }
.ext-arrow { font-size: 0.85em; opacity: 0.6; }

/* ---- Invoice statuses ---- */
.status--paid { background: #dcfce7; color: #166534; }
.status--sent { background: #dbeafe; color: #1e40af; }
.status--draft { background: #f1f5f9; color: #64748b; }
.status--overdue { background: #fee2e2; color: #991b1b; }

/* ---- Inquiry statuses ---- */
.status--open { background: #fef9c3; color: #854d0e; }
.status--sourcing { background: #dbeafe; color: #1e40af; }
.status--matched { background: #f4ecdc; color: #a07d44; }
.status--fulfilled { background: #dcfce7; color: #166534; }
.status--closed { background: #f1f5f9; color: #64748b; }
.mini-deal[data-open-inq] { cursor: pointer; }
.mini-deal[data-open-inq]:hover { background: #f8f4ec; border-radius: 8px; }

/* ---- Stock matching ---- */
.stock-note { margin: -0.4rem 0 0.8rem; }
.match-chip { background: #dcfce7; color: #166534; font-size: 0.72rem; font-weight: 700; padding: 0.12rem 0.5rem; border-radius: 999px; }

/* ---- Inventory ---- */
.toolbar select { width: auto; flex-shrink: 0; }
.page-title__count { font-size: 0.9rem; font-weight: 600; margin-left: 0.3rem; }
/* Standard statuses: neutral, normal weight. Available = bold green, Sold = bold red. */
.inv-status { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0.12rem 0.55rem; border-radius: 999px; background: #efeeea; color: #7a7a80; white-space: nowrap; }
.inv-status--avail { background: #e7f3ec; color: #2c8f60; font-weight: 700; }
.inv-status--sold { background: #f2e7e5; color: #b0463c; font-weight: 700; }

/* Keep the description column in check now the table carries three money
   columns (Purchase · Cost · Selling): clamp to 2 lines with an ellipsis
   (base td is nowrap — must override or long text paints over Reference),
   and give the table a floor width so a narrow window gets a horizontal
   slider (.table-wrap scrolls) instead of crushed columns. */
.table--inventory { min-width: 880px; }
.table--inventory td.cell-desc { max-width: 300px; white-space: normal; line-height: 1.3; }
.table--inventory td.cell-desc .clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table--inventory .cell-money { text-align: right; white-space: nowrap; }

/* Phone: compact inventory list — show only Code · Description · Price,
   smaller text, description wraps to 2 lines (no horizontal scroll). */
@media (max-width: 640px) {
  .table--inventory { font-size: 0.8rem; min-width: 0; }
  .table--inventory thead th { padding: 0.45rem 0.55rem; }
  .table--inventory tbody td { padding: 0.5rem 0.55rem; white-space: normal; }
  /* hide Reference(3), Status(4), Purchase(5), Cost(6) — leaves Code · Description · Selling */
  .table--inventory th:nth-child(3), .table--inventory td:nth-child(3),
  .table--inventory th:nth-child(4), .table--inventory td:nth-child(4),
  .table--inventory th:nth-child(5), .table--inventory td:nth-child(5),
  .table--inventory th:nth-child(6), .table--inventory td:nth-child(6) { display: none; }
  .table--inventory .cell-name { white-space: nowrap; }
  .table--inventory td.cell-desc { line-height: 1.25; }
  .table--inventory td.cell-desc .clamp2 {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .table--inventory th:nth-child(7), .table--inventory td:nth-child(7) {
    text-align: right; white-space: nowrap; font-weight: 600;
  }
}

/* ---- Deal stage badge (table view) ---- */
.deal-stage { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.12rem 0.55rem; border-radius: 999px; background: #ededeb; color: #4a4a50; white-space: nowrap; }
.deal-stage--won { background: #dcfce7; color: #166534; }
.deal-stage--lost { background: #f1f5f9; color: #64748b; }
.inq-match { margin-top: 1.2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.inq-match h4 { color: var(--muted); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.03em; }
.stock-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--border); }
.stock-row:last-child { border-bottom: none; }
.stock-row__main { flex: 1; min-width: 0; }
.stock-row__title { font-weight: 600; }
.stock-row__price { font-weight: 700; white-space: nowrap; }
.stock-row__price--within { color: var(--green); }

/* ---- Recent purchases ---- */
.invoice-row {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.2rem;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.invoice-row:hover { background: #f8f4ec; }
.invoice-row:last-child { border-bottom: none; }
.invoice-row__main { flex: 1; min-width: 0; }
.invoice-row__num { font-weight: 600; }
.invoice-row__amount { font-weight: 700; color: var(--green); }

/* ---- Files ---- */
.file-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: none; }
.file-row__icon { font-size: 1.3rem; flex-shrink: 0; width: 46px; text-align: center; }
.file-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--bg); border: 1px solid var(--border); }
.file-thumb[data-full] { cursor: zoom-in; }

/* Photos shown inline in the unified timeline (notes + photos) */
.tl-gallery { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.tl-photo { position: relative; width: 92px; }
.tl-photo .file-thumb, .tl-photo .file-row__icon { width: 92px; height: 92px; object-fit: cover; cursor: zoom-in; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1.7rem; }
/* Actions sit UNDER the thumbnail, never over it. Overlaid at the top-right
   these three buttons spanned ~74% of a 92px tile and were permanently visible
   on touch (@media (hover: none)), so tapping the picture to view it caught
   the delete button instead. A destructive control must not share a tap target
   with "open this". */
.tl-photo__actions { display: flex; gap: 2px; margin-top: 2px; }
.tl-photo__actions .icon-btn {
  flex: 1; min-height: 24px; border: 1px solid var(--border); background: var(--card);
  border-radius: 6px; color: var(--muted); font-size: 0.75rem; line-height: 1; padding: 2px;
}
.tl-photo__actions .icon-btn:hover { background: var(--bg); color: var(--text); }
.tl-photo__actions .icon-btn[data-del-file]:hover { background: rgba(210, 75, 65, 0.1); color: var(--danger); border-color: var(--danger); }
.tl-photo__name { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-preview { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.attach-preview:not(:empty) { margin: 0.5rem 0; }
.attach-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.78rem; display: inline-flex; align-items: center; gap: 0.35rem; max-width: 220px; }
.attach-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip button { border: none; background: none; cursor: pointer; color: var(--muted); padding: 0; }
.activity-form__actions { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.4rem; }
.activity-form__actions .spacer { flex: 1; }
.hero-thumb { width: 100%; height: 100%; border-radius: 50%; border: none; object-fit: cover; }
.drag-grip { color: var(--muted); cursor: grab; flex-shrink: 0; font-size: 1.1rem; user-select: none; }
.file-row[draggable] { cursor: default; }
.file-row.dragging { opacity: 0.4; }
.file-reorder-hint { margin-bottom: 0.5rem; }

/* ---- Lightbox ---- */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.88); display: flex; align-items: center; justify-content: center; z-index: 400; padding: 1rem; animation: fadeIn 0.15s ease; }
.lightbox img { max-width: 95vw; max-height: 92vh; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.lightbox__close { position: fixed; top: 1rem; right: 1rem; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.18); color: #fff; font-size: 1.2rem; cursor: pointer; }
.lightbox__close:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox__bar { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 0.6rem; z-index: 401; }
.lightbox__btn { background: rgba(255, 255, 255, 0.92); color: #111; border: none; border-radius: 999px; padding: 0.55rem 1.3rem; font-weight: 600; font-size: 0.92rem; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.lightbox__btn:hover { background: #fff; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.file-row__main { flex: 1; min-width: 0; }
.file-row__name { font-weight: 600; overflow-wrap: anywhere; }

/* ---- Timeline ---- */
.timeline { position: relative; margin-top: 0.4rem; }
.timeline::before { content: ""; position: absolute; left: 14px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { display: flex; gap: 0.8rem; align-items: flex-start; position: relative; padding: 0.5rem 0; }
.tl-item__icon {
  width: 30px; height: 30px; border-radius: 50%; background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; z-index: 1;
}
.tl-item__body { flex: 1; min-width: 0; }
.tl-item__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.tl-item__label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; color: var(--muted); }
.tl-item__date { flex-shrink: 0; white-space: nowrap; }
.tl-item__content { margin-top: 0.1rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.tl-item__content a { font-weight: 600; }
.tl-snippet { margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-head__actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

/* First-paint loading spinner (shell renders instantly; content fills after) */
.loading-screen { display: flex; align-items: center; justify-content: center; min-height: 55vh; }
.spinner { width: 38px; height: 38px; border: 3px solid var(--border, #e3e0d8); border-top-color: var(--gold, #c9a24b); border-radius: 50%; animation: vault-spin 0.7s linear infinite; }
@keyframes vault-spin { to { transform: rotate(360deg); } }

/* ---- Barcode / QR scan field + camera overlay ---- */
.scan-field { display: flex; gap: 0.4rem; align-items: stretch; }
.scan-field input { flex: 1; min-width: 0; }
.scan-btn { flex-shrink: 0; padding-left: 0.6rem; padding-right: 0.6rem; }
.scanner-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.92); display: flex; align-items: center; justify-content: center; padding: env(safe-area-inset-top, 1rem) 1rem 1rem; }
.scanner-box { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; width: min(94vw, 520px); }
.scanner-stage { position: relative; width: 100%; display: flex; }
.scanner-video { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 14px; background: #000; }
.scanner-reticle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 66%; height: 66%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 14px; pointer-events: none; }
.scanner-hint { color: #fff; font-size: 0.9rem; text-align: center; margin: 0; }
.scanner-cancel { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* ---- Google Calendar events ---- */
.gcal-event { padding: 0.5rem 0.2rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }
.gcal-event:last-child { border-bottom: none; }
.gcal-event__main { min-width: 0; flex: 1; }
.gcal-event__title { font-weight: 600; }
.gcal-event__actions { display: flex; gap: 0.1rem; opacity: 0.55; transition: opacity 0.12s; }
.gcal-event:hover .gcal-event__actions { opacity: 1; }
.tl-meeting-btn { border: none; background: transparent; cursor: pointer; font-size: 0.8rem; padding: 0 0.15rem; opacity: 0.55; transition: opacity 0.12s; }
.tl-meeting-btn:hover { opacity: 1; }
.contact-multipicker__chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.contact-multipicker__chips:not(:empty) { margin-bottom: 0.4rem; }
.addr-autocomplete { display: block; margin-top: 0.4rem; }
.addr-autocomplete gmp-place-autocomplete { width: 100%; display: block; }

/* ---- Remote signature requests (buy form list) ---- */
.bf-pending { margin: 0.5rem 0 1.4rem; }
.bf-pending__row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--border); }
.bf-pending__row:last-child { border-bottom: none; }
.bf-pending__main { flex: 1; min-width: 0; }
.bf-pending__actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* New-purchase "add details" prompt at the top of Inventory */
.inv-pending { margin: 0 0 1.2rem; padding: 0.7rem 0.9rem; background: #fbf6e9; border: 1px solid var(--gold, #c9a24b); border-radius: var(--radius); }
.inv-pending__title { margin: 0 0 0.3rem; }
.inv-pending__row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid rgba(0,0,0,0.07); }
.inv-pending__row:last-child { border-bottom: none; }
.inv-pending__main { flex: 1; min-width: 0; }
.inv-pending__actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.bf-review__sig { max-width: 260px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

/* ---- Public signing page (sign.html) ---- */
.sign-body { background: var(--bg, #f4f5f7); }
.sign-wrap { max-width: 600px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.sign-card { background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 16px; padding: 1.75rem; margin-top: 1.25rem; box-shadow: 0 6px 30px rgba(0,0,0,0.07); }
.sign-card h1 { margin: 0; font-size: 1.45rem; line-height: 1.25; }

.sign-head { text-align: center; padding-bottom: 1.4rem; margin-bottom: 0.4rem; border-bottom: 1px solid var(--border, #e5e7eb); }
.sign-logo { display: block; height: 50px; width: auto; max-width: 86%; margin: 0 auto 1.1rem; }
.sign-sub { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--muted, #6b7280); }
.sign-trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem 0.55rem; margin-top: 1rem; }
.sign-trust__item { font-size: 0.72rem; color: #475569; display: inline-flex; align-items: center; gap: 0.3rem; background: var(--bg, #f4f5f7); border: 1px solid var(--border, #e5e7eb); padding: 0.3rem 0.62rem; border-radius: 999px; white-space: nowrap; }
.sign-foot { text-align: center; font-size: 0.78rem; line-height: 1.55; color: var(--muted, #6b7280); margin: 1.1rem auto 0; max-width: 480px; }
.sign-card--notice { text-align: center; }
.sign-card--notice .sign-logo { margin-bottom: 1.4rem; }
.sign-card--notice h1 { font-size: 1.3rem; }
.sign-card--notice p { margin-top: 0.6rem; }

.sign-dealer { margin: 1.1rem 0 0.4rem; padding: 0.7rem 0.85rem; background: var(--bg, #f4f5f7); border-radius: 10px; font-size: 0.9rem; line-height: 1.5; }
.sign-dealer__label { display: block; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.68rem; color: var(--muted, #6b7280); margin-bottom: 0.1rem; }

.sign-block { padding: 1.3rem 0; border-bottom: 1px solid var(--border, #eef0f3); }
.sign-block:last-child { border-bottom: none; padding-bottom: 0.25rem; }
.sign-sec { margin: 0 0 0.7rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted, #6b7280); font-weight: 700; }

.sign-kv { display: flex; justify-content: space-between; gap: 1.25rem; padding: 0.5rem 0; line-height: 1.4; }
.sign-kv + .sign-kv { border-top: 1px dashed var(--border, #eef0f3); }
.sign-kv span:first-child { color: var(--muted, #6b7280); white-space: nowrap; }
.sign-kv span:last-child { text-align: right; font-weight: 600; }
.sign-kv--total { font-size: 1.1rem; margin-top: 0.35rem; padding-top: 0.7rem; border-top: 2px solid var(--border, #e5e7eb) !important; }

.sign-good { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; line-height: 1.4; }
.sign-good + .sign-good { border-top: 1px solid var(--border, #eef0f3); }
.sign-good span:last-child { font-weight: 600; white-space: nowrap; }

.sign-decl { margin: 0; background: #f0f6ff; border: 1px solid #d6e6ff; border-radius: 10px; padding: 0.9rem 1rem; font-size: 0.95rem; line-height: 1.55; }

.sign-terms { font-size: 0.82rem; line-height: 1.55; color: #4b5563; }
.sign-terms p { margin: 0 0 0.7rem; }
.sign-terms p:last-child { margin-bottom: 0; }
.sign-terms strong { color: var(--text, #111); }
.sign-warn { padding: 0.7rem 0.85rem; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; color: #9a3412; font-weight: 600; }

.sign-here { margin: 1.1rem 0 0.35rem; font-weight: 700; color: var(--text, #111); }
.sign-body .sigpad { width: 100%; height: auto; aspect-ratio: 600 / 300; border: 1px dashed #94a3b8; border-radius: 10px; background: #fff; touch-action: none; display: block; margin-top: 0.9rem; }
.sign-here + .sigpad { margin-top: 0; }
.sign-padrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.6rem; flex-wrap: wrap; }
.sign-date { font-size: 0.9rem; color: var(--muted, #6b7280); }
.sign-date input { margin-left: 0.35rem; }
.sign-ack { display: flex; align-items: flex-start; gap: 0.6rem; margin: 1.1rem 0 0; font-size: 0.9rem; line-height: 1.5; cursor: pointer; }
.sign-ack input { margin-top: 0.2rem; width: 1.1rem; height: 1.1rem; flex: none; }
.sign-submit { width: 100%; margin-top: 1.1rem; padding: 0.85rem; font-size: 1.02rem; }

/* ---- Pipeline board ---- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr);
  gap: 0.8rem; overflow-x: auto; padding-bottom: 0.5rem;
}
.column { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.column__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 0.8rem; font-weight: 700; border-bottom: 1px solid var(--border);
}
.column__body { padding: 0.6rem; display: flex; flex-direction: column; gap: 0.6rem; min-height: 60px; }
.deal-card { background: var(--bg); border-radius: 10px; padding: 0.7rem; border: 1px solid var(--border); }
.deal-card__title { font-weight: 600; }
.deal-card__value { color: var(--green); font-weight: 700; margin: 0.2rem 0; }
.deal-card__foot { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.5rem; }
.stage-select { font-size: 0.8rem; padding: 0.3rem 0.4rem; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(18, 16, 14, 0.5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal {
  background: var(--card); width: 100%; max-width: 540px;
  border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
.modal__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal__head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.modal__body { padding: 1.4rem; }

/* ---- Product QR code modal ---- */
.qr-modal { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.6rem; }
.qr-modal__img { width: 240px; height: 240px; image-rendering: pixelated; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: #fff; }
.qr-modal__meta strong { font-size: 1.05rem; }

/* ---- Forms in modal ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.form-actions--tools { margin-top: 0.2rem; padding-bottom: 0.35rem; border-bottom: 1px dashed var(--border); }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.checkbox-row input { width: auto; }

/* ---- Buy Form (Form 1) ---- */
.bf h2 { margin-bottom: 0.2rem; }
.bf-sec { margin: 1.4rem 0 0.6rem; color: var(--gold-dark); border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.04em; }
/* Scan-a-handwritten-form shortcut at the top of the buy form. */
.bf-scan { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg); }
.bf-scan .btn { white-space: nowrap; }
.bf-scan .muted { flex: 1 1 220px; }
/* Watch line: flex-wraps to a second line when the fields don't fit on one. */
.bf-goods-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px dashed var(--border); align-items: center; }
.bf-goods-row input { flex: 1 1 130px; min-width: 110px; }
.bf-goods-row .bf-g-type { flex: 0 1 84px; min-width: 70px; }
.bf-goods-row .bf-g-desc { flex: 3 1 220px; }
.bf-goods-row .bf-g-notes { flex: 2 1 180px; }
.bf-goods-row .bf-g-price { flex: 0 1 120px; min-width: 96px; }
.bf-goods-row .bf-g-remove { flex: 0 0 28px; min-width: 28px; }
.sigpad { width: 100%; max-width: 600px; height: 160px; border: 2px dashed var(--border); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.bf-date { display: inline-flex; flex-direction: column; font-weight: 600; font-size: 0.85rem; margin-top: 0.8rem; max-width: 200px; }
/* Repair drop-off form */
.bf-radio { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.bf-radio label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.bf-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.rdo-sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.rdo-sig { display: flex; flex-direction: column; }
.rdo-sig .sigpad { max-width: none; height: 150px; }
.rdo-sig__label { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.4rem; }
.rdo-sig [data-clear-sig] { align-self: flex-start; margin-top: 0.4rem; }
@media (max-width: 640px) {
  .bf-goods-row .bf-g-remove { margin-left: auto; }
  .rdo-sigs { grid-template-columns: 1fr; }
}

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translate(-50%, 1rem);
  background: var(--text); color: #fff; padding: 0.7rem 1.1rem; border-radius: 10px;
  box-shadow: var(--shadow); opacity: 0; transition: all 0.3s; z-index: 200; max-width: 90vw;
}
.toast--show { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--danger); }
.toast--success { background: var(--green); }

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius); }
}
@media (max-width: 520px) {
  .hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .detail__fields { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}

/* ---- Dashboard ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-bottom: 1.2rem; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem; text-align: left; cursor: pointer; font: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat--alert { border-color: rgba(210, 75, 65, 0.4); }
.stat__num { font-size: 1.65rem; font-weight: 800; letter-spacing: -0.025em; }
.stat__num--green { color: var(--green); }
.stat__label { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.4rem; margin-bottom: 1.2rem; }
.panel h4 { color: var(--muted); text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 0.8rem; }
.bar-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.55rem 0; }
.bar-row__label { width: 80px; font-size: 0.85rem; font-weight: 600; flex-shrink: 0; }
.bar-row__val { width: 110px; text-align: right; flex-shrink: 0; }
.bar { flex: 1; height: 9px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--gold); border-radius: 999px; min-width: 2px; }
.bar__fill--won { background: var(--green); }
.bar__fill--lost { background: #d8d4cc; }

/* ---- Dashboard widgets ---- */
.widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-bottom: 1.2rem; }
.widget {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  min-height: 230px; overflow: hidden;
}
.widget__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 1.05rem 1.25rem 0.7rem; font-weight: 700; font-size: 0.98rem;
}
.widget__head a { font-size: 0.8rem; font-weight: 600; color: var(--gold-dark); }
.widget__head a:hover { color: var(--gold); text-decoration: none; }
.widget__body { padding: 0.2rem 0.85rem 0.9rem; overflow-y: auto; flex: 1; }
.widget__body > .task { box-shadow: none; border: 1px solid var(--border); }
.w-row {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.62rem 0.55rem;
  cursor: pointer; border-radius: 10px;
}
.w-row + .w-row { box-shadow: 0 -1px 0 var(--border); }
.w-row:hover { background: var(--bg); box-shadow: none; }
.w-row:hover + .w-row { box-shadow: none; }
.w-row__main { flex: 1; min-width: 0; }
.w-row__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transfer-dest { font-size: 0.72rem; font-weight: 700; padding: 0.16rem 0.6rem; border-radius: 999px; background: var(--gold-soft); color: var(--gold-dark); border: 1px solid rgba(191, 154, 94, 0.45); white-space: nowrap; flex-shrink: 0; }

@media (max-width: 720px) {
  .widgets { grid-template-columns: 1fr; }
}

/* ---- Tags ---- */
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.tags--lg { margin: 0.4rem 0 0.2rem; }
.tag { background: #f4ecdc; color: #a07d44; font-size: 0.72rem; font-weight: 600; padding: 0.12rem 0.5rem; border-radius: 999px; }
.tag-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.tag-chip {
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  font: inherit; font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.7rem;
  border-radius: 999px; cursor: pointer;
}
.tag-chip--active { background: var(--gold); color: #fff; border-color: var(--gold); }

/* ---- Drag & drop ---- */
.deal-card { position: relative; cursor: grab; touch-action: none; }
.deal-card__edit { position: absolute; top: 0.4rem; right: 0.4rem; }
.deal-card.dragging { opacity: 0.35; }
.drag-ghost {
  position: fixed; transform: translate(-50%, -50%); pointer-events: none; z-index: 300;
  opacity: 0.95; box-shadow: 0 10px 28px rgba(15, 23, 42, 0.3); rotate: -2deg;
}
.column--over { outline: 2px dashed var(--gold); outline-offset: -3px; background: rgba(191, 154, 94, 0.07); }

/* ---- Tasks ---- */
.task-add { display: flex; gap: 0.5rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.task-add input[name="title"] { flex: 1; min-width: 160px; }
.task-add input[type="date"], .task-add select { width: auto; flex-shrink: 0; }
.task-group { margin-bottom: 1.3rem; }
.task-group h4 { color: var(--muted); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.03em; margin-bottom: 0.5rem; }
.task-group--overdue { color: var(--danger); }
.task {
  display: flex; align-items: center; gap: 0.75rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 0.8rem 0.9rem; margin-bottom: 0.55rem;
}
.task__check { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--gold); }
.task__main { flex: 1; min-width: 0; }
.task__title { font-weight: 600; }
.task--done .task__title { text-decoration: line-through; color: var(--muted); }
.task__meta .overdue { color: var(--danger); font-weight: 700; }
.task-done { margin-top: 1rem; }
.task-done summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 0.6rem; }

/* ============================================================
   Time Clock (standalone kiosk page) — /timeclock.html
   ============================================================ */
.tc-body { margin: 0; min-height: 100vh; background: linear-gradient(160deg, #1b1c22, #0f1013); color: #f4f3f1; }
#tc-app { min-height: 100vh; display: flex; flex-direction: column; }
.tc-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.4rem; gap: 1rem; }
.tc-logo { height: 32px; width: auto; }
.tc-now { text-align: center; display: flex; flex-direction: column; line-height: 1.1; }
.tc-now__time { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.02em; }
.tc-now__date { font-size: 0.8rem; color: #9a9aa2; }
.tc-mgr-link, .tc-back { background: none; border: none; color: #9a9aa2; font: inherit; font-size: 0.95rem; cursor: pointer; }
.tc-mgr-link:hover, .tc-back:hover { color: #fff; }
.tc-main { flex: 1; max-width: 920px; width: 100%; margin: 0 auto; padding: 1rem 1.4rem 3rem; box-sizing: border-box; }
.tc-title { text-align: center; font-size: 1.6rem; font-weight: 700; margin: 0.5rem 0 1.6rem; }
.tc-sub { text-align: center; color: #b5b5bd; margin: -1rem 0 1.4rem; }
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.9rem; }
.tc-card { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1.3rem 0.8rem; border-radius: 16px; border: 1px solid rgba(255,255,255,0.09); background: rgba(255,255,255,0.04); color: #fff; cursor: pointer; font: inherit; transition: transform 0.1s, border-color 0.15s, background 0.15s; }
.tc-card:hover { border-color: var(--gold); background: rgba(255,255,255,0.07); transform: translateY(-2px); }
.tc-card--in { border-color: rgba(46,158,107,0.5); }
.tc-card--break { border-color: rgba(216,153,63,0.5); }
.tc-card__name { font-size: 1.05rem; font-weight: 600; }
.tc-pill { font-size: 0.72rem; font-weight: 600; padding: 0.18rem 0.55rem; border-radius: 999px; }
.tc-pill--out { background: rgba(255,255,255,0.1); color: #c7c7cf; }
.tc-pill--in { background: rgba(46,158,107,0.2); color: #7fe0b0; }
.tc-pill--break { background: rgba(216,153,63,0.2); color: #f0c688; }
.tc-empty { text-align: center; color: #9a9aa2; grid-column: 1 / -1; padding: 2rem; }
.tc-pinwrap { max-width: 360px; text-align: center; }
.tc-dots { display: flex; justify-content: center; gap: 0.6rem; margin: 0 0 1.4rem; height: 16px; }
.tc-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); box-sizing: border-box; }
.tc-dot--on { background: var(--gold); border-color: var(--gold); }
.tc-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.tc-key { font-size: 1.6rem; font-weight: 600; padding: 1rem; border-radius: 14px; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: #fff; cursor: pointer; font-family: inherit; }
.tc-key:hover { background: rgba(255,255,255,0.1); }
.tc-key:active { transform: scale(0.97); }
.tc-key--ok { background: var(--gold); border-color: var(--gold); color: #1b1c22; }
.tc-key--back { color: #c7c7cf; }
.tc-actions { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.4rem; }
.tc-act { font-size: 1.1rem; padding: 1rem; }
.tc-textlink { display: block; margin: 1.1rem auto 0; background: none; border: none; color: #9a9aa2; font: inherit; font-size: 0.9rem; text-decoration: underline; cursor: pointer; }
.tc-textlink:hover { color: #fff; }
.tc-msg { margin-top: 1rem; min-height: 1.2rem; color: #f3a0a0; }
.tc-confirm { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 4rem; }
.tc-confirm__tick { width: 90px; height: 90px; border-radius: 50%; background: rgba(46,158,107,0.2); color: #7fe0b0; font-size: 3rem; display: flex; align-items: center; justify-content: center; margin-bottom: 1.2rem; }
.tc-confirm h1 { font-size: 1.8rem; margin: 0; }
.tc-confirm__name { color: #9a9aa2; margin-top: 0.4rem; font-size: 1.1rem; }
.tc-nudge { margin-top: 1.8rem; max-width: 340px; background: rgba(191,154,94,0.12); border: 1px solid rgba(191,154,94,0.35); border-radius: 14px; padding: 1.1rem 1.2rem; }
.tc-nudge p { margin: 0 0 1rem; color: #e7e0d2; font-size: 0.95rem; }
.tc-nudge__actions { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.tc-nudge__actions .btn { width: 100%; }
.tc-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.2rem; justify-content: center; }
.tc-tab { padding: 0.5rem 1.1rem; border-radius: 999px; border: 1px solid rgba(255,255,255,0.12); background: none; color: #c7c7cf; cursor: pointer; font: inherit; }
.tc-tab--on { background: var(--gold); border-color: var(--gold); color: #1b1c22; font-weight: 600; }
.tc-mgr .muted { color: #9a9aa2; }
.tc-range { display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.tc-range label { display: flex; flex-direction: column; font-size: 0.78rem; color: #9a9aa2; gap: 0.25rem; }
.tc-range input { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: #fff; border-radius: 8px; padding: 0.5rem; font: inherit; }
.tc-totals { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.tc-total { background: rgba(191,154,94,0.15); color: #f0c688; padding: 0.35rem 0.7rem; border-radius: 8px; font-size: 0.85rem; }
.tc-total b { color: #fff; margin-right: 0.3rem; }
.tc-rows { display: flex; flex-direction: column; }
.tc-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.2rem; border-bottom: 1px solid rgba(255,255,255,0.07); }
.tc-row__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tc-row__hrs { font-weight: 700; color: var(--gold); white-space: nowrap; }
.tc-mini { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: #c7c7cf; border-radius: 7px; padding: 0.35rem 0.6rem; cursor: pointer; font: inherit; font-size: 0.8rem; }
.tc-mini:hover { background: rgba(255,255,255,0.12); color: #fff; }
.tc-mini--del:hover { background: rgba(216,72,63,0.25); color: #fff; border-color: transparent; }
.tc-live { color: #7fe0b0; }
.tc-nopin { color: #f0a0a0; }
.tc-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.tc-modal__panel { background: #1f2027; border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 1.4rem; width: 100%; max-width: 420px; color: #f4f3f1; box-sizing: border-box; }
.tc-modal__panel h3 { margin: 0 0 1rem; }
.tc-modal__body { display: flex; flex-direction: column; gap: 0.8rem; }
.tc-modal__body label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; color: #9a9aa2; }
.tc-modal__body label.tc-check { flex-direction: row; align-items: center; gap: 0.5rem; color: #f4f3f1; }
.tc-modal__body input[type=text], .tc-modal__body input[type=number], .tc-modal__body input[type=datetime-local] { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); color: #fff; border-radius: 8px; padding: 0.55rem; font: inherit; }
.tc-modal__actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.2rem; }

/* ============================================================
   Team calendar (SPA view — "tcal-": the "tc-" prefix belongs
   to the time-clock kiosk styles above)
   ============================================================ */
.tcal-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.tcal-toolbar__spacer { flex: 1; }
.tcal-people { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tcal-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.28rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font: inherit; font-size: 0.82rem; cursor: pointer; }
.tcal-chip--off { opacity: 0.38; }
.tcal-chip--err { cursor: help; color: var(--muted); }
.tcal-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.tcal-day { margin: 1.2rem 0 0.4rem; }
.tcal-day h4 { margin: 0 0 0.45rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.tcal-event { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.35rem 0.7rem; padding: 0.55rem 0.75rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.35rem; box-shadow: var(--shadow); }
.tcal-event__time { flex: none; min-width: 64px; font-size: 0.8rem; color: var(--muted); }
.tcal-event__who { display: inline-flex; gap: 0.3rem; align-items: center; flex: none; }
.tcal-event__title { font-weight: 600; }
.tcal-event__loc { color: var(--muted); font-size: 0.8rem; }
.tcal-empty { color: var(--muted); font-size: 0.85rem; padding: 0.1rem 0.75rem; margin: 0; }

/* ---- Website listing editor (WooCommerce) ---- */
.web-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.web-chip { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--border); border-radius: 999px; padding: 0.22rem 0.65rem; cursor: pointer; font-size: 0.82rem; background: var(--card); }
.web-chip--on { border-color: var(--gold); background: var(--gold-soft); }
.web-chip input { margin: 0; }
.web-cat-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.45rem; }
.web-desc-tabs { display: flex; align-items: center; gap: 0.3rem; margin-bottom: 0.35rem; }
.web-desc-tabs__label { margin-right: auto; }
.web-desc-tab--active { border-color: var(--gold); background: var(--gold-soft); }
.web-desc-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); padding: 0.6rem 0.75rem; min-height: 130px; font-size: 0.9rem; }
.web-desc-preview:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.web-desc-preview:empty::before { content: "Nothing yet — press ✨ Generate title & description, or type here."; color: var(--muted); font-size: 0.85rem; }
.web-desc-preview table { border-collapse: collapse; width: 100%; margin-top: 0.4rem; }
.web-desc-preview td { border: 1px solid var(--border); padding: 0.32rem 0.55rem; }
.web-desc-preview td:first-child { font-weight: 600; width: 40%; }
.web-photo-grid { display: block; }
.web-photo-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.web-photo-strip { min-height: 46px; padding: 0.35rem; border: 1px dashed var(--border); border-radius: 8px; align-items: center; }
.web-photo { position: relative; border: 2px solid transparent; border-radius: 8px; padding: 2px; }
.web-photo--on { border-color: var(--gold); cursor: grab; }
.web-photo.dragging { opacity: 0.4; }
.web-photo__frame { position: relative; line-height: 0; }
/* Controls live below the image, never over it — ✕ deletes, so it must not
   share a tap target with "open this photo". */
.web-photo__bar { display: flex; gap: 2px; margin-top: 2px; }
.web-photo__act {
  flex: 1; min-height: 26px; border: 1px solid var(--border); background: var(--card);
  border-radius: 6px; cursor: pointer; font-size: 0.78rem; line-height: 1; color: var(--muted);
}
.web-photo__act:hover { background: var(--bg); color: var(--text); }
.web-photo__act--danger:hover { background: rgba(210, 75, 65, 0.1); color: var(--danger); border-color: var(--danger); }

/* Upload zone for the website gallery — photos are uploaded here directly
   rather than picked from the item's general photo pile. */
.web-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  margin-top: 0.5rem; padding: 1.1rem 1rem; cursor: pointer; text-align: center;
  border: 1.5px dashed var(--border); border-radius: 8px; background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}
.web-upload:hover, .web-upload--over { border-color: var(--gold); background: #fff; }
.web-upload__icon { font-size: 1.3rem; }
.web-upload__title { font-weight: 600; font-size: 0.9rem; }
.web-photo .file-thumb { width: 84px; height: 84px; cursor: zoom-in; }
.web-photo__main { position: absolute; top: 4px; left: 4px; z-index: 2; background: var(--gold); color: #fff; font-size: 0.62rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px; }

/* ---- Reports (admin-only) ---- */
.rpt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1.1rem; }
.rpt-stat__label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.rpt-stat__value { font-size: 1.5rem; font-weight: 700; margin-top: 0.12rem; }
.rpt-stats--pnl { margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); }
.rpt-list-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.1rem; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 0.87rem; }
.rpt-list-row:hover { background: var(--gold-soft, #f4ecdc); }
.rpt-list-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-list-row .amt { margin-left: auto; font-weight: 600; white-space: nowrap; color: var(--muted); }
.rpt-more { margin-top: 0.5rem; }
.rpt-unlinked-btn { background: none; border: none; padding: 0; font: inherit; color: var(--gold-dark, #a07d44); text-decoration: underline; cursor: pointer; }
.rpt-weeknav { display: inline-flex; gap: 2px; margin-left: 0.45rem; }
.rpt-weeknav .icon-btn[disabled] { opacity: 0.35; cursor: default; }
.rpt-modal-list { max-height: 62vh; overflow-y: auto; }
.rpt-flag { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 0.06rem 0.45rem; border-radius: 999px; white-space: nowrap; }
.rpt-flag--bad { background: #f8e1de; color: #b0463c; }
.rpt-flag--warn { background: #f7edd8; color: #9a7420; }

/* ---- Timeline likes + replies ---- */
.tl-footer { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.3rem; }
.tl-like, .tl-replybtn { background: none; border: none; padding: 0; cursor: pointer; font: inherit; font-size: 0.8rem; color: var(--muted); }
.tl-like--on { color: #c53030; }
.tl-like:hover, .tl-replybtn:hover { color: var(--gold-dark); }
.tl-replies { margin: 0.45rem 0 0 0.35rem; border-left: 2px solid var(--border); padding-left: 0.7rem; display: flex; flex-direction: column; gap: 0.5rem; }
.tl-reply__head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.tl-reply__body { font-size: 0.9rem; }
.tl-replybox { display: flex; gap: 0.45rem; margin-top: 0.4rem; align-items: flex-start; }
.tl-replybox textarea { flex: 1; }

/* ---- Invoice payments (Xero-style record-payment bar) ---- */
.payments-summary { display: flex; gap: 1.4rem; margin: 0.2rem 0 0.5rem; font-size: 0.9rem; color: var(--muted); }
.payments-summary b { color: var(--ink, #15161a); }
.payment-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.2rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; flex-wrap: wrap; }
.payment-row__amount { margin-left: auto; font-weight: 600; }
.payment-bar { display: grid; grid-template-columns: 140px minmax(140px, 1fr) 140px minmax(120px, 1fr) auto; gap: 0.55rem; align-items: end; margin-top: 0.75rem; }
.payment-bar label { display: flex; flex-direction: column; gap: 0.28rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.payment-bar input, .payment-bar select { width: 100%; }
.payment-bar .amount input { text-align: right; }
.payment-bar__btn { white-space: nowrap; }
@media (max-width: 700px) {
  .payment-bar { grid-template-columns: 1fr 1fr; }
  .payment-bar__btn { grid-column: 1 / -1; }
}

/* ============================================================
   Photo Studio — upload, review and publish product photos
   ============================================================ */
/* The studio is a full-screen overlay, so stop the page scrolling behind it. */
body.modal-open { overflow: hidden; }
.ps-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(20, 22, 26, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
}
.ps-panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: min(1180px, 100%); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.ps-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
}
.ps-title { margin: 0; font-size: 1.15rem; }
.ps-head__actions { display: flex; align-items: center; gap: 0.5rem; }
.ps-body { padding: 1.2rem 1.4rem; overflow-y: auto; flex: 1; }
.ps-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.4rem; border-top: 1px solid var(--border); background: var(--bg);
}
.ps-foot__actions { display: flex; gap: 0.5rem; }
.ps-warn-count { color: var(--amber); font-weight: 600; }
.ps-busy { color: var(--muted); }

/* Dropzone */
.ps-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
  padding: 2.4rem 1rem; margin-top: 1rem; cursor: pointer;
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  background: var(--bg); text-align: center; transition: border-color 0.15s, background 0.15s;
}
.ps-drop:hover, .ps-drop--over { border-color: var(--gold, #c9a227); background: #fff; }
.ps-drop__icon { font-size: 1.7rem; }
.ps-drop__title { font-weight: 600; }

/* Review grid */
.ps-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}
.ps-card {
  position: relative; display: flex; flex-direction: column; gap: 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.7rem; background: var(--card); cursor: grab;
}
.ps-card--warn { border-color: var(--amber); }
.ps-card--failed { border-color: var(--danger); }
.ps-card--dragging { opacity: 0.45; }
.ps-card--busy { align-items: center; justify-content: center; min-height: 190px; }
.ps-card__order {
  position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2;
  min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--text); color: #fff;
  font-size: 0.72rem; font-weight: 700;
}
.ps-card__hero, .ps-card__star {
  position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2;
  font-size: 0.68rem; font-weight: 700; border-radius: 999px; padding: 0.15rem 0.5rem;
}
.ps-card__hero { background: var(--gold, #c9a227); color: #fff; }
.ps-card__star { background: rgba(255,255,255,0.92); border: 1px solid var(--border); cursor: pointer; color: var(--muted); }
.ps-card__star:hover { color: var(--gold, #c9a227); }

.ps-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.ps-shot { margin: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.ps-shot img {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  background: var(--bg); border-radius: 8px; border: 1px solid var(--border);
}
.ps-shot figcaption { text-align: center; }

.ps-card__meta { display: flex; flex-direction: column; gap: 0.3rem; }
.ps-cat { width: 100%; font-size: 0.82rem; padding: 0.3rem 0.4rem; border-radius: 7px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
.ps-filename {
  display: block; font-size: 0.72rem; color: var(--muted);
  background: var(--bg); padding: 0.22rem 0.4rem; border-radius: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ps-flag { font-size: 0.74rem; padding: 0.22rem 0.45rem; border-radius: 6px; }
.ps-flag--warn { background: rgba(212, 152, 60, 0.14); color: #8a5f14; }
.ps-flag--info { background: var(--bg); color: var(--muted); }
.ps-card__tools { display: flex; gap: 0.15rem; justify-content: flex-end; margin-top: auto; }

.ps-card__spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--gold, #c9a227);
  animation: ps-spin 0.8s linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }

/* Manual cropper */
.ps-crop-overlay {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(20, 22, 26, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 1.25rem;
}
.ps-crop-panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1.1rem; max-width: min(760px, 100%); max-height: 92vh; overflow: auto;
}
.ps-crop-hint { margin: 0 0 0.7rem; color: var(--muted); font-size: 0.87rem; }
.ps-crop-stage { position: relative; display: inline-block; touch-action: none; cursor: crosshair; line-height: 0; }
.ps-crop-stage img { max-width: 100%; max-height: 64vh; border-radius: 8px; user-select: none; -webkit-user-drag: none; }
.ps-crop-box {
  position: absolute; border: 2px solid var(--gold, #c9a227);
  background: rgba(201, 162, 39, 0.14); pointer-events: none;
}
.ps-crop-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.9rem; }

@media (max-width: 640px) {
  .ps-overlay { padding: 0; }
  .ps-panel { max-height: 100vh; border-radius: 0; }
  .ps-grid { grid-template-columns: 1fr; }
  .ps-foot { flex-direction: column; align-items: stretch; }
  .ps-foot__actions { justify-content: stretch; }
  .ps-foot__actions .btn { flex: 1; }
}

/* "The website listing is behind the CRM" — a quiet badge instead of the
   confirm dialog that used to fire on every inventory save. */
.web-stale { color: var(--amber); font-weight: 600; }

/* ---- Cash admin dashboard --------------------------------------------- */
.cashd-accts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.cashd-acct { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.cashd-acct__name { font-weight: 700; }
.cashd-acct__bal { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.cashd-acct__bal.neg { color: var(--danger); }
.cashd-acct__meta { color: var(--muted); font-size: 0.78rem; margin-top: 6px; }
.cashd-total { background: var(--ink); color: #fff; border-color: var(--ink); }
.cashd-total .cashd-acct__bal { color: var(--gold); }
.cashd-total .cashd-acct__meta { color: #b9b8bd; }
.cashd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-bottom: 18px; }
.cashd-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow); }
.cashd-stat__label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.cashd-stat__value { font-size: 1.25rem; font-weight: 800; margin-top: 4px; letter-spacing: -0.01em; }
.cashd-stat__value.in { color: var(--green); }
.cashd-stat__value.out { color: var(--danger); }
.cashd-stat__sub { color: var(--muted); font-size: 0.74rem; margin-top: 3px; }
.cashd-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.cashd-filters input, .cashd-filters select { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font: inherit; background: var(--card); color: var(--text); }
.cashd-filters label { display: inline-flex; align-items: center; gap: 5px; }
.cashd-amt.in { color: var(--green); font-weight: 700; }
.cashd-amt.out { color: var(--danger); font-weight: 700; }
.cashd-row--voided td { opacity: 0.55; text-decoration: line-through; }
.cashd-row--voided td:last-child { text-decoration: none; }
/* Reconciliation */
.cashd-recon { border: 0; background: transparent; font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.cashd-recon--ok { color: var(--green); background: rgba(47,157,106,0.10); }
.cashd-recon--needs { color: var(--danger); background: rgba(210,75,65,0.12); }
.cashd-recon--na { color: var(--muted); }
.cashd-row--flag td { background: rgba(210,75,65,0.05); }
.cashd-row--flag td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.cashd-modal { position: fixed; inset: 0; background: rgba(20,22,26,0.5); display: grid; place-items: center; z-index: 60; padding: 16px; }
.cashd-modal__panel { background: var(--card); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 470px; max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.cashd-modal__panel h3 { margin: 0 0 2px; }
.cashd-modal__actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.cashd-rc-search { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font: inherit; margin: 8px 0 10px; }
.cashd-rc-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.cashd-rc-cand { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }
.cashd-rc-cand__label { min-width: 0; }
.cashd-rc-badge { display: inline-block; background: rgba(47,157,106,0.12); color: var(--green); font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.cashd-linked { color: var(--green); font-weight: 600; margin: 10px 0; }
/* Compact 2-line ledger list */
.cashd-list { display: flex; flex-direction: column; gap: 6px; }
.cashd-item { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; background: var(--card); cursor: pointer; }
.cashd-item:hover { border-color: #d9d5cd; background: var(--bg); }
.cashd-item__flag { flex: 0 0 22px; height: 22px; align-self: center; display: grid; place-items: center; font-weight: 800; border-radius: 6px; }
.cashd-item--ok .cashd-item__flag { color: var(--green); background: rgba(47,157,106,0.12); }
.cashd-item--needs .cashd-item__flag { color: var(--danger); background: rgba(210,75,65,0.14); }
.cashd-item--na .cashd-item__flag, .cashd-item--void .cashd-item__flag { color: var(--muted); }
.cashd-item--needs { border-color: rgba(210,75,65,0.35); }
.cashd-item--void { opacity: 0.55; }
.cashd-item__body { flex: 1; min-width: 0; }
.cashd-item__l1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.cashd-item__who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cashd-item__amt { font-weight: 700; white-space: nowrap; }
.cashd-item__amt.in { color: var(--green); }
.cashd-item__amt.out { color: var(--danger); }
.cashd-item--void .cashd-item__amt { text-decoration: line-through; }
.cashd-item__l2 { color: var(--muted); font-size: 0.82rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cashd-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 6px 0 4px; }
.cashd-dl div { display: contents; }
.cashd-dl dt { color: var(--muted); }
.cashd-dl dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
.cashd-recon-box { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.cashd-recon-title { font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.cashd-breakdown { margin: 6px 0 4px; line-height: 1.5; }
.cashd-bd-match { color: var(--green); font-weight: 700; }
.cashd-linked-actions { display: flex; gap: 8px; margin-top: 8px; }
.cashd-linked-actions .btn { flex: 1; }

/* ============================================================
   Messaging — WhatsApp (two-pane Inbox + the card on a customer record)
   ============================================================ */
.msg-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.msg-chip {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.82rem; cursor: pointer;
  font-family: inherit;
}
.msg-chip:hover { border-color: var(--gold); }
.msg-chip--on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Two-pane shell: conversation list | open conversation */
.inbox-wrap {
  display: grid; grid-template-columns: minmax(250px, 330px) 1fr;
  gap: 1rem; align-items: stretch;
}
.inbox-list {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-y: auto; max-height: 72vh;
}
.empty--inline { border: none; background: none; padding: 1.2rem 1rem; }

.inbox__row {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left;
  padding: 0.75rem 0.9rem; background: none; border: none; border-bottom: 1px solid #eceae6;
  cursor: pointer; font-family: inherit; font-size: 1rem; color: var(--text);
}
.inbox__row:last-child { border-bottom: none; }
.inbox__row:hover { background: var(--bg); }
.inbox__row[disabled] { cursor: default; opacity: 0.75; }
.inbox__row--unread { background: rgba(191, 154, 94, 0.07); }
.inbox__row--active { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.inbox__main { flex: 1; min-width: 0; display: block; }
.inbox__top { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.inbox__preview { display: block; margin-top: 0.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox__right { display: flex; align-items: center; gap: 0.45rem; flex-shrink: 0; }
.inbox__new {
  background: var(--green); color: #fff; border-radius: 999px;
  padding: 0.05rem 0.45rem; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em;
}
.inbox__closed { font-size: 0.8rem; opacity: 0.55; }

/* Open conversation */
.inbox-convo {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; height: 72vh; overflow: hidden;
}
.convo__head {
  display: flex; align-items: center; gap: 0.6rem;
  /* Wraps, so a narrow screen pushes the actions onto their own line instead of
     letting the name and the window status overlap each other. */
  flex-wrap: wrap; row-gap: 0.35rem;
  padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.convo__who { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.convo__who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo__who .muted {
  display: flex; align-items: center; gap: 0.3rem; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.convo__head-actions { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.convo__back { display: none; }
.convo__body {
  flex: 1; overflow-y: auto; padding: 0.9rem; background: var(--bg);
  display: flex; flex-direction: column; gap: 0.5rem;
}
.convo__day {
  align-self: center; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.1rem 0.65rem; font-size: 0.68rem; color: var(--muted);
  margin: 0.3rem 0 0.1rem;
}
.convo__foot { padding: 0.7rem 0.9rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.convo__empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.4rem; text-align: center; padding: 2rem 1rem;
}
.convo__empty-icon { font-size: 2rem; opacity: 0.5; }

/* Bubbles */
.msg { max-width: 76%; border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; }
.msg--in { align-self: flex-start; background: var(--card); border: 1px solid var(--border); }
.msg--out { align-self: flex-end; background: var(--gold-soft); border: 1px solid #e8dcc4; }
.msg__body { font-size: 0.92rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.msg__media { font-size: 0.85rem; color: var(--muted); font-style: italic; margin-top: 0.2rem; }
.msg__meta {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  margin-top: 0.3rem; font-size: 0.7rem; color: var(--muted);
}
.msg__tag {
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.02rem 0.4rem; font-size: 0.65rem; letter-spacing: 0.02em;
}
.msg__status { font-weight: 700; }
.msg__status--read { color: var(--gold-dark); }
.msg__status--bad { color: var(--danger); font-weight: 600; }

/* Composer */
.msg-composer { display: flex; gap: 0.5rem; align-items: flex-end; }
.msg-composer textarea {
  flex: 1; resize: vertical; min-height: 2.6rem; font-family: inherit; font-size: 0.92rem;
  padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text);
}
.msg-composer textarea:focus { outline: none; border-color: var(--gold); }
.msg-composer--closed {
  display: block; padding: 0.6rem 0.75rem;
  background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-sm);
}
.msg-composer--closed p { margin: 0; }
.msg-window--closed { color: var(--danger); font-weight: 600; }

/* The doorway card on a customer record */
.msg-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.8rem; }
.msg-card__body { font-size: 0.92rem; line-height: 1.4; margin-top: 0.2rem; white-space: pre-wrap; word-break: break-word; }
.msg-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.7rem; flex-wrap: wrap; }

/* Instagram/Messenger: "is this the same person?" suggestions + linked accounts */
.social-suggest { display: grid; gap: 0.4rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); background: var(--gold-soft); }
.social-suggest__row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; font-size: 0.9rem; }
.social-suggest__row--strong b { color: var(--green); }
.social-suggest__acts { display: flex; gap: 0.35rem; }
.modal .social-suggest { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.7rem; }
.social-linked { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; font-size: 0.92rem; }

/* Mobile: one pane at a time, like a phone messaging app */
@media (max-width: 860px) {
  .inbox-wrap { grid-template-columns: 1fr; }
  .inbox-list { max-height: none; }
  .inbox-wrap--open .inbox-list { display: none; }
  .inbox-wrap:not(.inbox-wrap--open) .inbox-convo { display: none; }
  .inbox-convo { height: 74vh; }
  .convo__back { display: inline-flex; }
  /* Own row, full width: back + avatar + name on top, window status and the
     profile button underneath, so neither can overlap or run off the edge. */
  .convo__head-actions {
    order: 3; flex-basis: 100%; margin-left: 0; flex-shrink: 1;
    gap: 0.4rem; justify-content: space-between;
  }
  .convo__head-actions .small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .msg { max-width: 88%; }
}

/* WhatsApp attachments in the thread */
.msg__thumb { margin-top: 0.3rem; cursor: zoom-in; font-size: 1.4rem; line-height: 1; }
.msg__thumb img { display: block; max-width: 220px; max-height: 260px; border-radius: 10px; }
.msg__file {
  margin-top: 0.3rem; display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem; font-family: inherit; font-size: 0.82rem; color: var(--text); cursor: pointer;
}
.msg__file:hover { border-color: var(--gold); }
.msg-full { display: block; max-width: 100%; border-radius: 12px; }

/* Sending a photo: attach button + the staged-photo chip */
.msg-composer__main { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.msg-composer__main textarea { width: 100%; }
.msg-attach { flex-shrink: 0; padding: 0.5rem 0.65rem; font-size: 1.05rem; line-height: 1; }
.msg-staged { display: flex; }
.msg-staged__chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--gold-soft); border: 1px solid #e8dcc4; border-radius: 999px;
  padding: 0.2rem 0.5rem 0.2rem 0.65rem; font-size: 0.78rem;
}
.msg-staged__x {
  background: none; border: none; cursor: pointer; font-size: 0.8rem; color: var(--muted);
  padding: 0 0.1rem; font-family: inherit;
}
.msg-staged__x:hover { color: var(--danger); }

/* Calls on the customer record (Vault Voice) */
.call-row { display: flex; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid #eceae6; }
.call-row:last-child { border-bottom: none; }
.call-row__icon { font-size: 1.05rem; line-height: 1.4; flex-shrink: 0; }
.call-row__main { flex: 1; min-width: 0; }
.call-row__top { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.call-badge {
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 0.02rem 0.45rem; font-size: 0.64rem; letter-spacing: 0.03em;
}
.call-summary {
  margin-top: 0.35rem; padding: 0.45rem 0.6rem; font-size: 0.88rem; line-height: 1.4;
  background: var(--gold-soft); border: 1px solid #e8dcc4; border-radius: var(--radius-sm);
}
.call-audio { margin-top: 0.4rem; }
.call-audio audio { width: 100%; max-width: 22rem; height: 2rem; display: block; }
.call-transcript { margin-top: 0.35rem; }
.call-transcript summary { cursor: pointer; }
.call-transcript p { margin: 0.3rem 0 0; white-space: pre-wrap; }

/* The Calls page */
.call-page-row {
  display: flex; align-items: flex-start; gap: 0.7rem;
  padding: 0.75rem 0.9rem; border-bottom: 1px solid #eceae6;
}
.call-page-row:last-child { border-bottom: none; }
.call-page-row:hover { background: var(--bg); }
.call-page-row--unmatched { background: rgba(47, 157, 106, 0.06); }
.call-page-row__actions { flex-shrink: 0; display: flex; align-items: center; }

/* Phone settings modal (Calls page) */
.cs-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; flex-wrap: wrap; }
.cs-row input[type="text"], .cs-row input[type="tel"] { flex: 1 1 8rem; min-width: 0; }
.cs-row input[type="number"] { width: 4rem; flex: 0 0 auto; }
.cs-row input[type="time"], .cs-row input[type="date"] { flex: 0 0 auto; }
.cs-day { flex: 0 0 6.5rem; font-size: 0.9rem; }
.cs-on { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.85rem; flex: 0 0 auto; white-space: nowrap; }
.cs-on input { margin: 0; }
.cs-remove { margin-left: auto; }
@media (max-width: 600px) {
  .cs-day { flex-basis: 100%; font-weight: 600; }
  .cs-row { border-bottom: 1px solid #eceae6; }
}
.cs-row--off { opacity: 0.55; }
.cs-row--off .cs-day { text-decoration: line-through; }

/* Choosing which channel a reply goes out on */
.msg-chan { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.msg-chan__pill {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 0.2rem 0.65rem; font-size: 0.78rem; cursor: pointer; font-family: inherit;
}
.msg-chan__pill:hover:not([disabled]) { border-color: var(--gold); }
.msg-chan__pill--on { background: var(--ink); color: #fff; border-color: var(--ink); }
.msg-chan__pill[disabled] { opacity: 0.45; cursor: not-allowed; }
.msg-chan__note { flex: 1 1 14rem; min-width: 0; line-height: 1.3; }

/* WhatsApp template picker */
.msg-chan__pill--template { border-style: dashed; }
.tpl-preview {
  background: var(--gold-soft); border: 1px solid #e8dcc4; border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem; font-size: 0.92rem; line-height: 1.45; margin-top: 0.3rem;
  white-space: pre-wrap; word-break: break-word;
}

/* Call settings: the behaviour flags read better stacked than in a grid row. */
.cs-flag { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.45rem 0; }
.cs-flag input { margin-top: 0.2rem; flex: none; }
.cs-prompt { display: block; margin-top: 0.6rem; }
.cs-prompt textarea { width: 100%; margin-top: 0.25rem; }

/* Screen pop: the non-destructive path, shown when a form is mid-edit. Fixed to
   the bottom so it never covers a toolbar or the field being typed into, and
   above the mobile tab bar. z-index sits under the lightbox and modals. */
.pop-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 1.1rem; z-index: 300;
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.9rem; border-radius: 999px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  max-width: calc(100vw - 1.5rem);
}
.pop-banner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .pop-banner { bottom: 4.8rem; font-size: 0.9rem; } }

/* An AI summary must be visibly distinct from the transcript: one is generated,
   the other is what the customer actually said. */
.call-summary__tag {
  display: block; margin-bottom: 0.2rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--gold-dark);
}

/* Call notes: whose job it is, and what happened. Quiet by default — the point
   is a visible owner, not a loud alert. */
.call-notes { margin-top: 0.45rem; border-top: 1px dashed var(--border); padding-top: 0.4rem; }
.call-note { font-size: 0.85rem; line-height: 1.35; margin-bottom: 0.3rem; }
.call-notes__row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.call-note-input { flex: 1 1 12rem; min-width: 0; font-size: 0.85rem; padding: 0.3rem 0.45rem; }
.call-handled { display: block; margin-top: 0.3rem; font-size: 0.78rem; color: var(--green); font-weight: 600; }
.call-badge--todo { background: #fdecea; border-color: #f3c6c1; color: var(--danger); font-weight: 700; }
