/* House style: light grey ground, white rounded cards, Apple system font, one 640px column. */
:root {
  --ground: #f2f2f7; --card: #ffffff; --ink: #1d1d1f; --grey: #86868b;
  --hair: #f2f2f7; --rule: #d2d2d7; --red: #ff3b30; --green: #34c759; --blue: #007aff;
  --muted: #6e6e73; --fill: #e8e8ed; --input: #ffffff; --green-text: #248a3d; --on-ink: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding: 0 12px 40px; background: var(--ground); color: var(--ink); font: 14px/1.5 var(--font); }
.wrap { max-width: 640px; margin: 0 auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 0 10px; }
.brand { font-size: 17px; font-weight: 700; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 12px; }
nav a { text-decoration: none; padding: 6px 12px; border-radius: 999px; color: var(--grey); font-weight: 600; white-space: nowrap; }
nav a.on { background: var(--card); color: var(--ink); }

/* Cards */
.card { background: var(--card); border-radius: 18px; padding: 20px; margin-bottom: 14px; }
.label { font-size: 11px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--grey); }
.hero { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin: 8px 0 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.headline { font-size: 14px; line-height: 1.5; margin: 8px 0 14px; }
.hero + .headline { margin-top: 0; margin-bottom: 0; }
.caption { font-size: 12px; color: var(--grey); line-height: 1.45; }
.title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 4px 0 2px; }
.foot { text-align: center; font-size: 12px; color: var(--grey); padding: 6px 0 2px; }
.red { color: var(--red); } .green { color: var(--green); }

/* Tables: hairlines only, numbers right-aligned, never shaded */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { padding: 7px 0; border-bottom: 1px solid var(--hair); vertical-align: top; text-align: left; }
table.t th { font-size: 11px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--grey); padding-top: 0; }
table.t .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
table.t tr.total td { border-bottom: 0; border-top: 2px solid var(--ink); padding: 10px 0 0; font-size: 18px; font-weight: 700; }
table.t tr.total td.n { padding-left: 12px; }
table.t tr.sub td { color: var(--grey); }
table.t tr.link { cursor: pointer; }
table.t tr.link:hover td:first-child { text-decoration: underline; }
table.t td .caption { display: block; }

/* Buttons */
.btn { display: inline-block; border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--ground); color: var(--ink); white-space: nowrap; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--grey); text-decoration: underline; cursor: pointer; font-size: 12px; }

