/* =============================================================================
   Salvage Yard Inventory — Front-end Portal
   Inherits typography, link colours, and layout widths from the active theme.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Portal wrapper & navigation
   ----------------------------------------------------------------------------- */

.syi-portal {
	margin: 0;
	box-sizing: border-box;
	width: 100%;
}

/* Portal header — yard name + user + theme toggle */
.syi-portal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	background: #1d2327;
	border-radius: 4px 4px 0 0;
	margin-bottom: 0;
	min-height: 52px;
}

.syi-portal-yard-name {
	font-size: 2em;
	font-weight: 500;
	color: #fff;
	letter-spacing: 0.02em;
}

.syi-portal-user {
	font-size: 12px;
	color: #a7aaad;
	margin-left: auto;
}

.syi-portal-header + .syi-portal-nav {
	margin-top: 1.25rem;
	margin-bottom: 1.5rem;
}

.syi-portal-nav {
	display: flex;
	flex-wrap: nowrap;
	gap: 4px;
	margin-bottom: 1.5rem;
	border-bottom: 2px solid #dcdcde;
	padding-bottom: 0;
}

.syi-portal-nav a {
	flex: 1;
	display: block;
	padding: 8px 12px;
	text-align: center;
	text-decoration: none;
	color: inherit;
	border: 1px solid transparent;
	border-bottom: none;
	border-radius: 3px 3px 0 0;
	margin-bottom: -2px;
	font-weight: 500;
	transition: background 0.15s;
}

.syi-portal-nav a:hover {
	background: #f6f7f7;
	color: inherit;
}

.syi-portal-nav a.syi-nav-active {
	background: #fff;
	border-color: #dcdcde #dcdcde #fff;
	color: #1d2327;
}


.syi-portal-section {
	padding: 0.25rem 0 1.5rem;
}

/* -----------------------------------------------------------------------------
   Notices
   ----------------------------------------------------------------------------- */

.syi-portal-notice,
.syi-notice {
	padding: 10px 14px;
	border-left: 4px solid #72aee6;
	background: #f0f6fc;
	margin-bottom: 1rem;
	border-radius: 0 3px 3px 0;
}

.syi-notice--success {
	border-color: #00a32a;
	background: #f0fdf4;
}

.syi-notice--error {
	border-color: #d63638;
	background: #fdf0f0;
}

.syi-notice p,
.syi-portal-notice p {
	margin: 0;
}

/* -----------------------------------------------------------------------------
   Buttons — base styles that inherit theme fonts
   ----------------------------------------------------------------------------- */

.syi-btn {
	display: inline-block;
	padding: 6px 14px;
	font-size: inherit;
	font-family: inherit;
	line-height: 1.5;
	cursor: pointer;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	background: #f6f7f7;
	color: #1d2327;
	text-decoration: none;
	vertical-align: middle;
	transition: background 0.15s, border-color 0.15s;
}

.syi-btn:hover {
	background: #f0f0f1;
	border-color: #1d2327;
	color: #1d2327;
	text-decoration: none;
}

