/*
 * Workload App — UI layer on top of Tabler 1.6.1.
 * Tokens and component sizes follow docs/ui/UI_SPEC.md §2 and §4.
 * No inline styles in views: dynamic widths are set by app.js from data-pct.
 */

/* ---------- Fonts (self-hosted, OFL; see fonts/OFL-*.txt) ---------- */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/montserrat-400.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/montserrat-500.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/montserrat-600.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/montserrat-700.woff2") format("woff2"); }

/* ---------- Tokens (§2) ---------- */
:root {
  --wl-bg: #f4f6fa;
  --wl-surface: #ffffff;
  --wl-border: #e3e7ee;
  --wl-border-soft: #eef1f6;
  --wl-row: #f1f3f7;
  --wl-input-border: #d5dbe5;
  --wl-track: #eef1f6;
  --wl-text: #1d2433;
  --wl-text-2: #3a4456;
  --wl-muted: #5b6475;
  --wl-muted-2: #6b7487;
  --wl-icon-muted: #9aa3b2;
  --wl-accent: #206bc4;
  --wl-accent-soft: #e8effa;
  --wl-sort-bg: #eef3fb;
  --wl-project: #f0a24a;
  --wl-danger-btn: #c92a2a;
  --wl-danger-btn-disabled: #e6a5a5;
  --wl-toast-bg: #1d2433;
  --wl-toast-icon: #7ee2a0;
  --wl-error: #d63939;
  --wl-error-text: #b42318;
  --wl-over-target-text: #a63f03;
  --wl-over-target-bg: #ffe8d9;
  --wl-over-target-bar: #e8590c;

  --wl-font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wl-shadow-drawer: -12px 0 32px rgba(15, 23, 42, .18);
  --wl-shadow-dialog: 0 20px 48px rgba(15, 23, 42, .28);
  --wl-shadow-toast: 0 10px 28px rgba(15, 23, 42, .28);

  /* Tabler mapping */
  --tblr-primary: var(--wl-accent);
  --tblr-primary-rgb: 32, 107, 196;
  --tblr-body-bg: var(--wl-bg);
  --tblr-body-color: var(--wl-text);
  --tblr-border-color: var(--wl-border);
  --tblr-font-sans-serif: var(--wl-font-sans);
  --tblr-font-monospace: var(--wl-font-sans);
  --tblr-body-font-family: var(--wl-font-sans);
  --tblr-body-font-size: 14px;
  --tblr-body-line-height: 1.45;
  --tblr-border-radius: 8px;
  --tblr-link-color: var(--wl-accent);
  --tblr-link-color-rgb: 32, 107, 196;
}

body.wl {
  background: var(--wl-bg);
  color: var(--wl-text);
  font-family: var(--wl-font-sans);
  font-size: 14px;
  line-height: 1.45;
}

.wl :focus-visible { outline: 2px solid var(--wl-accent); outline-offset: 2px; }
/* Numbers, codes, ids, IPs and times (UI_SPEC rev.2): same font, fixed-width digits. */
.wl-num { font-family: var(--wl-font-sans); font-variant-numeric: tabular-nums; }
.wl-muted { color: var(--wl-muted); }
.wl-hint { font-size: 12px; color: var(--wl-muted); }

/* ---------- Layout (§3) ---------- */
.wl-layout { display: flex; min-height: 100vh; }
.wl-content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.wl-main { padding: 28px; }
.wl-page { display: flex; flex-direction: column; gap: 22px; }
.wl-page--master { gap: 18px; }

/* The white sidebar box lives on the shell: Bootstrap forces a transparent
   background on .offcanvas-lg at >= 992px. Below 992px the shell has no box
   and the aside becomes an offcanvas. */
