:root {
    --army-green-950: #0f1b12;
    --army-green-900: #16241a;
    --army-green-800: #1f3325;
    --army-green-700: #2a4531;
    --army-accent: #4c7a3f;
    --army-gold: #c9a227;
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 68px;
    --navbar-height: 48px;
    --surface: #f3f5f3;
    --card-radius: 0.35rem;
    --text-body: #1f2a24;
    --border-soft: #dfe5e0;
    --font-size-base: 0.875rem;
    --font-size-sm: 0.8125rem;
    --font-size-xs: 0.75rem;
    --control-height: 1.9rem;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--surface);
    color: var(--text-body);
    font-size: var(--font-size-base);
    line-height: 1.4;
}

/* ---------------- Layout Shell ---------------- */
.app-wrapper {
    min-height: 100vh;
}

.app-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: linear-gradient(90deg, var(--army-green-950), var(--army-green-800));
    z-index: 1040;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

.brand-icon {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: var(--army-gold);
    color: var(--army-green-950);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.brand-text {
    color: #fff;
    font-weight: 600;
    letter-spacing: .2px;
    font-size: 0.9rem;
}

.avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* ---------------- Sidebar ---------------- */
.app-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--army-green-900);
    z-index: 1030;
    transition: transform .25s ease, width .25s ease;
    overflow-y: auto;
}

.sidebar-inner { padding: 0.65rem 0.55rem; }

.sidebar-menu-title {
    color: rgba(255,255,255,.42);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: .07em;
    margin: 0.75rem 0.65rem 0.3rem;
}
.sidebar-menu-title:first-child { margin-top: .2rem; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem .7rem;
    border-radius: .35rem;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    font-size: var(--font-size-sm);
    margin-bottom: .1rem;
    transition: background .15s ease, color .15s ease;
    min-height: 2.15rem;
    white-space: nowrap;
}

.sidebar-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-link span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link:hover:not(.disabled) {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar-link.active {
    background: var(--army-gold);
    color: var(--army-green-950);
    font-weight: 600;
}

.sidebar-link.disabled {
    opacity: .4;
    pointer-events: none;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1020;
}

.app-wrapper.sidebar-collapsed .app-sidebar { width: var(--sidebar-width-collapsed); }
.app-wrapper.sidebar-collapsed .app-sidebar .brand-text,
.app-wrapper.sidebar-collapsed .app-sidebar .sidebar-menu-title,
.app-wrapper.sidebar-collapsed .app-sidebar .sidebar-link span { display: none; }
.app-wrapper.sidebar-collapsed .app-content { margin-left: var(--sidebar-width-collapsed); }

/* ---------------- Content Area ---------------- */
.app-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.app-content > .container-fluid {
    padding: 0.75rem 1rem !important;
}

.app-breadcrumb {
    font-size: var(--font-size-xs);
    margin-bottom: 0.4rem !important;
}

.app-breadcrumb .breadcrumb {
    margin-bottom: 0;
    --bs-breadcrumb-divider-color: #9aa69e;
}

.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    font-size: var(--font-size-xs);
}

.app-page-header {
    margin-bottom: 0.75rem !important;
    gap: 0.5rem;
}

.app-page-header .page-title,
.app-page-header h1,
.app-page-header .h4,
.app-page-header .h5 {
    font-size: 1.25rem; /* ~20px */
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.1rem !important;
}

.app-page-header .text-muted.small,
.app-page-header p.small {
    font-size: var(--font-size-xs);
    margin-bottom: 0 !important;
}

.app-footer {
    margin-top: auto;
    background: #fff;
    border-top: 1px solid var(--border-soft);
}

.app-footer > div {
    padding: 0.45rem 1rem !important;
}

/* ---------------- Cards / Stats ---------------- */
.app-content .card {
    border-radius: var(--card-radius);
    box-shadow: 0 1px 2px rgba(15, 27, 18, 0.04) !important;
}

.app-content .card-header {
    padding: 0.55rem 0.85rem;
    background: #fff;
}

.app-content .card-header .h6,
.app-content .card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0;
}

.app-content .card-body {
    padding: 0.75rem 0.85rem !important;
}

.app-content .card-body.p-4,
.app-content .card-body.p-5 {
    padding: 0.75rem 0.85rem !important;
}

.stat-card .card-body {
    padding: 0.65rem 0.75rem !important;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-card .fs-4 {
    font-size: 1.15rem !important;
    line-height: 1.2;
}

.stat-card .text-muted.small {
    font-size: var(--font-size-xs);
}

/* ---------------- Forms ---------------- */
.app-content .form-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: 0.2rem;
    color: #314038;
}

.app-content .form-control,
.app-content .form-select {
    min-height: var(--control-height);
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-sm);
    border-radius: 0.3rem;
    border-color: #cfd8d2;
}

.app-content .form-control-sm,
.app-content .form-select-sm {
    min-height: 1.7rem;
    padding: 0.15rem 0.4rem;
    font-size: var(--font-size-xs);
}

.app-content textarea.form-control {
    min-height: 2.5rem;
}

.app-content .form-text,
.app-content small.text-muted {
    font-size: var(--font-size-xs);
}

.app-content .input-group-text {
    min-height: var(--control-height);
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-sm);
}

.app-content .row.g-3 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.65rem;
}

.app-content .row.g-2 {
    --bs-gutter-x: 0.55rem;
    --bs-gutter-y: 0.45rem;
}

