/* AutoDak portal — shared theme for portail.autodak.ca. */
:root {
  --accent: #297096;
  --accent-hover: #235f80;
  --accent-active: #1d5676;
  --navy: #14202d; /* kept for a future night mode */
  --ink: #1d2733;
  --muted: #6b7380;
  --line: #e4e7eb;
  --soft: #f5f6f8;
  --card: #ffffff;
  --red: #c62828;
  --green: #2e7d32;
  --menu-w: 248px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--soft); -webkit-font-smoothing: antialiased; font-size: 14px; }
a { color: var(--accent); }
button { font: inherit; }
.num, time, .date { font-variant-numeric: tabular-nums; }
.label { user-select: none; -webkit-user-select: none; }

/* ---- side menu -------------------------------------------------------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--menu-w); z-index: 20;
  display: flex; flex-direction: column; background: var(--accent); color: #fff;
}
.side-logo { display: block; padding: 22px 20px 14px; }
.side-logo img { display: block; width: 132px; height: auto; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.side-group { margin-top: 6px; }
.side-group > button {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: 0; color: rgba(255,255,255,.72); cursor: pointer;
  padding: 8px 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.side-group > button::after { content: "\203A"; font-size: 15px; transition: transform .15s; }
.side-group.open > button::after { transform: rotate(90deg); }
.side-group ul { list-style: none; margin: 0; padding: 0; display: none; }
.side-group.open ul { display: block; }
.side-group a {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px;
  color: #fff; text-decoration: none; font-size: 14px; line-height: 1.25;
}
.side-group a:hover { background: var(--accent-hover); }
.side-group a.current { background: var(--accent-active); font-weight: 600; }
.side-group a .tag { margin-left: auto; font-size: 10px; opacity: .7; }
.side-account { border-top: 1px solid rgba(255,255,255,.18); padding: 12px 16px 16px; font-size: 13px; }
.side-account .who { opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account button {
  margin-top: 8px; background: none; border: 1px solid rgba(255,255,255,.45); color: #fff;
  border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 13px;
}
.side-account button:hover { background: var(--accent-hover); }
.menu-toggle { display: none; }

/* ---- main area -------------------------------------------------------- */
.main { margin-left: var(--menu-w); min-height: 100vh; padding: 26px clamp(16px, 2.6vw, 40px) 48px; }
.page-title { margin: 0 0 14px; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.note { color: var(--muted); padding: 24px 4px; }
.error { color: var(--red); padding: 24px 4px; }

/* tabs (filters) */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tabs button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; font-size: 13px;
}
.tabs button:hover { border-color: var(--accent); }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs .count { margin-left: 6px; opacity: .75; font-variant-numeric: tabular-nums; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile .label { color: var(--muted); font-size: 12px; }
.tile .value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* lists */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: calc(100vh - 170px); }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th {
  position: sticky; top: 0; z-index: 1; background: var(--card); text-align: left; font-weight: 600;
  color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; user-select: none; -webkit-user-select: none;
}
table.list td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #f0f5f8; }
table.list td.n, table.list th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.list td.d { font-variant-numeric: tabular-nums; }
.vin b { font-weight: 700; }
.vin { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .02em; }
.list-foot { color: var(--muted); font-size: 12px; padding: 8px 2px; }

/* pills */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; line-height: 18px; background: #e9f1f6; color: var(--accent-active); white-space: nowrap; }
.pill.stock { background: var(--accent); color: #fff; margin-left: 6px; }
.pill.late { background: var(--red); color: #fff; margin-left: 6px; box-shadow: 0 0 6px rgba(229, 57, 53, .75); animation: late-glow 1.8s ease-in-out infinite alternate; }
.pill.ok { background: #e7f3e8; color: var(--green); }
@keyframes late-glow { from { box-shadow: 0 0 3px rgba(229, 57, 53, .5); } to { box-shadow: 0 0 10px rgba(229, 57, 53, .95); } }
@media (prefers-reduced-motion: reduce) { .pill.late { animation: none; } }

/* vehicle rows */
.veh-photo { width: 54px; height: 30px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); vertical-align: middle; }

/* details drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(15, 25, 35, .32); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 41; background: var(--card);
  box-shadow: -8px 0 28px rgba(0,0,0,.14); display: flex; flex-direction: column;
}
.drawer header { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 650; }
.drawer header button { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.drawer .body { overflow-y: auto; padding: 8px 18px 24px; }
.drawer dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 10px 0; font-size: 13px; }
.drawer dt { color: var(--muted); user-select: none; -webkit-user-select: none; }
.drawer dd { margin: 0; white-space: pre-wrap; word-break: break-word; font-variant-numeric: tabular-nums; }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.files button { border: 1px solid var(--line); background: var(--soft); border-radius: 7px; padding: 3px; cursor: pointer; }
.files img { display: block; width: 64px; height: 48px; object-fit: cover; border-radius: 5px; }
.files .doc { display: block; padding: 6px 8px; font-size: 12px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* quick-view lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10, 16, 24, .86); display: flex; align-items: center; justify-content: center; padding: 30px; }
.lightbox img, .lightbox iframe { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }
.lightbox iframe { width: min(1000px, 100%); height: 100%; border: 0; }
.lightbox button { position: absolute; top: 14px; right: 18px; border: 0; background: none; color: #fff; font-size: 30px; cursor: pointer; }

/* ---- sign-in ---------------------------------------------------------- */
body.sign-in { background: var(--accent); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.sign-card { width: min(380px, 100%); background: #fff; border-radius: 14px; padding: 28px 26px 22px; box-shadow: 0 18px 50px rgba(0,0,0,.22); }
.sign-card img { display: block; width: 150px; margin: 0 auto 18px; }
.sign-card h1 { font-size: 19px; margin: 0 0 4px; text-align: center; }
.sign-card p.sub { color: var(--muted); margin: 0 0 18px; text-align: center; font-size: 13px; }
.sign-card label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; user-select: none; }
.sign-card input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 15px; }
.sign-card input:focus { outline: 2px solid rgba(41, 112, 150, .35); border-color: var(--accent); }
.sign-card .primary { width: 100%; margin-top: 16px; padding: 10px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.sign-card .primary:hover { background: var(--accent-hover); }
.sign-card .primary:active { background: var(--accent-active); }
.sign-card .primary:disabled { opacity: .6; cursor: default; }
.sign-card .msg { min-height: 18px; margin-top: 10px; font-size: 13px; text-align: center; }
.sign-card .msg.bad { color: var(--red); }
.sign-card .link { display: block; margin-top: 8px; text-align: center; font-size: 13px; background: none; border: 0; color: var(--accent); cursor: pointer; width: 100%; }

/* ---- phones ----------------------------------------------------------- */
@media (max-width: 899px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .side { transform: none; }
  .main { margin-left: 0; padding-top: 58px; }
  .menu-toggle {
    display: block; position: fixed; top: 10px; left: 10px; z-index: 30; border: 0; border-radius: 8px;
    background: var(--accent); color: #fff; padding: 7px 11px; font-size: 18px; line-height: 1; cursor: pointer;
  }
  .panel { max-height: none; }
  body.menu-open .menu-toggle { left: calc(var(--menu-w) + 10px); }
  .drawer dl { grid-template-columns: 110px 1fr; }
}