.wl-sidebar-shell { display: contents; }
@media (min-width: 992px) {
  .wl-sidebar-shell { display: block; width: 240px; flex: 0 0 240px; background: var(--wl-surface); border-right: 1px solid var(--wl-border); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .wl-sidebar.offcanvas-lg, .wl-sidebar .offcanvas-body { height: 100%; }
}
.wl-sidebar.offcanvas-lg { --bs-offcanvas-width: 260px; --tblr-offcanvas-width: 260px; }
.wl-sidebar .offcanvas-body { display: flex; flex: 1 1 auto; padding: 0; overflow-y: auto; }
.wl-sidebar-inner { display: flex; flex-direction: column; width: 100%; min-height: 100%; padding: 18px 14px; }
.wl-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--wl-text); text-decoration: none; font-weight: 700; font-size: 16px; }
.wl-brand:hover { color: var(--wl-text); text-decoration: none; }
.wl-brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--wl-accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.wl-nav-group { margin-top: 12px; }
.wl-nav-label { padding: 6px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--wl-muted-2); }
.wl-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.wl-nav-link { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--wl-text-2); text-decoration: none; }
.wl-nav-link:hover { background: var(--wl-bg); color: var(--wl-text); text-decoration: none; }
.wl-nav-link[aria-current="page"] { background: var(--wl-accent-soft); color: var(--wl-accent); font-weight: 600; }
.wl-nav-text { flex: 1 1 auto; }
.wl-nav-count { font-size: 12px; color: var(--wl-muted-2); }
.wl-nav-link[aria-current="page"] .wl-nav-count { color: var(--wl-accent); }
.wl-sidebar-footer { margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid var(--wl-border-soft); display: flex; align-items: center; gap: 10px; }
.wl-sidebar-user { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.wl-logout { margin: 0; flex: 0 0 auto; }
.wl-sidebar-user strong { display: block; font-weight: 600; font-size: 13px; }
.wl-sidebar-user span { display: block; font-size: 12px; color: var(--wl-muted); overflow-wrap: anywhere; }

.wl-topbar { display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--wl-surface); border-bottom: 1px solid var(--wl-border); }
@media (max-width: 991.98px) {
  .wl-topbar { display: flex; }
  .wl-main { padding: 16px; }
}

