/* MotTrack – application styles (Bootstrap 5 based) */
:root {
  --wd-brand: #0d6efd;
  --wd-sidebar: #0f172a;
  --wd-sidebar-2: #1e293b;
  --wd-sidebar-text: #cbd5e1;
  --wd-bg: #f1f5f9;
  --wd-radius: 12px;
  --wd-sidebar-w: 250px;
}
body { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: .925rem; }
.wd-app { background: var(--wd-bg); }
.btn-primary { --bs-btn-bg: var(--wd-brand); --bs-btn-border-color: var(--wd-brand); --bs-btn-hover-bg: color-mix(in srgb, var(--wd-brand) 85%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-brand) 85%, #000); }
a { color: var(--wd-brand); }

/* Sidebar */
.wd-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--wd-sidebar-w); background: var(--wd-sidebar); color: var(--wd-sidebar-text); overflow-y: auto; z-index: 1040; transition: transform .2s; }
.wd-brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.2rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.07); }
.wd-brand:hover { color: #fff; }
.wd-logo { max-height: 34px; max-width: 60px; border-radius: 6px; background: #fff; padding: 2px; }
.wd-logo-mark { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; }
.wd-brand-text { font-weight: 700; font-size: .98rem; line-height: 1.15; }
.wd-nav { padding: .5rem 0 2rem; }
.wd-nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: #64748b; padding: 1rem 1.25rem .35rem; }
.wd-nav-link { display: flex; align-items: center; gap: .75rem; color: var(--wd-sidebar-text); text-decoration: none; padding: .52rem 1.25rem; margin: 1px .6rem; border-radius: 8px; }
.wd-nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .85; }
.wd-nav-link:hover { background: var(--wd-sidebar-2); color: #fff; }
.wd-nav-link.active { background: var(--wd-brand); color: #fff; }
.wd-backdrop { display: none; }

.wd-main { margin-left: var(--wd-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.wd-topbar { position: sticky; top: 0; z-index: 1030; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; }
.wd-search { position: relative; flex: 1; max-width: 520px; }
.wd-search > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.wd-search .form-control { padding-left: 2.2rem; background: #f8fafc; border-color: #e2e8f0; border-radius: 10px; }
.wd-search-results { width: 100%; max-height: 420px; overflow-y: auto; }
.wd-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--wd-brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; }
.wd-content { padding: 1.5rem; flex: 1; }
.wd-footer { padding: .8rem 1.5rem; color: #94a3b8; font-size: .78rem; }

@media (max-width: 991.98px) {
  .wd-sidebar { transform: translateX(-100%); }
  .wd-sidebar.open { transform: none; }
  .wd-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
  .wd-main { margin-left: 0; }
  .wd-content { padding: 1rem; }
}

/* Page header + cards */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-head .sub { color: #64748b; font-size: .85rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.card { border: 1px solid #e2e8f0; border-radius: var(--wd-radius); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef2f7; font-weight: 600; border-radius: var(--wd-radius) var(--wd-radius) 0 0 !important; }
.card.stat-card, .stat-card { padding: 1rem 1.1rem; display: flex; flex-direction: row; align-items: center; gap: .9rem; text-decoration: none; color: inherit; height: 100%; }
.stat-card:hover { box-shadow: 0 4px 14px rgba(15,23,42,.08); color: inherit; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: #64748b; font-size: .8rem; }
.soft-primary { background: #e0ecff; color: #1d4ed8; } .soft-success { background: #dcfce7; color: #15803d; }
.soft-warning { background: #fef3c7; color: #b45309; } .soft-danger { background: #fee2e2; color: #b91c1c; }
.soft-info { background: #e0f2fe; color: #0369a1; } .soft-purple { background: #ede9fe; color: #6d28d9; }
.soft-teal { background: #ccfbf1; color: #0f766e; } .soft-dark { background: #e2e8f0; color: #334155; }

/* Tables */
.table { --bs-table-bg: transparent; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr { cursor: default; }
tr[data-href] { cursor: pointer; }
.reg-plate { display: inline-block; font-family: "Arial Narrow", Arial, sans-serif; font-weight: 700; letter-spacing: .05em; background: #facc15; color: #111; border: 1px solid #a16207; border-radius: 4px; padding: 0 .4rem; font-size: .85rem; white-space: nowrap; }
.reg-plate.lg { font-size: 1.4rem; padding: .1rem .7rem; }

/* Extra status colours */
.bg-orange { background-color: #ea580c !important; color: #fff; }
.bg-purple { background-color: #7c3aed !important; color: #fff; }
.bg-teal { background-color: #0d9488 !important; color: #fff; }
.badge-st { font-weight: 600; font-size: .72rem; padding: .35em .6em; }
.text-orange { color: #ea580c; }

/* Filters */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 140px; }

/* Line items editor */
.items-table input { min-width: 70px; }
.items-table td { padding: .3rem; }
.totals-box { max-width: 340px; margin-left: auto; }
.totals-box .row > div { padding: .2rem .5rem; }

/* Diary */
.diary-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.diary-month { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid #e2e8f0; border-top: 1px solid #e2e8f0; background: #fff; border-radius: 10px; overflow: hidden; }
.diary-month .dm-head { background: #f8fafc; font-size: .75rem; font-weight: 600; text-transform: uppercase; color: #64748b; padding: .5rem; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.diary-month .dm-day { min-height: 118px; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; padding: .3rem; position: relative; }
.diary-month .dm-day.other { background: #fafbfc; color: #aab; }
.diary-month .dm-day.today { background: #eff6ff; }
.dm-num { font-size: .78rem; font-weight: 600; text-decoration: none; color: inherit; }
.diary-week { display: grid; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: auto; }
.dw-col-head { position: sticky; top: 0; background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: .45rem; font-size: .8rem; font-weight: 600; text-align: center; z-index: 2; }
.dw-time { font-size: .7rem; color: #94a3b8; text-align: right; padding: 2px 6px 0 0; border-top: 1px solid #f1f5f9; height: 44px; }
.dw-slot { border-top: 1px solid #f1f5f9; border-left: 1px solid #eef2f7; height: 44px; position: relative; }
.dw-slot.hour { border-top-color: #e2e8f0; }
.dw-slot.drag-over, .dm-day.drag-over { background: #dbeafe !important; }
.dw-slot:hover { background: #f8fafc; }
.diary-event { display: block; font-size: .74rem; line-height: 1.2; border-radius: 6px; padding: 3px 6px; margin-bottom: 3px; color: #0f172a; text-decoration: none; border-left: 4px solid var(--ev, #64748b); background: color-mix(in srgb, var(--ev, #64748b) 14%, #fff); cursor: grab; overflow: hidden; }
.diary-event:hover { color: #0f172a; filter: brightness(.97); }
.diary-event.abs { position: absolute; left: 2px; right: 2px; z-index: 1; }
.diary-event .ev-reg { font-weight: 700; }
.diary-event.dragging { opacity: .5; }
.diary-legend span { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-size: .75rem; }
.diary-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Timeline */
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid #e2e8f0; margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--wd-brand); }
.timeline .tl-meta { font-size: .75rem; color: #94a3b8; }

/* Auth */
.wd-auth { background: #f1f5f9; min-height: 100vh; }
.wd-auth-wrap { display: flex; min-height: 100vh; }
.wd-auth-side { flex: 1; background: linear-gradient(140deg, #0f172a 0%, #1e3a8a 100%); color: #fff; align-items: center; justify-content: center; padding: 3rem; }
.wd-auth-side h1 { font-weight: 800; font-size: 2.4rem; }
.wd-auth-mark { width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; font-size: 2rem; margin-bottom: 1rem; }
.wd-auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.wd-auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 10px 40px rgba(15,23,42,.08); }

/* Terminal */
.wd-terminal { background: #0b1220; color: #e2e8f0; min-height: 100vh; }
.term-wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.term-lock { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.term-shield { font-size: 3.5rem; color: #facc15; }
.pin-display { font-size: 2.4rem; letter-spacing: .6rem; height: 3.4rem; min-width: 220px; text-align: center; background: #111a2e; border-radius: 12px; border: 1px solid #23324f; margin: 1rem 0; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 92px); gap: 12px; }
.pin-pad button { height: 78px; font-size: 1.7rem; border-radius: 14px; border: 1px solid #23324f; background: #111a2e; color: #fff; }
.pin-pad button:active { background: #1e3a8a; }
.term-card { background: #111a2e; border: 1px solid #23324f; border-radius: 14px; padding: 1rem; }
.term-job { background: #0f172a; border: 1px solid #23324f; border-radius: 12px; padding: 1rem; margin-bottom: .8rem; }
.term-job .btn { min-width: 110px; padding: .7rem 1rem; font-weight: 600; }
.term-clock { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Print */
.wd-print { background: #fff; font-size: 13px; }
.doc-head { border-bottom: 3px solid var(--wd-brand); padding-bottom: 1rem; margin-bottom: 1rem; }
@media print {
  .no-print, .wd-sidebar, .wd-topbar, .wd-footer, .btn, .page-head .actions { display: none !important; }
  .wd-main { margin: 0; }
  .wd-content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff !important; }
}
.checklist-row { border-bottom: 1px dashed #e2e8f0; padding: .45rem 0; }
.cursor-pointer { cursor: pointer; }
.min-w-0 { min-width: 0; }
