/* Patrol Build - BIN ATEEJ monochrome palette, Montserrat. Logical properties so Arabic (rtl) works later. */
:root {
  --carbon: #111111; --graphite: #4F5257; --silver: #C9CCD1; --light: #E6E8EB; --off: #F7F7F7;
  --bg: var(--off); --card: #FFFFFF; --text: var(--carbon); --muted: var(--graphite); --line: var(--light);
  --accent: var(--carbon); --on-accent: #FFFFFF;
  --bad: #B42318; --bad-bg: #FDECEA; --good: #1F7A4D; --good-bg: #E7F4EC; --warn: #8A5A00; --warn-bg: #FFF4DB;
  --p1: #111111; --p2: #9AA0A8;
  --radius: 14px; --gutter: 16px;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0B0C; --card: #17181A; --text: #F7F7F7; --muted: #A6AAB1; --line: #2A2C30;
    --accent: #F7F7F7; --on-accent: #111111;
    --bad: #FF8A7A; --bad-bg: #3A1512; --good: #6FD3A0; --good-bg: #0F2C1E; --warn: #F3C969; --warn-bg: #33270B;
    --p1: #F7F7F7; --p2: #6E747C;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.boot { padding: 40px var(--gutter); color: var(--muted); }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 10px;
  display: flex; align-items: center; gap: 12px; border-block-end: 1px solid var(--line); }
.top h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: .2px; flex: 1; }
.top .sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.wrap { max-width: 760px; margin: 0 auto; padding: 14px var(--gutter); }

/* bottom nav */
.nav { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 6; background: var(--card); border-block-start: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
  text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; }