/* Forms */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .wide { grid-column: 1 / -1; }
label.f { display: block; }
label.f > span { display: block; font-size: 11px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--grey); margin-bottom: 4px; }
input, select, textarea { width: 100%; border: 1px solid var(--rule); border-radius: 10px; padding: 9px 11px; background: var(--input); font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
textarea { min-height: 70px; resize: vertical; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
.item { border-top: 1px solid var(--hair); padding: 12px 0; }
.item:first-of-type { border-top: 0; padding-top: 4px; }
.item .grid { grid-template-columns: 1fr 1fr 1fr; }
.item .amt { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters .wide { grid-column: 1 / -1; }

.msg { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 9; max-width: 90vw; text-align: center; }
.msg.err { background: var(--red); }
.empty { color: var(--grey); padding: 4px 0; }

@media (max-width: 520px) {
  .card { padding: 18px; }
  .grid, .filters, .item .grid { grid-template-columns: 1fr 1fr; }
  .item .grid .desc { grid-column: 1 / -1; }
  .hide-phone { display: none; }
}

[hidden] { display: none !important; }

/* Apple look on the Fleet Log layout: wide page, tab bar, joined stat boxes, status pills. */
.wrap { max-width: 1040px; }
#main.narrow { max-width: 720px; margin: 0 auto; }
.top { padding: 22px 4px 14px; }
.brand { font-size: 21px; letter-spacing: -.02em; }
nav { background: var(--card); border-radius: 14px; padding: 4px; margin-bottom: 26px; box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: visible; }
nav a { flex: 1; text-align: center; border-radius: 10px; padding: 9px 6px; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; }
nav a.on { background: var(--blue); color: #fff; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 0 4px 18px; }
.pagehead h1 { font-size: 32px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; margin: 0 0 4px; }
.pagehead .caption { font-size: 15px; color: var(--muted); }
.card { padding: 24px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.hero { font-size: 44px; letter-spacing: -.03em; }
.btn.primary { background: var(--blue); }
.btn { background: var(--fill); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px -24px -24px; border-top: 1px solid var(--hair); }
.stats > div { padding: 16px 24px 18px; border-left: 1px solid var(--hair); min-width: 0; }
.stats > div:first-child { border-left: 0; }
.stat { font-size: 26px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.green { color: var(--green-text); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.two > .card { margin-bottom: 14px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 9px; border-radius: 999px; margin-top: 4px; background: var(--fill); color: var(--muted); }
.pill.paid { background: #e3f6e8; color: #248a3d; }
.pill.overdue { background: #ffe9e7; color: #d70015; }
.pill.sent { background: #e5f1ff; color: #0066cc; }
.pill.partly-paid { background: #fff2dc; color: #b25000; }
.filters { grid-template-columns: repeat(4, 1fr); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,122,255,.15); }
@media (max-width: 760px) {
  .two { grid-template-columns: 1fr; gap: 0; }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .card { padding: 18px; }
  .hero { font-size: 34px; }
  nav { margin-bottom: 20px; }
  nav a { font-size: 13px; padding: 8px 2px; }
  .pagehead { flex-direction: column; align-items: stretch; }
  .pagehead h1 { font-size: 26px; }
  .pagehead .btn { text-align: center; }
  .stats { margin: 16px -18px -18px; }
  .stats > div { padding: 12px 10px 14px 12px; }
  .stats > div:first-child { padding-left: 18px; }
  .stat { font-size: 18px; }
}

label.f, .filters > *, .grid > * { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }

.top { align-items: center; }
.themebtn { width: 38px; height: 38px; border: 0; border-radius: 12px; background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.04); font-size: 18px; line-height: 1; cursor: pointer; }
.filters.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Dark mode: Apple's dark system colors. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #000000; --card: #1c1c1e; --ink: #f5f5f7; --grey: #98989d; --muted: #aeaeb2;
  --hair: #2c2c2e; --rule: #3a3a3c; --red: #ff453a; --green: #30d158; --blue: #0a84ff;
  --fill: #2c2c2e; --input: #2c2c2e; --green-text: #30d158; --on-ink: #000000;
}
:root[data-theme="dark"] .pill.paid { background: #12331c; color: #30d158; }
:root[data-theme="dark"] .pill.overdue { background: #3d1412; color: #ff6961; }
:root[data-theme="dark"] .pill.sent { background: #0d2a4d; color: #64aaff; }
:root[data-theme="dark"] .pill.partly-paid { background: #3d2a0a; color: #ffb340; }

.invno { color: var(--blue); font-weight: 600; text-decoration: none; }
.invno:hover { text-decoration: underline; }

/* Main dashboard page */
.brandwrap { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.backlink { color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.backlink:hover { color: var(--blue); }
body.on-dashboard .brandwrap, body.on-dashboard nav, body.on-dashboard .pagehead .btn { display: none; }
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.hubcard { display: flex; flex-direction: column; margin: 0; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.hubcard:hover { box-shadow: 0 6px 20px rgba(0,0,0,.09); transform: translateY(-1px); }
.hubcard .headline { flex: 1; margin-bottom: 12px; }
.hubcard .hero { font-size: 34px; }
.ext { color: var(--grey); font-weight: 400; font-size: 18px; }
.themebtn { margin-left: auto; }

.logo { width: 40px; height: 40px; object-fit: contain; display: block; flex: none; }
.logolink { flex: none; }
.top { justify-content: flex-start; gap: 12px; }
.hubback { margin: -8px 4px 14px; }
