/* JA Associates LR Generator - navy and gold, from the company logo. No inline styles anywhere (CSP). */
:root {
  --navy: #0f1b2d; --navy-2: #18283f; --navy-3: #24374f; --gold: #a98445; --gold-2: #c9a25c; --gold-soft: #f3ead7;
  --bg: #f5f3ee; --card: #ffffff; --ink: #1a1f29; --mute: #5b6472; --line: #dcd8cf; --line-2: #ebe8e1;
  --ok: #1d6b45; --ok-bg: #e4f3ea; --warn: #8a5a00; --warn-bg: #fdf1d6; --err: #a3231c; --err-bg: #fbe6e4;
  --info: #1f4f82; --info-bg: #e5eef8; --radius: 10px; --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 4px 14px rgba(15, 27, 45, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; color: var(--navy); letter-spacing: .01em; }
h2 { font-size: 1.05rem; margin: 0 0 .7rem; color: var(--navy); }
p { margin: .4rem 0 .8rem; }
code, .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .92em; }
.muted { color: var(--mute); font-size: .9rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---- shell */
.test-banner { background: #8a5a00; color: #fff; text-align: center; font-size: .8rem; font-weight: 600; padding: .25rem .5rem;
  letter-spacing: .04em; }
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); color: #dfe5ee;
  display: flex; flex-direction: column; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand-row { display: flex; align-items: center; gap: .7rem; padding: .2rem .35rem 1rem; border-bottom: 1px solid rgba(201, 162, 92, .35);
  margin-bottom: .8rem; }
