/* ==========================================================================
   Axle ERP theme
   Layout structure based on NiceAdmin (BootstrapMade), rebuilt on CSS variables
   so light and dark mode come from one set of tokens.
   Brand colours sampled from the Axle Consultancy logo:
     forest #0b6935 (wordmark) · leaf #009846 (mark) · sky #03b8ed (mark)
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/inter/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20B9, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/inter/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Design tokens: light ---------- */
:root,
[data-bs-theme="light"] {
  --ax-forest: #0b6935;
  --ax-forest-rgb: 11, 105, 53;
  --ax-leaf: #009846;
  --ax-sky: #03b8ed;
  --ax-sky-rgb: 3, 184, 237;

  --ax-primary: #0b6935;
  --ax-primary-rgb: 11, 105, 53;
  --ax-primary-hover: #09592d;
  --ax-primary-active: #074a25;
  --ax-primary-soft: #e6f2eb;
  --ax-primary-text: #0b6935;
  --ax-on-primary: #ffffff;
  --ax-focus-ring: rgba(11, 105, 53, .25);

  --ax-body-bg: #f4f7f5;
  --ax-surface: #ffffff;
  --ax-surface-2: #f8faf9;
  --ax-border: #e3e9e5;
  --ax-heading: #12261b;
  --ax-text: #34433a;
  --ax-muted: #6b7a71;
  --ax-shadow: 0 1px 2px rgba(16, 40, 26, .04), 0 4px 18px rgba(16, 40, 26, .06);
  --ax-shadow-lg: 0 10px 40px rgba(16, 40, 26, .14);

  --ax-header-h: 60px;
  --ax-sidebar-w: 264px;
  --ax-radius: .6rem;

  /* Bootstrap 5.3 token overrides */
  --bs-primary: var(--ax-primary);
  --bs-primary-rgb: var(--ax-primary-rgb);
  --bs-primary-text-emphasis: #06381c;
  --bs-primary-bg-subtle: #d6eadf;
  --bs-primary-border-subtle: #a9d2bb;
  --bs-info: #0596c9;
  --bs-info-rgb: 5, 150, 201;
  --bs-success: #12884a;
  --bs-success-rgb: 18, 136, 74;
  --bs-link-color: var(--ax-primary);
  --bs-link-color-rgb: var(--ax-primary-rgb);
  --bs-link-hover-color: var(--ax-primary-hover);
  --bs-link-hover-color-rgb: 9, 89, 45;
  --bs-body-bg: var(--ax-body-bg);
  --bs-body-color: var(--ax-text);
  --bs-emphasis-color: var(--ax-heading);
  --bs-border-color: var(--ax-border);
  --bs-secondary-color: var(--ax-muted);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9rem;
  --bs-border-radius: .5rem;
  --bs-border-radius-lg: .7rem;
  --bs-focus-ring-color: var(--ax-focus-ring);
}

/* ---------- Design tokens: dark ---------- */
[data-bs-theme="dark"] {
  --ax-primary: #2fb36b;
  --ax-primary-rgb: 47, 179, 107;
  --ax-primary-hover: #45c27d;
  --ax-primary-active: #5ccc8e;
  --ax-primary-soft: rgba(47, 179, 107, .14);
  --ax-primary-text: #6fd59c;
  --ax-on-primary: #06140c;
  --ax-focus-ring: rgba(47, 179, 107, .35);

  --ax-body-bg: #0d1411;
  --ax-surface: #141d18;
  --ax-surface-2: #19241e;
  --ax-border: #26332b;
  --ax-heading: #e9f1ec;
  --ax-text: #c3cfc8;
  --ax-muted: #8a9a90;
  --ax-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 18px rgba(0, 0, 0, .25);
  --ax-shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);

  --bs-primary-text-emphasis: #8fe0b3;
  --bs-primary-bg-subtle: rgba(47, 179, 107, .16);
  --bs-primary-border-subtle: rgba(47, 179, 107, .4);
  --bs-info: #35c4f2;
  --bs-info-rgb: 53, 196, 242;
  --bs-success: #34b86f;
  --bs-success-rgb: 52, 184, 111;
  --bs-link-hover-color-rgb: 69, 194, 125;
  --bs-body-bg: var(--ax-body-bg);
  --bs-body-color: var(--ax-text);
  --bs-tertiary-bg: var(--ax-surface-2);
  --bs-secondary-bg: var(--ax-surface-2);
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body {
  background: var(--ax-body-bg);
  color: var(--ax-text);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ax-heading); font-weight: 650; letter-spacing: -.01em; }
a { text-decoration: none; }
.num, .table td.num, .table th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.text-primary { color: var(--ax-primary-text) !important; }
.bg-primary-soft { background: var(--ax-primary-soft) !important; }
::selection { background: rgba(var(--ax-primary-rgb), .22); }

/* Theme-aware logo and icons */
.logo-dark-mode, .theme-icon-dark { display: none !important; }
[data-bs-theme="dark"] .logo-light-mode, [data-bs-theme="dark"] .theme-icon-light { display: none !important; }
[data-bs-theme="dark"] .logo-dark-mode, [data-bs-theme="dark"] .theme-icon-dark { display: inline-block !important; }

/* ---------- Buttons (Bootstrap compiles colours into each variant, so re-point them) ---------- */
.btn { --bs-btn-font-weight: 550; --bs-btn-padding-x: .9rem; }
.btn-primary {
  --bs-btn-color: var(--ax-on-primary);
  --bs-btn-bg: var(--ax-primary);
  --bs-btn-border-color: var(--ax-primary);
  --bs-btn-hover-color: var(--ax-on-primary);
  --bs-btn-hover-bg: var(--ax-primary-hover);
  --bs-btn-hover-border-color: var(--ax-primary-hover);
  --bs-btn-active-color: var(--ax-on-primary);
  --bs-btn-active-bg: var(--ax-primary-active);
  --bs-btn-active-border-color: var(--ax-primary-active);
  --bs-btn-disabled-color: var(--ax-on-primary);
  --bs-btn-disabled-bg: var(--ax-primary);
  --bs-btn-disabled-border-color: var(--ax-primary);
  --bs-btn-focus-shadow-rgb: var(--ax-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--ax-primary-text);
  --bs-btn-border-color: var(--ax-primary);
  --bs-btn-hover-color: var(--ax-on-primary);
  --bs-btn-hover-bg: var(--ax-primary);
  --bs-btn-hover-border-color: var(--ax-primary);
  --bs-btn-active-color: var(--ax-on-primary);
  --bs-btn-active-bg: var(--ax-primary-active);
  --bs-btn-active-border-color: var(--ax-primary-active);
  --bs-btn-disabled-color: var(--ax-primary-text);
  --bs-btn-disabled-border-color: var(--ax-primary);
  --bs-btn-focus-shadow-rgb: var(--ax-primary-rgb);
}
.btn-soft-primary {
  --bs-btn-color: var(--ax-primary-text);
  --bs-btn-bg: var(--ax-primary-soft);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--ax-on-primary);
  --bs-btn-hover-bg: var(--ax-primary);
  --bs-btn-hover-border-color: var(--ax-primary);
  --bs-btn-active-bg: var(--ax-primary-active);
  --bs-btn-active-color: var(--ax-on-primary);
}
.btn-icon {
  --bs-btn-padding-x: .45rem; --bs-btn-padding-y: .3rem;
  color: var(--ax-muted); border: 0; font-size: 1.15rem; line-height: 1;
}
.btn-icon:hover, .btn-icon:focus-visible { color: var(--ax-primary-text); background: var(--ax-primary-soft); }

