:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1e3a8a;
  --brand-2: #2546a8;
  --owed: #dc2626;
  --owed-bg: #fef2f2;
  --paid: #15803d;
  --paid-bg: #f0fdf4;
  --wa: #25d366;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 96px; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--brand); color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
}
.bar-in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.bar h1 { font-size: 18px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar small { display: block; font-weight: 400; opacity: .8; font-size: 13px; }
.icon-btn {
  background: rgba(255,255,255,.12); border: 0; color: #fff;
  width: 40px; height: 40px; border-radius: 12px; font-size: 18px;
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { background: rgba(255,255,255,.22); }

/* summary */
.hero { background: var(--brand); color: #fff; padding: 0 16px 22px; border-radius: 0 0 22px 22px; }
.hero-in { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius); padding: 12px 14px; }
.stat span { font-size: 12.5px; opacity: .85; }
.stat b { display: block; font-size: 22px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.big { grid-column: 1 / -1; }
.stat.big b { font-size: 30px; }
.stat.owed { background: rgba(220,38,38,.25); border-color: rgba(252,165,165,.6); }

/* search + list */
.search {
  width: 100%; margin: 16px 0 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.search:focus, .field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--brand-2); outline-offset: 0; border-color: transparent;
}
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--line); text-align: start;
}
.row:first-child { border-top: 0; }
.row:hover { background: #f8fafc; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700;
  background: #e0e7ff; color: var(--brand);
}
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { color: var(--muted); font-size: 12.5px; }
.amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.owed { color: var(--owed); }
.amt.paid { color: var(--paid); }
.amt.zero { color: var(--muted); font-weight: 600; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* buttons */
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.job { background: #ea580c; }
.btn.pay { background: var(--paid); }
.btn.wa { background: var(--wa); color: #06361a; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid #c7d2fe; }
.btn.danger { background: transparent; color: var(--owed); border: 1px solid #fecaca; }
.btn.block { width: 100%; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 10px; }
.actions .btn { padding: 14px 10px; font-size: 16px; }
.fab {
  position: fixed; right: max(16px, calc(50% - 364px)); bottom: calc(env(safe-area-inset-bottom) + 18px);
  box-shadow: 0 8px 24px rgba(30,58,138,.35); border-radius: 16px; padding: 14px 20px; z-index: 6;
}

/* timeline of a client */
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 18px 2px 8px; color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.entry .avatar { border-radius: 12px; font-size: 18px; }
.entry.job .avatar { background: #ffedd5; }
.entry.pay .avatar { background: var(--paid-bg); }
.bal { display: block; color: var(--muted); font-size: 12px; font-weight: 500; text-align: end; }
.note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-size: 14px; white-space: pre-wrap; }

/* modal */
.shade {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(env(safe-area-inset-bottom) + 16px);
}
@media (min-width: 600px) {
  .shade { align-items: center; }
  .sheet { border-radius: 20px; }
}
.sheet h2 { margin: 0 0 14px; font-size: 18px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input.money { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.sheet-btns .btn { flex: 1 1 140px; }
.slip {
  background: #e7fbe9; border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px;
  white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.5; margin: 0 0 12px; overflow-wrap: anywhere;
}
.err { color: var(--owed); font-size: 14px; min-height: 20px; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .card { background: var(--card); border-radius: 18px; padding: 22px; border: 1px solid var(--line); }
.login h1 { text-align: center; margin: 12px 0 18px; font-size: 22px; }
.login img { display: block; margin: 0 auto; width: 56px; height: 56px; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: .2s; z-index: 30; max-width: calc(100% - 32px); text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; border: 1px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 9px 6px; font-weight: 600; }
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* (no inline styles: the page's security policy blocks them) */
.offscreen { position: fixed; left: -9999px; opacity: 0; }
.seg.tabs { margin-bottom: 16px; }
.hint.center { text-align: center; margin-top: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 8px; }
.check input { width: 20px; height: 20px; margin: 0; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.link { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 10px 0 0; display: block; margin: 0 auto; }
.link:hover { text-decoration: underline; }
.hidden { display: none; }
.field input.code { font-size: 26px; letter-spacing: .35em; text-align: center; font-weight: 800; }

/* bottom tabs */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-in { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; }
.tabbar button {
  background: none; border: 0; padding: 8px 0 10px; color: var(--muted); font-weight: 700; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar button .ti { font-size: 20px; filter: grayscale(1); opacity: .7; }
.tabbar button.on { color: var(--brand); }
.tabbar button.on .ti { filter: none; opacity: 1; }
.wrap { padding-bottom: 170px; }
.fab { display: none; }
.fabs {
  position: fixed; right: max(16px, calc(50% - 364px)); bottom: calc(env(safe-area-inset-bottom) + 76px);
  display: flex; gap: 10px; z-index: 6;
}
.fabs .btn { box-shadow: 0 8px 24px rgba(15,23,42,.25); border-radius: 16px; padding: 14px 18px; }
.day { padding: 10px 14px 6px; font-size: 12.5px; font-weight: 800; color: var(--muted); background: #f8fafc; border-top: 1px solid var(--line); }
.list .day:first-child { border-top: 0; }
.seg.chips { margin: 0 0 10px; }
.seg.chips button { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; }
.tools { display: flex; gap: 10px; align-items: center; margin: 16px 0 10px; }
.tools .search { margin: 0; flex: 1; }
.tools .btn { flex: none; padding: 11px 14px; }
.list.pick { max-height: 52vh; overflow: auto; margin-top: 8px; }
.list.pick .row.new b { color: var(--brand); }
.check-row { cursor: pointer; }
.check-row input { width: 20px; height: 20px; flex: none; margin: 0; }
.btn.block + .btn.block, .btn.block + .hint + .btn.block { margin-top: 10px; }
.note a { color: var(--brand); font-weight: 700; }

.btn.block.chat { margin-top: 10px; }
.field input.cc { max-width: 120px; }

.slip.key { font-family: ui-monospace, Consolas, monospace; user-select: all; text-align: center; }

/* country flags also on Windows (Twemoji Country Flags, CC-BY 4.0 Twitter / TalkJS) */
@font-face {
  font-family: "Twemoji Country Flags";
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  src: url("flags.woff2") format("woff2");
  font-display: swap;
}
body, button, input, select, textarea { font-family: "Twemoji Country Flags", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.fabs { display: none; }
.plus {
  position: fixed; right: max(16px, calc(50% - 364px)); bottom: calc(env(safe-area-inset-bottom) + 80px); z-index: 6;
  width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--brand); color: #fff;
  font-size: 30px; line-height: 1; box-shadow: 0 8px 22px rgba(30,58,138,.4);
}
.plus:hover { filter: brightness(1.1); }
.menu .btn { margin-bottom: 10px; font-size: 16px; padding: 14px; }
.sum-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 16px 0 6px; }
.sum-card .seg.chips { margin-bottom: 8px; }
.sum-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14.5px; }
.sum-line b { font-variant-numeric: tabular-nums; }
.sum-line b.paid { color: var(--paid); }
.sum-line b.owed { color: var(--owed); }
.sum-line.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; font-size: 16px; }
.sum-card .hint { margin: 6px 0 0; }
.cur-bal { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #f1f5f9; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.cur-bal b { font-size: 17px; }
.cur-bal.owed { background: var(--owed-bg); color: var(--owed); }
.cur-bal.paid { background: var(--paid-bg); color: var(--paid); }
.wrap > .link { margin: 0 auto 6px; }

/* work tab: the time bar and small money cards */
.period {
  grid-column: 1 / -1; display: flex; gap: 4px; background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 4px; overflow-x: auto;
}
.period button {
  flex: 1 0 auto; border: 0; background: none; color: #fff; opacity: .85; font-weight: 600;
  padding: 7px 10px; border-radius: 9px; font-size: 13px; white-space: nowrap;
}
.period button.on { background: #fff; color: var(--brand); opacity: 1; }
.hero-in.small { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hero-in.small .stat { padding: 8px 10px; }
.hero-in.small .stat span { font-size: 11.5px; }
.hero-in.small .stat b { font-size: 16px; }
.hero-in.small .stat.wide { grid-column: 1 / -1; }
.hero-in.small .stat.wide b { font-size: 24px; }
.hero-in.small .stat.wide2 { grid-column: 1 / -1; }
.hero-in.small .stat.good b { color: #86efac; }
.hero-in.small .stat.owed b { color: #fecaca; }
@media (max-width: 560px) {
  .hero-in.small { grid-template-columns: 1fr 1fr; }
}

/* six equal money cards: 3 a row, 2 on phones */
.hero-in.small { grid-template-columns: repeat(3, 1fr); }
.hero-in.small .stat { min-height: 62px; }
.hero-in.small .stat span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
@media (max-width: 560px) { .hero-in.small { grid-template-columns: 1fr 1fr; } }
/* the earnings line under the cards: work − cost − expenses, paid or not */
.hero-in.small .stat.profit { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; min-height: 0; }
.hero-in.small .stat.profit span { flex: 1 1 auto; font-size: 13px; opacity: 1; font-weight: 600; }
.hero-in.small .stat.profit b { font-size: 22px; margin: 0; }
.hero-in.small .stat.profit small { flex-basis: 100%; font-size: 11px; opacity: .7; }
/* a client owing in two currencies: one under the other */
.amts { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.cur-seg button { font-weight: 800; font-size: 16px; }
/* select mode in the client list */
.selbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; position: sticky; top: 8px; z-index: 5; }
.selbar .btn { flex: 1 1 auto; }
.tick { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid #cbd5e1; display: grid; place-items: center; font-weight: 800; color: #fff; }
.tick.on { background: #1e3a8a; border-color: #1e3a8a; }
.row.picked { background: #eef2ff; }

/* ₺ / $ calculator under the amount (Binance + fee) */
.conv { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.conv .field { margin-bottom: 4px; }
.conv input.fee { text-align: center; }
.hint.rate { display: block; margin: 0 0 12px; }
.amt.lira { font-size: 12px; opacity: .8; font-weight: 600; }
.stat small.lira { display: block; margin-top: 4px; font-size: 12.5px; opacity: .9; font-weight: 600; }
/* own message wording */
textarea.tpl { min-height: 230px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.45; }
.tpl-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; align-items: center; }
.chip { border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.chip:hover { background: #f1f5f9; }
.btn.small { padding: 6px 12px; font-size: 13px; }
/* suggestions list */
.sugg-list { margin-top: 10px; max-height: 55vh; overflow: auto; }
.row.sugg { cursor: default; }
.sugg-btn { border: 1px solid #cbd5e1; background: #fff; border-radius: 8px; width: 36px; height: 34px; cursor: pointer; font-size: 15px; margin-left: 6px; }
.sugg-btn:hover { background: #f1f5f9; }
.sugg-btn.danger:hover { background: #fee2e2; border-color: #fca5a5; }

.btn.rem { background: #ca8a04; color: #fff; }
.btn.rem + .btn.block { margin-top: 10px; }

/* the extension's page */
.ext-btn { width: auto; padding: 0 12px; gap: 4px; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; }
.ext-dl { margin: 6px 0 16px; }
.btn.ext-get { font-size: 17px; padding: 14px; text-decoration: none; text-align: center; display: block; }
.ext-state { font-weight: 800; text-align: center; margin: 0 0 10px; }
.ext-state.old { color: #b45309; }
.ext-state.ok { color: #15803d; }
.ext-steps { margin-bottom: 14px; line-height: 1.5; }
.ext-steps p { margin: 6px 0 0; }
@media (max-width: 520px) { .ext-btn span { display: none; } }

.note.ext-once { background: #fff7ed; border-color: #fdba74; color: #7c2d12; margin-bottom: 14px; }
