/* Easy Tips
   A plain, dense product UI: Heebo throughout, neutral greys, one green for
   money, 8px corners, borders rather than shadows. Phones get a single column
   with a bottom tab bar; computers get a sidebar and full-width content. */

@font-face {
  font-family: "Heebo"; font-weight: 100 900; font-display: swap;
  src: url("fonts/heebo-hebrew.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Heebo"; font-weight: 100 900; font-display: swap;
  src: url("fonts/heebo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --subtle: #f1f1f3;
  --hover: #ececef;
  --border: #e3e3e8;
  --border-strong: #cfcfd6;
  --text: #17171c;
  --text-2: #4b4b55;
  --muted: #74747f;
  --primary: #17171c;
  --on-primary: #ffffff;
  --money: #0f7a4d;
  --money-bg: #e7f5ee;
  --owed: #b45309;
  --owed-bg: #fdf3e4;
  --focus: #2f6fdf;
  --danger: #c4312b;
  --danger-bg: #fdecea;
  --radius: 10px;
  --radius-sm: 8px;
  --font: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #18181b;
    --subtle: #202024;
    --hover: #26262b;
    --border: #2a2a30;
    --border-strong: #3a3a42;
    --text: #f2f2f4;
    --text-2: #c4c4cc;
    --muted: #8d8d98;
    --primary: #f2f2f4;
    --on-primary: #111113;
    --money: #4cc38a;
    --money-bg: #13291f;
    --owed: #f0a65a;
    --owed-bg: #33240f;
    --focus: #6b9bff;
    --danger: #ff7b72;
    --danger-bg: #3a1a18;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* The page colour behind everything, so Android colours its bottom bar to match in dark mode too. */
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
svg { flex: none; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money { color: var(--money); font-weight: 600; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- app shell ---------- */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.main { padding: 0 0 calc(env(safe-area-inset-bottom) + 84px); min-width: 0; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 6px 0 calc(env(safe-area-inset-bottom) + 6px);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 4px 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--text); }

/* page header */
.pagebar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.pagebar h1 { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pagebar .actions { display: flex; gap: 8px; }
.crumbs { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.crumbs a { color: var(--muted); font-weight: 500; white-space: nowrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--border-strong); }
.crumbs h1 { flex: 1; }

.content { padding: 16px; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .tabbar { display: none; }
  .main { padding-bottom: 48px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 24px;
    position: sticky; top: 0; height: 100dvh;
    padding: 20px 14px;
    background: var(--surface); border-inline-end: 1px solid var(--border);
  }
  .pagebar { min-height: 68px; padding: 12px 32px; background: var(--bg); backdrop-filter: none; }
  .pagebar h1 { font-size: 22px; }
  .content { padding: 28px 32px; }
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; direction: ltr; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 15px;
}
.side-nav a:hover { background: var(--hover); }
.side-nav a[aria-current="page"] { background: var(--subtle); color: var(--text); font-weight: 600; }
.side-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--subtle); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary); opacity: .88; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { border-color: transparent; background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-wide { width: 100%; height: 46px; }
.btn-icon { width: 40px; padding: 0; }
@media (min-width: 1024px) { .btn { height: 36px; font-size: 14px; } .btn-icon { width: 36px; } .btn-wide { height: 42px; } }
@media (max-width: 1023px) { .hide-mobile { display: none !important; } }
@media (min-width: 1024px) { .hide-desktop { display: none !important; } }

.input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); outline: none;
  font-size: 16px;
}
.input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
.input::placeholder { color: var(--muted); }
@media (min-width: 1024px) { .input { height: 38px; font-size: 15px; } }

.field { display: grid; gap: 6px; min-width: 0; }
.field > * { min-width: 0; }
input[type="date"].input { min-width: 0; -webkit-appearance: none; appearance: none; text-align: start; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }

.search { position: relative; }
.search svg { position: absolute; inset-inline-start: 11px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search .input { padding-inline-start: 36px; }

.seg { display: inline-flex; padding: 2px; border-radius: var(--radius-sm); background: var(--subtle); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 5px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); direction: ltr; }
.stepper button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--text-2); font-size: 18px; line-height: 1; }
.stepper button:hover { background: var(--subtle); }
.stepper input { width: 44px; height: 34px; border: 0; border-inline: 1px solid var(--border); text-align: center; outline: none; background: transparent; font-weight: 600; font-variant-numeric: tabular-nums; }