.app-content .form-check {
    font-size: var(--font-size-sm);
    min-height: 1.25rem;
}

.app-content .form-check.p-3 {
    padding: 0.55rem 0.7rem !important;
}

/* Tom Select compact */
.app-content .ts-wrapper.form-select,
.app-content .ts-wrapper.single .ts-control {
    min-height: var(--control-height);
    padding: 0.15rem 0.45rem;
    font-size: var(--font-size-sm);
    border-radius: 0.3rem;
}

.app-content .ts-wrapper.single .ts-control {
    display: flex;
    align-items: center;
}

.app-content .ts-dropdown {
    font-size: var(--font-size-sm);
}

/* ---------------- Tables ---------------- */
.app-content .table {
    font-size: var(--font-size-sm);
    margin-bottom: 0;
    --bs-table-cell-padding-y: 0.35rem;
    --bs-table-cell-padding-x: 0.5rem;
}

.app-content .table > :not(caption) > * > * {
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
}

.app-content .table thead th {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: none;
    white-space: nowrap;
    background: #eef2ef;
    color: #2c3a32;
    border-bottom-width: 1px;
}

.app-content .table-bordered > :not(caption) > * > * {
    padding: 0.3rem 0.4rem;
}

.app-content #repairRowsTable .form-select,
.app-content #repairRowsTable .form-control {
    min-height: 1.7rem;
    font-size: var(--font-size-xs);
}

/* ---------------- Buttons ---------------- */
.app-content .btn {
    --bs-btn-padding-y: 0.28rem;
    --bs-btn-padding-x: 0.65rem;
    --bs-btn-font-size: var(--font-size-sm);
    --bs-btn-border-radius: 0.3rem;
    font-weight: 500;
}

.app-content .btn-sm {
    --bs-btn-padding-y: 0.15rem;
    --bs-btn-padding-x: 0.4rem;
    --bs-btn-font-size: var(--font-size-xs);
}

.app-content .btn-lg {
    --bs-btn-padding-y: 0.35rem;
    --bs-btn-padding-x: 0.75rem;
    --bs-btn-font-size: var(--font-size-sm);
}

.btn-army {
    background-color: var(--army-green-800);
    border-color: var(--army-green-800);
    color: #fff;
    font-weight: 600;
    border-radius: 0.3rem;
}
.btn-army:hover, .btn-army:focus {
    background-color: var(--army-green-700);
    border-color: var(--army-green-700);
    color: #fff;
}

/* ---------------- Badges / Alerts / Modals ---------------- */
.app-content .badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25em 0.45em;
    border-radius: 0.25rem;
}

.app-content .alert {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
    margin-bottom: 0.65rem;
    border-radius: 0.3rem;
}

.app-content .alert.small,
.app-content .alert.py-2 {
    padding: 0.4rem 0.65rem !important;
}

.app-content .modal-header,
.app-content .modal-footer {
    padding: 0.65rem 0.85rem;
}

.app-content .modal-body {
    padding: 0.75rem 0.85rem;
    font-size: var(--font-size-sm);
}

.app-content .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.app-content .modal-content {
    border-radius: 0.4rem;
}

.app-content hr {
    margin: 0.75rem 0;
    opacity: 0.12;
}

.app-content dl.row {
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

.app-content dl.row > dt,
.app-content dl.row > dd {
    margin-bottom: 0.35rem;
    padding-top: 0.05rem;
    padding-bottom: 0.05rem;
}

.app-content dl.row > dt {
    font-weight: 500;
}

.app-content .pagination {
    --bs-pagination-padding-x: 0.5rem;
    --bs-pagination-padding-y: 0.25rem;
    --bs-pagination-font-size: var(--font-size-sm);
    margin-bottom: 0;
}

/* Utility density helpers used across pages */
.app-content .mb-4 { margin-bottom: 0.85rem !important; }
.app-content .mt-4 { margin-top: 0.85rem !important; }
.app-content .my-4 { margin-top: 0.85rem !important; margin-bottom: 0.85rem !important; }
.app-content .py-4 { padding-top: 0.85rem !important; padding-bottom: 0.85rem !important; }
.app-content .gap-2 { gap: 0.4rem !important; }

/* ---------------- Login Page ---------------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, var(--army-green-800), var(--army-green-950));
    font-family: 'Inter', sans-serif;
    padding: 1rem;
}

.login-wrapper { width: 100%; max-width: 380px; }

.login-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.35rem 1.25rem;
}

.login-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--army-green-900);
    color: var(--army-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.login-card .form-control {
    min-height: var(--control-height);
    padding: 0.3rem 0.55rem;
    font-size: var(--font-size-sm);
}

.login-card .btn {
    --bs-btn-padding-y: 0.35rem;
    --bs-btn-font-size: var(--font-size-sm);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: min(260px, 85vw);
    }
    .app-wrapper.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-wrapper.sidebar-open .sidebar-backdrop { display: block; }
    .app-content { margin-left: 0 !important; }
    .app-content > .container-fluid {
        padding: 0.65rem 0.75rem !important;
    }
}

@media (max-width: 575.98px) {
    .login-card { padding: 1.1rem 0.95rem; }
    .app-page-header .page-title,
    .app-page-header h1,
    .app-page-header .h4 {
        font-size: 1.1rem;
    }
    .brand-text { font-size: 0.82rem; }
}
.table-responsive {
    overflow: visible;
}
#repairRowsTable {
    overflow: visible;
}