/* Truckpenny shared styles: brand tokens + components used by site, app and admin.
   Light theme by default (dark mode is a later, deliberate step, never half-done). */
@font-face { font-family: 'Outfit'; font-weight: 500; font-display: swap; src: url(/_s/fonts/outfit-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Outfit'; font-weight: 700; font-display: swap; src: url(/_s/fonts/outfit-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Outfit'; font-weight: 500; font-display: swap; src: url(/_s/fonts/outfit-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Outfit'; font-weight: 700; font-display: swap; src: url(/_s/fonts/outfit-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Sans'; font-weight: 400; font-display: swap; src: url(/_s/fonts/dm-sans-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Sans'; font-weight: 500; font-display: swap; src: url(/_s/fonts/dm-sans-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Sans'; font-weight: 700; font-display: swap; src: url(/_s/fonts/dm-sans-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Sans'; font-weight: 400; font-display: swap; src: url(/_s/fonts/dm-sans-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Sans'; font-weight: 500; font-display: swap; src: url(/_s/fonts/dm-sans-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Sans'; font-weight: 700; font-display: swap; src: url(/_s/fonts/dm-sans-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  --copper: #B4572A; --copper-dark: #9A4722; --copper-bright: #E08A52; --peach: #F0DDD0; --peach-soft: #FBF5F1;
  --asphalt: #17181C; --ink-2: #45464C; --ink-3: #5C5E66; --line: #E4E1DA; --line-2: #EEEBE5; --field: #D9D5CC;
  --lime: #F5F4F1; --white: #FFFFFF; --hover: #ECE9E3; --on: #FFFFFF; /* --white = card surface (dark in the app's dark theme); --on = text on a coloured button (always white) */
  --safe: #1F6B43; --safe-ink: #1F5C38; --safe-soft: #E3F1E8; --ok: #2E7D4F;
  --warn-bg: #FDF0DC; --warn: #7A4A00; --bad-bg: #FBE7E4; --bad: #8E2A1E;
  --r: 14px; --r-lg: 20px;
  --f-head: 'Outfit', system-ui, sans-serif; --f-body: 'DM Sans', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--lime); color: var(--asphalt); font-family: var(--f-body); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--f-head); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 .5em; }
a { color: var(--copper-dark); }
a:hover { color: var(--asphalt); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
img, svg { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons: every one has a hover, a focus ring and a loading state */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: var(--r);
  border: 1px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn-p { background: var(--copper); color: var(--on); }
.btn-p:hover { background: var(--copper-dark); color: var(--on); }
.btn-s { background: var(--white); border-color: var(--field); color: var(--asphalt); font-weight: 500; }
.btn-s:hover { background: var(--hover); color: var(--asphalt); }
.btn-dark { background: var(--asphalt); color: var(--on); }
.btn-dark:hover { background: #2D2E34; color: var(--on); }
.btn-danger { background: var(--bad); color: var(--on); }
.btn-danger:hover { background: #6F2016; color: var(--on); }
.btn-wide { width: 100%; }
.btn[disabled] { cursor: default; } .btn[disabled]:not(.busy) { opacity: .45; }
.btn.busy { opacity: .72; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* fields; select gets its own chevron with room on the right */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 700; }
.field .hint { font-size: 14px; color: var(--ink-3); }
.field .err { font-size: 14px; color: var(--bad); font-weight: 500; }
input:not([type]), input[type=text], input[type=url], input[type=password], input[type=month], input[type=email], input[type=number], input[type=search], input[type=tel], input[type=date], select, textarea {
  font: inherit; color: var(--asphalt); background: var(--white); border: 1px solid var(--field); border-radius: 12px; min-height: 48px; padding: 0 14px; width: 100%; }
textarea { padding: 10px 14px; min-height: 96px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2345464C' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--copper); outline-offset: 1px; border-color: var(--copper); }

/* cards, pills */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; background: var(--hover); color: var(--ink-2); }
.pill.ok { background: var(--safe-soft); color: var(--safe-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.demo { background: var(--peach); color: var(--asphalt); }

/* green trust badge (Orhan: must catch the eye, not look like a form message) */
.safe { display: flex; gap: 14px; align-items: center; background: var(--safe); color: var(--on); border-radius: 16px; padding: 14px 16px; box-shadow: 0 6px 18px rgba(31,107,67,.28); }
.safe .safe-ic { flex: 0 0 52px; height: 52px; border-radius: 15px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; }
.safe b { display: block; font-size: 18px; line-height: 1.25; }
.safe span { font-size: 14px; color: #D6EEDF; font-weight: 500; }
.safe-pill { display: inline-flex; align-items: center; gap: 10px; background: var(--safe); color: var(--on); border-radius: 999px; padding: 8px 16px 8px 10px; font-size: 14px; font-weight: 700; }

/* tables; 4+ columns become labelled cards on phones (ui.js adds data-l) */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #F1EEE9; vertical-align: top; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--peach-soft); }
@media (max-width: 700px) {
  table.stk thead { display: none; }
  table.stk, table.stk tbody, table.stk tr, table.stk td { display: block; width: 100%; }
  table.stk tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stk td { border: 0; padding: 4px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; overflow-wrap: anywhere; }
  table.stk td::before { content: attr(data-l); color: var(--ink-3); font-size: 13px; font-weight: 700; text-align: left; }
}

/* our own dialog (never the browser's alert/confirm); bottom sheet on phones */
dialog.dlg { border: 0; border-radius: 20px; padding: 22px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.25);
  display: grid; grid-template-columns: 44px 1fr; gap: 6px 14px; color: var(--asphalt); background: var(--white); }
dialog.dlg::backdrop { background: rgba(23,24,28,.5); }
.dlg-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--peach); display: flex; align-items: center; justify-content: center; }
.dlg-ic svg { width: 24px; height: 24px; fill: none; stroke: var(--copper-dark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
dialog.ok .dlg-ic { background: var(--safe-soft); } dialog.ok .dlg-ic svg { stroke: var(--ok); }
dialog.err .dlg-ic, dialog.danger .dlg-ic { background: var(--bad-bg); } dialog.err .dlg-ic svg, dialog.danger .dlg-ic svg { stroke: var(--bad); }
.dlg-txt h2 { font-size: 20px; margin: 2px 0 6px; }
.dlg-txt p { margin: 0; color: var(--ink-2); }
.dlg-btns { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 560px) {
  dialog.dlg { margin: auto 0 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; padding-bottom: 28px; }
  .dlg-btns .btn { flex: 1 1 0; }
}

/* toast, update bar, link-loading line */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--asphalt); color: var(--on); padding: 12px 16px; border-radius: 12px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .3s, transform .3s; }
.toast.err { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }
.update-bar { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 70; border: 0; border-radius: 999px; padding: 12px 20px;
  background: var(--asphalt); color: var(--on); font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.update-bar:hover { background: var(--copper-dark); }
html.navigating::before { content: ''; position: fixed; left: 0; top: 0; height: 3px; width: 40%; background: var(--copper); z-index: 80; animation: nav 1.2s ease-in-out infinite; }
@keyframes nav { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .spin, html.navigating::before { animation: none; } }
