/* =====================================================================
   Vehicle Movement - dashboard pages
     admin/c_a_vehicle_dashboard.jsp
     user/c_u_vehicle_dashboard.jsp

   See the rules at the top of vehiclemovement_theme.css, which every page in
   the module loads first: white surfaces with no block fills, colour carried
   by buttons, icons and status, and restrained font weights on the
   application's own typeface. Nothing here sets a font-family.

   The charts are the one place this page fills anything, and deliberately so:
   a bar IS its value, so it is a shape rather than a block behind content. The
   cards, tiles, rows and panels around them stay white and are separated by
   1px borders.

   Chart hues repeat the module's icon accents rather than inventing a palette -
   blue, teal, violet, amber, green - so a Car reads the same colour wherever it
   appears on the page.

   Everything is namespaced .vd-* / #vd* so nothing leaks into the theme or the
   other pages. The date-range picker's own restyle lives in
   vehiclemovement_theme.css, since the log and activity pages share it.
   ===================================================================== */

#main-container .content { background: var(--vmx-white); }
.vd-wrap { max-width: 1680px; margin: 0 auto; }
.vd-wrap * { box-sizing: border-box; }

/* ---------------------------------------------------------- page heading */
.vd-hero {
	display: flex; align-items: center; justify-content: space-between; gap: 18px;
	flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--vmx-line);
}
.vd-hero-l { display: flex; align-items: center; gap: 14px; }
.vd-hero-ico {
	width: 42px; height: 42px; border-radius: var(--vmx-r-s); flex: 0 0 42px;
	border: 1px solid var(--vmx-line); color: var(--vmx-violet);
	display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
}
.vd-hero h2 { margin: 0; font-size: 19px; font-weight: var(--vmx-fw-head); color: var(--vmx-ink); }
.vd-hero p  { margin: 3px 0 0; font-size: 13px; color: var(--vmx-muted); }
.vd-hero-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------- buttons */
.vd-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	padding: 9px 16px; border-radius: var(--vmx-r-s); border: 1px solid transparent;
	font-size: 13px; font-weight: var(--vmx-fw-label); line-height: 1.3; cursor: pointer;
	transition: background .15s, border-color .15s, color .15s;
	white-space: nowrap; font-family: inherit;
}
.vd-btn i { font-size: 12px; }
.vd-btn:focus { outline: 2px solid var(--vmx-focus); outline-offset: 1px; }
.vd-btn[disabled] { opacity: .55; cursor: not-allowed; }
.vd-btn-primary { background: var(--vmx-brand); color: #fff; }
.vd-btn-primary:hover:not([disabled]) { background: var(--vmx-brand-dark); color: #fff; }
.vd-btn-ghost { background: var(--vmx-white); color: var(--vmx-body); border-color: var(--vmx-line); }
.vd-btn-ghost:hover:not([disabled]) { background: var(--vmx-hover); color: var(--vmx-ink); border-color: #d1d5db; }
.vd-btn-sm { padding: 6px 12px; font-size: 12px; }

/* the date-range trigger opens a picker, so it is a button - and a filled one, since the
   range is the filter the whole page is computed for */
.vd-range {
	display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
	padding: 10px 14px; border-radius: var(--vmx-r-s); border: 1px solid transparent;
	background: var(--vmx-brand); color: #fff; font-size: 13px; font-weight: var(--vmx-fw-label); white-space: nowrap;
}
.vd-range:hover { background: var(--vmx-brand-dark); }
.vd-range i.fa-angle-down { opacity: .8; margin-left: 1px; }

/* ---------------------------------------------------------- stat tiles */
.vd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.vd-stat {
	background: var(--vmx-white); border: 1px solid var(--vmx-line); border-radius: var(--vmx-r);
	padding: 15px 16px; display: flex; align-items: center; gap: 14px;
}
/* the icon carries the tile's colour - an outlined square, never a filled one */
.vd-stat-ico {
	width: 40px; height: 40px; flex: 0 0 40px; border-radius: var(--vmx-r-s);
	border: 1px solid currentColor; color: var(--vmx-muted);
	display: flex; align-items: center; justify-content: center; font-size: 16px;
}
/* "currently out" is a trip in progress, so it takes the in-progress blue */
.vd-stat.is-out   .vd-stat-ico { color: var(--vmx-progress); }
.vd-stat.is-trips .vd-stat-ico { color: var(--vmx-violet); }
.vd-stat.is-km    .vd-stat-ico { color: var(--vmx-amber); }
.vd-stat.is-avg   .vd-stat-ico { color: var(--vmx-teal); }
.vd-stat-k { font-size: 11px; font-weight: var(--vmx-fw-label); letter-spacing: .4px; text-transform: uppercase; color: var(--vmx-muted); }
.vd-stat-v { font-size: 24px; font-weight: var(--vmx-fw-head); color: var(--vmx-ink); line-height: 1.2; margin: 3px 0 1px; }
.vd-stat-v small { font-size: 13px; font-weight: var(--vmx-fw-label); color: var(--vmx-muted); margin-left: 2px; }
.vd-stat-s { font-size: 12px; color: var(--vmx-muted); }
/* the one number that is not about the chosen period gets the in-progress colour, so it
   is visibly "right now" rather than "in the range" */
.vd-stat.is-out .vd-stat-v { color: var(--vmx-progress-text); }

/* ---------------------------------------------------------- chart cards */
.vd-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.vd-card { background: var(--vmx-white); border: 1px solid var(--vmx-line); border-radius: var(--vmx-r); overflow: hidden; }
.vd-card-head {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--vmx-line);
}
.vd-card-head h3 {
	margin: 0; font-size: 14px; font-weight: var(--vmx-fw-head); color: var(--vmx-ink);
	display: inline-flex; align-items: center; gap: 9px;
}
.vd-card-head h3 i { color: var(--vmx-blue); }
.vd-card-note { font-size: 12px; color: var(--vmx-muted); }
.vd-card-body { padding: 16px 14px; min-height: 250px; }

/* a two-state switch inside a card head: the chosen side is outlined, not filled, so the
   bars stay the only coloured shapes in the card */
.vd-toggle { display: inline-flex; border: 1px solid var(--vmx-line); border-radius: 999px; padding: 3px; gap: 2px; }
.vd-tog {
	border: 0; background: transparent; cursor: pointer; font-family: inherit;
	padding: 5px 13px; border-radius: 999px; font-size: 12px; font-weight: var(--vmx-fw-label);
	color: var(--vmx-muted);
}
.vd-tog:hover { color: var(--vmx-brand); }
.vd-tog.active { color: var(--vmx-brand-dark); box-shadow: inset 0 0 0 1px var(--vmx-brand); }

/* ---------------------------------------------------------- horizontal bars
   Used by "by purpose", "by vehicle type" and "busiest". The label sits above its
   bar rather than beside it, so a long purpose never squeezes the bar to nothing
   and the same markup works on a phone. */
.vd-bars { display: flex; flex-direction: column; gap: 14px; }
.vd-bar-row { display: block; }
.vd-bar-top {
	display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px;
}
.vd-bar-label {
	font-size: 12.5px; color: var(--vmx-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vd-bar-val { font-size: 12.5px; font-weight: var(--vmx-fw-label); color: var(--vmx-ink); white-space: nowrap; }
.vd-bar-val small { font-weight: 400; color: var(--vmx-muted); margin-left: 5px; }
.vd-bar-track { height: 9px; border-radius: 999px; background: var(--vmx-line2); overflow: hidden; }
.vd-bar-fill { height: 100%; border-radius: 999px; background: var(--vmx-brand); transition: width .3s ease; min-width: 3px; }
/* the five accents, cycled by position so a chart never repeats a hue before it has to */
.vd-bar-fill.c0 { background: var(--vmx-blue); }
.vd-bar-fill.c1 { background: var(--vmx-teal); }
.vd-bar-fill.c2 { background: var(--vmx-violet); }
.vd-bar-fill.c3 { background: var(--vmx-amber); }
.vd-bar-fill.c4 { background: var(--vmx-success); }

/* ---------------------------------------------------------- column chart
   One column per day (or per month over a long range). Scrolls sideways rather
   than squeezing the columns below a readable width. */
.vd-cols-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.vd-cols {
	display: flex; align-items: flex-end; gap: 6px; height: 190px;
	border-bottom: 1px solid var(--vmx-line); padding: 0 2px;
}
.vd-col { flex: 1 1 0; min-width: 22px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.vd-col-bar {
	border-radius: 5px 5px 0 0; background: var(--vmx-brand); min-height: 2px;
	transition: height .3s ease;
}
/* a day with nothing on it still gets a tick, so the gap is visible as a gap */
.vd-col.is-zero .vd-col-bar { background: var(--vmx-line); }
.vd-col-n { font-size: 11px; color: var(--vmx-ink); text-align: center; margin-bottom: 5px; font-weight: var(--vmx-fw-label); }
.vd-col.is-zero .vd-col-n { color: var(--vmx-faint); font-weight: 400; }
.vd-axis { display: flex; gap: 6px; padding: 7px 2px 0; }
.vd-axis-x { flex: 1 1 0; min-width: 22px; text-align: center; font-size: 10.5px; color: var(--vmx-muted); white-space: nowrap; }
.vd-axis-x small { display: block; color: var(--vmx-faint); font-size: 9.5px; }
.vd-chart-foot { margin-top: 12px; font-size: 12px; color: var(--vmx-muted); }

/* ---------------------------------------------------------- panel + filters */
.vd-panel { background: var(--vmx-white); border: 1px solid var(--vmx-line); border-radius: var(--vmx-r); overflow: hidden; }
.vd-panel-head {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--vmx-line);
}
.vd-panel-head h3 {
	margin: 0; font-size: 14px; font-weight: var(--vmx-fw-head); color: var(--vmx-ink);
	display: inline-flex; align-items: center; gap: 9px;
}
.vd-panel-head h3 i { color: var(--vmx-blue); }
.vd-panel-head-r { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vd-count { font-size: 12.5px; color: var(--vmx-muted); }

.vd-filters {
	padding: 13px 14px; border-bottom: 1px solid var(--vmx-line);
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.vd-search { position: relative; flex: 1 1 260px; min-width: 190px; }
.vd-search i {
	position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
	color: var(--vmx-blue); font-size: 12.5px; pointer-events: none;
}
.vd-search input {
	width: 100%; padding: 10px 12px 10px 33px; border: 1px solid var(--vmx-line);
	border-radius: var(--vmx-r-s); font-size: 13px; color: var(--vmx-body);
	background: var(--vmx-white); font-family: inherit;
}
.vd-search input:focus { outline: none; border-color: var(--vmx-brand); }

.vd-fsel { position: relative; }
.vd-fsel select {
	appearance: none; -webkit-appearance: none; -moz-appearance: none;
	padding: 10px 30px 10px 12px; border: 1px solid var(--vmx-line); border-radius: var(--vmx-r-s);
	font-size: 13px; color: var(--vmx-body); background: var(--vmx-white); font-family: inherit;
	cursor: pointer; max-width: 200px; text-overflow: ellipsis;
}
.vd-fsel select:focus { outline: none; border-color: var(--vmx-brand); }
.vd-fsel:after {
	content: "\f107"; font-family: FontAwesome; position: absolute; right: 11px; top: 50%;
	transform: translateY(-50%); color: var(--vmx-violet); font-size: 13px; pointer-events: none;
}
/* a filter that is narrowing something: blue border and text, no fill */
.vd-fsel select.on { border-color: var(--vmx-brand); color: var(--vmx-brand-dark); }

.vd-clear {
	display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px;
	border-radius: var(--vmx-r-s); border: 1px dashed #d1d5db;
	background: var(--vmx-white); color: var(--vmx-muted); font-size: 12.5px; font-weight: var(--vmx-fw-label);
	cursor: pointer; font-family: inherit; white-space: nowrap;
}
.vd-clear i { color: var(--vmx-amber); }
.vd-clear:hover { border-style: solid; border-color: var(--vmx-danger); color: var(--vmx-danger); }
.vd-clear:hover i { color: var(--vmx-danger); }

/* ---------------------------------------------------------- table */
.vd-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.vd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vd-table thead th {
	text-align: left; padding: 11px 13px; font-size: 11px; font-weight: var(--vmx-fw-label);
	letter-spacing: .4px; text-transform: uppercase; color: var(--vmx-muted);
	background: var(--vmx-white); border-bottom: 1px solid var(--vmx-line); white-space: nowrap;
}
.vd-table thead th.num, .vd-table tbody td.num { text-align: right; }
.vd-table tbody td {
	padding: 12px 13px; border-bottom: 1px solid var(--vmx-line2);
	color: var(--vmx-body); vertical-align: middle; white-space: nowrap;
}
.vd-table tbody td.wrap { white-space: normal; min-width: 150px; }
.vd-table tbody tr:last-child td { border-bottom: 0; }
.vd-vnum { font-weight: var(--vmx-fw-head); color: var(--vmx-ink); }
.vd-sub { display: block; font-size: 11.5px; color: var(--vmx-muted); margin-top: 2px; }
.vd-dash { color: #d1d5db; }

/* chips are outlined: blue for Out, green for Returned, accents elsewhere */
.vd-chip {
	display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
	padding: 3px 10px; font-size: 12px; font-weight: var(--vmx-fw-label); white-space: nowrap;
	border: 1px solid var(--vmx-line); color: var(--vmx-body); background: transparent;
}
.vd-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.vd-chip.is-out   { border-color: var(--vmx-progress); color: var(--vmx-progress-text); }
.vd-chip.is-back  { border-color: var(--vmx-success);  color: var(--vmx-success-text); }
.vd-chip.is-type  { border-color: #fcd9a4; color: var(--vmx-amber); }
.vd-chip.is-build { border-color: #d8c7f7; color: var(--vmx-violet); }

/* ---------------------------------------------------------- empty + loading */
.vd-empty { padding: 44px 22px; text-align: center; }
.vd-empty-ico {
	width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 13px;
	border: 1px solid var(--vmx-line); color: var(--vmx-violet);
	display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.vd-empty h4 { margin: 0 0 5px; font-size: 15px; font-weight: var(--vmx-fw-head); color: var(--vmx-ink); }
.vd-empty p { margin: 0 auto; font-size: 13px; color: var(--vmx-muted); max-width: 400px; line-height: 1.6; }
/* inside a chart card the empty state has to sit in far less room than in the table */
.vd-card-body .vd-empty { padding: 30px 10px; }
.vd-card-body .vd-empty-ico { width: 46px; height: 46px; font-size: 18px; border-radius: 14px; }

.vd-loading { padding: 40px 20px; text-align: center; color: var(--vmx-muted); font-size: 13px; }
.vd-spin {
	width: 26px; height: 26px; margin: 0 auto 12px; border-radius: 50%;
	border: 3px solid var(--vmx-line); border-top-color: var(--vmx-progress);
	animation: vdspin .7s linear infinite;
}
@keyframes vdspin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1100px) {
	.vd-stats  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.vd-charts { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
	.vd-hero { align-items: flex-start; }
	.vd-hero-r { width: 100%; }
	.vd-hero-r > * { flex: 1 1 auto; justify-content: center; }
	.vd-fsel, .vd-fsel select { width: 100%; max-width: none; }

	.vd-stats { grid-template-columns: minmax(0, 1fr); }
	.vd-card-body { min-height: 0; padding: 14px 12px; }
	.vd-card-head { gap: 8px; }

	.vd-search { flex: 1 1 100%; }
	.vd-filters .vd-clear { width: 100%; justify-content: center; }

	/* Cards, the panel and the table all reach the screen edges at this width, so the
	   table is the only thing allowed to scroll sideways. */
	.vd-cols { height: 150px; }
	.vd-col, .vd-axis-x { min-width: 30px; }
}

/* The Zone > Cluster > Building picker used by this page is shared with the register
   and the movement log, so its styles (.vm-bt-*) live in vehiclemovement_theme.css. */
