/* Q-Tracker theme, taken from the UAT round 2 mock-up "Dashboard with Aging V2" (the standard for every screen).
   Loaded after app.css. Values are the mock-up's own: navy rail #0C2547 -> #07162B, page #F4F7FA inside #E8EEF5,
   primary #00338D, accent #38BDF8, ink #0F172A / #0B2241, slate text, 12px-radius white cards with #E2E8F0 borders. */

:root {
  --t-navy: #0B2241; --t-navy-2: #07162B; --t-rail-top: #0C2547; --t-primary: #00338D; --t-primary-2: #002A75;
  --t-sky: #38BDF8; --t-ink: #0F172A; --t-page: #F4F7FA; --t-outer: #E8EEF5; --t-card: #FFFFFF;
  --t-border: #E2E8F0; --t-border-2: #CBD5E1; --t-slate-300: #CBD5E1; --t-slate-400: #94A3B8; --t-slate-500: #64748B;
  --t-slate-600: #475569; --t-slate-700: #334155; --t-surface: #F8FAFC;
  --t-blue: #2563EB; --t-green: #059669; --t-amber: #D97706; --t-orange: #EA580C; --t-red: #DC2626; --t-violet: #6D28D9;
  --t-radius: .75rem; --t-radius-sm: .5rem;
  --t-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --t-shadow-hover: 0 8px 18px -6px rgba(11, 34, 65, .14);
  --t-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
            sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --bs-body-font-family: var(--t-font);
  --bs-body-color: var(--t-ink); --bs-body-bg: #fff; --bs-border-color: var(--t-border);
  --bs-primary: #00338D; --bs-primary-rgb: 0, 51, 141; --bs-link-color: #1D4ED8; --bs-link-color-rgb: 29, 78, 216;
  --bs-link-hover-color: #00338D; --bs-border-radius: .5rem; --bs-border-radius-lg: .75rem;
}

html { font-size: 87.5%; }                     /* 14px: the mock-up's text-xs / text-sm scale */
body { font-family: var(--t-font); color: var(--t-ink); background-color: var(--t-page); -webkit-font-smoothing: antialiased;
       line-height: 1.5; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--t-navy); font-weight: 700; letter-spacing: -.005em; }
.h6, h6 { font-size: 1rem; }
a { text-underline-offset: 2px; }
.text-muted, .small.text-muted { color: var(--t-slate-500) !important; }

/* ---------- Shell ---------- */
.qt-shell { display: flex; min-height: 100vh; }
.qt-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--t-page); }
.qt-content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 1.5rem; flex: 1 0 auto; }
@media (max-width: 767.98px) { .qt-content { padding: 1rem; } }

/* Header bar: page title left, filters and user right (white, as in the mock-up) */
.qt-header { background: #fff; border-bottom: 1px solid var(--t-border); position: sticky; top: 0; z-index: 1010; }
.qt-header-inner { max-width: 1480px; margin: 0 auto; padding: 1rem 1.5rem; display: flex; flex-wrap: wrap;
                   align-items: center; justify-content: space-between; gap: .75rem; }
.qt-header-title { min-width: 0; }
.qt-header h1 { font-size: 1.3rem; font-weight: 700; color: var(--t-navy); margin: 0; line-height: 1.3; }
.qt-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.qt-header-actions > .dropdown { padding-left: .75rem; border-left: 1px solid var(--t-border); }
@media (max-width: 991.98px) { .qt-header { top: 52px; } .qt-header-inner { padding: .75rem 1rem; } }
.qt-pagehead { display: none; }                /* replaced by .qt-header */

.qt-user { display: flex; align-items: center; gap: .5rem; padding: .15rem .35rem; color: inherit; border-radius: .5rem; }
.qt-user:hover, .qt-user[aria-expanded="true"] { background: var(--t-surface); }
.qt-avatar { width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--t-navy); color: #fff; font-weight: 700;
             font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--t-shadow); }
.qt-user-name { font-size: .9rem; font-weight: 700; color: var(--t-ink); }
.qt-user-role { font-size: .78rem; color: var(--t-slate-500); }

/* ---------- Sidebar (navy rail) ---------- */
.qt-side-wrap { --bs-offcanvas-width: 272px; --bs-offcanvas-bg: var(--t-navy-2); flex: none; }
@media (min-width: 992px) { .qt-side-wrap { position: sticky; top: 0; height: 100vh; } }
.qt-side { width: 240px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; gap: 1rem;
           padding: .75rem; color: #fff; overflow-y: auto; overflow-x: hidden;
           background: linear-gradient(180deg, var(--t-rail-top) 0%, var(--t-navy-2) 100%);
           transition: width 220ms cubic-bezier(.22, 1, .36, 1); font-size: 1rem; }
