:root {
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #ccfbf1;
    --sidebar-bg: #0b1f2a;
    --sidebar-fg: #b7c6cf;
    --sidebar-active: #14b8a6;
    --app-bg: #f3f6f9;
    --bs-primary: #0f766e;
    --bs-primary-rgb: 15, 118, 110;
    --bs-link-color: #0f766e;
    --bs-link-color-rgb: 15, 118, 110;
    --bs-link-hover-color: #115e59;
    --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Nastaliq Urdu", sans-serif;
}

body.app-body { background: var(--app-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-dark); }
.text-bg-primary { background-color: var(--brand) !important; }
.form-control:focus, .form-select:focus { border-color: #5eead4; box-shadow: 0 0 0 .2rem rgba(20, 184, 166, .2); }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--sidebar-bg) !important; color: var(--sidebar-fg); flex-shrink: 0; }
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg { background: var(--sidebar-bg); }
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #14b8a6, #0ea5e9); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.brand-text { color: #fff; font-weight: 600; letter-spacing: .2px; }
.sidebar-nav { padding: .5rem .6rem 2rem; }
.nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: #6b8594; margin: 1rem .6rem .35rem; font-weight: 600; }
.sidebar .nav-link { display: flex; align-items: center; gap: .7rem; color: var(--sidebar-fg); padding: .48rem .7rem; border-radius: .5rem; font-size: .88rem; }
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: rgba(20,184,166,.16); color: #fff; box-shadow: inset 3px 0 0 var(--sidebar-active); }
.sidebar .nav-link:focus-visible { outline: 2px solid var(--sidebar-active); outline-offset: 1px; }

.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: .6rem 1.25rem; background: #fff; border-bottom: 1px solid #e5e9ef; }
.topbar-search { position: relative; width: min(460px, 50vw); }
.topbar-search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.topbar-search input { padding-left: 2.2rem; background: #f1f5f9; border-color: transparent; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.content { padding: 1.25rem; flex: 1; }
@media (min-width: 1200px) { .content { padding: 1.5rem 2rem; } }
.app-footer { font-size: .75rem; color: #94a3b8; padding: .75rem 2rem; }

/* Cards & tables */
.card { border: 1px solid #e6ebf1; border-radius: .75rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card-header { background: #fff; border-bottom: 1px solid #eef2f6; font-weight: 600; border-radius: .75rem .75rem 0 0 !important; }
.table { --bs-table-hover-bg: #f8fafc; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table-card { margin-bottom: 0; }
.table-card td { vertical-align: middle; }
.table a.row-link { color: inherit; font-weight: 600; text-decoration: none; }
.table a.row-link:hover { color: var(--brand); text-decoration: underline; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.min-w-0 { min-width: 0; }

.stat-card .card-body { padding: 1rem 1.1rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: #0f172a; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-link { transition: transform .12s ease, box-shadow .12s ease; color: inherit; }
.stat-link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
.stat-link:focus-visible { outline: 3px solid #5eead4; }

.filter-bar { background: #fff; border: 1px solid #e6ebf1; border-radius: .75rem; padding: .75rem; margin-bottom: 1rem; }
.filter-bar .form-control, .filter-bar .form-select { font-size: .875rem; }

.nav-tabs .nav-link { color: #475569; }
.nav-tabs .nav-link.active { color: var(--brand); font-weight: 600; }

/* Wizard */
.wizard-steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; counter-reset: step; }
.wizard-steps .step { flex: 1 1 140px; padding: .6rem .8rem; border-radius: .6rem; background: #fff; border: 1px solid #e2e8f0; color: #64748b; font-size: .85rem; cursor: pointer; }
.wizard-steps .step.active { border-color: var(--brand); color: var(--brand-dark); background: #f0fdfa; font-weight: 600; }
.wizard-steps .step.done { color: #0f766e; }
.wizard-steps .step::before { counter-increment: step; content: counter(step); display: inline-flex; width: 1.4rem; height: 1.4rem; border-radius: 50%; align-items: center; justify-content: center; background: #e2e8f0; margin-right: .45rem; font-size: .75rem; }
.wizard-steps .step.active::before, .wizard-steps .step.done::before { background: var(--brand); color: #fff; }
.wizard-pane { display: none; }
.wizard-pane.active { display: block; }

.ageing-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: #eef2f6; }
.kv dt { font-weight: 500; color: #64748b; font-size: .8rem; }
.kv dd { margin-bottom: .6rem; }
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.2rem; border-left: 2px solid #e2e8f0; margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .25rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.95); border-top: 1px solid #e5e9ef; padding: .75rem 0; z-index: 5; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 15% 20%, #134e4a 0, #0b1f2a 55%); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; border-radius: 1rem; }

/* Technician mobile view */
.job-card { border-left: 4px solid var(--brand); }
.job-card.priority-high, .job-card.priority-urgent { border-left-color: #dc3545; }

@media print {
    .sidebar, .topbar, .app-footer, .no-print, .btn { display: none !important; }
    .content { padding: 0; }
    body.app-body { background: #fff; }
    .card { border: none; box-shadow: none; }
}

/* Five-across dashboard cards */
.row-cols-xxl-5 .stat-card .card-body { padding: .9rem; gap: .75rem !important; }
.row-cols-xxl-5 .stat-icon { width: 40px; height: 40px; font-size: 1.15rem; }
.row-cols-xxl-5 .stat-value { font-size: 1.15rem; white-space: nowrap; }
