/* Brightline / Electrician app – design tokens and components on top of Bootstrap 5 */
:root {
    --app-navy: #14213d;
    --app-navy-2: #1d2f57;
    --app-amber: #f5a524;
    --app-amber-dark: #b86e00;
    --app-bg: #f4f6fa;
    --app-card-border: #e3e7ef;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-link-color: #1d4ed8;
    --bs-link-color-rgb: 29, 78, 216;
    --bs-body-font-size: 1rem;
    --touch: 44px;
}

body { background: var(--app-bg); }
.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: .5rem; }

/* Navigation */
.app-navbar { background: linear-gradient(90deg, var(--app-navy), var(--app-navy-2)); box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.app-navbar .nav-link { color: rgba(255,255,255,.82); border-radius: .5rem; padding: .55rem .75rem !important; min-height: var(--touch); display: flex; align-items: center; gap: .4rem; }
.app-navbar .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.app-navbar .nav-link.active { color: #fff; background: rgba(245,165,36,.18); box-shadow: inset 0 -2px 0 var(--app-amber); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--app-amber); color: var(--app-navy); display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.brand-name { max-width: 52vw; font-weight: 600; letter-spacing: .01em; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--app-amber); color: var(--app-navy); font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; display: grid; grid-template-columns: repeat(6, 1fr);
    background: #fff; border-top: 1px solid var(--app-card-border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 14px rgba(20,33,61,.08); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; font-size: .72rem; color: #4b5563; text-decoration: none; }
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--bs-primary); font-weight: 600; }
@media (max-width: 991.98px) { body.has-bottom-nav main { padding-bottom: 84px !important; } }