/* ---------- Avatar ---------- */
.wl-avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--wl-border-soft); color: var(--wl-text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.wl-avatar--dark { background: var(--wl-text); color: #fff; }

/* ---------- Icons ---------- */
.wl-icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.wl-icon--sm { width: 14px; height: 14px; }
.wl-icon--md { width: 16px; height: 16px; }
.wl-icon--lg { width: 22px; height: 22px; }

/* ---------- Typography ---------- */
.wl-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.wl-eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--wl-muted); }
.wl-breadcrumb { margin: 0 0 4px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; font-size: 13px; color: var(--wl-muted); }
.wl-breadcrumb li + li::before { content: "/"; padding: 0 4px; }
.wl-breadcrumb a { color: var(--wl-muted); }
.wl-h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; color: var(--wl-text); }
.wl-h2 { margin: 0; font-size: 17px; font-weight: 600; }
.wl-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Card ---------- */
.wl .card { border: 1px solid var(--wl-border); border-radius: 12px; box-shadow: none; background: var(--wl-surface); }
.wl .card-body { padding: 16px 18px; }
.wl .card-header { padding: 16px 18px; border-bottom: 1px solid var(--wl-border-soft); background: transparent; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.wl .card-footer { padding: 12px 18px; border-top: 1px solid var(--wl-border-soft); background: transparent; }

/* ---------- Controls ---------- */
.wl .btn { min-height: 40px; border-radius: 8px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.wl .btn-outline-secondary, .wl .btn-secondary-outline { --tblr-btn-border-color: var(--wl-input-border); --tblr-btn-color: var(--wl-text); --tblr-btn-bg: var(--wl-surface); }
.wl .btn-group > .btn { min-height: 40px; }
.wl .form-control, .wl .form-select { min-height: 40px; border-radius: 8px; border-color: var(--wl-input-border); font-family: inherit; }
.wl .form-label { font-weight: 500; margin-bottom: 6px; }
.wl .form-control.is-invalid, .wl .form-select.is-invalid { border-color: var(--wl-error); background-image: none; padding-right: .75rem; }
.wl .invalid-feedback { display: block; color: var(--wl-error-text); font-size: 12px; margin-top: 4px; }
.wl-btn-icon { width: 40px; height: 40px; padding: 0; }
.wl-btn-icon--danger { color: var(--wl-error-text); }

/* Filter chips (§4 filter_bar) */
.wl-chip { min-height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--wl-input-border); background: var(--wl-surface); color: var(--wl-text-2); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.wl-chip:hover { border-color: var(--wl-accent); }
.wl-chip[aria-pressed="true"] { background: var(--wl-accent); border-color: var(--wl-accent); color: #fff; }
.wl-chip-count { font-weight: 500; opacity: .75; }
.wl-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.wl-filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.wl-filter-field { display: flex; align-items: center; gap: 8px; color: var(--wl-muted); }
.wl-filter-spacer { flex: 1 1 auto; }
.wl-search { position: relative; min-width: 220px; }
.wl-search .wl-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--wl-icon-muted); pointer-events: none; }
.wl-search .form-control { padding-left: 36px; }

/* Sync indicator */
.wl-sync { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--wl-muted); }
.wl-sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #2f9e44; flex: 0 0 8px; }
.wl-sync-loading { display: none; }
.wl-sync.htmx-request .wl-sync-dot, .wl-sync.is-loading .wl-sync-dot { background: #f08c00; }
.wl-sync.htmx-request .wl-sync-idle, .wl-sync.is-loading .wl-sync-idle { display: none; }
.wl-sync.htmx-request .wl-sync-loading, .wl-sync.is-loading .wl-sync-loading { display: inline; }

/* Loading target (§7): section opacity while htmx loads */
.wl-loading-target { transition: opacity .15s; }
.wl-loading-target.htmx-request, .wl-loading-target.is-loading { opacity: .45; }

/* ---------- KPI ---------- */
.wl-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.wl-kpi-label { font-size: 13px; color: var(--wl-muted); }
.wl-kpi-value { margin: 6px 0 4px; font-size: 26px; font-weight: 600; line-height: 1.2; color: var(--wl-text); }
.wl-kpi-value--danger { color: var(--wl-error-text); }
.wl-kpi-value--warning { color: var(--wl-over-target-text); }
.wl-kpi-unit { font-size: 14px; font-weight: 500; color: var(--wl-muted); }
.wl-kpi-card .wl-progress { margin-top: 10px; }

/* ---------- Progress, capacity, stack ---------- */
.wl-progress { position: relative; height: 8px; border-radius: 99px; background: var(--wl-track); overflow: hidden; }
.wl-progress--lg { height: 10px; }
.wl-progress-bar { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--wl-accent); transition: width .2s ease; }
.wl-bar-overloaded { background: #d63939; }
.wl-bar-near-full { background: #f08c00; }
.wl-bar-over-target { background: var(--wl-over-target-bar); }
.wl-bar-healthy { background: #2f9e44; }
.wl-bar-underloaded { background: #7fa9e6; }

.wl-capacity { position: relative; padding: 4px 0; }
.wl-capacity-marker { position: absolute; left: 83.3333%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--wl-text); border-radius: 1px; }

.wl-stack { display: flex; height: 8px; max-width: 160px; border-radius: 99px; overflow: hidden; background: var(--wl-track); }
.wl-stack-part { display: block; height: 100%; width: 0; }
.wl-stack-recurring { background: var(--wl-accent); }
.wl-stack-project { background: var(--wl-project); }
.wl-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--wl-muted); }
.wl-legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Badges (§2 Status) ---------- */
.wl-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.wl-badge--code { border-radius: 6px; padding: 2px 8px; font-weight: 600; }
.wl-status-overloaded { color: #b42318; background: #fdecec; }
.wl-status-near-full { color: #9a4d00; background: #fff1df; }
.wl-status-over-target { color: var(--wl-over-target-text); background: var(--wl-over-target-bg); }
.wl-status-healthy { color: #1e6b36; background: #e5f5ea; }
.wl-status-underloaded { color: #2c4f86; background: #e8effa; }
.wl-status-sequential-heavy { color: #9a4d00; background: #fff1df; }
.wl-status-high-focus-heavy { color: #6b3fb0; background: #f1ebfb; }
.wl-status-ok { color: #1e6b36; background: #e5f5ea; }
.wl-status-active { color: #1e6b36; background: #e5f5ea; }
.wl-status-paused { color: #9a4d00; background: #fff1df; }
.wl-status-done { color: #3a4456; background: #eef1f6; }
.wl-status-neutral { color: #3a4456; background: #eef1f6; }
.wl-badge-service { border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; color: var(--wl-text-2); background: var(--wl-border-soft); }
.wl-badge-internal { border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; color: #6b3fb0; background: #f1ebfb; }

/* ---------- Tables (§4 data_table, §6) ---------- */
.wl-table-wrap { overflow-x: auto; }
.wl-table { width: 100%; margin: 0; border-collapse: collapse; }
.wl-minw-560 { min-width: 560px; }
.wl-minw-720 { min-width: 720px; }
.wl-minw-900 { min-width: 900px; }
.wl-table th { padding: 10px 18px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--wl-muted); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--wl-border-soft); background: transparent; }
.wl-table td { padding: 12px 18px; border-top: 1px solid var(--wl-row); vertical-align: middle; }
.wl-table tbody tr:first-child td { border-top: 0; }
.wl-table td.wl-num, .wl-table th.wl-num { text-align: right; }
.wl-table .wl-actions-cell { text-align: right; white-space: nowrap; }
.wl-row-muted td { color: var(--wl-muted); }
.wl-row-sub { display: block; font-size: 12px; color: var(--wl-muted); }
.wl-sort-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 8px; margin: 0 -8px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; text-decoration: none; }
.wl-sort-btn:hover { color: var(--wl-text); text-decoration: none; }
.wl-sort-btn .wl-icon { color: var(--wl-icon-muted); }
th[aria-sort="ascending"] .wl-sort-btn, th[aria-sort="descending"] .wl-sort-btn { background: var(--wl-sort-bg); color: var(--wl-accent); }
th[aria-sort="ascending"] .wl-sort-btn .wl-icon, th[aria-sort="descending"] .wl-sort-btn .wl-icon { color: var(--wl-accent); }
.wl-empty td { padding: 36px 18px; text-align: center; color: var(--wl-muted); }
.wl-skeleton { display: none; }
.wl-skeleton-bar { display: block; height: 12px; border-radius: 6px; background: var(--wl-track); animation: wl-pulse 1.2s ease-in-out infinite; }
.wl-skeleton-bar--short { width: 40%; }
@keyframes wl-pulse { 50% { opacity: .5; } }
.wl-table-region.htmx-request .wl-skeleton, .wl-table-region.is-loading .wl-skeleton { display: table-row-group; }
.wl-table-region.htmx-request .wl-table-body, .wl-table-region.is-loading .wl-table-body { display: none; }
.wl-table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--wl-border-soft); font-size: 13px; color: var(--wl-muted); }
.wl-pager { display: flex; gap: 8px; }
.wl-pager .disabled, .wl-pager [aria-disabled="true"] { pointer-events: none; opacity: .55; }

/* ---------- Drawer (§4) ---------- */
.wl-drawer.offcanvas { --tblr-offcanvas-width: 460px; --bs-offcanvas-width: 460px; width: 460px; max-width: 100%; border-left: 0; box-shadow: var(--wl-shadow-drawer); display: flex; flex-direction: column; }
.wl-drawer .offcanvas-header { padding: 18px 22px; border-bottom: 1px solid var(--wl-border-soft); gap: 12px; }
.wl-drawer-title { margin: 0; font-size: 19px; font-weight: 700; }
.wl-drawer-close { width: 44px; height: 44px; border: 1px solid var(--wl-border); border-radius: 8px; background: var(--wl-surface); color: var(--wl-text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin-left: auto; flex: 0 0 auto; }
.wl-drawer .offcanvas-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.wl-drawer .form-control, .wl-drawer .form-select, .wl-dialog .form-control { min-height: 44px; }
.wl-drawer-footer { position: sticky; bottom: 0; margin-top: auto; padding: 16px 22px; border-top: 1px solid var(--wl-border-soft); background: var(--wl-surface); display: flex; flex-wrap: wrap; gap: 10px; }
.wl-drawer-footer .btn { min-height: 44px; }
.wl-drawer-footer .btn-primary { flex: 1 1 auto; }
.wl-note { background: #f6f7fa; border-radius: 10px; padding: 12px 14px; color: var(--wl-text-2); font-size: 13px; }
.wl-fieldset { border: 1px solid var(--wl-border-soft); border-radius: 10px; padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.wl-fieldset legend { float: none; width: auto; padding: 0 6px; margin: 0; font-size: 14px; font-weight: 600; }
.offcanvas-backdrop { background-color: rgb(15, 23, 42); }
.offcanvas-backdrop.show { opacity: .38; }

/* ---------- Confirm dialog (§4, §7) ---------- */
.wl-dialog .modal-dialog { max-width: 420px; }
.wl-dialog .modal-content { border: 0; border-radius: 14px; box-shadow: var(--wl-shadow-dialog); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.wl-dialog-icon { width: 44px; height: 44px; border-radius: 12px; background: #fdecec; color: var(--wl-error-text); display: inline-flex; align-items: center; justify-content: center; }
.wl-dialog-title { margin: 0; font-size: 18px; font-weight: 700; }
.wl-dialog-text { margin: 0; color: var(--wl-text-2); }
.wl-dialog-error { margin: 0; padding: 10px 12px; border-radius: 8px; background: #fdecec; color: var(--wl-error-text); font-size: 13px; }
.wl-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.wl-dialog-actions .btn { min-height: 44px; padding: 0 18px; }
.wl-btn-danger { background: var(--wl-danger-btn); border-color: var(--wl-danger-btn); color: #fff; }
.wl-btn-danger:hover { background: #b02525; border-color: #b02525; color: #fff; }
.wl-btn-danger:disabled, .wl-btn-danger.disabled { background: var(--wl-danger-btn-disabled); border-color: var(--wl-danger-btn-disabled); color: #fff; opacity: 1; }
.modal-backdrop { background-color: rgb(15, 23, 42); }
.modal-backdrop.show { opacity: .42; }

/* ---------- Toast (§4) ---------- */
.wl-toast-container { position: fixed; top: 20px; right: 20px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; }
.wl-toast { max-width: 380px; background: var(--wl-toast-bg); color: #fff; border: 0; border-radius: 10px; padding: 12px 16px; box-shadow: var(--wl-shadow-toast); font-size: 13px; align-items: center; gap: 10px; }
.wl-toast.show, .wl-toast.showing { display: flex; }
.wl-toast .wl-icon { stroke: var(--wl-toast-icon); stroke-width: 2.2; }

/* ---------- Health item (§4) ---------- */
.wl-health-list { list-style: none; margin: 0; padding: 0; }
.wl-health-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--wl-border-soft); color: var(--wl-text); text-decoration: none; min-height: 56px; }
.wl-health-list li:first-child .wl-health-item { border-top: 0; }
.wl-health-item:hover { background: #f8f9fc; color: var(--wl-text); text-decoration: none; }
.wl-health-count { width: 40px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.wl-health-count--ok { background: #e5f5ea; color: #1e6b36; }
.wl-health-count--warn { background: #fff1df; color: #9a4d00; }
.wl-health-count--danger { background: #fdecec; color: #b42318; }
.wl-health-label { font-weight: 600; }
.wl-health-hint { display: block; font-size: 12px; color: var(--wl-muted); font-weight: 400; }
.wl-health-item .wl-icon { color: var(--wl-icon-muted); }

/* ---------- Activity row (§4) ---------- */
.wl-activity td { padding: 10px 18px; }
.wl-activity .wl-time, .wl-activity .wl-ip { font-size: 13px; color: var(--wl-muted); white-space: nowrap; }
.wl-table td.wl-time { text-align: left; }
.wl-activity .wl-ip { text-align: right; }

/* ---------- PIC card (§4) ---------- */
.wl-pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.wl-pic-head { display: flex; align-items: flex-start; gap: 10px; }
.wl-pic-name { font-weight: 600; }
.wl-pic-meta { display: block; font-size: 12px; color: var(--wl-muted); }
.wl-pic-ident { flex: 1 1 auto; min-width: 0; }
.wl-pic-metaline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; margin-top: 2px; }
.wl-pic-metaline .wl-pic-meta { display: inline; white-space: nowrap; }
.wl-pic-figures { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 14px 0 8px; }
.wl-pic-util { font-size: 22px; font-weight: 600; }
.wl-pic-load { font-size: 13px; color: var(--wl-text-2); }
.wl-pic-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--wl-muted); }

/* ---------- Heatmap (§2) ---------- */
.wl-heat-table { border-collapse: separate; border-spacing: 6px; }
.wl-heat-table th { padding: 4px 6px; }
.wl-heat-table td { padding: 0; border: 0; }
.wl-heat { display: flex; align-items: center; justify-content: center; min-width: 72px; height: 44px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--wl-text); }
.wl-heat-0 { background: #f6f7fa; color: #9aa3b2; }
.wl-heat-1 { background: #e7eefa; }
.wl-heat-2 { background: #c9d9f2; }
.wl-heat-3 { background: #9dbbe6; }
.wl-heat-4 { background: #5e8fd3; color: #fff; }
.wl-heat-5 { background: #2f63ad; color: #fff; }
/* Service filter: other services (cells and headers) dimmed; the selected header stays neutral. */
.wl-heat-dim { opacity: .3; }

/* ---------- Responsive (§9: no horizontal page scroll at 390px) ---------- */
@media (max-width: 575.98px) {
  .wl-search { min-width: 0; flex: 1 1 100%; }
  .wl-filter-spacer { display: none; }
  .wl-drawer.offcanvas { width: 100%; }
}

/* ---------- UI Kit page only ---------- */
.wl-kit-section { display: flex; flex-direction: column; gap: 12px; }
.wl-kit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.wl-kit-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.wl-kit-label { font-size: 12px; color: var(--wl-muted); }

/* ---------- Component details ---------- */
.wl-table th form { display: inline; margin: 0; }
.wl-table th.wl-num .wl-sort-btn { margin-left: auto; }
.wl-toast--static { position: static; display: flex; }
.wl-heat-table td { padding: 0 3px; border-top: 0; }
.wl-heat-table tbody th { padding: 6px 12px; font-size: 14px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--wl-text); border-bottom: 0; }
.wl-heat-table thead th:first-child { padding-left: 12px; }
.wl-heat-table tbody th .wl-pic-name { display: block; }
.wl-heat-table .wl-num { padding: 6px 12px; white-space: nowrap; }
.wl-heat-table .wl-pic-meta { padding: 0; white-space: normal; }
.wl-heat-table tbody td:last-child { padding-left: 12px; }

/* Master Data (UI_SPEC §5.3) */
.wl-card-toolbar { padding: 16px; border-bottom: 1px solid var(--wl-border-soft); }
.wl-row-title { display: block; font-weight: 600; }
.wl-table tr.wl-row-done td, .wl-table tr.wl-row-done .wl-row-title { color: var(--wl-muted); }
.wl-pic-line { display: block; }
.wl-pic-line--second { font-size: 13px; color: var(--wl-muted); }
.wl-share { font-size: 12px; color: var(--wl-muted); }
.wl-actions-cell .wl-btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.wl-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wl-form-grid--share { grid-template-columns: minmax(0, 1fr) 120px; }
@media (max-width: 575.98px) { .wl-form-grid:not(.wl-form-grid--share) { grid-template-columns: minmax(0, 1fr); } }
.wl-form-card { max-width: 680px; }
.wl-form-body { display: flex; flex-direction: column; gap: 16px; }
.wl-form-footer { display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--wl-border-soft); }
.wl-fieldset .wl-hint { margin: 0; }
.wl-fieldset .wl-stack, .wl-drawer .wl-stack { max-width: none; }
.wl-dialog--page .modal-dialog { margin: 0; max-width: 520px; }
.wl-drawer--open { z-index: 1045; }
a.wl-drawer-close:hover { color: var(--wl-text); }

/* Team dashboard (UI_SPEC §5.1) */
.wl-section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.wl-card-head { padding: 16px 18px 12px; }
.wl-inline-form { margin: 0; display: inline-flex; }
.wl-actions .btn-group .btn { min-height: 40px; display: inline-flex; align-items: center; }
.wl-dash-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 18px; align-items: start; }
.wl-dash-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 1199.98px) { .wl-dash-row { grid-template-columns: minmax(0, 1fr); } }
.wl-row-link { color: var(--wl-accent-link, #1a5aa8); text-decoration: none; }
.wl-row-link:hover { text-decoration: underline; }
.wl-table-note { margin: 0; padding: 0 18px 10px; font-size: 13px; color: var(--wl-text-2); }
.wl-table-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 18px; border-top: 1px solid var(--wl-border-soft); font-size: 12px; color: var(--wl-muted); }
.wl-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.wl-legend-note { margin-left: auto; }
.wl-cat-list { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.wl-cat-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.wl-cat-value { font-weight: 600; }
.wl-cat-total { margin: 0; padding-top: 12px; border-top: 1px solid var(--wl-border-soft); }
.wl-drawer-meta { margin: 0; color: var(--wl-text-2); }
.wl-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.wl-stat-grid > div { background: #f6f7fa; border-radius: 10px; padding: 12px 14px; }
.wl-stat-grid dt { font-size: 12px; font-weight: 500; color: var(--wl-muted); }
.wl-stat-grid dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; }
.wl-drawer-split { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--wl-text-2); }
.wl-h3 { margin: 0; font-size: 14px; font-weight: 600; }
.wl-task-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.wl-task-list li { border: 1px solid var(--wl-border-soft); border-radius: 10px; padding: 10px 12px; }
.wl-task-name { display: block; font-weight: 600; }
.wl-task-formula { display: block; font-size: 12px; color: var(--wl-muted); }

/* Admin dashboard (UI_SPEC §5.2): Kesehatan data and the heatmap each take the full width. */
.wl-health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 0 18px 18px; }
@media (max-width: 1199.98px) { .wl-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .wl-health-grid { grid-template-columns: minmax(0, 1fr); } }
.wl-health-grid .wl-health-item, .wl-health-grid li:first-child .wl-health-item { height: 100%; padding: 12px 14px; border: 1px solid var(--wl-border-soft); border-radius: 10px; }
.wl-card-head--split { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 16px; }
.wl-heat-toggle { display: inline-flex; align-items: center; min-height: 40px; font-size: 13px; font-weight: 600; color: var(--wl-accent); text-decoration: none; }
.wl-heat-toggle:hover { text-decoration: underline; }
/* PIC column stays in view while the heatmap scrolls sideways inside its box. */
.wl-heat-table .wl-heat-sticky { position: sticky; left: 0; z-index: 1; background: var(--wl-surface); }
.wl-card-head .wl-hint { display: block; margin-top: 2px; }
.wl-health-note { padding-top: 10px; }
.wl-table th.wl-team-name { padding: 12px 18px; font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--wl-text); border-bottom: 0; border-top: 1px solid var(--wl-row); }
.wl-link-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.wl-link-list a { display: block; border: 1px solid var(--wl-border-soft); border-radius: 10px; padding: 10px 12px; color: var(--wl-text); text-decoration: none; }
.wl-link-list a:hover { border-color: var(--wl-accent); }
.wl-admin-heat .wl-heat-table { min-width: 0; width: 100%; }
.wl-admin-heat .wl-heat-table tbody th { white-space: normal; min-width: 150px; max-width: 190px; }
.wl-admin-heat .wl-heat { min-width: 56px; }
.wl-admin-heat .wl-heat-table .wl-num { padding-left: 6px; padding-right: 6px; }
.wl-admin-heat .wl-heat-table tbody td:last-child { padding: 0 12px 0 6px; }
.wl-admin-heat .wl-heat-table .wl-pic-meta { padding: 0; }
.wl-anchor { scroll-margin-top: 72px; }

/* Form fields (components/field.php) */
.wl-field { min-width: 0; }
.wl-check { display: flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; padding-left: 0; }
.wl-check .form-check-input { margin: 0; float: none; width: 18px; height: 18px; flex: 0 0 auto; }
.wl-check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.wl-fieldset--plain { gap: 4px; }
.wl-import-rules { margin: 0; padding-left: 18px; font-size: 13px; color: var(--wl-text-2); display: flex; flex-direction: column; gap: 4px; }
.wl-page--master .wl-kpi-grid { margin-bottom: 16px; }
.wl-form-card + .wl-form-card { margin-top: 16px; }
.wl-table th.wl-col-main { min-width: 120px; }
.wl-table .wl-row-title, .wl-table .wl-row-sub { overflow-wrap: anywhere; }
.wl-table .wl-check-cell { width: 44px; padding-right: 0; }
.wl-check-cell .form-check-input { width: 18px; height: 18px; margin: 0; vertical-align: middle; }
.wl-bulk-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--wl-border-soft); background: var(--wl-surface); }
.wl-bulk-bar .wl-field { min-width: 140px; }
.wl-bulk-count { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--wl-muted); }
.wl-bulk-bar.is-active .wl-bulk-count { color: var(--wl-text); }
.wl-bulk-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.wl-impact { border: 1px solid var(--wl-border-soft); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.wl-impact:empty { display: none; }
.wl-impact p { margin: 0; }
.wl-impact-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.wl-impact-label { font-size: 13px; font-weight: 600; }
.wl-impact-value { font-size: 16px; font-weight: 700; }
.wl-impact-pics { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wl-impact-pics li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; }
.wl-impact-pics li > span:first-child { min-width: 96px; }
.wl-filter-break { flex-basis: 100%; height: 0; }
.wl-per-page { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.wl-per-page label { margin: 0; }
.wl-per-page .form-select { width: auto; min-height: 40px; }
.wl-table-note { margin: 0; padding: 10px 18px; border-top: 1px solid var(--wl-border-soft); font-size: 13px; color: var(--wl-text-2); background: var(--wl-sort-bg); }
@media (max-width: 575.98px) { .wl-per-page { margin-left: 0; } }
.wl-filter-field label { white-space: nowrap; }
.wl-filter-field .form-select { max-width: 200px; }
/* A table above 100 rows (marked by data_table) appears without the fade: animating the opacity of thousands of rows costs seconds. */
.wl-loading-target[hx-history="false"] { transition: none; }
.wl-bulk-select { display: flex; flex-direction: column; gap: 2px; min-width: 190px; }
.wl-bulk-everything { display: flex; align-items: center; min-height: 28px; font-size: 13px; }
.wl-bulk-everything .wl-check { min-height: 28px; }
.wl-form-card--wide { max-width: 980px; }
.wl-summary-card { max-width: 980px; margin-bottom: 16px; }
.wl-summary-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 24px; margin: 0; }
.wl-summary-facts dt { font-size: 12px; font-weight: 600; color: var(--wl-muted); }
.wl-summary-facts dd { margin: 0; }
.wl-page--master .wl-table-card + .wl-table-card { margin-top: 16px; }
.wl-filter-field input[type=date] { width: auto; min-height: 40px; }
.wl-audit-changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.wl-audit-changes .wl-old { color: var(--wl-muted); }
.wl-audit-value { overflow-wrap: anywhere; font-size: 13px; }
.wl-detail-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 20px; margin: 0 0 14px; }
.wl-detail-meta dt { font-size: 12px; font-weight: 600; color: var(--wl-muted); }
.wl-detail-meta dd { margin: 0; overflow-wrap: anywhere; }
.wl-inline-form--card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
/* Pages without the sidebar layout: login and the error pages. */
.wl-standalone { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.wl-standalone-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--wl-text); }
.wl-standalone-card { width: 100%; max-width: 400px; }
.wl-standalone-title { margin: 0; font-size: 20px; font-weight: 600; }
.wl-standalone-text { margin: 0; color: var(--wl-text-2); }
.wl-standalone-code { margin: 0; font-size: 13px; font-weight: 600; color: var(--wl-muted); }

/* Simulation (UI_SPEC §5.9): new load above the PIC's max capacity */
.wl-sim-warn { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--wl-over-target-text); }