/* ---------- Form controls ---------- */
.form-control, .form-select { background-color: var(--ax-surface); border-color: var(--ax-border); }
.form-control:focus, .form-select:focus { border-color: rgba(var(--ax-primary-rgb), .6); box-shadow: 0 0 0 .2rem var(--ax-focus-ring); }
.form-check-input:checked { background-color: var(--ax-primary); border-color: var(--ax-primary); }
.form-check-input:focus { border-color: rgba(var(--ax-primary-rgb), .6); box-shadow: 0 0 0 .2rem var(--ax-focus-ring); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2338a169'/%3e%3c/svg%3e"); }
.form-range::-webkit-slider-thumb { background: var(--ax-primary); }
.form-range::-moz-range-thumb { background: var(--ax-primary); }
.form-label { font-weight: 550; color: var(--ax-heading); font-size: .85rem; margin-bottom: .3rem; }
.form-label .req { color: var(--bs-danger); margin-left: 2px; }
.form-text { font-size: .78rem; }
.input-group-text { background: var(--ax-surface-2); border-color: var(--ax-border); color: var(--ax-muted); }

/* ---------- Other Bootstrap components on brand colour ---------- */
.nav-pills { --bs-nav-pills-link-active-bg: var(--ax-primary); --bs-nav-pills-link-active-color: var(--ax-on-primary); }
.nav-link { color: var(--ax-text); }
.nav-link:hover, .nav-link:focus { color: var(--ax-primary-text); }
.pagination { --bs-pagination-color: var(--ax-text); --bs-pagination-bg: var(--ax-surface); --bs-pagination-border-color: var(--ax-border); --bs-pagination-hover-color: var(--ax-primary-text); --bs-pagination-hover-bg: var(--ax-primary-soft); --bs-pagination-hover-border-color: var(--ax-border); --bs-pagination-focus-color: var(--ax-primary-text); --bs-pagination-focus-box-shadow: 0 0 0 .2rem var(--ax-focus-ring); --bs-pagination-active-bg: var(--ax-primary); --bs-pagination-active-border-color: var(--ax-primary); --bs-pagination-active-color: var(--ax-on-primary); --bs-pagination-disabled-bg: var(--ax-surface); --bs-pagination-disabled-border-color: var(--ax-border); }
.dropdown-menu { --bs-dropdown-bg: var(--ax-surface); --bs-dropdown-border-color: var(--ax-border); --bs-dropdown-link-active-bg: var(--ax-primary-soft); --bs-dropdown-link-active-color: var(--ax-primary-text); --bs-dropdown-link-hover-bg: var(--ax-surface-2); --bs-dropdown-font-size: .875rem; border-radius: var(--ax-radius); padding: .4rem; animation: ax-fade-in .15s ease-out; }
.dropdown-item { border-radius: .4rem; padding: .45rem .75rem; display: flex; align-items: center; gap: .55rem; }
.dropdown-header { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--ax-primary); --bs-progress-bg: var(--ax-surface-2); }
.list-group { --bs-list-group-bg: var(--ax-surface); --bs-list-group-active-bg: var(--ax-primary); --bs-list-group-active-border-color: var(--ax-primary); --bs-list-group-border-color: var(--ax-border); }
.accordion { --bs-accordion-bg: var(--ax-surface); --bs-accordion-border-color: var(--ax-border); --bs-accordion-active-bg: var(--ax-primary-soft); --bs-accordion-active-color: var(--ax-primary-text); --bs-accordion-btn-focus-box-shadow: 0 0 0 .2rem var(--ax-focus-ring); }
.modal { --bs-modal-bg: var(--ax-surface); --bs-modal-border-color: var(--ax-border); --bs-modal-border-radius: .8rem; }
.modal-header, .modal-footer { border-color: var(--ax-border); }
.offcanvas { --bs-offcanvas-bg: var(--ax-surface); --bs-offcanvas-border-color: var(--ax-border); }
.toast { --bs-toast-bg: var(--ax-surface); }
.badge { font-weight: 600; letter-spacing: .01em; }
.badge-soft { background: rgba(var(--bs-badge-rgb, var(--ax-primary-rgb)), .14); color: rgb(var(--bs-badge-rgb, var(--ax-primary-rgb))); }
.badge-soft.text-bg-primary { --bs-badge-rgb: var(--ax-primary-rgb); background: var(--ax-primary-soft) !important; color: var(--ax-primary-text) !important; }

