:root {
    --ars-primary: #2563eb;
    --ars-primary-dark: #1d4ed8;
    --bs-primary: var(--ars-primary);
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.btn-primary {
    --bs-btn-bg: var(--ars-primary);
    --bs-btn-border-color: var(--ars-primary);
    --bs-btn-hover-bg: var(--ars-primary-dark);
    --bs-btn-hover-border-color: var(--ars-primary-dark);
    --bs-btn-active-bg: var(--ars-primary-dark);
    --bs-btn-disabled-bg: var(--ars-primary);
    --bs-btn-disabled-border-color: var(--ars-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--ars-primary);
    --bs-btn-border-color: var(--ars-primary);
    --bs-btn-hover-bg: var(--ars-primary);
    --bs-btn-hover-border-color: var(--ars-primary);
    --bs-btn-active-bg: var(--ars-primary-dark);
}

/* Auth pages (login / setup) */
.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(37, 99, 235, .12), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(14, 165, 233, .12), transparent 40%),
        #f4f6fb;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border: 0;
    border-radius: 1rem;
}

.auth-card-lg {
    max-width: 520px;
}

.brand-logo {
    display: block;
    width: 160px;
    height: 160px;
    margin-inline: auto;
    object-fit: cover;
    border-radius: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}

.navbar-logo {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: .5rem;
}

.brand-icon {
    width: 64px;
    height: 64px;
    margin-inline: auto;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    font-size: 1.75rem;
    color: #fff;
    background: linear-gradient(135deg, var(--ars-primary), #0ea5e9);
    box-shadow: 0 8px 20px rgba(37, 99, 235, .3);
}

.form-label {
    font-size: .875rem;
    font-weight: 500;
}

.input-group-text {
    background-color: #f8f9fb;
    color: #6c757d;
}

.form-control:focus {
    border-color: var(--ars-primary);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15);
}

.btn {
    font-weight: 500;
}

/* Admin layout */
.admin-page {
    --sidebar-width: 260px;
    --sidebar-bg: #111827;
    --sidebar-text: #9ca3af;
    background: #f4f6fb;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-page .sidebar {
    /* !important beats Bootstrap's transparent background on .offcanvas-lg */
    background-color: var(--sidebar-bg) !important;
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 0;
        width: var(--sidebar-width);
        height: 100vh;
        flex-shrink: 0;
        overflow-y: auto;
    }
}

@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg {
        --bs-offcanvas-width: var(--sidebar-width);
        --bs-offcanvas-bg: var(--sidebar-bg);
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: .6rem;
    object-fit: cover;
}

.sidebar-brand-sub {
    font-size: .75rem;
    color: var(--sidebar-text);
}

.sidebar-nav {
    flex: 1;
    padding: .75rem;
}

.sidebar-section {
    padding: 1rem .75rem .4rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6b7280;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .75rem;
    margin-bottom: 2px;
    border-radius: .5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .925rem;
}

.sidebar-link i {
    font-size: 1.05rem;
}

a.sidebar-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.sidebar-link.active {
    background: var(--ars-primary);
    color: #fff;
}

.sidebar-link.disabled {
    opacity: .55;
    cursor: default;
}

.sidebar-link .badge {
    background: rgba(255, 255, 255, .1);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: .65rem;
}

.sidebar-link .badge.badge-alert {
    background: #f59e0b;
    color: #111827;
    font-weight: 600;
}

.sidebar-footer {
    padding: .75rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.topbar-date {
    font-size: .8rem;
    color: #6b7280;
}

.avatar {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--ars-primary);
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
}

.admin-footer {
    padding: 1rem 1.5rem;
    font-size: .8rem;
    color: #6b7280;
}

@media (max-width: 575.98px) {
    .topbar { padding: .75rem 1rem; }
    .admin-content { padding: 1rem; }
}

/* Dashboard cards */
.admin-page .card {
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.admin-page .card-header {
    background: transparent;
    border-bottom: 1px solid #eef0f3;
    padding: 1rem 1.25rem;
}

.admin-page .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.admin-page .card-subtitle {
    font-size: .8rem;
    color: #6b7280;
    margin-top: .15rem;
}

.admin-page .table > :not(caption) > * > * {
    padding: .7rem 1.25rem;
}

.admin-page .table thead th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    background: #f9fafb;
}

.admin-page .list-group-item {
    padding: .75rem 1.25rem;
}

.stat-label {
    font-size: .8rem;
    font-weight: 500;
    color: #6b7280;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.3;
    margin-top: .25rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: .65rem;
    font-size: 1.25rem;
}