.amount-input { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.amount-input:focus-within { border-color: var(--focus); }
.amount-input input { width: 84px; border: 0; outline: none; background: transparent; font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-input span { color: var(--muted); font-size: 14px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; }
.card-head .count { color: var(--muted); font-weight: 500; font-size: 14px; }
.card-body { padding: 16px; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.kpi-extra { display: none; }
@media (min-width: 1024px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
  .kpi { padding: 16px 20px; }
  .kpi .value { font-size: 26px; }
  .kpi-extra { display: block; }
}

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.toolbar .search { flex: 1; max-width: 360px; }

/* ---------- tables (computers) / lists (phones) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: start; font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--subtle); white-space: nowrap;
}
.table th:first-child { border-start-start-radius: var(--radius); }
.table th:last-child { border-start-end-radius: var(--radius); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .end { text-align: end; }
.table .shrink { width: 1%; white-space: nowrap; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--subtle); }
.table .chev { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 14px; color: var(--muted); }
a.row:active { background: var(--subtle); }

.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--subtle); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 700;
}
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; }

.empty { padding: 48px 24px; text-align: center; }
.empty h3 { margin: 0 0 4px; font-size: 17px; }
.empty p { margin: 0 auto 16px; color: var(--muted); max-width: 40ch; }

/* ---------- event page ---------- */
.event-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.details { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.summary .total-input {
  display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
.summary .total-input:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
.summary .total-input input { flex: 1; width: 100%; min-width: 0; border: 0; outline: none; background: transparent; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary .total-input span { font-size: 22px; font-weight: 600; color: var(--muted); }
.summary dl { margin: 16px 0 0; display: grid; gap: 10px; }
.summary dl div { display: flex; justify-content: space-between; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--subtle); overflow: hidden; margin-top: 14px; }
.meter i { display: block; height: 100%; background: var(--money); transition: width .2s ease; }
.alert { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); font-size: 14px; font-weight: 600; }
.summary .btn-wide { margin-top: 16px; }

.crew { list-style: none; margin: 0; padding: 0; }
.crew-row {
  display: grid; align-items: center; column-gap: 10px; row-gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "name name pay" "mode value value" "paid paid remove";
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.crew-row:last-child { border-bottom: 0; }
.c-name { grid-area: name; }
.c-mode { grid-area: mode; }
.c-value { grid-area: value; justify-self: end; }
.c-pay { grid-area: pay; font-size: 17px; }
.c-remove { grid-area: remove; justify-self: end; margin-inline-end: -8px; }
.c-paid { grid-area: paid; justify-self: start; }
.c-value { justify-self: end; }
.seg button { white-space: nowrap; }
.crew-row.is-paid .c-mode, .crew-row.is-paid .c-value { opacity: .45; }
.crew-row.is-paid .c-pay { color: var(--money); }
.crew-head { display: none; }
.mobile-delete { margin-top: 16px; text-align: center; }

@media (min-width: 1024px) {
  .event-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas: "details summary" "crew summary";
    grid-template-rows: auto 1fr;
    gap: 24px; align-items: start;
  }
  .event-details { grid-area: details; }
  .event-crew { grid-area: crew; }
  .summary { grid-area: summary; position: sticky; top: 92px; }
  .details { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }

  .crew-head, .crew-row {
    display: grid; align-items: center; column-gap: 16px;
    grid-template-columns: minmax(150px, 1fr) 186px 148px 96px 118px 36px;
    grid-template-areas: "name mode value pay paid remove";
    padding: 10px 16px;
  }
  .crew-head { background: var(--subtle); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted); }
  .crew-head .end, .c-pay { text-align: end; }
  .c-pay { font-size: 16px; }
  .c-paid { justify-self: start; }
  .c-value { justify-self: start; }
  .c-remove { margin: 0; }
}
@media (min-width: 1600px) {
  .event-layout { grid-template-columns: minmax(0, 1fr) 380px; }
}

/* ---------- waiters page ---------- */
.add-form { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; justify-content: start; margin-bottom: 16px; }
@media (max-width: 1023px) { .add-form { justify-content: stretch; } }
.waiter-row {
  display: grid; align-items: center; column-gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name del" "phone del" "count del";
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.waiter-row:last-child { border-bottom: 0; }
.w-name { grid-area: name; }
.w-phone { grid-area: phone; padding-inline-start: 42px; }
.w-count { grid-area: count; padding-inline-start: 42px; font-size: 13px; }
.w-last { display: none; }
.w-del { grid-area: del; }
.waiter-head { display: none; }
.add-form .phone { display: none; }
@media (min-width: 1024px) {
  .add-form { grid-template-columns: minmax(0, 260px) minmax(0, 200px) auto; }
  .add-form .phone { display: block; }
  .waiter-head, .waiter-row {
    display: grid; align-items: center; column-gap: 16px;
    grid-template-columns: minmax(200px, 1.4fr) minmax(160px, 1fr) 140px 160px 36px;
    grid-template-areas: "name phone count last del";
    padding: 8px 16px;
  }
  .waiter-head { padding: 10px 16px; background: var(--subtle); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
  .w-phone, .w-count { padding: 0; font-size: 15px; }
  .w-last { display: block; grid-area: last; }
}
.inline-edit {
  width: 100%; height: 34px; padding: 0 8px; margin-inline-start: -9px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; outline: none; font-size: 15px;
}
.inline-edit:hover { border-color: var(--border); }
.inline-edit:focus { border-color: var(--focus); background: var(--surface); }
.inline-edit.strong { font-weight: 600; }

/* ---------- dialog ---------- */
.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--text);
  width: 100%; max-width: 100%; height: auto; max-height: calc(100% - 40px);
  inset: auto 0 0 0; margin: 0; border-radius: 14px 14px 0 0;
  display: none; flex-direction: column;
}
.sheet[open] { display: flex; animation: up .22s ease-out; }
.sheet::backdrop { background: rgb(0 0 0 / .4); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 640px) {
  .sheet { inset: 0; max-width: 560px; height: fit-content; margin: auto; border-radius: 14px; border: 1px solid var(--border); max-height: min(720px, calc(100% - 80px)); }
}
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 700; }
.sheet-tools { display: grid; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sheet-body { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.sheet > :not(.sheet-body) { flex: none; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); border-top: 1px solid var(--border); }
.sheet-foot .btn-primary { flex: 1; }
.section-label { padding: 12px 16px 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; }
.pick:hover { background: var(--subtle); }
.pick input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.pick .name { flex: 1; font-weight: 500; }
.pick.disabled { opacity: .5; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; color: var(--focus); font-weight: 600; font-size: 14px; justify-self: start; }
.new-waiter { display: grid; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.new-waiter form { display: flex; gap: 8px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.check-label input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; inset-inline: 0; bottom: calc(env(safe-area-inset-bottom) + 80px); margin: 0 auto; width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary);
  font-size: 14px; font-weight: 600; z-index: 50; animation: up .2s ease-out;
}
@media (min-width: 1024px) { .toast { bottom: 24px; } }

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

/* phone list rows: one divider between items */
.rows > li > .row { border-bottom: 0; }
.rows > li + li { border-top: 1px solid var(--border); }

/* ---------- debts ---------- */
.owed { color: var(--owed); font-weight: 700; }
.kpi .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpi .kpi-total { display: block; margin-top: 6px; color: var(--text-2); text-decoration: none; }
.kpi .kpi-total:hover { text-decoration: underline; }
a.kpi-link { display: block; }
a.kpi-link:hover { border-color: var(--border-strong); }
a.kpi-link .value { color: var(--owed); }
.tag-paid { display: inline-flex; align-items: center; gap: 4px; background: var(--money-bg); color: var(--money); }
.tag-paid svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.summary dl .strong dt { color: var(--text); font-weight: 600; }
.summary dl .strong dd { color: var(--owed); font-size: 17px; }
.alert-info { background: var(--subtle); color: var(--text-2); font-weight: 500; }
.summary .btn-wide + .btn-wide { margin-top: 8px; }

.paid-toggle {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; white-space: nowrap;
  border-radius: 999px; border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600;
}
.paid-toggle:hover { border-style: solid; background: var(--subtle); }
.paid-toggle[aria-pressed="true"] { border: 1px solid transparent; background: var(--money-bg); color: var(--money); }
.paid-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-sm svg { width: 15px; height: 15px; }
@media (min-width: 1024px) { .btn-sm { height: 30px; } }

.search-lg { display: block; margin-bottom: 16px; }
.search-lg .input { height: 50px; font-size: 17px; padding-inline-start: 42px; }
.search-lg svg { width: 20px; height: 20px; inset-inline-start: 14px; }
@media (min-width: 1024px) { .search-lg { max-width: 560px; } .search-lg .input { height: 46px; font-size: 16px; } }

.rows .row .btn-sm { flex: none; }
.rows a.row-title { display: block; }

.person-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.person-main { display: grid; gap: 16px; align-content: start; }
.balance { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; }
.balance .label { font-size: 15px; color: var(--text-2); font-weight: 600; }
.balance .value { font-size: 36px; font-weight: 800; line-height: 1.15; margin-top: 2px; }
.balance .sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
@media (max-width: 1023px) { .balance .btn { width: 100%; height: 46px; } }
.details-form { display: grid; gap: 12px; }
.details-form .btn-danger { justify-self: start; }
.new-form { display: grid; gap: 12px; }
@media (min-width: 1024px) {
  .person-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
  .person-side { position: sticky; top: 92px; }
  .balance { padding: 24px 28px; }
  .balance .value { font-size: 44px; }
}

/* Excel import */
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.link-icon { display: inline-flex; align-items: center; gap: 6px; }
.link-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.import-file { display: flex; align-items: center; gap: 12px; }
.file-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-sm); background: var(--money-bg); color: var(--money); }
.file-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; padding: 7px 8px; font-size: 14px; }
.import-fields { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 150px); }
.sheet-tools .hint { margin: 0; }
.pick .name small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.pick .num { font-weight: 600; }
.pick-all { border-bottom: 1px solid var(--border); }
.pick-all .name { font-weight: 600; color: var(--text-2); }
.tag-new { background: var(--money-bg); color: var(--money); }
.excel-row { display: flex; gap: 8px; }