@media (max-width: 991.98px) { .qt-side { width: 100%; } }
.qt-side-top { display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
.qt-side .qt-brand { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .25rem;
                     border: 0; margin: 0; }
.qt-brand-link { display: flex; align-items: center; gap: .6rem; min-width: 0; color: #fff !important; text-decoration: none;
                 padding: 0 !important; margin: 0 !important; background: none !important; box-shadow: none !important; }
.qt-badge { width: 2.25rem; height: 2.25rem; flex: none; border-radius: .5rem; background: var(--t-primary);
            border: 1px solid rgba(255,255,255,.25); color: #fff; font-weight: 800; font-size: .72rem; letter-spacing: .06em;
            display: inline-flex; align-items: center; justify-content: center; }
.qt-brand-logo { max-height: 2.25rem; max-width: 7rem; flex: none; }
.qt-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.qt-brand-name { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.qt-brand-firm { font-size: .78rem; color: rgba(203,213,225,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-collapse { width: 1.9rem; height: 1.9rem; flex: none; border: 0; border-radius: .5rem; background: rgba(255,255,255,.1);
               color: #fff; font-weight: 700; align-items: center; justify-content: center; }
.qt-collapse:hover { background: rgba(255,255,255,.2); }
.qt-jump { display: flex; align-items: center; gap: .5rem; padding: .45rem .65rem; border-radius: .5rem;
           background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.1); color: var(--t-slate-300); }
.qt-jump:focus-within { background: rgba(255,255,255,.15); border-color: rgba(56,189,248,.6); }
.qt-jump input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font-size: .85rem; }
.qt-jump input::placeholder { color: var(--t-slate-300); }
.qt-jump kbd { font-size: .68rem; padding: .05rem .35rem; border-radius: .25rem; background: rgba(255,255,255,.1);
               color: var(--t-slate-300); box-shadow: none; white-space: nowrap; }
.qt-nav { display: flex; flex-direction: column; gap: 1rem; }
.qt-nav-group { display: flex; flex-direction: column; gap: 2px; }
.qt-side .section { padding: 0 .65rem .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
                    color: rgba(148,163,184,.9); opacity: 1; }
.qt-side .qt-nav a { position: relative; display: flex; align-items: center; gap: .65rem; margin: 0; padding: .5rem .65rem;
                     border-radius: .5rem; border: 0; color: var(--t-slate-300); font-size: .92rem; font-weight: 500;
                     text-decoration: none; white-space: nowrap; transition: background-color 140ms ease, color 140ms ease;
                     box-shadow: none; }
.qt-side .qt-nav a .qi { width: 1.15rem; height: 1.15rem; color: var(--t-slate-400); opacity: 1; }
.qt-side .qt-nav a span { overflow: hidden; text-overflow: ellipsis; }
.qt-side .qt-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.qt-side .qt-nav a.active { background: var(--t-primary); color: #fff; font-weight: 700; box-shadow: var(--t-shadow); }
.qt-side .qt-nav a.active::before { content: ""; position: absolute; left: 0; top: .4rem; bottom: .4rem; width: 4px;
                                    border-radius: 0 4px 4px 0; background: var(--t-sky); }
.qt-side .qt-nav a.active .qi { color: var(--t-sky); }
.qt-pill { margin-left: auto; padding: 0 .45rem; border-radius: 99px; background: var(--t-blue); color: #fff; font-size: .72rem;
           font-weight: 700; }
.qt-side-foot { padding-top: .75rem; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: .5rem; }
.qt-profile { display: flex; align-items: center; gap: .6rem; padding: .5rem; border-radius: .5rem; background: rgba(255,255,255,.05); }
.qt-profile-avatar { width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%; background: var(--t-sky); color: var(--t-navy-2);
                     font-weight: 800; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; }
.qt-profile-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.qt-profile-name { font-size: .85rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-profile-role { font-size: .78rem; color: var(--t-slate-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-registered { padding: 0 .5rem; font-size: .75rem; color: rgba(148,163,184,.8); }

/* Collapsed rail (desktop): icons only, labels as tooltips */
@media (min-width: 992px) {
  .qt-collapsed .qt-side { width: 68px; padding: .75rem .5rem; }
  .qt-collapsed .qt-side .qt-brand { flex-direction: column; justify-content: center; gap: .5rem; padding: 0; }
  .qt-collapsed .qt-brand-text, .qt-collapsed .qt-side .qt-nav a span, .qt-collapsed .qt-jump input,
  .qt-collapsed .qt-jump kbd, .qt-collapsed .qt-profile-text, .qt-collapsed .qt-registered, .qt-collapsed .qt-pill { display: none; }
  .qt-collapsed .qt-collapse span { display: inline-block; transform: rotate(180deg); }
  .qt-collapsed .qt-jump { justify-content: center; padding: .5rem 0; }
  .qt-collapsed .qt-side .section { font-size: 0; padding: 0; margin: .25rem .5rem; border-top: 1px solid rgba(255,255,255,.1); }
  .qt-collapsed .qt-side .qt-nav a { justify-content: center; padding: .6rem 0; }
  .qt-collapsed .qt-side .qt-nav a.active::before { display: none; }
  .qt-collapsed .qt-profile { justify-content: center; background: none; padding: 0; }
}

/* Phone / tablet top bar */
.qt-topbar { position: sticky; top: 0; z-index: 1020; height: 52px; display: flex; align-items: center; gap: .5rem;
             padding: 0 .75rem; color: #fff; background: linear-gradient(90deg, var(--t-rail-top), var(--t-navy-2)); }
.qt-topbar-brand { display: inline-flex; align-items: center; gap: .5rem; color: #fff; font-weight: 800; font-size: 1.05rem;
                   text-decoration: none; }
.qt-topbar-brand:hover { color: #fff; }
.qt-topbar .qt-badge { width: 1.9rem; height: 1.9rem; font-size: .62rem; }

/* ---------- Cards, sections ---------- */
.qt-main .card { border: 1px solid var(--t-border); border-radius: var(--t-radius); box-shadow: var(--t-shadow); background: var(--t-card);
                 --bs-card-spacer-y: 1rem; --bs-card-spacer-x: 1.25rem; --bs-card-inner-border-radius: calc(var(--t-radius) - 1px); }
.qt-main .card-header { background: var(--t-surface); border-bottom-color: var(--t-border); }
.dash-h { display: flex; align-items: center; gap: .5rem; margin: 0 0 .6rem; font-size: .9rem; font-weight: 800;
          letter-spacing: .06em; text-transform: uppercase; color: var(--t-navy); }
.dash-h .qi { display: none; }
.dash-h::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; flex: none; background: var(--t-primary); }
.dash-block:nth-of-type(2) .dash-h::before { background: var(--t-orange); }
.dash-block:nth-of-type(3) .dash-h::before { background: var(--t-blue); }

/* KPI cards: coloured top border and tint, as in the mock-up */
.kpi { border-top-width: 4px !important; border-top-style: solid !important; border-top-color: var(--t-navy) !important; }
.kpi-title { color: var(--t-slate-700); font-size: .8rem; letter-spacing: .02em; }
.kpi-num { font-size: 1.85rem; font-weight: 800; letter-spacing: -.01em; }
.kpi-unit { color: var(--t-slate-600); }
.kpi-due { border-top-color: var(--t-blue) !important; background: #EFF6FF; }
.kpi-pending { border-top-color: var(--t-orange) !important; background: #FFF7ED; }
.kpi-ok { border-top-color: var(--t-green) !important; background: #ECFDF5; }
.kpi-warn { border-top-color: var(--t-amber) !important; background: #FFFBEB; }
.kpi-bad { border-top-color: #BE123C !important; background: #FFF1F2; }
.stat { border-top: 4px solid var(--t-primary) !important; }
.stat::before { display: none; }
.stat-alert { border-top-color: var(--t-red) !important; }
.stat-label { color: var(--t-slate-700); font-size: .78rem; font-weight: 700; letter-spacing: .02em; text-transform: none; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--t-ink); }

/* ---------- Tables ---------- */
.qt-main .table { --bs-table-bg: transparent; --bs-table-border-color: #EEF2F7; --bs-table-hover-bg: var(--t-surface);
                  font-size: .95rem; }
.qt-main .table > thead th { background: var(--t-surface); color: var(--t-slate-500); font-size: .74rem; font-weight: 700;
                             letter-spacing: .05em; text-transform: uppercase; border-bottom: 1px solid var(--t-border);
                             padding-top: .55rem; padding-bottom: .55rem; }
.qt-main .table > tbody td { padding-top: .55rem; padding-bottom: .55rem; }
.table.bg-white, .table-responsive > .table.bg-white { border: 1px solid var(--t-border); border-radius: var(--t-radius); overflow: hidden; }

/* ---------- Buttons, forms, alerts, badges ---------- */
.btn { border-radius: .5rem; font-weight: 600; }
.btn-sm { border-radius: .45rem; }
.btn-primary { --bs-btn-bg: var(--t-primary); --bs-btn-border-color: var(--t-primary); --bs-btn-hover-bg: var(--t-primary-2);
               --bs-btn-hover-border-color: var(--t-primary-2); --bs-btn-active-bg: var(--t-navy); --bs-btn-active-border-color: var(--t-navy);
               --bs-btn-disabled-bg: var(--t-primary); --bs-btn-disabled-border-color: var(--t-primary); }
.form-label { font-weight: 600; color: var(--t-slate-700); }
.form-control, .form-select { border-color: var(--t-border-2); border-radius: .5rem; color: var(--t-ink); }
.form-control:focus, .form-select:focus { border-color: #60A5FA; box-shadow: 0 0 0 .2rem rgba(0, 51, 141, .15); }
.form-text { color: var(--t-slate-500); }
.alert { border-radius: var(--t-radius); }
.nav-tabs .nav-link { font-weight: 600; color: var(--t-slate-600); }
.nav-tabs .nav-link.active { color: var(--t-navy); }
.nav-pills .nav-link { border-radius: .5rem; font-weight: 600; }
.dropdown-menu { border-radius: var(--t-radius); border-color: var(--t-border); box-shadow: 0 12px 28px -8px rgba(11,34,65,.22); }

/* ---------- Sign-in and other signed-out pages: centred on any screen ---------- */
.qt-public { min-height: 100vh; background: var(--t-outer);
             background-image: radial-gradient(1200px 600px at 50% -10%, #F4F7FA 0%, rgba(244,247,250,0) 70%); }
.qt-public-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
                  padding: 2rem 1rem; }
.qt-public-alert { width: min(100%, 26rem); }
.qt-auth { width: min(100%, 26rem); display: flex; flex-direction: column; align-items: stretch; gap: 1.25rem; }
.qt-auth-brand { text-align: center; }
.qt-auth-brand .qt-login-logo { max-height: 64px; max-width: 240px; margin-bottom: .75rem; }
.qt-auth-firm { font-weight: 700; color: var(--t-navy); font-size: 1.05rem; }
.qt-auth-sub { color: var(--t-slate-500); font-size: .9rem; }
.qt-auth-card { border: 1px solid var(--t-border); border-top: 4px solid var(--t-primary); border-radius: 1rem;
                box-shadow: 0 20px 40px -20px rgba(11, 34, 65, .25); }
.qt-auth-card .card-body { padding: 2rem; }
@media (max-width: 575.98px) { .qt-auth-card .card-body { padding: 1.5rem 1.25rem; } }
.qt-auth-title { font-size: 1.5rem; font-weight: 800; color: var(--t-navy); margin-bottom: .25rem; }
.qt-auth-lead { color: var(--t-slate-500); margin-bottom: 1.25rem; }
.qt-ms-btn { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; }
.qt-ms-btn .qi { width: 1.1rem; height: 1.1rem; margin: 0; }
.qt-auth-or { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--t-slate-500); font-size: .85rem; }
.qt-auth-or::before, .qt-auth-or::after { content: ""; flex: 1; height: 1px; background: var(--t-border); }
.qt-auth-foot { text-align: center; color: var(--t-slate-500); font-size: .85rem; margin: 0; }

/* ---------- Print ---------- */
@media print {
  .qt-side-wrap, .qt-topbar, .qt-header-actions { display: none !important; }
  .qt-header { position: static; border: 0; }
  .qt-content { padding: 0; max-width: none; }
  .qt-main, body { background: #fff; }
}

/* Long menus scroll; the profile card stays below the links instead of covering them. */
.qt-side-top, .qt-side-foot { flex: 0 0 auto; }
.qt-side { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }

/* Header extras: role pill and subtitle (dashboard), filters on the right */
.qt-role-pill { display: inline-block; margin-left: .5rem; padding: .1rem .6rem; border-radius: 99px; font-size: .75rem;
                font-weight: 700; vertical-align: middle; background: #EFF6FF; color: var(--t-primary); box-shadow: inset 0 0 0 1px #BFDBFE; }
.qt-subtitle { margin: .15rem 0 0; font-size: .85rem; color: var(--t-slate-500); }
.qt-header .dash-filters .form-select { font-weight: 600; }
