/* Rent 2 Go — shared styles */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5;
  --text: #14181f; --muted: #667085; --border: #e4e7ec;
  --brand: #059669; --brand-2: #047857;
  --in: #059669; --out: #dc2626;
  --personal: #2563eb; --r2g: #059669; --mmf: #d97706;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --surface: #161b22; --surface-2: #1c2230;
    --text: #e6e9ef; --muted: #97a0b0; --border: #262d3a;
    --brand: #10b981; --brand-2: #34d399;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
}
a { color: var(--brand-2); }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; letter-spacing: -.02em; font-size: 17px; }
.brand span { color: var(--brand); }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--brand); color: #fff; }
.topbar .spacer { flex: 1; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

/* Cards */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card .value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.card .value.tnum { font-variant-numeric: tabular-nums; }
.card .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pos { color: var(--in); } .neg { color: var(--out); }

/* Entity chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff; }
.chip.personal { background: var(--personal); } .chip.r2g { background: var(--r2g); } .chip.mmf { background: var(--mmf); }
.chip.ghost { background: var(--surface-2); color: var(--muted); }

/* Table */
.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 10px; }
table { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable:hover { background: var(--surface-2); cursor: pointer; }

/* Buttons + forms */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--out); border-color: var(--out); background: transparent; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 12px 0 5px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

/* Segmented direction toggle */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button { padding: 8px 14px; border: none; background: var(--surface); color: var(--muted); font-weight: 700; cursor: pointer; }
.seg button.on-in { background: var(--in); color: #fff; }
.seg button.on-out { background: var(--out); color: #fff; }
.seg button.on-transfer { background: #6b7280; color: #fff; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,14,20,.55); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px; overflow: auto; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal header h2 { font-size: 17px; margin: 0; }
.modal .body { padding: 4px 20px 8px; }
.modal footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* Setup / notice banner */
.banner { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; font-size: 14px; }
@media (prefers-color-scheme: dark) { .banner { background: #2a220c; border-color: #4d3d10; color: #fbd669; } }
.banner b { font-weight: 800; }

.equiv { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.equiv div { font-size: 13px; color: var(--muted); }
.equiv strong { color: var(--text); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---- mobile readiness ----
   Measured at 390px across every page in this app. Kept at the end of the file
   so it settles arguments with the rules above it. */

/* iOS zooms the page in when you tap a field whose text is under 16px, and it
   does not zoom back out. Every input here was 14px. */
@media (max-width: 820px) {
  /* !important because every page carries its own <style> with more specific
     input rules (.ctl input, input[type=text], input.search). This is a
     correctness rule about how iOS behaves, not a look someone might prefer. */
  input, select, textarea { font-size: 16px !important; }
}

/* A wide table is the one thing on these pages that can push the whole page
   sideways once real data is in it - an owner name and a car name and a date and
   three amounts do not fit in 390px. Let the table scroll inside itself rather
   than dragging the page with it. */
@media (max-width: 720px) {
  table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 9px 10px; font-size: 13px; white-space: nowrap; }
  th:first-child, td:first-child { position: sticky; left: 0; background: var(--surface); }
  th:first-child { background: var(--surface-2); }
}

/* Thumbs, not cursors. */
@media (hover: none), (max-width: 560px) {
  .btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .btn.sm { min-height: 34px; }
  .seg button { min-height: 40px; }
}

/* Nothing should be able to drag the page sideways. */
@media (max-width: 820px) {
  html, body { overflow-x: clip; max-width: 100%; }
  img, canvas, iframe { max-width: 100%; height: auto; }
  pre, code { overflow-x: auto; word-break: break-word; }
}