/* Touch-friendly controls */
.btn, .form-control, .form-select { min-height: var(--touch); }
.btn-sm { min-height: 36px; }
.form-control-sm, .form-select-sm { min-height: 36px; }
.btn-icon { width: var(--touch); height: var(--touch); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.form-check-input { width: 1.3em; height: 1.3em; }
.form-label { font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: #1e40af; --bs-btn-hover-border-color: #1e40af; }
.btn-amber { background: var(--app-amber); border-color: var(--app-amber); color: var(--app-navy); font-weight: 600; }
.btn-amber:hover { background: #e39410; border-color: #e39410; color: var(--app-navy); }

/* Page header */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; margin: 0; color: var(--app-navy); }
.page-header .subtitle { color: #6b7280; margin: .15rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Cards */
.card { border-color: var(--app-card-border); border-radius: .85rem; box-shadow: 0 1px 2px rgba(20,33,61,.04); }
.card-header { background: #fff; border-bottom-color: var(--app-card-border); font-weight: 600; padding: .85rem 1rem; border-radius: .85rem .85rem 0 0 !important; }
.card-header .bi { color: var(--app-amber-dark); }
.stat-card { padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; text-decoration: none; color: inherit; height: 100%; }
.stat-card:hover { box-shadow: 0 6px 18px rgba(20,33,61,.08); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex: none; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; color: var(--app-navy); }
.stat-label { font-size: .85rem; color: #6b7280; }

.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 768px) { .quick-actions { grid-template-columns: repeat(4, 1fr); } }
.quick-actions .btn { min-height: 64px; display: flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 600; }

/* Lists */
.list-row { display: flex; gap: .75rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--app-card-border); text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #f8fafc; }
.list-row .time { min-width: 3.6rem; font-weight: 700; color: var(--app-navy); }
.meta { font-size: .85rem; color: #6b7280; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; font-weight: 600; background: #f8fafc; }
.table-hover tbody tr { cursor: default; }
.table a.row-link { color: inherit; text-decoration: none; font-weight: 600; }
.table a.row-link:hover { color: var(--bs-primary); text-decoration: underline; }

/* Responsive table → cards on phones */
@media (max-width: 767.98px) {
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr { border: 1px solid var(--app-card-border); border-radius: .75rem; margin-bottom: .75rem; background: #fff; padding: .25rem 0; }
    .table-cards td { border: 0 !important; padding: .3rem .9rem !important; text-align: left !important; }
    .table-cards td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
}

.empty-state .empty-icon { width: 72px; height: 72px; border-radius: 50%; background: #eef2ff; color: var(--bs-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; }

/* Filters */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 10rem; }
.filter-bar .grow { flex: 1 1 14rem; }

/* Detail definitions */
.dl-grid { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .45rem 1rem; margin: 0; }
.dl-grid dt { color: #6b7280; font-weight: 500; }
.dl-grid dd { margin: 0; }

/* Tabs on job page */
.nav-tabs-scroll { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.nav-tabs-scroll .nav-link { white-space: nowrap; min-height: var(--touch); display: flex; align-items: center; gap: .35rem; }

/* Checklist */
.checklist-item { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-bottom: 1px solid var(--app-card-border); }
.checklist-item.done .item-text { text-decoration: line-through; color: #6b7280; }
.checklist-item .item-text { flex: 1; }

/* Week schedule */
.week-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 1200px) { .week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.day-col { background: #fff; border: 1px solid var(--app-card-border); border-radius: .85rem; min-height: 6rem; display: flex; flex-direction: column; }
.day-col.today { border-color: var(--app-amber); box-shadow: 0 0 0 2px rgba(245,165,36,.25); }
.day-head { padding: .6rem .75rem; border-bottom: 1px solid var(--app-card-border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.day-body { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.sched-item { display: block; padding: .55rem .65rem; border-radius: .6rem; background: #f1f5ff; border-left: 4px solid var(--bs-primary); text-decoration: none; color: inherit; font-size: .9rem; }
.sched-item:hover { background: #e3eaff; }
.sched-item.st-InProgress { border-left-color: #f59e0b; background: #fff7e6; }
.sched-item.st-Completed { border-left-color: #16a34a; background: #ecfdf3; }
.sched-item .when { font-weight: 700; color: var(--app-navy); }

/* Line editor */
.line-grid { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .line-grid { grid-template-columns: 8rem minmax(12rem, 1fr) 6rem 5.5rem 7rem 5.5rem 7rem 3rem; align-items: start; } }
.line-row { padding: .75rem; border: 1px solid var(--app-card-border); border-radius: .75rem; background: #fff; margin-bottom: .5rem; }
@media (min-width: 768px) { .line-row { padding: .5rem; } }
.totals-preview > div { display: flex; justify-content: space-between; padding: .25rem 0; }
.totals-preview dt { font-weight: 500; color: #4b5563; }
.totals-preview dd { margin: 0; font-variant-numeric: tabular-nums; }
.totals-preview .grand { border-top: 2px solid var(--app-navy); margin-top: .25rem; padding-top: .5rem; font-size: 1.15rem; font-weight: 700; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals-table td { padding: .35rem .5rem; }
.totals-table .grand td { font-size: 1.1rem; font-weight: 700; border-top: 2px solid var(--app-navy); }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.photo-grid figure { margin: 0; background: #fff; border: 1px solid var(--app-card-border); border-radius: .75rem; overflow: hidden; }
.photo-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.photo-grid figcaption { padding: .4rem .55rem; font-size: .8rem; }

/* Plan preview */
.plan-preview { background: #fff; border: 1px solid var(--app-card-border); border-radius: .75rem; overflow: auto; max-height: 75vh; }
.plan-preview svg { width: 100%; height: auto; display: block; }
.legend-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; }
.symbol-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem .75rem; }
.symbol-legend div { display: flex; align-items: center; gap: .5rem; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: radial-gradient(circle at 20% 10%, #23386a, var(--app-navy) 60%); }
.auth-card { width: 100%; max-width: 420px; }

.sticky-actions { position: sticky; bottom: 0; background: rgba(244,246,250,.96); padding: .75rem 0; border-top: 1px solid var(--app-card-border); z-index: 5; }
@media (max-width: 991.98px) { .sticky-actions { bottom: 58px; } }

:focus-visible { outline: 3px solid var(--app-amber); outline-offset: 2px; }
.text-amber { color: var(--app-amber-dark) !important; }

/* Flex helpers used by list rows (not provided by Bootstrap) */
.min-w-0 { min-width: 0; }
.flex-none { flex: none; }
.list-row > :last-child:not(:only-child) { flex: none; }

/* Shared board UI (overview pages) */
.board-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem; padding: .1rem .45rem; border-radius: .4rem; background: var(--app-navy); color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .02em; flex: none; }
.board-chip-lg { font-size: 1.1rem; padding: .15rem .6rem; vertical-align: middle; }
.board-preview { overflow: auto; background: #fff; border-radius: 0 0 .85rem .85rem; max-height: 75vh; }
.board-preview svg { display: block; width: 100%; max-width: 1000px; height: auto; margin: 0 auto; }
.check-item { padding: .2rem 0; }
.check-error { color: #b91c1c; }
.check-advisory { color: #92400e; }
.start-option { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem .75rem; border: 1px solid var(--app-card-border); border-radius: .6rem; cursor: pointer; background: #fff; }
.start-option:has(input:checked) { border-color: var(--bs-primary); box-shadow: 0 0 0 2px rgba(29,78,216,.2); background: #f5f8ff; }
.start-option input { margin-top: .2rem; flex: none; }
.schedule-table th { white-space: nowrap; }
.type-swatch { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem; height: 1.5rem; padding: 0 .25rem; border-radius: .3rem; font-size: .62rem; font-weight: 700; color: #0f172a; border: 1px solid rgba(15,23,42,.25); flex: none; }