.stat-meta {
    margin-top: .75rem;
    font-size: .8rem;
    color: #6b7280;
}

.chart-wrap {
    position: relative;
    height: 300px;
}

.chart-empty {
    position: absolute;
    inset: 0 0 2rem 3rem;
    display: grid;
    place-items: center;
    color: #9ca3af;
    font-size: .9rem;
    pointer-events: none;
}

.status-list li + li {
    margin-top: 1.1rem;
}

.status-list .progress {
    height: 6px;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 2.5rem 1rem;
}

.empty-state i {
    display: block;
    font-size: 2rem;
    margin-bottom: .5rem;
}

.rank {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--ars-primary);
    font-size: .75rem;
    font-weight: 600;
}

/* Master records */
.table-actions {
    white-space: nowrap;
    text-align: end;
}

/* DataTables */
.dt-container .dt-search input {
    width: 260px;
    max-width: 100%;
    margin-left: 0;
}

.dt-container .dt-length select {
    margin-right: .35rem;
}

.dt-container .dt-info {
    font-size: .85rem;
    color: #6b7280;
}

.dt-container .dt-processing {
    z-index: 5;
}

.admin-page table.dataTable > thead > tr > th {
    font-size: .7rem;
    line-height: 1.3;
    vertical-align: middle;
    /* Same dark tone as the sidebar */
    background-color: var(--sidebar-bg);
    color: #e5e7eb;
    border-bottom: 0;
}

.admin-page table.dataTable > thead > tr > th:first-child {
    border-top-left-radius: .5rem;
}

.admin-page table.dataTable > thead > tr > th:last-child {
    border-top-right-radius: .5rem;
}

/* Sorted column stands out in white */
.admin-page table.dataTable > thead > tr > th.dt-ordering-asc,
.admin-page table.dataTable > thead > tr > th.dt-ordering-desc {
    color: #fff;
}

.admin-page table.dataTable > thead > tr > th.dt-orderable-asc:hover,
.admin-page table.dataTable > thead > tr > th.dt-orderable-desc:hover {
    background-color: #1f2937;
    outline: none;
}

.table-actions .btn {
    --bs-btn-padding-y: .2rem;
    --bs-btn-padding-x: .45rem;
}

.form-section-title {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: .75rem;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    margin-inline: auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger);
    font-size: 1.5rem;
}

.required::after {
    content: " *";
    color: var(--bs-danger);
}

/* Uppercase inputs keep a normal-case placeholder */
.text-uppercase::placeholder {
    text-transform: none;
}

/* Only highlight invalid fields; valid ones keep their normal look */
.was-validated .form-control:valid {
    border-color: var(--bs-border-color);
    background-image: none;
    padding-right: .75rem;
}

.was-validated .form-select:valid {
    --bs-form-select-bg-icon: none;
    border-color: var(--bs-border-color);
}

.was-validated .form-control:valid:focus,
.was-validated .form-select:valid:focus {
    border-color: var(--ars-primary);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15);
}

/* Compact cells so wide record tables (e.g. vehicles) fit without collapsing */
.admin-page table.dataTable {
    font-size: .9rem;
}

.admin-page table.dataTable > :not(caption) > * > * {
    padding: .6rem .75rem;
}

.admin-page table.dataTable .plate {
    font-size: .8rem;
    letter-spacing: .03em;
}

/* Job orders: numbered customer request lines */
.request-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
}

.request-no {
    flex: 0 0 1.75rem;
    text-align: end;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
}

.request-preview {
    max-width: 16rem;
}

/* Sales: line items and totals */
.sale-items > thead th {
    font-size: .75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.sale-items .line-amount {
    font-variant-numeric: tabular-nums;
}

/* Line up every cell with the inputs, even when a part shows its stock line underneath:
   cells start at the top, and text-only cells (badge, amount) are one input-height tall. */
.sale-items > tbody > tr > td {
    vertical-align: top;
}

.sale-items > tbody > tr > td:not(:has(input:not([type="hidden"]), select, .form-text)) {
    line-height: calc(1.8125rem + 2px); /* height of a .form-control-sm */
}

.sale-totals {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .5rem 1rem;
    padding: 1rem;
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
}

.sale-totals dt {
    font-weight: 500;
    color: var(--bs-secondary-color);
}

.sale-totals dd {
    margin: 0;
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.sale-totals .total {
    padding-top: .5rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bs-body-color);
}

/* Parts: % / ₱ mark up selector beside the amount */
.markup-type {
    width: 4.5rem;
}