/* ---------- sign-in ---------- */
body.signed-out .app, body.signed-out .tabbar { display: none; }
.auth {
  min-height: 100dvh; display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 28px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.auth-brand { padding: 0; margin-bottom: 24px; }
.auth h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.auth-sub { margin: 4px 0 20px; color: var(--muted); font-size: 15px; }
.auth-form { display: grid; gap: 14px; }
.auth-form .btn-wide { margin-top: 4px; }
.auth-form-gap { margin-top: 20px; }
.field small { font-size: 13px; }
.auth-error {
  margin: 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--danger-bg); color: var(--danger); font-size: 14px; font-weight: 500;
}
.auth-notice {
  margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--owed-bg); color: var(--owed); font-size: 14px; font-weight: 500;
}
.auth-switch { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; font-size: 15px; color: var(--text-2); }
.auth-foot { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 1024px) { .auth-card { padding: 36px 32px; } }

/* ---------- account ---------- */
.side-account {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.side-account:hover, .side-account[aria-current="page"] { background: var(--subtle); }
.side-account-text { display: grid; min-width: 0; }
.side-account-text b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-line { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sync-line::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.sync-line[data-status="ok"]::before { background: var(--money); }
.sync-line[data-status="offline"]::before, .sync-line[data-status="error"]::before { background: var(--owed); }

.account { display: grid; gap: 16px; max-width: 720px; grid-template-columns: minmax(0, 1fr); }
.account-who { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.account-who p { margin: 0; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.account-id { display: grid; flex: 1; min-width: 0; }
.account-id span { color: var(--muted); font-size: 14px; text-align: right; }
.account-sync { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-basis: 100%; }
@media (min-width: 640px) { .account-sync { flex-basis: auto; } }
.account-sync .sync-line { font-size: 14px; }
.account-form { display: grid; gap: 14px; max-width: 420px; }
.account-note { margin: 0 0 14px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* colleagues */
.members-intro { border-bottom: 1px solid var(--border); }
.member-add { display: flex; gap: 8px; max-width: 520px; }
.member-add .input { flex: 1; min-width: 0; }
.member-add .btn { flex: none; }
.members-intro .auth-error { margin-top: 10px; max-width: 520px; }
.members .row-sub { display: flex; flex-wrap: wrap; gap: 0 4px; }
.members .row-title[dir="ltr"] { text-align: right; }
.members .row-sub [dir="ltr"] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-state { color: var(--muted); }
.member-state[data-state="joined"] { color: var(--money); font-weight: 600; }
.member-actions { display: flex; flex: none; gap: 4px; }
.members-empty { justify-content: center; padding: 20px 16px; }
@media (max-width: 639px) {
  .members .row { flex-wrap: wrap; row-gap: 10px; }
  .member-actions { flex-basis: 100%; padding-inline-start: 48px; }
}
.temp-password {
  padding: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--subtle);
  font-size: 24px; font-weight: 700; letter-spacing: 0.08em; text-align: center; font-variant-numeric: tabular-nums;
}
.invite-text {
  margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--subtle); color: var(--text-2);
  font: inherit; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ---------- debts added by hand ---------- */
.item-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-title > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-btn { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.text-btn:hover b, .table a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.tag-manual { flex: none; font-size: 11px; padding: 0 7px; }
.debt-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.money-input {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
.money-input:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
.money-input input { flex: 1; width: 100%; min-width: 0; border: 0; outline: none; background: transparent; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-input .unit { font-size: 18px; font-weight: 600; color: var(--muted); }
.debt-grid input[type="date"].input { height: 52px; }
.new-form .hint[data-ref="error"] { color: var(--danger); margin: 0; }
.version-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- part payments ---------- */
.c-pay small, .part-note { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.table td .part-note { margin-top: 2px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.pay-sum { margin: 0; display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--subtle); }
.pay-sum div { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.pay-sum dt { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-sum dd { margin: 0; font-weight: 600; }
.pay-sum .strong dt { color: var(--text); font-weight: 600; }
.pay-sum .strong dd { font-size: 17px; }
.parts { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.parts li { display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 0; padding-inline-start: 12px; border-bottom: 1px solid var(--border); }
.parts li:last-child { border-bottom: 0; }
.parts li .muted { flex: 1; }

/* ---------- Sign in with Google ---------- */
.auth-google { display: grid; gap: 12px; margin-bottom: 16px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
/* Google draws its button in a frame whose page is light. In dark mode a frame
   whose colour scheme differs from its page gets an opaque white backdrop, so
   give the frame the same (light) scheme and it stays see-through. */
.google-btn, .google-btn iframe { color-scheme: light; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- the site owner: every account ---------- */
.all-note { margin: 0 0 16px; max-width: 760px; }
.account-cell { display: grid; min-width: 0; }
.account-cell span { color: var(--muted); font-size: 14px; text-align: right; }
.account-cell b + span { font-size: 13px; }
.tag-off { background: var(--danger-bg); color: var(--danger); }
.small { font-size: 12px; }
.all-row .row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; white-space: normal; }
.all-row .row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.all-row .btn { flex: none; }
.btn svg { flex: none; }

.viewing-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--owed-bg); color: var(--owed); border-bottom: 1px solid color-mix(in srgb, var(--owed) 25%, transparent);
  font-size: 14px; font-weight: 500;
}
.viewing-bar b { font-weight: 700; }
.viewing-text { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.viewing-text svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.viewing .viewing-bar + .pagebar { padding-top: 8px; }
body.viewing .pagebar { top: 0; box-shadow: inset 0 3px 0 var(--owed); }
.practice-bar { background: var(--subtle); color: var(--text-2); border-bottom-color: var(--border); }
body.practice .pagebar { box-shadow: inset 0 3px 0 var(--border-strong); }
@media (min-width: 1024px) { .viewing-bar { padding: 10px 24px; } }

/* owner: managing people */
.all-actions { display: flex; gap: 6px; justify-content: flex-end; flex: none; }
.tag-wait { background: var(--owed-bg); color: var(--owed); }
.choice { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.choice legend { margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.choice label {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.choice label:has(input:checked) { border-color: var(--text); background: var(--subtle); }
.choice input { margin: 3px 0 0; accent-color: var(--text); }
.choice span, .manage-row > div { display: grid; gap: 2px; min-width: 0; }
.choice small, .manage-row small { color: var(--muted); font-size: 13px; }
.manage { display: grid; gap: 0; padding-top: 4px; }
.manage-who { margin: 0 0 8px; font-size: 14px; }
.manage-note { margin: 4px 0 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--subtle); color: var(--text-2); font-size: 14px; }
.manage-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.manage-row .btn { flex: none; }
.manage-danger b { color: var(--danger); }
@media (max-width: 639px) {
  .all-row { flex-wrap: wrap; row-gap: 10px; }
  .all-row .all-actions { flex-basis: 100%; justify-content: flex-start; padding-inline-start: 48px; }
}

/* ---------- undo in the toast ---------- */
.toast.has-undo { display: flex; align-items: center; gap: 14px; padding-inline-end: 8px; }
.toast-undo {
  border: 0; border-radius: 6px; padding: 4px 10px; margin: -2px 0;
  background: color-mix(in srgb, var(--on-primary) 16%, transparent); color: var(--on-primary);
  font-size: 14px; font-weight: 700;
}
.toast-undo:hover { background: color-mix(in srgb, var(--on-primary) 26%, transparent); }

/* ---------- deleted, can be brought back ---------- */
.trash .row { gap: 12px; }
.trash .row-title .tag { margin-inline-start: 6px; vertical-align: 1px; }
.trash-more { padding-top: 12px; border-top: 1px solid var(--border); }

/* ---------- monthly summary ---------- */
.month-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.month-nav h2 { margin: 0; min-width: 9.5em; text-align: center; font-size: 18px; font-weight: 700; }
.month-nav .btn-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* the chevron points to the next month (left, in Hebrew); the previous month points the other way */
.month-nav .month-prev svg { transform: scaleX(-1); }
.month-nav .month-now { margin-inline-start: 8px; }
.summary-grid { display: grid; gap: 16px; margin-top: 16px; }
.summary-grid > .card { min-width: 0; }
.table.months tr.is-current td { background: var(--subtle); }
.months-sub { display: block; font-size: 12px; }
@media (max-width: 1023px) {
  .table.months td, .table.months th { padding: 10px 12px; font-size: 14px; }
}
@media (min-width: 1024px) {
  .month-nav { margin-bottom: 20px; }
  .month-nav h2 { font-size: 20px; }
  .summary-grid { margin-top: 24px; gap: 24px; }
}
@media (min-width: 1400px) {
  .summary-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
}
.table.months td:first-child b { white-space: nowrap; }

/* add to home screen */
.install-hero { display: flex; align-items: center; gap: 12px; }
.install-hero img { border-radius: 13px; border: 1px solid var(--border); }
.install-hero b { display: block; font-size: 16px; }
.install-hero small { color: var(--muted); }
.install-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.install-steps li { counter-increment: step; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; line-height: 1.5; }
.install-steps li::before { content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--subtle); border: 1px solid var(--border); margin-inline-end: 4px; }
.install-key { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 7px; }
.install-key svg, [data-action="install"] svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