.syi-btn-primary {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

.syi-btn-primary:hover {
	background: #135e96;
	border-color: #135e96;
	color: #fff;
}

.syi-btn-small {
	padding: 3px 10px;
	font-size: 0.875em;
}

.syi-btn-danger {
	color: #b32d2e;
	border-color: #b32d2e;
}

.syi-btn-danger:hover {
	background: #fdf0f0;
}

.syi-btn:disabled,
.syi-btn[disabled] {
	opacity: 0.6;
	cursor: default;
}

/* -----------------------------------------------------------------------------
   Page headings & actions row
   ----------------------------------------------------------------------------- */

.syi-page-header {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}

.syi-page-header h2 {
	margin: 0;
}

/* -----------------------------------------------------------------------------
   Filter / search bar
   ----------------------------------------------------------------------------- */

.syi-filter-bar {
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 16px 20px;
	margin-bottom: 1.25rem;
	box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.syi-filter-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.syi-filter-row label {
	font-weight: 600;
	white-space: nowrap;
}

.syi-filter-row input[type="text"],
.syi-filter-row input[type="search"],
.syi-filter-row input[type="number"],
.syi-filter-row input[type="date"],
.syi-filter-row select {
	font-family: inherit;
	font-size: inherit;
	padding: 5px 8px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	background: #fff;
}

/* Stacked label:field layout — each row is a 2-col grid so all fields line up */
.syi-filter-row--stacked {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
	width: 100%;
	max-width: 480px;
}

@media (min-width: 900px) {
	.syi-filter-row--stacked {
		display: grid;
		grid-template-columns: 1fr 1fr;
		max-width: none;
		gap: 8px 48px;
	}

	.syi-filter-actions {
		grid-column: 1 / -1;
		padding-left: calc(110px + 16px);
	}
}

.syi-filter-field {
	display: grid;
	grid-template-columns: 110px 1fr;
	align-items: center;
	column-gap: 16px;
	width: 100%;
	text-align: left;
}

.syi-filter-field label {
	text-align: left;
	font-weight: 600;
	color: #3c434a;
	white-space: nowrap;
}

.syi-filter-field select,
.syi-filter-field input[type="text"],
.syi-filter-field input[type="search"],
.syi-filter-field input[type="number"] {
	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
	font-size: inherit;
	padding: 6px 10px;
	border: 1px solid #c5c9ce;
	border-radius: 4px;
	background: #fff;
	box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
	transition: border-color 0.15s, box-shadow 0.15s;
}

.syi-filter-field select:focus,
.syi-filter-field input:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 2px rgba(34,113,177,0.18);
}

.syi-filter-actions {
	display: flex;
	gap: 8px;
	padding-left: calc(110px + 16px);
	margin-top: 2px;
}

/* -----------------------------------------------------------------------------
   Tables
   ----------------------------------------------------------------------------- */

.syi-table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin-bottom: 1rem;
}

.syi-table {
	width: 100%;
	border-collapse: collapse;
	font-size: inherit;
	min-width: 500px;
}

.syi-table th,
.syi-table td {
	padding: 8px 10px;
	text-align: left;
	border-bottom: 1px solid #dcdcde;
	vertical-align: middle;
}

.syi-table th {
	background: #f6f7f7;
	font-weight: 600;
}

.syi-table tbody tr:hover {
	background: #f9f9f9;
}

.syi-table .syi-actions {
	white-space: nowrap;
}

.syi-table .syi-actions a {
	margin-right: 4px;
}

/* Vehicle thumbnail in list */
.syi-list-vehicle-cell {
	display: flex;
	align-items: center;
	gap: 10px;
}

.syi-list-thumb {
	flex-shrink: 0;
}

.syi-list-thumb img {
	width: 48px;
	height: 36px;
	object-fit: cover;
	border-radius: 3px;
	display: block;
}

/* Results count */
.syi-results-count {
	color: #646970;
	margin: 0.5rem 0 0.75rem;
}

/* -----------------------------------------------------------------------------
   Status badges (shared with admin)
   ----------------------------------------------------------------------------- */

.syi-status {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 0.8em;
	font-weight: 600;
	text-transform: capitalize;
	white-space: nowrap;
}

