:root {
    --sidebar-w: 240px;
    --sidebar-bg: #14213d;
    --sidebar-accent: #2f6fed;
    --page-bg: #f4f6fa;
}

body { background: var(--page-bg); font-size: .925rem; }

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--sidebar-bg); color: #fff;
    position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1040; transition: transform .2s;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--sidebar-accent); display: grid; place-items: center; font-size: 1.15rem; }
.brand small { font-size: .72rem; }
.sidebar .nav { padding: .6rem .5rem 1.5rem; }
.sidebar .nav-link { color: rgba(255,255,255,.72); border-radius: 8px; padding: .5rem .75rem; display: flex; align-items: center; gap: .65rem; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar .nav-link.active { color: #fff; background: var(--sidebar-accent); }
.nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: rgba(255,255,255,.4); padding: 1rem .75rem .35rem; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .75rem; background: #fff; border-bottom: 1px solid #e5e8ef; padding: .6rem 1.25rem; }
.topbar-search { position: relative; width: 100%; max-width: 360px; }
.topbar-search i { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: #8a93a6; }
.topbar-search input { padding-left: 1.9rem; background: var(--page-bg); border-color: transparent; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--sidebar-accent); color: #fff; font-size: .72rem; font-weight: 600; display: inline-grid; place-items: center; }

.content { padding: 1.25rem; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .main { margin-left: 0; }
    .content { padding: 1rem; }
}

/* Page pieces */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; margin: 0; font-weight: 600; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }

.card { border: 1px solid #e5e8ef; border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f4; font-weight: 600; border-radius: 12px 12px 0 0 !important; }

.stat { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; text-decoration: none; color: inherit; }
.stat:hover { background: #fafbfd; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: #6b7385; font-size: .8rem; }

.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .55rem .75rem; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7385; font-weight: 600; background: #fafbfd; white-space: nowrap; }
.table-hover tbody tr { cursor: default; }
.table a.row-link { color: inherit; text-decoration: none; font-weight: 500; }
.table a.row-link:hover { color: var(--sidebar-accent); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filters .form-select, .filters .form-control { width: auto; min-width: 140px; }

.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; row-gap: .45rem; column-gap: .75rem; margin: 0; }
.kv dt { color: #6b7385; font-weight: 400; }
.kv dd { margin: 0; word-break: break-word; }

/* Stage pipeline on job page */
.pipeline { display: flex; flex-wrap: wrap; gap: .35rem; }
.pipeline .step { padding: .3rem .7rem; border-radius: 999px; font-size: .78rem; background: #eef0f4; color: #6b7385; border: 0; }
.pipeline .step.done { background: #d1f0dc; color: #146c43; }
.pipeline .step.current { background: var(--sidebar-accent); color: #fff; font-weight: 600; }
.pipeline button.step:hover:not(.current) { background: #dbe5fb; color: #1e4fbf; }

/* Compliance grid */
.grid-table td, .grid-table th { text-align: center; vertical-align: middle; }
.grid-table td:first-child, .grid-table th:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 220px; }
.cell { display: inline-block; min-width: 64px; padding: .25rem .4rem; border-radius: 6px; font-size: .72rem; font-weight: 600; text-decoration: none; }
.cell-done { background: #d1f0dc; color: #146c43; }
.cell-pending { background: #fff3cd; color: #8a6100; }
.cell-progress { background: #dbe5fb; color: #1e4fbf; }
.cell-overdue { background: #f8d7da; color: #a52834; }
.cell-cancelled { background: #eef0f4; color: #6b7385; }
.cell-none { color: #c4c9d4; }
.legend span { margin-right: .75rem; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.2rem; border-left: 2px solid #e5e8ef; margin-left: .3rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--sidebar-accent); }
.timeline li:last-child { padding-bottom: 0; }

.empty { text-align: center; color: #8a93a6; padding: 2rem 1rem; }
.empty i { font-size: 2rem; display: block; margin-bottom: .4rem; }

/* GST invoice */
.invoice-sheet { position: relative; overflow: hidden; }
.invoice-table thead th { background: #f4f6fa; }
.invoice-watermark { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-20deg); font-size: 5rem; font-weight: 800; color: rgba(165, 40, 52, .12); pointer-events: none; }

@media print {
    .sidebar, .topbar, .no-print, .alert { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    body { background: #fff; }
    .invoice-sheet { border: 0; box-shadow: none; }
    .row > [class*="col-"] { width: 100%; }
}

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, #14213d 0%, #2f6fed 100%); }
.login-card { width: 100%; max-width: 400px; }