/* Status badges used by every module (quotation, job, reminder, invoice) */
.status { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.status-draft { color: var(--ax-muted); background: var(--ax-surface-2); border: 1px solid var(--ax-border); }
.status-pending { color: #b26a00; background: rgba(255, 170, 0, .14); }
.status-approved, .status-paid, .status-completed { color: var(--bs-success); background: rgba(var(--bs-success-rgb), .13); }
.status-sent, .status-progress { color: var(--bs-info); background: rgba(var(--bs-info-rgb), .13); }
.status-overdue, .status-rejected { color: var(--bs-danger); background: rgba(var(--bs-danger-rgb), .12); }
[data-bs-theme="dark"] .status-pending { color: #ffc35a; }

/* ---------- Header ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 997;
  height: var(--ax-header-h);
  padding: 0 1rem 0 .75rem;
  background: var(--ax-surface);
  border-bottom: 1px solid var(--ax-border);
  gap: .5rem;
}
.header-brand { width: calc(var(--ax-sidebar-w) - .75rem); flex-shrink: 0; justify-content: space-between; }
.logo img { height: 34px; width: auto; }
.toggle-sidebar-btn { font-size: 1.5rem !important; }
.btn-company {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--ax-surface-2); border: 1px solid var(--ax-border); color: var(--ax-heading);
  padding: .3rem .7rem; border-radius: 999px; font-weight: 600; font-size: .85rem;
}
.btn-company:hover, .btn-company.show { border-color: rgba(var(--ax-primary-rgb), .5); color: var(--ax-heading); }
.company-code {
  display: inline-block; min-width: 2.6rem; text-align: center;
  background: var(--ax-primary); color: var(--ax-on-primary);
  border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .04em; padding: .12rem .45rem;
}
.search-bar { max-width: 520px; margin-left: 1rem; }
.search-form { position: relative; }
.search-form i { position: absolute; left: .8rem; color: var(--ax-muted); pointer-events: none; }
.search-form input {
  width: 100%; border: 1px solid var(--ax-border); background: var(--ax-surface-2); color: var(--ax-text);
  border-radius: 999px; padding: .42rem 2.6rem .42rem 2.2rem; font-size: .85rem; transition: border-color .15s, box-shadow .15s;
}
.search-form input:focus { outline: 0; border-color: rgba(var(--ax-primary-rgb), .6); box-shadow: 0 0 0 .2rem var(--ax-focus-ring); background: var(--ax-surface); }
.search-form kbd { position: absolute; right: .7rem; background: var(--ax-surface); color: var(--ax-muted); border: 1px solid var(--ax-border); font-size: .7rem; padding: .05rem .35rem; }
.header-nav ul { list-style: none; margin: 0; padding: 0; gap: .25rem; }
.header-nav .badge-number { position: absolute; top: -2px; right: -4px; font-size: .62rem; padding: .2rem .38rem; }
.header-nav .notifications { width: 340px; padding: .4rem; }
.notification-item { display: flex; gap: .75rem; padding: .6rem .6rem; border-radius: .45rem; color: var(--ax-text); align-items: flex-start; }
.notification-item:hover { background: var(--ax-surface-2); color: var(--ax-text); }
.notification-item > i { font-size: 1.25rem; margin-top: .1rem; }
.nav-profile { border: 0; color: var(--ax-heading); padding: .2rem .4rem; }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ax-sky), var(--ax-leaf)); color: #fff; font-weight: 700; font-size: .78rem;
}
.header-nav .profile { min-width: 220px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--ax-header-h); left: 0; bottom: 0; z-index: 996;
  width: var(--ax-sidebar-w); padding: 1rem .75rem;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--ax-border) transparent;
  background: var(--ax-surface); border-right: 1px solid var(--ax-border);
  transition: transform .25s ease;
}
.sidebar-nav, .sidebar-nav li { list-style: none; margin: 0; padding: 0; }
.sidebar-nav .nav-item { margin-bottom: 2px; }
.sidebar-nav .nav-heading { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ax-muted); font-weight: 700; margin: 1.1rem .4rem .35rem .8rem; display: flex; align-items: center; gap: .45rem; }
.sidebar-nav .nav-heading i { font-size: .8rem; color: var(--ax-primary-text); opacity: .8; }
.sidebar-nav .nav-heading::after { content: ""; flex: 1; height: 1px; background: var(--ax-border); }
.sidebar-tools { display: grid; gap: .55rem; margin: 0 0 .4rem; }
.sidebar-create { font-weight: 600; box-shadow: 0 4px 12px rgba(11, 105, 53, .22); }
.sidebar-tools .dropdown-menu { max-height: 60vh; overflow: auto; }
.sidebar-find { position: relative; }
.sidebar-find i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--ax-muted); font-size: .8rem; }
.sidebar-find input { padding-left: 1.9rem; background: var(--ax-surface-2); border-color: transparent; border-radius: .5rem; }
.sidebar-find input:focus { background: var(--ax-surface); }
.sidebar-nav .nav-empty { color: var(--ax-muted); font-size: .85rem; padding: .6rem .8rem; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .7rem;
  font-size: .875rem; font-weight: 550; color: var(--ax-text);
  padding: .55rem .8rem; border-radius: .5rem; transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; color: var(--ax-muted); transition: color .15s; }
.sidebar-nav .nav-link:hover { background: var(--ax-surface-2); color: var(--ax-heading); }
.sidebar-nav .nav-link:hover i { color: var(--ax-primary-text); }
.sidebar-nav .nav-link.active, .sidebar-nav .nav-link:not(.collapsed)[data-bs-toggle] { background: var(--ax-primary-soft); color: var(--ax-primary-text); }
.sidebar-nav .nav-link.active i, .sidebar-nav .nav-link:not(.collapsed)[data-bs-toggle] i { color: var(--ax-primary-text); }
.sidebar-nav .nav-link .bi-chevron-down { font-size: .75rem; transition: transform .2s; }
.sidebar-nav .nav-link:not(.collapsed) .bi-chevron-down { transform: rotate(180deg); }
.sidebar-nav .disabled-link { opacity: .5; pointer-events: none; }
.sidebar-nav .nav-content { padding: .2rem 0 .3rem; margin: 0; }
.sidebar-nav .nav-content a {
  display: flex; align-items: center; gap: .6rem;
  font-size: .84rem; font-weight: 500; color: var(--ax-text);
  padding: .45rem .8rem .45rem 2.3rem; border-radius: .45rem;
}
.sidebar-nav .nav-content a i { font-size: .4rem; color: var(--ax-muted); }
.sidebar-nav .nav-content a:hover { color: var(--ax-primary-text); }
.sidebar-nav .nav-content a.active { color: var(--ax-primary-text); font-weight: 650; }
.sidebar-nav .nav-content a.active i { color: var(--ax-primary-text); }
.sidebar-backdrop { display: none; }

/* ---------- Main + footer ---------- */
.main { margin-top: var(--ax-header-h); margin-left: var(--ax-sidebar-w); padding: 1.4rem 1.75rem; min-height: calc(100vh - var(--ax-header-h) - 52px); transition: margin .25s ease; }
.footer { margin-left: var(--ax-sidebar-w); padding: 1rem 1.75rem; border-top: 1px solid var(--ax-border); font-size: .78rem; color: var(--ax-muted); display: flex; justify-content: space-between; gap: 1rem; transition: margin .25s ease; }

/* Desktop: collapse the sidebar completely */
@media (min-width: 1200px) {
  .sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .sidebar-collapsed .main, .sidebar-collapsed .footer { margin-left: 0; }
}
/* Tablet / phone: sidebar becomes an overlay drawer */
@media (max-width: 1199.98px) {
  .header-brand { width: auto; gap: .5rem; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--ax-shadow-lg); }
  .main, .footer { margin-left: 0; }
  .main { padding: 1rem; }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: var(--ax-header-h) 0 0 0; background: rgba(0, 0, 0, .35); z-index: 995; }
}
@media (max-width: 575.98px) {
  .logo img { height: 28px; }
  .header { padding: 0 .5rem; }
  .company-switcher .btn-company { padding: .25rem .45rem; }
  .footer { flex-direction: column; gap: .2rem; }
}

/* ---------- Page title ---------- */
.pagetitle { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.pagetitle h1 { font-size: 1.4rem; margin: 0; }
.pagetitle .breadcrumb { font-size: .8rem; margin: .25rem 0 0; --bs-breadcrumb-divider-color: var(--ax-muted); }
.pagetitle .breadcrumb a { color: var(--ax-muted); }
.pagetitle .breadcrumb .active { color: var(--ax-text); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Cards ---------- */
.card { --bs-card-bg: var(--ax-surface); --bs-card-border-color: var(--ax-border); --bs-card-cap-bg: transparent; border-radius: var(--ax-radius); box-shadow: var(--ax-shadow); margin-bottom: 1.5rem; }
.card-header { padding: .9rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-color: var(--ax-border); }
.card-title { font-size: 1rem; font-weight: 650; color: var(--ax-heading); margin: 0; }
.card-title small, .card-subtitle { font-weight: 450; color: var(--ax-muted); font-size: .8rem; }
.card-body { padding: 1.25rem; }
.card-footer { border-color: var(--ax-border); background: var(--ax-surface-2); }

/* KPI tiles */
.kpi { display: flex; align-items: center; gap: 1rem; }
.kpi-icon { width: 48px; height: 48px; border-radius: .75rem; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.kpi-icon.forest { background: var(--ax-primary-soft); color: var(--ax-primary-text); }
.kpi-icon.sky { background: rgba(var(--ax-sky-rgb), .14); color: #0287b0; }
.kpi-icon.amber { background: rgba(255, 170, 0, .15); color: #b26a00; }
.kpi-icon.rose { background: rgba(var(--bs-danger-rgb), .12); color: var(--bs-danger); }
[data-bs-theme="dark"] .kpi-icon.sky { color: var(--ax-sky); }
[data-bs-theme="dark"] .kpi-icon.amber { color: #ffc35a; }
.kpi-label { font-size: .78rem; color: var(--ax-muted); font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--ax-heading); font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-delta { font-size: .78rem; font-weight: 600; }
.kpi > div:last-child { min-width: 0; }
.kpi-value.money { font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.money .cur { font-size: .85em; font-weight: 600; color: var(--ax-muted); margin-right: .1rem; }
.kpi-delta.wrap-ok { white-space: normal; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ax-text); --bs-table-border-color: var(--ax-border); --bs-table-hover-bg: var(--ax-surface-2); --bs-table-striped-bg: var(--ax-surface-2); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ax-muted); font-weight: 650; background: var(--ax-surface-2); border-bottom-width: 1px; white-space: nowrap; }
.table thead th a.sort { color: inherit; display: inline-flex; align-items: center; gap: .3rem; }
.table thead th a.sort:hover { color: var(--ax-primary-text); }
.table thead th a.sort.active { color: var(--ax-primary-text); }
.table thead th a.sort i { font-size: .7rem; opacity: .5; }
.table thead th a.sort.active i { opacity: 1; }
.table tbody tr { transition: background .1s; }
.grid-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; padding: .9rem 1.25rem; border-bottom: 1px solid var(--ax-border); }
.grid-toolbar .search { position: relative; min-width: 240px; }
.grid-toolbar .search i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--ax-muted); }
.grid-toolbar .search input { padding-left: 2rem; }
.grid-footer { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: .75rem 1.25rem; border-top: 1px solid var(--ax-border); font-size: .82rem; color: var(--ax-muted); }
.grid-body { position: relative; }
.grid-body.htmx-request::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--ax-surface) 55%, transparent); }