.nav a svg { width: 22px; height: 22px; }
.nav a.on { color: var(--text); }
.nav .dot { position: absolute; top: 8px; inset-inline-start: calc(50% + 8px); background: var(--bad); color: #fff; border-radius: 9px;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 4px; }

/* cards & stats */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-block-end: 12px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.card h2 .r { float: inline-end; text-transform: none; letter-spacing: 0; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.stat .k { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat .cur { font-size: 11px; font-weight: 600; color: var(--muted); margin-inline-end: 4px; }
.stat .v { font-size: 19px; white-space: nowrap; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat.bad .v { color: var(--bad); } .stat.good .v { color: var(--good); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.bad-t { color: var(--bad); } .good-t { color: var(--good); }

/* rows */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-block-end: 1px solid var(--line); cursor: pointer; }
.row:last-child { border-block-end: 0; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row .m { font-size: 12px; color: var(--muted); margin-top: 1px; }
.row .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: var(--light); color: var(--graphite); margin-inline-end: 4px; vertical-align: 1px; }
@media (prefers-color-scheme: dark) { .tag { background: #2A2C30; color: #C9CCD1; } }
.tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.good { background: var(--good-bg); color: var(--good); }

/* bars */
.bar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.over { background: var(--bad); }
.split { height: 14px; border-radius: 8px; overflow: hidden; display: flex; background: var(--line); }
.split > i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.legend b { font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }

/* alerts */
.alert { border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-block-end: 12px; background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.good { background: var(--good-bg); color: var(--good); }
.alert a { font-weight: 700; }

/* forms */
label.f { display: block; margin-block-end: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-block-end: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--silver); border-radius: 10px; background: var(--card); font-size: 16px; }
@media (prefers-color-scheme: dark) { input, select, textarea { border-color: #3A3D42 !important; } }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; margin-block-end: 12px; font-weight: 500; }
.check input { width: 20px; height: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  padding: 11px 16px; border-radius: 10px; font-weight: 700; cursor: pointer; text-decoration: none; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--silver); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-block-end: 4px; margin-block-end: 10px; scrollbar-width: none; }
.seg button { border: 1px solid var(--silver); background: transparent; padding: 7px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* sheet / modal */
.back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 16px var(--gutter) calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .back { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h3 { margin: 2px 0 14px; font-size: 17px; }
.sheet .grab { width: 40px; height: 4px; background: var(--silver); border-radius: 2px; margin: 0 auto 12px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chips button { border: 1px solid var(--silver); background: transparent; border-radius: 16px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.chips button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.toast { position: fixed; inset-inline: 16px; inset-block-end: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 30; background: var(--carbon); color: #fff;
  border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 14px; max-width: 520px; margin: 0 auto; }
@media (prefers-color-scheme: dark) { .toast { background: #F7F7F7; color: #111; } }

/* auth */
.auth { max-width: 380px; margin: 8vh auto 0; padding: 0 var(--gutter); }
.auth .logo { width: 56px; height: 56px; margin-block-end: 12px; }
.auth h1 { font-size: 22px; margin: 0 0 4px; }
.auth p { color: var(--muted); margin: 0 0 22px; }
.err { color: var(--bad); font-weight: 600; font-size: 14px; min-height: 20px; margin-block-end: 8px; }

/* tables (import review) */
.imp { display: flex; flex-direction: column; gap: 8px; }
.imp .it { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; grid-template-columns: 26px 1fr; gap: 6px; }
.imp .it.off { opacity: .45; }
.imp .flds { display: grid; grid-template-columns: 110px 1fr; gap: 6px; }
.imp .flds input, .imp .flds select { padding: 7px 8px; font-size: 14px; }
.imp .flds .full { grid-column: 1 / -1; }

.rules { white-space: pre-wrap; line-height: 1.6; }
.sec-h { font-size: 13px; font-weight: 700; margin: 14px 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.ck { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--silver); flex: none; display: grid; place-items: center; background: transparent; cursor: pointer; padding: 0; }
.ck.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.done .t { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.receipt { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-block: 6px 10px; }
.empty { color: var(--muted); padding: 10px 0; font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* assistant */
.chatbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--silver); border-radius: 20px; padding: 6px 12px; text-decoration: none; font-weight: 700; font-size: 13px; }
.chatbtn svg { width: 18px; height: 18px; }
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.bubble { max-width: 92%; }
.bubble.me { align-self: flex-end; }
.bubble.me .btext { background: var(--accent); color: var(--on-accent); border-radius: 16px 16px 4px 16px; }
.bubble.bot .btext { background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; }
.btext { padding: 10px 13px; white-space: pre-wrap; line-height: 1.45; }
.acard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 8px; }
.acard.done { border-color: var(--good); }
.acard.off { opacity: .55; }
.acard-t { font-weight: 700; margin-bottom: 8px; }
.acard-l { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.chatbar { display: flex; gap: 8px; position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); background: var(--bg); padding: 6px 0; }
.chatbar input { flex: 1; }

/* Home: the big round button in the middle of the bottom bar */
.nav a.mid { overflow: visible; }
.nav a.mid .midc { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  margin-top: -26px; box-shadow: 0 4px 14px rgba(0,0,0,.28); border: 3px solid var(--card); }
.nav a.mid .midc svg { width: 24px; height: 24px; }
.nav a.mid { color: var(--text); }

/* big chat box on the dashboard */
.chatcard { padding: 14px; }
.chatin { width: 100%; min-height: 0; resize: none; font-size: 17px; line-height: 1.4; padding: 12px 14px; border-radius: 12px; }
.chatcard .chat { margin: 12px 0 0; }
.chatcard .chat:empty { display: none; }
.chatbar .chatin { font-size: 16px; }

/* v1.10.0 - simpler home and add-expense */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block-end: 12px; }
.act { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: start;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); border-radius: var(--radius); padding: 14px 12px; cursor: pointer; font: inherit; min-width: 0; }
.act b { grid-row: 1 / 3; font-size: 26px; line-height: 1; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.16); }
.act span { font-weight: 700; font-size: 15px; }
.act small { font-size: 11px; opacity: .75; }
.act.ghost { background: var(--card); color: var(--text); border-color: var(--silver); }
.act.ghost b { background: var(--line); }
.hero .k { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.hero .big { font-size: 30px; font-weight: 700; margin-top: 2px; }
.owners { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.owner .on { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.owner .on b { margin-inline-start: auto; }
.owner .ov { font-size: 17px; font-weight: 700; margin: 2px 0; }
.chips.big button { display: flex; flex-direction: column; align-items: flex-start; padding: 9px 14px; font-size: 14px; border-radius: 12px; text-align: start; }
.chips.big button small { font-size: 11px; font-weight: 500; opacity: .75; }
.bigamt { font-size: 26px !important; padding: 12px 14px !important; font-weight: 700; }
div.f { display: block; margin-block-end: 12px; }
div.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-block-end: 4px; }
@media (max-width: 360px) { .actions, .owners { grid-template-columns: 1fr; } }