.syi-status--active    { background: #d8f5e1; color: #1d6a36; }
.syi-status--available { background: #d8f5e1; color: #1d6a36; }
.syi-status--stripped  { background: #fff3cd; color: #7d5a00; }
.syi-status--crushed   { background: #f0d5d5; color: #8b1a1a; }
.syi-status--sold      { background: #e0e0e0; color: #3c3c3c; }
.syi-status--missing   { background: #fdefd3; color: #7d4300; }

/* -----------------------------------------------------------------------------
   Vehicle header (detail view)
   ----------------------------------------------------------------------------- */

.syi-vehicle-header {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 1rem 1.25rem;
	margin-bottom: 1.5rem;
	align-items: flex-start;
}

.syi-vehicle-image img {
	width: 200px;
	height: 140px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}

.syi-vehicle-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	flex: 1;
}

.syi-vehicle-meta-item {
	display: flex;
	flex-direction: column;
	min-width: 100px;
}

.syi-meta-label {
	font-size: 0.75em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #646970;
}

.syi-meta-value {
	font-weight: 500;
}

.syi-vehicle-notes {
	width: 100%;
	padding-top: 0.5rem;
	border-top: 1px solid #dcdcde;
	color: #3c434a;
}

/* -----------------------------------------------------------------------------
   Inventory table (vehicle detail)
   ----------------------------------------------------------------------------- */

.syi-category-group {
	margin-bottom: 1.5rem;
}

.syi-category-heading {
	font-size: 0.9em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #646970;
	margin: 0 0 0.4rem;
	padding-bottom: 4px;
	border-bottom: 2px solid #dcdcde;
}

.syi-inventory-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 0.5rem;
}

.syi-inventory-table th,
.syi-inventory-table td {
	padding: 7px 8px;
	text-align: left;
	border-bottom: 1px solid #ececec;
	vertical-align: middle;
}

.syi-inventory-table th {
	background: #f6f7f7;
	font-weight: 600;
	font-size: 0.85em;
}

.syi-inventory-table .col-part    { width: 22%; }
.syi-inventory-table .col-condition { width: 110px; }
.syi-inventory-table .col-price   { width: 110px; }
.syi-inventory-table .col-status  { width: 110px; }
.syi-inventory-table .col-notes   { }
.syi-inventory-table .col-save    { width: 90px; white-space: nowrap; }
.syi-inventory-table .col-sell    { width: 70px; }

.syi-field {
	font-family: inherit;
	font-size: 0.9em;
	padding: 4px 6px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	width: 100%;
	box-sizing: border-box;
	background: #fff;
}

.syi-price-field { width: 80px; }

.syi-save-feedback {
	font-size: 0.8em;
	margin-left: 4px;
}

.syi-feedback-ok  { color: #00a32a; }
.syi-feedback-err { color: #d63638; }

/* Sell button */
.syi-sell-btn {
	background: #f0ad4e;
	border-color: #e09b3d;
	color: #fff;
	padding: 4px 10px;
	font-size: 0.85em;
	font-family: inherit;
	border-radius: 3px;
	cursor: pointer;
	white-space: nowrap;
	border-style: solid;
}

.syi-sell-btn:hover {
	background: #e09b3d;
}

.syi-sold-label {
	color: #3c434a;
	font-size: 0.85em;
}

/* -----------------------------------------------------------------------------
   Form layout (add / edit vehicle)
   ----------------------------------------------------------------------------- */

.syi-form-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
	.syi-form-layout {
		grid-template-columns: 1fr;
	}
}

.syi-form-section {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 1rem 1.25rem;
}

.syi-form-section h3 {
	margin: 0 0 0.75rem;
	font-size: 1em;
	font-weight: 700;
	border-bottom: 1px solid #ececec;
	padding-bottom: 0.5rem;
}

.syi-form-section--full {
	grid-column: 1 / -1;
}

.syi-form-table {
	width: 100%;
	border-collapse: collapse;
}

.syi-form-table th,
.syi-form-table td {
	padding: 8px 6px;
	vertical-align: middle;
	text-align: left;
}

.syi-form-table th {
	width: 130px;
	font-weight: 600;
	color: #3c434a;
	white-space: nowrap;
}

.syi-form-table input[type="text"],
.syi-form-table input[type="number"],
.syi-form-table select,
.syi-form-table textarea {
	font-family: inherit;
	font-size: inherit;
	padding: 6px 8px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	background: #fff;
	width: 100%;
	box-sizing: border-box;
}

.syi-form-table input.syi-narrow { width: 100px; }
.syi-form-table input.syi-medium { width: 200px; }

.syi-form-notes {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #ececec;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.syi-form-notes label {
	font-weight: 600;
	color: #3c434a;
}

.syi-form-notes textarea {
	font-family: inherit;
	font-size: inherit;
	padding: 6px 8px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	background: #fff;
	width: 100%;
	box-sizing: border-box;
	resize: vertical;
}

.syi-form-description {
	font-size: 0.85em;
	color: #646970;
	margin: 3px 0 0;
}

.syi-required { color: #d63638; }

/* VIN lookup row */
.syi-vin-row {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

.syi-vin-row input {
	flex: 1;
	min-width: 200px;
}

.syi-vin-feedback {
	font-size: 0.85em;
}

.syi-vin-feedback--success { color: #00a32a; }
.syi-vin-feedback--error   { color: #d63638; }

/* Image upload area */
.syi-image-upload-area {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.syi-image-preview img {
	max-width: 280px;
	max-height: 200px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
	border: 1px solid #dcdcde;
}

.syi-image-actions {
	display: flex;
	gap: 8px;
}

/* Submit row */
.syi-form-submit {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
	padding-top: 0.75rem;
	border-top: 1px solid #dcdcde;
}

/* Breadcrumb */
.syi-breadcrumb {
	color: #646970;
	margin-bottom: 1rem;
	font-size: 0.9em;
}

.syi-breadcrumb a {
	color: inherit;
}

/* -----------------------------------------------------------------------------
   Sale recording modal (shared with admin)
   ----------------------------------------------------------------------------- */

.syi-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
}

.syi-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.5);
}

.syi-modal-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	border-radius: 6px;
	padding: 1.5rem;
	width: 90%;
	max-width: 520px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.syi-modal-content h2 {
	margin: 0 0 0.25rem;
	font-size: 1.1em;
}

.syi-modal-part-name {
	color: #646970;
	font-size: 0.9em;
	margin: 0 0 1rem;
}

.syi-modal-form {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1rem;
}

.syi-modal-form th,
.syi-modal-form td {
	padding: 7px 6px;
	vertical-align: middle;
}

.syi-modal-form th {
	width: 120px;
	font-weight: 600;
	text-align: left;
}

.syi-modal-form input[type="number"],
.syi-modal-form input[type="text"],
.syi-modal-form input[type="tel"],
.syi-modal-form input[type="date"] {
	font-family: inherit;
	font-size: inherit;
	padding: 5px 8px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	width: 100%;
	box-sizing: border-box;
}

.syi-currency-prefix {
	margin-right: 4px;
	font-weight: 600;
}

.syi-modal-error {
	background: #fdf0f0;
	border-left: 4px solid #d63638;
	padding: 8px 12px;
	margin-bottom: 0.75rem;
	border-radius: 0 3px 3px 0;
	font-size: 0.9em;
}

.syi-modal-error p { margin: 0; }

.syi-modal-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
}

/* -----------------------------------------------------------------------------
   Sales summary bar
   ----------------------------------------------------------------------------- */

.syi-sales-summary {
	display: flex;
	gap: 1.5rem;
	background: #f0f6fc;
	border: 1px solid #c5d9ed;
	border-radius: 4px;
	padding: 10px 16px;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}

.syi-summary-item {
	display: flex;
	flex-direction: column;
}

.syi-summary-number {
	font-size: 1.4em;
	font-weight: 700;
	line-height: 1.2;
}

.syi-summary-label {
	font-size: 0.8em;
	color: #646970;
}

/* -----------------------------------------------------------------------------
   Pagination
   ----------------------------------------------------------------------------- */

.syi-pagination {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0.75rem 0;
	flex-wrap: wrap;
}

.syi-pagination .syi-page-current {
	display: inline-block;
	padding: 6px 10px;
	background: #2271b1;
	color: #fff;
	border-radius: 3px;
	font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Report stat cards (shared with admin)
   ----------------------------------------------------------------------------- */

.syi-report-stat-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1rem;
	margin-bottom: 1.75rem;
}

.syi-report-card {
	display: flex;
	flex-direction: column;
	padding: 1rem 1.25rem;
	border-radius: 6px;
	border: 1px solid #dcdcde;
	background: #f6f7f7;
}

.syi-report-card--revenue { border-left: 4px solid #2271b1; }
.syi-report-card--year    { border-left: 4px solid #00a32a; }
.syi-report-card--month   { border-left: 4px solid #f0ad4e; }
.syi-report-card--inventory { border-left: 4px solid #8c8f94; }

.syi-report-card-value {
	font-size: 1.6em;
	font-weight: 700;
	line-height: 1.2;
}

.syi-report-card-label {
	font-weight: 600;
	font-size: 0.85em;
	margin-top: 2px;
}

.syi-report-card-sub {
	font-size: 0.8em;
	color: #646970;
	margin-top: 2px;
}

/* -----------------------------------------------------------------------------
   Bar chart (reports — 12-month revenue)
   ----------------------------------------------------------------------------- */

.syi-report-section {
	margin-bottom: 2rem;
}

.syi-report-section > h2 {
	font-size: 1em;
	font-weight: 700;
	margin-bottom: 0.75rem;
}

.syi-report-two-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	margin-bottom: 2rem;
}

@media (max-width: 720px) {
	.syi-report-two-col { grid-template-columns: 1fr; }
}

.syi-bar-chart {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.syi-bar-row {
	display: grid;
	grid-template-columns: 60px 1fr 120px 80px;
	align-items: center;
	gap: 8px;
	font-size: 0.85em;
}

.syi-bar-label {
	text-align: right;
	color: #646970;
	white-space: nowrap;
}

.syi-bar-track {
	background: #ececec;
	border-radius: 3px;
	height: 18px;
	overflow: hidden;
}

.syi-bar-fill {
	background: #2271b1;
	height: 100%;
	border-radius: 3px;
	transition: width 0.3s ease;
}

.syi-bar-row--empty .syi-bar-fill { background: #c0c4c7; }
.syi-bar-amount { font-weight: 600; white-space: nowrap; }
.syi-bar-zero   { color: #8c8f94; }
.syi-bar-count  { color: #646970; white-space: nowrap; }

/* -----------------------------------------------------------------------------
   Report tables
   ----------------------------------------------------------------------------- */

.syi-report-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}

.syi-report-table th,
.syi-report-table td {
	padding: 7px 8px;
	border-bottom: 1px solid #ececec;
	text-align: left;
	vertical-align: middle;
}

.syi-report-table th { background: #f6f7f7; font-weight: 600; }

.syi-col-rank { width: 30px; color: #646970; font-weight: 600; }
.syi-col-num  { text-align: right; white-space: nowrap; }
.syi-revenue-cell { font-weight: 600; color: #1d6a36; }

/* Inline mini-bar inside report table */
.syi-inline-bar {
	height: 4px;
	background: #ececec;
	border-radius: 2px;
	margin-top: 4px;
	overflow: hidden;
}

.syi-inline-bar-fill {
	background: #2271b1;
	height: 100%;
}

/* -----------------------------------------------------------------------------
   Inventory health stacked bar
   ----------------------------------------------------------------------------- */

.syi-health-bar-cell { min-width: 160px; }

.syi-health-bar {
	display: flex;
	height: 16px;
	border-radius: 3px;
	overflow: hidden;
	background: #ececec;
	margin-bottom: 3px;
}

.syi-health-seg { height: 100%; }
.syi-health-seg--available { background: #00a32a; }
.syi-health-seg--sold      { background: #8c8f94; }
.syi-health-seg--missing   { background: #f0ad4e; }

.syi-health-pct-label { font-size: 0.75em; color: #646970; }

.syi-health-legend {
	display: flex;
	gap: 12px;
	margin-top: 0.75rem;
	flex-wrap: wrap;
}

.syi-legend-item {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 0.85em;
}

.syi-legend-item::before {
	content: '';
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 2px;
}

.syi-legend--available::before { background: #00a32a; }
.syi-legend--sold::before      { background: #8c8f94; }
.syi-legend--missing::before   { background: #f0ad4e; }

/* -----------------------------------------------------------------------------
   Column availability colours
   ----------------------------------------------------------------------------- */
.syi-col-available { color: #1d6a36; }
.syi-col-sold      { color: #3c434a; }
.syi-col-missing   { color: #7d4300; }

/* -----------------------------------------------------------------------------
   Empty state
   ----------------------------------------------------------------------------- */

.syi-empty-state {
	padding: 2rem;
	text-align: center;
	color: #646970;
	border: 1px dashed #dcdcde;
	border-radius: 4px;
}

/* Input display helpers */
.syi-input-vin        { text-transform: uppercase; }
.syi-input-capitalize { text-transform: capitalize; }
