/* Inter, served from here (no Google request on launch). Variable font: one file covers 400–700. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/account/assets/fonts/inter-latin.woff2?v=20) 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; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/account/assets/fonts/inter-latin-ext.woff2?v=20) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Ruby Petrochem accounts app — the ERP's look: Inter, Ruby red, warm off-white. Phone first;
   from 900px a sidebar replaces the bottom tabs and lists become tables. */
:root {
  --red: #da0b0b; --red-dark: #b00909; --red-tint: #fdecec; --red-soft: #ffd9d9;
  --bg: #f8f5f5; --card: #ffffff; --ink: #1c0d0d; --muted: #6b4a4a; --label: #7a5858;
  --line: #eedfdf; --line-soft: #f5ecec; --track: #f1e6e6; --green: #2f6b1f; --green-tint: #eaf3e4;
  --radius: 16px; --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --status-bg: #ffffff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--red); }
img { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(218, 11, 11, .35); outline-offset: 2px; }

/* boot */
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.boot-logo { width: 120px; height: auto; opacity: .9; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .55 } to { opacity: 1 } }

/* shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.side { display: none; }
.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) calc(var(--tabbar) + 24px + var(--safe-b)) calc(16px + var(--safe-l)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 40px; width: auto; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text small { font-size: 12px; color: var(--label); font-weight: 500; }
.brand-text strong { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-switch { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 4px; min-width: 0; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 14px; }
.page-title h1 { margin: 0; font-size: 26px; font-weight: 700; }
.page-title img { height: 30px; width: auto; }
.back { display: flex; align-items: center; gap: 6px; padding: 6px 0 12px; }
.back a { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--ink); margin-left: -10px; border-radius: 22px; }
.back h1 { margin: 0; font-size: 20px; font-weight: 700; }
.back small { display: block; color: var(--muted); font-size: 13px; }

.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); display: flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; flex: none; text-decoration: none; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 18px; height: 18px; }

/* tab bar (phone) */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 6px calc(8px + var(--safe-r)) calc(6px + var(--safe-b)) calc(8px + var(--safe-l)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--label); font-size: 11px; font-weight: 500; border-radius: 12px; min-height: 48px; }
.tabs a.on { color: var(--red); font-weight: 700; }

/* cards */
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flush { padding: 0 16px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--label); text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 0 4px; }
.card-head a { font-size: 14px; font-weight: 600; text-decoration: none; padding: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }

/* balance */
.balance { border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--card); border: 1px solid var(--line); }
.balance .lbl { font-size: 13px; font-weight: 500; color: var(--label); }
.balance .amt { font-size: 34px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.balance .row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.balance .row b { color: var(--ink); font-weight: 600; }
.balance .pill { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; background: #fff; color: var(--red-dark); }
.balance .actions { display: flex; gap: 10px; }
.balance.red { background: var(--red); border-color: var(--red); color: #fff; }
.balance.red .lbl { color: var(--red-soft); }
.balance.red .row, .balance.red .row b { color: #fff; }

.btn { height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-size: 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink); font-weight: 600; }
.btn.ghost:hover { background: #fcf8f8; }
.btn.white { background: #fff; color: var(--red); }
.btn.outline-white { background: transparent; border-color: #f59a9a; color: #fff; font-weight: 600; }
.btn.small { height: 38px; font-size: 14px; padding: 0 14px; border-radius: 19px; }
.btn.danger-text { background: var(--card); border-color: var(--line); color: var(--red-dark); font-weight: 600; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { border: 0; background: none; color: var(--red); font-weight: 600; cursor: pointer; padding: 10px 0; font-size: 15px; }

/* credit */
.credit-head { font-size: 17px; font-weight: 700; line-height: 1.3; margin: 10px 0; }
.credit-head.warn { color: var(--red-dark); display: flex; gap: 8px; align-items: flex-start; }
.bar { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; margin-bottom: 10px; }
.bar i { display: block; height: 100%; border-radius: 5px; background: var(--red); }

/* latest order / lists */
.order-link { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); padding-bottom: 4px; }
.order-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.order-top b { font-size: 17px; }
.segs { display: flex; gap: 6px; }
.segs i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.segs i.on { background: var(--red); }
.badge-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--red-tint); color: var(--red); display: flex; align-items: center; justify-content: center; flex: none; }
.line-item { display: flex; align-items: center; gap: 12px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; }
.card.flush .list-row:first-of-type { border-top: 0; }
.list-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row .t b { font-size: 15px; font-weight: 600; }
.list-row .t span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .a { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-weight: 600; white-space: nowrap; }
.tag { width: 40px; height: 40px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.tag.invoice { background: var(--red-tint); color: var(--red); }
.tag.credit { background: var(--green-tint); color: var(--green); }
.tag.debit { background: #f7ebe9; color: var(--red-dark); }
.tag.payment { background: var(--bg); color: var(--ink); }
.state { font-size: 12px; font-weight: 600; color: var(--label); }
.state.due { color: var(--ink); }
.state.overdue { color: var(--red-dark); }
.state.paid { color: var(--green); }

.order-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); }
.chip { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--red-tint); color: var(--red); white-space: nowrap; }
.chip.done { background: var(--red); color: #fff; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* filters */
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill-btn { flex: none; height: 40px; padding: 0 14px; border-radius: 20px; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--card); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.pill-btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.search { display: flex; align-items: center; gap: 8px; height: 46px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; color: var(--label); }
.search input { flex: 1; border: 0; outline: none; background: transparent; color: var(--ink); min-width: 0; font-size: 15px; }
.select { height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); padding: 0 12px; font-weight: 600; font-size: 14px; }
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }

/* timeline */
.tl { display: flex; flex-direction: column; }
.tl-step { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 26px; height: 26px; border-radius: 13px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.tl-dot.wait { background: var(--card); border: 2px solid var(--line); color: var(--label); }
.tl-line { width: 2px; flex: 1; background: var(--red); min-height: 22px; }
.tl-line.wait { background: var(--line); }
.tl-body { padding-bottom: 18px; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tl-body b { font-size: 16px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; background: var(--bg); border-radius: 12px; padding: 12px; }
.facts span { display: block; font-size: 12px; color: var(--label); }
.facts b { font-size: 14px; font-weight: 600; word-break: break-word; }
.bill-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 4px 0; }
.bill-row.total { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

/* statement */
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat.strong { border: 2px solid var(--ink); padding: 11px 13px; }
.stat span { font-size: 12px; color: var(--label); }
.stat b { font-size: 18px; }
.ledger { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ledger-head, .ledger-row { display: grid; grid-template-columns: 1fr 96px 100px; gap: 8px; padding: 11px 14px; align-items: center; }
.ledger-head { background: #fbf7f7; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--label); }
.ledger-row { border-bottom: 1px solid var(--line-soft); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row b { font-size: 14px; display: block; }
.ledger-row small { font-size: 12px; color: var(--muted); }
.ledger .cr { color: var(--green); }
.ledger .col-d, .ledger .col-c, .ledger .col-date, .ledger .col-ref { display: none; }
.dates { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dates input { height: 40px; border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; background: var(--card); }

/* settings */
.set-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.card.flush > .set-row:first-child, .card.flush > div:first-child > .set-row { border-top: 0; }
.set-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.set-row .t b { font-size: 16px; font-weight: 600; }
.set-row .t span { font-size: 13px; color: var(--muted); }
.note { font-size: 13px; line-height: 1.45; color: var(--red-dark); background: var(--red-tint); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.note.plain { color: var(--muted); background: var(--bg); }
.switch { flex: none; width: 52px; height: 32px; border-radius: 16px; border: 0; padding: 3px; display: flex; cursor: pointer; background: #cdb8b8; justify-content: flex-start; transition: background .15s; }
.switch::after { content: ''; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 2px rgba(28,13,13,.25); }
.switch[aria-checked="true"] { background: var(--red); justify-content: flex-end; }
.switch[disabled] { background: #e2cfcf; cursor: not-allowed; }
.avatar { width: 38px; height: 38px; border-radius: 19px; background: var(--red-tint); color: var(--red); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex: none; }
.section-h { margin: 18px 4px 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input { height: 48px; border: 1px solid #e2cfcf; border-radius: 12px; padding: 0 12px; font-size: 16px; background: #fff; }
.phone-input { display: flex; align-items: center; gap: 8px; height: 54px; border: 2px solid var(--red); border-radius: 14px; padding: 0 14px; background: #fff; }
.phone-input span { font-size: 17px; font-weight: 600; color: var(--muted); }
.phone-input input { flex: 1; border: 0; outline: none; font-size: 17px; font-weight: 600; min-width: 0; background: transparent; }
.code-input { height: 58px; border: 2px solid var(--red); border-radius: 14px; text-align: center; font-size: 26px; font-weight: 700; letter-spacing: .4em; width: 100%; background: #fff; }

/* sign in / setup / lock */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; justify-content: center; padding: calc(28px + var(--safe-t)) calc(20px + var(--safe-r)) calc(24px + var(--safe-b)) calc(20px + var(--safe-l)); background: #fff; }
.auth-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.auth-inner > img { height: 64px; width: auto; align-self: flex-start; }
.auth h1 { margin: 6px 0 0; font-size: 28px; line-height: 1.2; }
.auth p { margin: 0; color: var(--muted); font-size: 16px; }
.spacer { flex: 1; min-height: 16px; }
.step { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.step-top { display: flex; gap: 12px; align-items: flex-start; }
.step-n { width: 28px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; font-size: 14px; font-weight: 700; background: var(--red-tint); color: var(--red); }
.step-n.done { background: var(--red); color: #fff; }
.step-top .t { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.step-top .t b { font-size: 16px; }
.step-top .t span { font-size: 14px; color: var(--muted); line-height: 1.4; }
.app-icon { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--line); }
.err { color: var(--red-dark); font-size: 14px; font-weight: 600; min-height: 1em; margin: 0; }
.center { text-align: center; }

.banner { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.banner .t { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.banner .t b { font-size: 15px; }
.banner .t span { font-size: 13px; color: var(--muted); }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(28,13,13,.45); display: flex; flex-direction: column; justify-content: flex-end; animation: fade .15s ease; }
.sheet-close { flex: 1; border: 0; background: transparent; cursor: pointer; }
.sheet { background: #fff; border-radius: 24px 24px 0 0; padding: 12px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; max-height: 88vh; overflow-y: auto; width: 100%; max-width: 560px; margin: 0 auto; animation: up .2s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; }
.sheet h2 { margin: 4px 0 0; font-size: 20px; }
.opt { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 60px; padding: 10px 14px; border-radius: 14px; cursor: pointer; text-align: left; background: #fff; border: 2px solid var(--line); gap: 10px; }
.opt.on { background: var(--red-tint); border-color: var(--red); }
.opt span span { display: block; }
.copy-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.copy-row span { font-size: 12px; color: var(--label); display: block; }
.copy-row b { font-size: 15px; word-break: break-all; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(30px); opacity: .6 } }

#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 20px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: all .2s; z-index: 60; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { padding: 36px 8px; text-align: center; color: var(--muted); }
.loading { padding: 40px 0; text-align: center; color: var(--label); }
.skel { background: linear-gradient(90deg, #f3eded 25%, #faf6f6 50%, #f3eded 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 16px; }
@keyframes sk { to { background-position: -200% 0 } }

/* ------------------------------------------------------------ computers */
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .tabs { display: none; }
  .side { display: flex; flex-direction: column; gap: 4px; width: 248px; flex: none; position: sticky; top: 0; height: 100vh; padding: 24px 16px; background: #fff; border-right: 1px solid var(--line); }
  .side .brand { padding: 0 8px 18px; }
  .side .brand img { height: 44px; }
  .side nav { display: flex; flex-direction: column; gap: 4px; }
  .side nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 600; }
  .side nav a:hover { background: var(--bg); color: var(--ink); }
  .side nav a.on { background: var(--red-tint); color: var(--red); }
  .side .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
  .side .side-biz { padding: 10px 12px; border-radius: 12px; background: var(--bg); }
  .side .side-biz small { display: block; font-size: 12px; color: var(--label); }
  .side .side-biz b { font-size: 14px; }
  .main { max-width: 1120px; padding: 28px 36px 48px; }
  .top .brand img, .top .icon-btn { display: none; }
  .top .brand-text strong { font-size: 24px; }
  .top { padding-top: 0; }
  .page-title img, .top .brand img { display: none; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .orders-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .ledger-head, .ledger-row { grid-template-columns: 110px minmax(0, 1fr) 140px 130px 130px 140px; }
  .ledger .col-d, .ledger .col-c, .ledger .col-date, .ledger .col-ref { display: block; }
  .ledger .col-amt, .ledger .mob-date { display: none; }
  .two { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 720px; }
  .filters { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .filters .search { flex: 1; min-width: 260px; }
  .sheet-wrap { justify-content: center; align-items: center; }
  .sheet { border-radius: 20px; max-width: 480px; padding-bottom: 24px; }
  .sheet .grab { display: none; }
  .sheet-close { position: absolute; inset: 0; }
  #toast { bottom: 28px; }
  .auth { background: var(--bg); align-items: center; }
  .auth-inner { background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 36px; }
}
@media (hover: hover) { .list-row:hover { background: #fcf9f9; } .order-card:hover { border-color: #e2cfcf; } }

/* in-app PDF viewer (iPhone home-screen app) */
.viewer { position: fixed; inset: 0; z-index: 70; background: #2a1515; display: flex; flex-direction: column; padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.viewer-bar b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-body { flex: 1; display: flex; }
.viewer-body iframe { flex: 1; border: 0; width: 100%; height: 100%; background: #fff; }
.viewer-msg { margin: auto; color: #fff; padding: 20px; text-align: center; }

/* orders by weight, shipments, updates */
.wbar { display: flex; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.wbar i { display: block; height: 100%; }
.wbar .gone { background: var(--red); }
.wbar .load { background: repeating-linear-gradient(45deg, #f08a8a 0 6px, #f6b3b3 6px 12px); }
.chip.warn-chip { background: #fff4e0; color: #8a4b00; }
.chip.muted-chip { background: var(--bg); color: var(--label); }
.is-cancelled { opacity: .8; }
.is-cancelled .strike-if, .strike-if.is-cancelled { text-decoration: line-through; color: var(--label); }
.card.is-cancelled .strike-if { text-decoration: line-through; color: var(--label); }
.update-card { border-color: #f3d39b; background: #fffaf0; display: flex; flex-direction: column; gap: 4px; }
.confirm-card { border: 2px solid var(--red); display: flex; flex-direction: column; gap: 8px; }
.grade-table { display: flex; flex-direction: column; }
.grade-row { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13px; align-items: baseline; }
.grade-row b { font-size: 14px; }
.grade-row .gone-t { color: var(--red); font-weight: 600; }
.grade-row .load-t { color: #b85c00; font-weight: 600; }
.shipment { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 520px) { .grade-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grade-row b { grid-column: 1 / -1; } }

/* welcome + picture guide */
.benefits { display: flex; flex-direction: column; gap: 10px; }
.benefits > div { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; }
.divider { height: 1px; background: var(--line); margin: 6px 0; }
.g-h { margin: 0; font-size: 20px; }
.guide { display: flex; flex-direction: column; gap: 22px; margin-top: 4px; }
.g-step { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.g-text { display: flex; gap: 12px; align-items: flex-start; align-self: stretch; }
.g-text b { display: block; font-size: 16px; }
.g-text span:not(.step-n) { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.g-text .step-n { background: var(--red); color: #fff; }
.shot { width: 100%; max-width: 230px; height: auto; display: block; filter: drop-shadow(0 6px 16px rgba(28,13,13,.15)); }
.shot text { font-family: -apple-system, 'SF Pro Text', Inter, Roboto, sans-serif; }
.shot .ring { transform-box: fill-box; transform-origin: center; animation: ring 1.6s ease-out infinite; }
@keyframes ring { from { transform: scale(1); opacity: .9 } to { transform: scale(1.7); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .shot .ring { animation: none; } }

/* status-bar backdrop: content scrolling up never shows through the clock / notch area */
body::before { content: ''; position: fixed; top: -150px; left: 0; right: 0; height: calc(150px + var(--safe-t)); background: var(--status-bg); z-index: 45; pointer-events: none; }
/* sign-in screens: the logo big, centred and lower */
.auth-inner.hero { text-align: center; }
.auth-inner.hero > .auth-logo { width: 174px; height: auto; align-self: center; margin: clamp(16px, 9vh, 96px) 0 10px; }
.auth-inner.hero h1 { margin-top: 4px; }
.auth-inner.hero .phone-input, .auth-inner.hero .code-input { text-align: left; }
.auth-inner.hero .code-input { text-align: center; }
.auth-inner.hero > .link-btn:first-of-type { align-self: flex-start; }
@media (min-width: 900px) { body::before { display: none; } .auth-inner.hero > .auth-logo { margin-top: 8px; } }

/* frozen screen headers */
.sticky-head { position: sticky; top: var(--safe-t); z-index: 30; background: var(--bg); margin: -12px calc(-16px - var(--safe-r)) 0 calc(-16px - var(--safe-l)); padding: 12px calc(16px + var(--safe-r)) 2px calc(16px + var(--safe-l)); transition: box-shadow .2s; }
.sticky-head.scrolled { box-shadow: 0 1px 0 var(--line), 0 8px 14px -10px rgba(28,13,13,.25); }
.sticky-head > :last-child { margin-bottom: 12px; }
.sticky-head > .top, .sticky-head > .page-title, .sticky-head > .back { padding-top: 0; }
@media (min-width: 900px) { .sticky-head { top: 0; margin: -28px -36px 0; padding: 22px 36px 2px; } }

/* housekeeping: one header layout — [logo] title ......... actions */
.page-title { padding: 8px 0 12px; }
.pt-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pt-left h1 { margin: 0; font-size: 24px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-left .brand-text strong { font-size: 18px; }
.page-title img.pt-logo { height: 28px; width: auto; flex: none; }
.pt-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.section-h { margin: 6px 4px -4px; }
@media (min-width: 900px) { .page-title img.pt-logo { display: none; } .pt-left h1 { font-size: 26px; } }
/* per-grade progress */
.grades { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.grade { display: flex; flex-direction: column; gap: 6px; }
.grade b { font-size: 15px; }
.g-sum { font-size: 14px; font-weight: 600; }
.g-done { font-size: 14px; font-weight: 600; color: var(--green); display: inline-flex; align-items: center; gap: 4px; }
/* driver */
.driver-row { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.driver-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.driver-row .t b { font-size: 15px; }
.driver-row .t span { font-size: 13px; color: var(--muted); }
.order-card .ico.sm, .order-link .ico.sm { vertical-align: -3px; }
/* document viewer */
.viewer { background: #3a2a2a; }
.viewer-bar { padding: 8px 10px; }
.v-back { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 10px 0 4px; border: 0; background: none; color: var(--red); font-size: 16px; font-weight: 600; cursor: pointer; }
.viewer-body { overflow-y: auto; -webkit-overflow-scrolling: touch; flex-direction: column; align-items: center; padding: 8px; gap: 8px; }
.pdf-page { display: block; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); border-radius: 2px; flex: none; }

/* pull to refresh */
html, body { overscroll-behavior-y: contain; }
#ptr { position: fixed; top: calc(var(--safe-t) + 8px); left: 50%; z-index: 40; width: 40px; height: 40px; border-radius: 20px; background: #fff; box-shadow: 0 2px 10px rgba(28,13,13,.18); display: flex; align-items: center; justify-content: center; transform: translate(-50%, -44px); opacity: 0; pointer-events: none; }
#ptr svg { width: 24px; height: 24px; }
#ptr.ready svg circle { stroke-dasharray: 57 100; }
#ptr.spin { animation: ptrspin .7s linear infinite; }
@keyframes ptrspin { from { transform: translate(-50%, 18px) rotate(0deg); } to { transform: translate(-50%, 18px) rotate(360deg); } }
@media (min-width: 900px) and (hover: hover) { #ptr { display: none; } }

/* order cards: the date as a tile */
.oc { display: flex; gap: 14px; align-items: flex-start; }
.oc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.date-tile { flex: none; width: 52px; border-radius: 12px; background: var(--red-tint); color: var(--red); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 7px 0 6px; line-height: 1; }
.date-tile b { font-size: 22px; font-weight: 700; }
.date-tile span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.date-tile small { font-size: 10px; font-weight: 600; margin-top: 3px; opacity: .8; }
.date-tile.off { background: var(--bg); color: var(--label); }
.filters .dates { gap: 6px; }
.filters .dates input { flex: 1; min-width: 0; height: 42px; }
.filters .dates .link-btn { padding: 6px 4px; }

/* ---------------------------------------------------------------- motion (see screenMotion in app.js) */
:root { --ease: cubic-bezier(0.32, 0.72, 0, 1); --spring: cubic-bezier(0.34, 1.56, 0.64, 1); }
html { -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: no-preference) {
  /* press feedback, like Smart Entry */
  .btn, .pill-btn, .icon-btn, .link-btn, .tabs a, .opt, .v-back { transition: transform .18s var(--ease), background-color .15s, opacity .15s, color .15s; }
  .btn:not(:disabled):active, .pill-btn:active, .icon-btn:active, .opt:active, .v-back:active { transform: scale(.96); }
  .tabs a:active { transform: scale(.92); }
  .order-card, .order-link, .list-row { transition: transform .18s var(--ease), background-color .15s, border-color .15s; }
  .order-card:active, .order-link:active { transform: scale(.985); }
  .list-row:active { background: #f6eded; }
  /* the tab you're on gives a small hop */
  .tabs a.on .ico { animation: hop .45s var(--spring); }
  @keyframes hop { 0% { transform: scale(.7) } 60% { transform: scale(1.12) } 100% { transform: scale(1) } }
  /* cards rise in one after another */
  .orders-grid > *, .home-grid > .stack > *, .detail-grid > .stack > *, .stack > .card, .two > .stat, .grades > .grade, .benefits > div, .guide > .g-step {
    animation: rise .46s var(--ease) both; }
  .orders-grid > *:nth-child(2), .home-grid > .stack > *:nth-child(2), .detail-grid > .stack > *:nth-child(2), .stack > .card:nth-child(2), .two > .stat:nth-child(2), .grades > .grade:nth-child(2), .benefits > div:nth-child(2), .guide > .g-step:nth-child(2) { animation-delay: .05s; }
  .orders-grid > *:nth-child(3), .home-grid > .stack > *:nth-child(3), .detail-grid > .stack > *:nth-child(3), .stack > .card:nth-child(3), .grades > .grade:nth-child(3), .benefits > div:nth-child(3), .guide > .g-step:nth-child(3) { animation-delay: .1s; }
  .orders-grid > *:nth-child(4), .stack > .card:nth-child(4), .grades > .grade:nth-child(4), .guide > .g-step:nth-child(4) { animation-delay: .15s; }
  .orders-grid > *:nth-child(5), .stack > .card:nth-child(5), .guide > .g-step:nth-child(5) { animation-delay: .2s; }
  .orders-grid > *:nth-child(n+6) { animation-delay: .24s; }
  .home-grid > .stack:nth-child(2) > * { animation-delay: .08s; }
  .home-grid > .stack:nth-child(2) > *:nth-child(2) { animation-delay: .14s; }
  .card.flush > .list-row { animation: fadein .4s var(--ease) both; }
  .card.flush > .list-row:nth-child(n+3) { animation-delay: .05s; } .card.flush > .list-row:nth-child(n+5) { animation-delay: .1s; } .card.flush > .list-row:nth-child(n+8) { animation-delay: .15s; }
  .ledger-row { animation: fadein .35s var(--ease) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
  @keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
  /* progress fills in */
  .wbar i, .bar i { transform-origin: left center; animation: fill .8s var(--ease) both .12s; }
  .wbar i.load { animation-delay: .3s; }
  @keyframes fill { from { transform: scaleX(0) } to { transform: scaleX(1) } }
  /* timeline steps pop in, in order */
  .tl-dot { animation: pop .4s var(--spring) both; }
  .tl-step:nth-child(2) .tl-dot { animation-delay: .18s; } .tl-step:nth-child(3) .tl-dot { animation-delay: .32s; }
  .tl-line { transform-origin: top; animation: drop .4s var(--ease) both .1s; }
  @keyframes pop { from { transform: scale(0); opacity: 0 } to { transform: scale(1); opacity: 1 } }
  @keyframes drop { from { transform: scaleY(0) } to { transform: scaleY(1) } }
  /* something happening right now */
  .chip.live { position: relative; }
  .chip.live::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 4px; background: currentColor; margin-right: 6px; vertical-align: 1px; animation: blink 1.4s ease-in-out infinite; }
  @keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }
  /* date tiles flip in */
  .date-tile { animation: flip .5s var(--spring) both .08s; }
  @keyframes flip { from { transform: rotateX(80deg); opacity: 0 } to { transform: none; opacity: 1 } }
  /* sheets, the document viewer and toasts */
  .sheet { animation: up .38s var(--ease); }
  @keyframes up { from { transform: translateY(100%) } }
  .viewer { animation: up .36s var(--ease); }
  #toast { transition: opacity .2s, transform .35s var(--spring); }
  .switch::after { transition: transform .25s var(--spring); }
  .balance.red { animation: alertin .6s var(--ease) both; }
  @keyframes alertin { 0% { box-shadow: 0 0 0 0 rgba(218,11,11,.45) } 100% { box-shadow: 0 0 0 14px rgba(218,11,11,0) } }
  @media (min-width: 900px) { .sheet { animation: fadein .2s ease; } }
}

/* "Something's wrong" on new orders */
.wrong-card { display: flex; align-items: center; gap: 12px; }
.wrong-card .t { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.wrong-btn { align-self: flex-start; margin-top: 2px; color: var(--red-dark); }

/* approve on your phone */
.approve-pulse { width: 84px; height: 84px; border-radius: 42px; background: var(--red-tint); color: var(--red); display: flex; align-items: center; justify-content: center; align-self: center; margin: 10px 0; }
.approve-pulse .ico { width: 36px; height: 36px; }
@media (prefers-reduced-motion: no-preference) { .approve-pulse { animation: callpulse 1.6s ease-out infinite; } @keyframes callpulse { 0% { box-shadow: 0 0 0 0 rgba(218,11,11,.35) } 100% { box-shadow: 0 0 0 26px rgba(218,11,11,0) } } }

/* grade category next to the grade code */
.gcat { display: inline-block; margin-left: 2px; padding: 1px 6px; border-radius: 6px; background: var(--chip, #f3eaea); color: var(--muted); font-size: .78em; font-weight: 600; line-height: 1.4; vertical-align: 1px; white-space: nowrap; }

/* empty Active list: the nudge card */
.nudge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 26px 22px 22px; border-radius: 20px; }
.nudge-art { width: 210px; height: auto; max-width: 70%; overflow: visible; }
.nudge h2 { margin: 6px 0 0; font-size: 22px; font-weight: 700; line-height: 1.25; }
.nudge p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.nudge .btn { margin-top: 8px; }
.nudge .small { line-height: 1.4; }
@media (prefers-reduced-motion: no-preference) {
  .nudge-truck { animation: bob 2.4s ease-in-out infinite; transform-box: fill-box; }
  .nudge-shadow { animation: shadowpulse 2.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
  .nudge-badge { animation: pop .5s var(--spring) both .25s; transform-origin: center; transform-box: fill-box; }
  @keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
  @keyframes shadowpulse { 0%, 100% { transform: scaleX(1); opacity: .18 } 50% { transform: scaleX(.9); opacity: .12 } }
}
.nudge-shadow { opacity: .16; }

/* date fields (Orders, Statement) */
.date-field { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--label); cursor: pointer; }
.date-field .dv { font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-field .dv.empty { color: var(--label); font-weight: 400; }
.filters .dates .date-field input, .date-field input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-appearance: none; appearance: none; font-size: 16px; }
.date-field:focus-within { border-color: var(--red); }

/* settings rows: text left, one control right; links and actions under the text */
.set-row .t { gap: 2px; }
.set-row .t .row-link { align-self: flex-start; padding: 6px 0 0; font-size: 14px; }
.set-row.person { align-items: flex-start; }
.set-row.person .avatar { margin-top: 2px; }
.row-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.owner-chip { font-size: 11px; padding: 2px 8px; vertical-align: 1px; }