/* Tables become cards on phones: each cell shows its column label */
@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(--ax-border); border-radius: var(--ax-radius); margin: .75rem; width: auto; background: var(--ax-surface); }
  .table-cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0 !important; padding: .35rem .8rem !important; text-align: right !important; }
  .table-cards td::before { content: attr(data-label); font-weight: 600; color: var(--ax-muted); font-size: .75rem; text-transform: uppercase; text-align: left; }
}

/* ---------- Line-item calculator ---------- */
.lines-table input { min-width: 70px; }
.lines-table .form-control { padding: .35rem .5rem; font-size: .85rem; }
/* keep Bootstrap's right padding for the select arrow, otherwise it covers the value */
.lines-table .form-select { padding: .35rem 1.9rem .35rem .5rem; background-position: right .45rem center; font-size: .85rem; min-width: 92px; }
.lines-table td { vertical-align: middle; }
.totals { min-width: 300px; }
.totals .row-line { display: flex; justify-content: space-between; padding: .3rem 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 1px solid var(--ax-border); margin-top: .4rem; padding-top: .6rem; font-size: 1.15rem; font-weight: 700; color: var(--ax-heading); }
.amount-words { font-size: .82rem; color: var(--ax-muted); font-style: italic; }
.over-limit { color: var(--bs-danger) !important; }