.brand-logo { width: 46px; height: 46px; background: #fff; border-radius: 10px; padding: 5px; object-fit: contain; }
.brand { font-family: Georgia, "Times New Roman", serif; font-size: .92rem; letter-spacing: .09em; white-space: nowrap; color: #fff; font-weight: 700; }
.brand small { display: block; font: 600 .62rem/1.3 "Segoe UI", system-ui, sans-serif; letter-spacing: .2em; color: var(--gold-2);
  text-transform: uppercase; margin-top: 2px; }
.navgroup { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: #8fa0b8; margin: 1rem .6rem .3rem; }
a.nav { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px; color: #dfe5ee; font-weight: 500;
  border-left: 3px solid transparent; }
a.nav:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
a.nav.active { background: rgba(201, 162, 92, .16); border-left-color: var(--gold-2); color: #fff; }
a.nav.key { background: var(--gold); color: #fff; font-weight: 700; justify-content: center; margin: .2rem 0 .5rem; border-left: 0; }
a.nav.key:hover { background: var(--gold-2); }
.cnt { margin-left: auto; background: var(--gold-2); color: var(--navy); border-radius: 999px; font-size: .72rem; font-weight: 700;
  padding: .05rem .5rem; }
.side-user { display: flex; align-items: center; gap: .6rem; padding: .8rem .35rem 0; border-top: 1px solid rgba(255, 255, 255, .12);
  margin-top: .8rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; flex: none; }
.who { font-size: .86rem; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.who-role { display: block; font-size: .72rem; color: #8fa0b8; }
.signout { margin-left: auto; }
.phone-bar { display: none; }
.main { flex: 1; min-width: 0; padding: 1.4rem 1.6rem 3rem; max-width: 1400px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem; margin-bottom: 1rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: .8rem; padding: .75rem 1.1rem; border-bottom: 1px solid var(--line-2);
  background: #fbfaf7; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .right { margin-left: auto; display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line); background: #fff;
  color: var(--ink); border-radius: 8px; padding: .5rem .95rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.btn:hover { border-color: var(--navy-3); text-decoration: none; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-3); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-danger { color: var(--err); border-color: #e3b7b3; }
.btn-sm { padding: .28rem .65rem; min-height: 32px; font-size: .86rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.sidebar .btn { background: transparent; color: #dfe5ee; border-color: rgba(255, 255, 255, .25); }
.alert { border-radius: 8px; padding: .65rem .9rem; margin-bottom: .9rem; border: 1px solid; font-weight: 500; }
.alert-success { background: var(--ok-bg); border-color: #b9dcc7; color: var(--ok); }
.alert-error { background: var(--err-bg); border-color: #efc2be; color: var(--err); }
.alert-warning { background: var(--warn-bg); border-color: #efd9a4; color: var(--warn); }
.alert-info { background: var(--info-bg); border-color: #c3d6ec; color: var(--info); }
.chip { display: inline-block; border-radius: 999px; padding: .08rem .6rem; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-err { background: var(--err-bg); color: var(--err); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-mute { background: #eceae4; color: var(--mute); }

/* ---- forms */
label { font-size: .82rem; font-weight: 600; color: var(--mute); display: block; margin-bottom: .2rem; }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input[type=tel], input[type=file],
input:not([type]), select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9c5bb;
  border-radius: 8px; padding: .5rem .65rem; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-2); outline-offset: 1px; border-color: var(--gold); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--navy); vertical-align: middle; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .85rem 1rem; }
.span-all { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }
.field .hint { font-size: .78rem; color: var(--mute); margin-top: .2rem; }
.field .errorlist, .errorlist { color: var(--err); font-size: .82rem; list-style: none; padding: 0; margin: .2rem 0 0; }
.req { color: var(--err); }
.check { display: flex; align-items: center; gap: .5rem; font-size: .92rem; color: var(--ink); font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filters .field { min-width: 150px; flex: 1 1 150px; }
.filters .field.wide { flex: 2 1 240px; }
.filters .field.fit { flex: 0 0 auto; min-width: 0; }
.freight-box { border: 1px dashed var(--gold); background: #fffaf0; border-radius: var(--radius); padding: .9rem 1rem; }
.freight-box h2 { color: var(--warn); }

/* ---- tables */
.scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); background: #fbfaf7;
  padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: .5rem .7rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover { background: #fcfbf8; }
.tbl tfoot td { font-weight: 700; background: var(--gold-soft); border-top: 2px solid var(--gold); }
.tbl-compact td, .tbl-compact th { padding: .35rem .5rem; }
.tbl td.chk, .tbl th.chk { width: 40px; text-align: center; }
.tbl input[type=text].in-cell { min-height: 34px; padding: .3rem .5rem; }
.tbl .amount { width: 130px; text-align: right; }
.tbl td[data-label="Date"], .tbl td[data-label="Type"], .tbl td[data-label="Vehicle"] { white-space: nowrap; }
tr.cancelled td { color: var(--mute); text-decoration: line-through; }
tr.cancelled td.keep { text-decoration: none; }
.freeze { overflow: auto; max-height: 70vh; }

/* ---- dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem;
  border-top: 3px solid var(--navy); color: var(--ink); display: block; }
.stat:hover { text-decoration: none; border-color: var(--gold); }
.stat.gold { border-top-color: var(--gold); }
.stat .k { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.stat .v { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .82rem; color: var(--mute); }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start; }

/* ---- invoices (ODN) list */
.group { margin-bottom: .9rem; }
.group.ticked { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(169, 132, 69, .25); }
.group-name { font-weight: 700; color: var(--navy); }
.sticky-bar { position: sticky; bottom: 0; z-index: 5; background: var(--navy); color: #fff; border-radius: var(--radius); padding: .7rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; box-shadow: 0 -4px 18px rgba(15, 27, 45, .25); margin-top: 1rem; }
.sticky-bar b { color: var(--gold-2); font-size: 1.05rem; }
.sticky-bar .warn { color: #ffd98a; font-weight: 600; }
.sticky-bar .btn { margin-left: auto; }

/* ---- LR detail */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem 1.2rem; }
.fact .k { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.fact .v { font-weight: 600; }
.lr-no { font-family: Consolas, Menlo, monospace; font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.copies { display: flex; flex-wrap: wrap; gap: .5rem; }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* ---- sign-in */
body.login-page { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%); }
body.login-page .main { max-width: none; padding: 0; display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(940px, 94vw); background: #fff; border-radius: 16px; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-art { background: #fbf8f1; padding: 2.4rem 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; border-right: 1px solid var(--line); }
.login-art img { width: min(300px, 80%); height: auto; }
.login-art p { color: var(--mute); max-width: 30ch; margin-top: 1.2rem; }
.login-form { padding: 2.4rem 2.2rem; }
.login-form h1 { font-family: Georgia, serif; letter-spacing: .08em; }
.login-sub { color: var(--mute); margin-bottom: 1.2rem; }
.login-fields label { margin-top: .8rem; }
.login-btn { width: 100%; margin-top: 1.2rem; }
.login-note { font-size: .8rem; color: var(--mute); text-align: center; }
.pw-wrap { position: relative; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--mute); cursor: pointer;
  padding: 4px; }
.pw-eye.on { color: var(--navy); }
.auth { max-width: 460px; margin: 6vh auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.8rem;
  box-shadow: var(--shadow); }
.auth .card { box-shadow: none; border: 0; padding: 0; }
.auth .form > * { margin-bottom: .7rem; }
.qr svg { width: 200px; height: 200px; }
.secret { display: inline-block; background: var(--gold-soft); padding: .15rem .4rem; border-radius: 4px; }
ul.codes { columns: 2; list-style: none; padding: 0; font-size: 1.05rem; }

/* ---- phones and small tablets */
@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { width: auto; height: auto; position: sticky; top: 0; z-index: 20; padding: .5rem .7rem; overflow: visible; }
  .sidebar > :not(.phone-bar) { display: none; }
  .sidebar.phone-open > :not(.phone-bar) { display: flex; }
  .sidebar.phone-open > .navgroup { display: block; }
  .sidebar.phone-open { max-height: 100vh; overflow-y: auto; }
  .phone-bar { display: flex; align-items: center; gap: .6rem; }
  .phone-bar .brand { font-size: .95rem; }
  .phone-bar .btn { margin-left: auto; }
  .main { padding: 1rem .8rem 4rem; }
  .two { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-art { padding: 1.4rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-art img { width: 170px; }
  .login-art p { display: none; }
  .span-2 { grid-column: auto; }
  /* tables that turn into cards */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border-bottom: 1px solid var(--line); padding: .55rem .8rem; position: relative; }
  table.cards td { border: 0; padding: .12rem 0; text-align: left; white-space: normal; }
  table.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--mute); font-size: .78rem; font-weight: 600; }
  table.cards td.chk { position: absolute; right: .7rem; top: .5rem; width: auto; }
  table.cards td.chk input { width: 26px; height: 26px; }
  table.cards td.lead { font-weight: 700; font-size: 1rem; padding-right: 3rem; }
  table.cards tfoot { display: none; }
  .pdf-frame { height: 62vh; }
}
@media print { .sidebar, .test-banner, .sticky-bar, .btn { display: none !important; } .main { padding: 0; } }