/* ---------- Document directory ---------- */
.dir-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 520px; }
.dir-tree { border-right: 1px solid var(--ax-border); padding: .75rem; overflow: auto; max-height: 70vh; }
.dir-tree ul { list-style: none; margin: 0; padding-left: 1rem; }
.dir-tree > ul { padding-left: 0; }
.dir-node { display: flex; align-items: center; gap: .4rem; padding: .3rem .45rem; border-radius: .4rem; cursor: pointer; color: var(--ax-text); font-size: .85rem; user-select: none; }
.dir-node:hover { background: var(--ax-surface-2); }
.dir-node.active { background: var(--ax-primary-soft); color: var(--ax-primary-text); font-weight: 600; }
.dir-node .caret { width: 1rem; font-size: .7rem; color: var(--ax-muted); transition: transform .15s; }
.dir-node.open .caret { transform: rotate(90deg); }
.dir-node .bi-folder-fill, .dir-node .bi-folder2-open { color: #e0a526; }
.dir-pane { padding: 1rem 1.25rem; min-width: 0; }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.file-card { border: 1px solid var(--ax-border); border-radius: var(--ax-radius); background: var(--ax-surface); overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.file-card:hover { box-shadow: var(--ax-shadow); transform: translateY(-1px); }
.file-card .thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--ax-surface-2); font-size: 2.2rem; color: var(--ax-muted); }
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .meta { padding: .5rem .6rem; font-size: .78rem; }
.file-card .meta .name { font-weight: 600; color: var(--ax-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-card .thumb { color: #e0a526; }
.dir-drop { outline: 2px dashed rgba(var(--ax-primary-rgb), .6); outline-offset: -6px; background: var(--ax-primary-soft); }
@media (max-width: 991.98px) {
  .dir-shell { grid-template-columns: 1fr; }
  .dir-tree { border-right: 0; border-bottom: 1px solid var(--ax-border); max-height: 260px; }
}

/* PDF preview panel */
.pdf-viewer { background: var(--ax-surface-2); padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; min-height: 200px; }
.pdf-viewer canvas { max-width: 100%; height: auto !important; box-shadow: var(--ax-shadow); background: #fff; }
.offcanvas-preview { --bs-offcanvas-width: min(760px, 100vw); }

/* ---------- Upload (Uppy) on theme ---------- */
.uppy-Root { font-family: var(--bs-body-font-family) !important; }
.uppy-Dashboard-inner { border-radius: var(--ax-radius) !important; border-color: var(--ax-border) !important; background-color: var(--ax-surface-2) !important; }
.uppy-Dashboard-AddFiles { border-color: rgba(var(--ax-primary-rgb), .35) !important; }
.uppy-Dashboard-browse, .uppy-Dashboard-browse:hover { color: var(--ax-primary-text) !important; }
.uppy-StatusBar-actionBtn--upload, .uppy-c-btn-primary { background-color: var(--ax-primary) !important; color: var(--ax-on-primary) !important; }
.uppy-StatusBar-progress { background-color: var(--ax-primary) !important; }
.uppy-Dashboard-AddFiles-title { color: var(--ax-heading) !important; }
.upload-rules { font-size: .78rem; color: var(--ax-muted); }

/* ---------- Tom Select on theme ---------- */
.ts-wrapper .ts-control { background: var(--ax-surface) !important; border-color: var(--ax-border); color: var(--ax-text); }
.ts-wrapper.focus .ts-control { border-color: rgba(var(--ax-primary-rgb), .6); box-shadow: 0 0 0 .2rem var(--ax-focus-ring); }
.ts-dropdown { background: var(--ax-surface); border-color: var(--ax-border); color: var(--ax-text); border-radius: .5rem; box-shadow: var(--ax-shadow-lg); }
.ts-dropdown .active { background: var(--ax-primary-soft); color: var(--ax-primary-text); }
.ts-dropdown .option .sub { display: block; font-size: .75rem; color: var(--ax-muted); }
.ts-wrapper.multi .ts-control > div { background: var(--ax-primary-soft); color: var(--ax-primary-text); border-radius: .35rem; }
.ts-control input { color: var(--ax-text) !important; }

/* ---------- NProgress top bar on brand colours ---------- */
#nprogress .bar { background: linear-gradient(90deg, var(--ax-sky), var(--ax-leaf)); height: 3px; z-index: 2000; }
#nprogress .peg { box-shadow: 0 0 10px var(--ax-sky), 0 0 5px var(--ax-leaf); }

/* ---------- Notiflix on theme ---------- */
[data-bs-theme="dark"] .notiflix-confirm-content,
[data-bs-theme="dark"] .notiflix-report-content { background: var(--ax-surface) !important; }
[data-bs-theme="dark"] .notiflix-confirm-content h5, [data-bs-theme="dark"] .notiflix-report-content h5 { color: var(--ax-heading) !important; }
[data-bs-theme="dark"] .notiflix-confirm-content div, [data-bs-theme="dark"] .notiflix-report-content p { color: var(--ax-text) !important; }

/* ---------- GLightbox ---------- */
.glightbox-clean .gslide-description { background: var(--ax-surface); }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand { background: linear-gradient(150deg, #0b6935 0%, #08502a 55%, #063d20 100%); color: #e8f5ed; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(3, 184, 237, .35), transparent 70%); }
.auth-brand h2 { color: #fff; font-size: 2rem; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: var(--ax-surface); }
.auth-card { width: 100%; max-width: 380px; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-brand { display: none; } }

/* ---------- Small utilities ---------- */
.ui-section-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ax-muted); font-weight: 700; margin: 0 0 .75rem; }
.swatch { height: 64px; border-radius: .5rem; display: flex; align-items: flex-end; padding: .4rem .5rem; font-size: .72rem; font-weight: 600; }
.code-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; background: var(--ax-surface-2); border: 1px solid var(--ax-border); padding: .05rem .35rem; border-radius: .3rem; }
[x-cloak] { display: none !important; }
@keyframes ax-fade-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.fade-in { animation: ax-fade-in .2s ease-out; }
#main.htmx-swapping { opacity: .6; transition: opacity .1s; }
#main.htmx-settling > * { animation: ax-fade-in .18s ease-out; }

/* Inline spinner shown only while its element's htmx request is running */
.htmx-indicator-inline { display: none; }
.htmx-request .htmx-indicator-inline, .htmx-request.htmx-indicator-inline { display: inline-block; }

/* Outline warning needs darker text on white to stay readable */
[data-bs-theme="light"] .btn-outline-warning { --bs-btn-color: #9a6400; --bs-btn-border-color: #e0a526; --bs-btn-hover-bg: #e0a526; --bs-btn-hover-border-color: #e0a526; --bs-btn-hover-color: #1d1300; }
.alloc-table > :not(caption) > * > * { padding: .45rem .4rem; }
/* Uppy links and "Done" on brand colour */
.uppy-DashboardContent-addMore, .uppy-DashboardContent-back, .uppy-StatusBar-actionBtn--done, .uppy-Dashboard-browse { color: var(--ax-primary-text) !important; }
.uppy-StatusBar-actionBtn--done:hover, .uppy-DashboardContent-addMore:hover { color: var(--ax-primary-hover) !important; }
.uppy-StatusBar.is-complete .uppy-StatusBar-progress, .uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator { color: var(--bs-success) !important; }
[data-uppy-theme="dark"] .uppy-Dashboard-inner { background-color: var(--ax-surface-2) !important; }
/* Bootstrap's .btn-light stays white in dark mode; use the dark surface instead */
[data-bs-theme="dark"] .btn-light { --bs-btn-color: var(--ax-text); --bs-btn-bg: var(--ax-surface-2); --bs-btn-border-color: var(--ax-border); --bs-btn-hover-color: var(--ax-heading); --bs-btn-hover-bg: var(--ax-border); --bs-btn-hover-border-color: var(--ax-border); --bs-btn-active-bg: var(--ax-border); --bs-btn-active-color: var(--ax-heading); }

/* ---------- Login: floating icons (subtle, brand colours, off for reduced motion) ---------- */
.auth-form { position: relative; overflow: hidden; }
.auth-card { position: relative; z-index: 1; }
.auth-brand > :not(.auth-floaters) { position: relative; z-index: 1; }
.auth-floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-floaters i {
  position: absolute; left: var(--x); top: var(--y); font-size: var(--s);
  color: rgba(255, 255, 255, .16);
  animation: ax-float var(--d) ease-in-out var(--delay) infinite alternate, ax-glow calc(var(--d) * 1.6) ease-in-out var(--delay) infinite alternate;
  will-change: transform;
}
.auth-floaters i:nth-child(3n) { color: rgba(3, 184, 237, .30); }
.auth-floaters i:nth-child(4n) { color: rgba(118, 214, 152, .26); }
.auth-floaters-soft i { color: rgba(var(--ax-primary-rgb), .07) !important; }
.auth-floaters-soft i:nth-child(2n) { color: rgba(var(--ax-sky-rgb), .09) !important; }
@keyframes ax-float {
  0%   { transform: translate(0, 0) rotate(-6deg); }
  50%  { transform: translate(14px, -22px) rotate(4deg); }
  100% { transform: translate(-10px, 16px) rotate(8deg); }
}
@keyframes ax-glow { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .auth-floaters i { animation: none; } }

/* ---------- Phase 1 additions ---------- */
.min-w-0 { min-width: 0; }
.avatar-lg { width: 3.25rem; height: 3.25rem; font-size: 1.15rem; }
.notification-item.unread { background: rgba(var(--bs-primary-rgb), .07); }
.notification-item.unread .fw-semibold::after { content: ""; display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: var(--bs-primary); margin-left: .4rem; vertical-align: middle; }
.notifications { width: min(360px, calc(100vw - 1.5rem)); max-height: 70vh; overflow-y: auto; }
.company-switcher form.dropdown-menu .dropdown-item { display: flex; gap: .5rem; align-items: center; }

/* Permission matrix (Users & access) */
.perm-matrix td, .perm-matrix th { vertical-align: middle; }
.perm-matrix .btn-group .btn { min-width: 4.6rem; }
.perm-matrix .covers { font-size: .78rem; color: var(--ax-muted); }

/* Letterhead preview (Company master): mirrors the PDF header */
.lh-preview { background: #fff; color: #12261b; border: 1px solid var(--ax-border); border-radius: .5rem; padding: 1.1rem 1.25rem .9rem; font-family: "Noto Sans", Inter, sans-serif; box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.lh-preview .lh-row { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-end; }
.lh-preview .lh-logo { height: 30px; width: auto; max-width: 180px; object-fit: contain; display: block; margin-bottom: .3rem; }
.lh-preview .lh-logo.own { height: 42px; }
.lh-preview .lh-name { color: #0b6935; font-weight: 700; font-size: 1rem; text-transform: uppercase; line-height: 1.2; }
.lh-preview .lh-addr { color: #6b7a71; font-size: .72rem; margin-top: .15rem; }
.lh-preview .lh-group { color: #03b8ed; font-size: .65rem; font-style: italic; }
.lh-preview .lh-right { text-align: right; font-size: .7rem; white-space: nowrap; }
.lh-preview .lh-right span { color: #6b7a71; margin-right: .35rem; }
.lh-preview .lh-rule { display: flex; height: 4px; margin-top: .6rem; }
.lh-preview .lh-rule i:first-child { flex: 5; background: #0b6935; }
.lh-preview .lh-rule i:last-child { flex: 1; background: #03b8ed; }
.lh-preview .lh-body { height: 70px; margin-top: .8rem; background: repeating-linear-gradient(#fff 0 10px, #eef2ef 10px 12px); border-radius: 2px; opacity: .8; }
@media (max-width: 575.98px) { .lh-preview .lh-row { flex-direction: column; align-items: flex-start; } .lh-preview .lh-right { text-align: left; } }

/* Sticky save bar for long forms */
.form-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: .5rem; justify-content: flex-end; align-items: center; padding: .75rem 1rem; margin: 0 -1rem; background: color-mix(in srgb, var(--ax-surface) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--ax-border); }
.series-preview { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--bs-primary); }
.current-logo { display: flex; gap: .9rem; align-items: center; padding: .75rem; border: 1px solid var(--ax-border); border-radius: var(--ax-radius); background: var(--ax-surface-2); }
.current-logo-img { flex: 0 0 140px; height: 64px; background: #fff; border-radius: .4rem; display: grid; place-items: center; padding: .35rem; border: 1px solid var(--ax-border); }
.current-logo-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- Phase 2 ---------- */
.d-contents { display: contents; }
.color-dot { width: .9rem; height: .9rem; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.12); }
a.master-card { color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
a.master-card:hover { box-shadow: var(--ax-shadow); transform: translateY(-1px); }
.import-steps { padding-left: 1.2rem; margin: 0; display: grid; gap: 1.1rem; }
.import-steps li::marker { font-weight: 700; color: var(--bs-primary); }
.site-block { border: 1px solid var(--ax-border); border-radius: var(--ax-radius); margin-bottom: .6rem; background: var(--ax-surface); }
.site-block.has-error { border-color: rgba(var(--bs-danger-rgb), .6); }
.site-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; cursor: pointer; }
.site-head .caret { font-size: .75rem; color: var(--ax-muted); transition: transform .15s; }
.site-block.open .site-head .caret { transform: rotate(90deg); }
.site-body { padding: .25rem .9rem .9rem; border-top: 1px dashed var(--ax-border); }
.contacts-table td { min-width: 130px; }
.copy-panel { border-style: dashed; }
.profile-dl dt { font-weight: 500; color: var(--ax-muted); }
.profile-dl dd { margin-bottom: .45rem; }
.dir-count { margin-left: auto; font-size: .7rem; color: var(--ax-muted); background: var(--ax-surface-2); border-radius: 999px; padding: 0 .45rem; }
.dir-node.empty { color: var(--ax-muted); }
.folder-icon { color: #e0a526; }
.doc-tag { display: inline-block; font-size: .68rem; padding: 0 .4rem; margin-left: .3rem; border-radius: 999px; background: rgba(var(--bs-info-rgb), .12); color: var(--bs-info); font-weight: 600; vertical-align: middle; }
.doc-path .breadcrumb-item a { text-decoration: none; }
#doc-panel .tab-content { min-height: 0; }
#doc-panel .pdf-viewer { min-height: 100%; }
.search { position: relative; }
.search > i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--ax-muted); pointer-events: none; z-index: 2; }
.search > input { padding-left: 2rem; }
.totals-box { border: 1px solid var(--ax-border); border-radius: var(--ax-radius); padding: .75rem 1rem; display: grid; gap: .35rem; background: var(--ax-surface-2); }
.totals-box .grand { font-weight: 700; font-size: 1.1rem; color: var(--ax-heading); border-top: 1px solid var(--ax-border); padding-top: .45rem; margin-top: .2rem; }
.quote-lines td { vertical-align: top; }
.q-timeline { list-style: none; padding: 0; margin: 0; }
.q-timeline li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid var(--ax-border); margin-left: .35rem; }
.q-timeline li:last-child { border-left-color: transparent; }
.q-timeline li::before { content: ""; position: absolute; left: -.42rem; top: .2rem; width: .75rem; height: .75rem; border-radius: 50%; background: var(--ax-surface); border: 2px solid var(--bs-primary); }
.q-timeline li.ok::before { background: var(--bs-success); border-color: var(--bs-success); }
.q-timeline li.bad::before { background: var(--bs-danger); border-color: var(--bs-danger); }
.q-pdf { height: 75vh; overflow: auto; border-radius: var(--ax-radius); }

/* Quotation lines: one card per line on phones */
@media (max-width: 767.98px) {
  .quote-lines thead { display: none; }
  .quote-lines, .quote-lines tbody, .quote-lines tr { display: block; width: 100%; }
  .quote-lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .6rem; border: 1px solid var(--ax-border); border-radius: var(--ax-radius); margin: .6rem; padding: .6rem; position: relative; }
  .quote-lines td { display: block; border: 0 !important; padding: 0 !important; }
  .quote-lines td::before { content: attr(data-label); display: block; font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--ax-muted); margin-bottom: .1rem; }
  .quote-lines td[data-label="#"] { position: absolute; top: .4rem; right: 2.6rem; font-size: .75rem; }
  .quote-lines td[data-label="#"]::before { display: none; }
  .quote-lines td[data-label="Item"] { grid-column: 1 / -1; }
  .quote-lines td[data-label="Amount"] { text-align: right; align-self: end; font-size: 1rem; }
  .quote-lines td:last-child { position: absolute; top: .2rem; right: .2rem; }
  .quote-lines input, .quote-lines .form-select { min-width: 0; width: 100%; }
}

/* Quotation item search menu */
.item-pick { position: relative; }
.item-menu { position: fixed; z-index: 1060; max-height: 300px; overflow-y: auto; background: var(--ax-surface); border: 1px solid var(--ax-border); border-radius: var(--ax-radius); box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: .25rem; }
.item-opt { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: .45rem .65rem; border-radius: calc(var(--ax-radius) - 2px); color: inherit; }
.item-opt.active { background: color-mix(in srgb, var(--bs-primary) 10%, transparent); }
.item-opt-name { display: block; font-weight: 600; font-size: .875rem; }
.item-opt-meta { display: block; font-size: .75rem; color: var(--ax-muted); }

/* ===================== Phase 4: service jobs ===================== */
.job-steps-card { padding: .9rem 1rem; overflow-x: auto; }
.job-steps { display: flex; list-style: none; margin: 0; padding: 0; min-width: 640px; counter-reset: s; }
.job-steps li { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; font-size: .78rem; color: var(--ax-muted); text-align: center; }
.job-steps li::before { content: ""; position: absolute; top: 14px; left: -50%; width: 100%; height: 2px; background: var(--ax-border); z-index: 0; }
.job-steps li:first-child::before { display: none; }
.job-steps li.done::before, .job-steps li.current::before { background: var(--bs-primary); }
.job-steps .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ax-surface); border: 2px solid var(--ax-border); font-weight: 600; z-index: 1; position: relative; }
.job-steps li.done .dot { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.job-steps li.current .dot { border-color: var(--bs-primary); color: var(--bs-primary); box-shadow: 0 0 0 4px var(--ax-focus-ring); }
.job-steps li.current .lbl { color: var(--ax-heading); font-weight: 600; }
.job-steps .lbl { margin-top: .35rem; }
.review-list { display: grid; gap: .5rem; }
.review-item { border: 1px solid var(--ax-border); border-radius: var(--ax-radius); padding: .65rem .75rem; background: var(--ax-surface); }
.review-item.is-rejected { border-color: rgba(214, 60, 60, .45); background: rgba(214, 60, 60, .04); }
.review-item.is-accepted { border-color: rgba(18, 136, 74, .35); }
.review-value { white-space: pre-line; background: var(--ax-surface-2); border-radius: 6px; padding: .3rem .5rem; margin: .25rem 0; font-size: .9rem; }
.review-children { margin: .5rem 0 0 1.25rem; display: grid; gap: .4rem; }
.job-note { border-left: 3px solid var(--ax-border); padding: .25rem .75rem; margin-bottom: .6rem; }
.req-table .req-section td { background: var(--ax-surface-2); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ax-muted); }
.req-table .req-child td:nth-child(2) { padding-left: 1.75rem !important; position: relative; }
.req-table .req-child td:nth-child(2)::before { content: "↳"; position: absolute; left: .7rem; color: var(--ax-muted); }
.min-w-0 { min-width: 0; }

/* ===================== Client link (public) ===================== */
.public-page { background: var(--ax-body-bg); padding-bottom: 5.5rem; }
.link-wrap { max-width: 880px; margin: 0 auto; padding: 0 1rem; }
.link-header { background: var(--ax-surface); border-bottom: 1px solid var(--ax-border); padding: .75rem 0; margin-bottom: 1rem; }
.link-logo { height: 42px; width: auto; max-width: 140px; object-fit: contain; }
.link-card { background: var(--ax-surface); border: 1px solid var(--ax-border); border-radius: 14px; padding: 1.1rem 1.15rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(16, 24, 20, .04); }
.link-hero h1 { color: var(--ax-heading); }
.link-howto { padding-left: 1.1rem; font-size: .88rem; color: var(--ax-muted); }
.link-howto li { margin-bottom: .15rem; }
.link-success, .link-warning, .link-info { display: flex; gap: .75rem; align-items: flex-start; }
.link-success { border-color: rgba(18, 136, 74, .4); background: rgba(18, 136, 74, .06); }
.link-success > i { color: #12884a; font-size: 1.4rem; }
.link-warning { border-color: rgba(201, 130, 0, .45); background: rgba(201, 130, 0, .07); }
.link-warning > i { color: #c98200; font-size: 1.4rem; }
.link-info > i { color: var(--ax-sky); font-size: 1.2rem; }
.link-progress { position: sticky; top: 0; z-index: 20; background: var(--ax-surface); border: 1px solid var(--ax-border); border-radius: 12px; padding: .6rem .9rem; margin-bottom: 1rem; box-shadow: 0 4px 12px rgba(16, 24, 20, .06); }
.link-progress .progress { height: 8px; }
.link-section { font-size: 1rem; font-weight: 700; color: var(--ax-heading); margin: 0 0 .75rem; padding-bottom: .5rem; border-bottom: 1px solid var(--ax-border); }
.link-site summary { cursor: pointer; list-style: none; }
.link-site summary::-webkit-details-marker { display: none; }
.link-site summary::before { content: "\F282"; font-family: bootstrap-icons; display: inline-block; margin-right: .35rem; transition: transform .15s; font-size: .8rem; }
.link-site[open] summary::before { transform: rotate(90deg); }
.link-item { border: 1px solid var(--ax-border); border-radius: 12px; padding: .8rem .9rem; margin-bottom: .65rem; }
.link-item:last-child { margin-bottom: 0; }
.link-item.is-done { border-color: rgba(18, 136, 74, .35); }
.link-item.is-rejected { border-color: rgba(214, 60, 60, .55); background: rgba(214, 60, 60, .04); }
.link-item.is-locked { background: var(--ax-surface-2); }
.link-item-head { display: flex; gap: .65rem; align-items: flex-start; }
.link-check { font-size: 1.15rem; line-height: 1.2; color: var(--ax-border); }
.link-item.is-done .link-check { color: #12884a; }
.link-item.is-locked .link-check { color: #12884a; }
.link-item.is-rejected .link-check { color: #d63c3c; }
.link-item-title { font-weight: 600; color: var(--ax-heading); }
.link-item-meta { display: flex; gap: .75rem; flex-wrap: wrap; font-size: .78rem; color: var(--ax-muted); margin-top: .1rem; }
.link-item-help { font-size: .85rem; color: var(--ax-muted); margin-top: .2rem; }
.link-item-reason { font-size: .85rem; color: #b42318; margin-top: .3rem; }
.link-item-body { margin: .6rem 0 0 1.8rem; }
.link-group { margin: .6rem 0 0 1.8rem; }
.link-group .link-item { border-style: dashed; }
.link-short { max-width: 260px; }
.link-files { list-style: none; padding: 0; margin: 0 0 .5rem; display: grid; gap: .35rem; }
.link-files li { display: flex; gap: .5rem; align-items: center; background: var(--ax-surface-2); border-radius: 8px; padding: .35rem .6rem; min-width: 0; }
.link-files a { min-width: 0; }
.link-upload { display: block; border: 1.5px dashed var(--ax-border); border-radius: 10px; padding: .6rem .8rem; text-align: center; cursor: pointer; color: var(--bs-primary); font-weight: 500; transition: background .15s, border-color .15s; }
.link-upload:hover, .link-upload:focus-within { background: var(--ax-primary-soft); border-color: var(--bs-primary); }
.link-table th { font-size: .78rem; white-space: nowrap; background: var(--ax-surface-2); }
.link-table td { padding: .2rem !important; min-width: 120px; }
.link-table td:first-child, .link-table td:last-child { min-width: 0; text-align: center; vertical-align: middle; }
.link-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--ax-surface) 94%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--ax-border); padding: .7rem 0 calc(.7rem + env(safe-area-inset-bottom)); }
@media (max-width: 575.98px) {
  .link-card { padding: .9rem .85rem; border-radius: 12px; }
  .link-item-body, .link-group { margin-left: 0; }
  .link-actions .btn { flex: 1; }
}

/* Alpine x-show hides with an inline display:none; Bootstrap display utilities (d-flex, d-block…) use !important and would win. */
[x-show][style*="display: none"] { display: none !important; }

/* Tom Select single: chosen value and search box stay on one line (no blank second line while focused) */
.ts-wrapper.single .ts-control { flex-wrap: nowrap; padding-right: 2.6rem; }
.ts-wrapper.single .ts-control > input { flex: 1 1 0; min-width: 0 !important; }
.ts-wrapper.single.has-items .ts-control > .item { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-wrapper .clear-button { right: 2rem !important; opacity: .55; }
.ts-wrapper .clear-button:hover { opacity: 1; }

/* Bell: remove button on each notification */
.notification-row { position: relative; }
.notification-row .notification-item { padding-right: 2rem; }
.notification-remove { position: absolute; top: .45rem; right: .35rem; border: 0; background: transparent; color: var(--ax-muted); width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; opacity: 0; transition: opacity .15s; font-size: .75rem; }
.notification-row:hover .notification-remove, .notification-remove:focus-visible { opacity: 1; }
.notification-remove:hover { background: var(--ax-surface-2); color: var(--bs-danger); }
@media (hover: none) { .notification-remove { opacity: .7; } }

/* ---------- Phase 5: job report ---------- */
.report-steps { list-style: none; counter-reset: rs; padding: 0; margin: 0; }
.report-steps > li { counter-increment: rs; position: relative; padding: 0 0 1rem 2.6rem; border-left: 2px solid var(--bs-border-color); margin-left: .9rem; }
.report-steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.report-steps > li::before { content: counter(rs); position: absolute; left: -.95rem; top: -.1rem; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 600; background: var(--bs-body-bg); border: 2px solid var(--bs-border-color); color: var(--bs-secondary-color); }
.report-steps > li.done::before { content: "\2713"; background: var(--bs-success); border-color: var(--bs-success); color: #fff; }
.report-steps > li.done { border-left-color: var(--bs-success-border-subtle); }

.rf-equipment { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-start; justify-content: space-between; padding: .75rem 1rem; margin-bottom: 1rem;
  background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; }
.rf-fields { display: flex; flex-direction: column; }
.rf-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: .35rem 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--bs-border-color); align-items: start; }
.rf-heading { display: flex; gap: .25rem; padding: .9rem 0 .3rem; font-weight: 600; border-bottom: 1px solid var(--bs-border-color); }
.rf-break { margin-top: .75rem; }
.rf-label { display: flex; gap: .25rem; margin: 0; font-size: .875rem; }
.rf-no { flex: 0 0 2.6rem; color: var(--bs-secondary-color); font-weight: 600; }
.rf-text { display: flex; gap: .25rem; align-items: flex-start; }
.rf-text textarea { field-sizing: content; min-height: calc(1.5em + .5rem + 2px); max-height: 18rem; resize: vertical; }
.rf-phrases { max-width: min(28rem, 90vw); max-height: 22rem; overflow: auto; }
.rf-input .btn-group { flex-wrap: wrap; }
.rf-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; }
.rf-photo-img { display: grid; place-items: center; aspect-ratio: 4 / 3; border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow: hidden; background: var(--bs-tertiary-bg); }
.rf-photo-img img { width: 100%; height: 100%; object-fit: cover; }
.rf-photo-empty { color: var(--bs-secondary-color); gap: .25rem; align-content: center; }
.rf-photo-empty i { font-size: 1.6rem; }
@media (max-width: 767.98px) {
  .rf-row { grid-template-columns: 1fr; }
}

/* ---------- Phase 6: reminders ---------- */
.freq-option { display: flex; gap: .5rem; align-items: flex-start; padding: .55rem .8rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; cursor: pointer; min-width: 9.5rem; background: var(--bs-body-bg); }
.freq-option:has(input:checked) { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.freq-option input { margin-top: .2rem; }
.reminder-due { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; align-items: flex-end; padding: .9rem 1rem; border-radius: .6rem;
  background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { display: flex; gap: .75rem; align-items: center; padding: .55rem 0; border-bottom: 1px dashed var(--bs-border-color); }
.dash-list li:last-child { border-bottom: 0; }
.dash-date { flex: 0 0 3.2rem; text-align: center; line-height: 1.1; border-radius: .5rem; padding: .3rem 0; background: var(--bs-tertiary-bg); }
.dash-date b { display: block; font-size: 1.05rem; }
.dash-date small { font-size: .7rem; text-transform: uppercase; color: var(--bs-secondary-color); }
.dash-date.overdue { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.dash-date.due { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }

/* ---------- Phase 7: sales ---------- */
.pay-summary > div { display: flex; justify-content: space-between; padding: .25rem 0; }
.pay-summary > div.grand { border-top: 1px solid var(--bs-border-color); margin-top: .25rem; padding-top: .5rem; font-size: 1.1rem; }
.alloc-table input { max-width: 9rem; margin-left: auto; }
.ledger-table td, .ledger-table th { white-space: nowrap; }
.ledger-table td.details { white-space: normal; min-width: 12rem; }
@media print {
  @page { size: A4 portrait; margin: 12mm 10mm; }
  .ledger-actions, .sidebar, #header, .pagetitle nav, .page-actions, footer, .footer, #toast-host, .back-to-top { display: none !important; }
  html, body { background: #fff !important; }
  .main, #main { margin: 0 !important; padding: 0 !important; min-height: 0 !important; }
  .card { box-shadow: none !important; border: 0 !important; margin: 0 !important; }
  .card-body { padding: 0 !important; }
  .table-responsive { overflow: visible !important; }
  .ledger-table { width: 100% !important; font-size: 9pt; }
  .ledger-table td, .ledger-table th { white-space: normal !important; padding: .2rem .3rem !important; }
  .ledger-table td.num, .ledger-table th.num { white-space: nowrap !important; }
  .ledger-table tr { page-break-inside: avoid; }
  .ledger-table thead { display: table-header-group; }
  a { color: inherit !important; text-decoration: none !important; }
}

/* Opening stock sheet: compact spreadsheet-like rows */
.sheet-table td { padding-top: .2rem; padding-bottom: .2rem; }
.sheet-table input.form-control-sm { min-width: 6rem; }
.sheet-table tbody tr:focus-within { background: var(--ax-primary-soft); }

/* Reports (Phase 8) */
.report-card:hover { border-color: var(--ax-primary); box-shadow: 0 .25rem .9rem rgba(11, 105, 53, .12); }
.report-table td, .report-table th { font-size: .86rem; }
.report-table tfoot td { border-top: 2px solid var(--ax-border); }
@media print { .report-filters { display: none !important; } }

/* ---------- Dashboard (redesign) ---------- */
.dash-hero { background: linear-gradient(120deg, var(--ax-primary-soft), var(--ax-surface) 60%); border: 0; }
.dash-hero-date { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ax-muted); font-weight: 600; }
.dash-hero-title { font-size: 1.45rem; font-weight: 700; color: var(--ax-heading); margin: .1rem 0 .15rem; }
.dash-quick .btn { background: var(--ax-surface); }
.dash-kpi, .dash-card { border: 1px solid var(--ax-border); box-shadow: 0 1px 2px rgba(16, 40, 26, .05), 0 8px 24px rgba(16, 40, 26, .07); transition: transform .15s ease, box-shadow .15s ease; }
a.dash-kpi:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 40, 26, .06), 0 14px 32px rgba(16, 40, 26, .12); }
[data-bs-theme="dark"] .dash-kpi, [data-bs-theme="dark"] .dash-card { box-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3); }
.dash-kpi .card-body { padding: 1rem 1.1rem; }
.dash-kpi-value { font-size: 1.45rem; font-weight: 700; color: var(--ax-heading); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .15rem; }
.dash-kpi-foot { font-size: .78rem; color: var(--ax-muted); margin-top: .25rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; min-height: 1.2rem; }
.kpi-icon.sm { width: 34px; height: 34px; border-radius: .6rem; font-size: 1rem; }
.kpi-icon.violet { background: rgba(124, 92, 219, .13); color: #6a4fc4; }
[data-bs-theme="dark"] .kpi-icon.violet { color: #b9a6f5; }
.dash-chip { display: inline-flex; align-items: center; gap: .15rem; padding: .05rem .4rem; border-radius: 1rem; font-weight: 650; font-size: .72rem; }
.dash-chip.up { background: rgba(var(--bs-success-rgb), .13); color: var(--bs-success); }
.dash-chip.down { background: rgba(var(--bs-danger-rgb), .12); color: var(--bs-danger); }
.dash-chart { height: 280px; position: relative; }
.dash-chart.sm { height: 210px; }
.dash-big { font-size: 1.35rem; font-weight: 700; color: var(--ax-heading); margin-bottom: .6rem; font-variant-numeric: tabular-nums; }
.dash-empty { text-align: center; color: var(--ax-muted); padding: 2rem .5rem; }
.dash-empty i { display: block; font-size: 1.8rem; margin-bottom: .3rem; color: var(--ax-primary); opacity: .6; }
.dash-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.dash-bar { height: 6px; border-radius: 4px; background: var(--ax-surface-2); margin-top: .3rem; overflow: hidden; }
.dash-bar span { display: block; height: 100%; border-radius: 4px; background: var(--ax-primary); }
.dash-bar span.neg { background: var(--bs-danger); }
.dash-tag { display: inline-flex; gap: .3rem; align-items: center; padding: .15rem .55rem; border: 1px solid var(--ax-border); border-radius: 1rem; color: var(--ax-text); white-space: nowrap; }
.dash-tag:hover { border-color: var(--ax-primary); color: var(--ax-primary-text); }
.dash-kind { flex: 0 0 2rem; height: 2rem; border-radius: .5rem; display: grid; place-items: center; font-size: .95rem; }
.dash-kind.invoice { background: var(--ax-primary-soft); color: var(--ax-primary-text); }
.dash-kind.bill { background: rgba(255, 170, 0, .15); color: #b26a00; }
.dash-kind.expense { background: rgba(124, 92, 219, .13); color: #6a4fc4; }
.due-list { max-height: 420px; overflow: auto; }

@media (max-width: 575.98px) {
  .dash-kpi .card-body { padding: .75rem .8rem; }
  .dash-kpi-value { font-size: 1.15rem; }
  .dash-kpi .kpi-label { font-size: .68rem; }
  .dash-kpi .kpi-icon.sm { display: none; }
  .dash-hero-title { font-size: 1.2rem; }
}

/* ---------- User manual (/Help) ---------- */
.help-toc { position: sticky; top: calc(var(--ax-header-h) + 1rem); max-height: calc(100vh - var(--ax-header-h) - 2rem); overflow-y: auto; }
.help-toc .nav-link { color: var(--ax-text); }
.help-toc .nav-link:hover { color: var(--ax-primary-text); }
.help-section { scroll-margin-top: calc(var(--ax-header-h) + 1rem); }
.help-section h2 { font-size: 1.25rem; font-weight: 700; color: var(--ax-heading); margin-bottom: .75rem; }
.help-section h2 .bi { color: var(--ax-primary); margin-right: .25rem; }
.help-section h3 { font-size: 1rem; font-weight: 650; color: var(--ax-heading); margin: 1.1rem 0 .4rem; }
.help-section p, .help-section li, .help-section dd { line-height: 1.6; overflow-wrap: anywhere; }
.help-section li + li { margin-top: .2rem; }
.help-table { font-size: .9rem; }
.help-recipe { background: var(--ax-surface-2); border: 1px solid var(--ax-border); border-radius: var(--ax-radius); padding: .9rem 1rem; height: 100%; }
.help-recipe b { display: block; margin-bottom: .35rem; color: var(--ax-heading); }
.help-faq dt { color: var(--ax-heading); margin-top: .75rem; }
.help-faq dd { margin-bottom: 0; }
@media print {
  .help-manual > .col-lg-9 { width: 100% !important; }
  .help-section { display: block !important; page-break-inside: auto; margin-bottom: 1rem !important; }
  .help-section h2 { page-break-after: avoid; }
}

/* Search results: titles in the body colour (list-group-item-action is muted by default). */
.search-hit-title { color: var(--ax-heading); }

/* Notifications page */
.notification-unread { background: rgba(var(--bs-primary-rgb), .05); }
