/* =====================================================================
   HTS AI Engine - brand layer on Universal Theme 26.1 (Vita)
   No colour literals here: every colour comes from the --hts-* custom
   properties that HTS_APEX_PKG.page_init adds to each page from
   HTS_BRANDING (view HTS_V_BRANDING_CSS). Change colours in the table,
   not in this file.
   ===================================================================== */

:root {
  --ut-palette-primary: var(--hts-primary);
  --ut-palette-primary-contrast: var(--hts-text);
  --ut-palette-primary-shade: var(--hts-primary);
  --ut-header-background-color: var(--hts-secondary);
  --ut-header-text-color: var(--hts-text);
  --ut-nav-background-color: var(--hts-surface-dark);
  --ut-nav-text-color: var(--hts-text);
  --a-button-hot-background-color: var(--hts-primary);
  --a-button-hot-border-color: var(--hts-primary);
  --a-button-hot-text-color: var(--hts-text);
  --a-button-hot-hover-background-color: var(--hts-primary);
  --a-button-hot-hover-text-color: var(--hts-text);
}

/* ---------- Header ---------- */
.t-Header {
  background-color: var(--hts-secondary);
  color: var(--hts-text);
  border-bottom: 3px solid var(--hts-primary);
}
.t-Header-logo,
.t-Header-logo-link,
.t-Header .t-Button--header,
.t-Header .t-Button--header .t-Icon,
.t-Header .t-NavigationBar .t-Button {
  color: var(--hts-text);
}
.t-Header-logo img,
.t-Header-logo-link img {
  height: 30px;
  width: auto;
  margin-inline-end: 8px;
  border-radius: 4px;
}

/* ---------- Side navigation ---------- */
.t-Body-nav,
.t-TreeNav,
.t-TreeNav .a-TreeView {
  background-color: var(--hts-surface-dark);
}
.t-TreeNav .a-TreeView-label,
.t-TreeNav .a-TreeView-node .fa,
.t-TreeNav .a-TreeView-node .t-Icon {
  color: var(--hts-text);
}
.t-TreeNav .a-TreeView-node--topLevel > .a-TreeView-content.is-current--top,
.t-TreeNav .a-TreeView-node--topLevel > .a-TreeView-content.is-current,
.t-TreeNav .a-TreeView-content.is-current {
  background-color: var(--hts-primary);
}
.t-TreeNav .a-TreeView-content.is-hover {
  background-color: var(--hts-accent);
}

/* ---------- Buttons ---------- */
.t-Button--hot,
.t-Button--hot:not(.t-Button--simple) {
  background-color: var(--hts-primary);
  border-color: var(--hts-primary);
  color: var(--hts-text);
}
.t-Button--hot:hover,
.t-Button--hot:focus {
  filter: brightness(0.92);
}

/* ---------- Sign-in pages (9997, 9998, 9999) ---------- */
.t-PageBody--login {
  background: linear-gradient(160deg, var(--hts-secondary) 0%, var(--hts-surface-dark) 60%, var(--hts-accent) 100%);
  background-attachment: fixed;
}
.t-PageBody--login .t-Login-region {
  background-color: var(--hts-text);
  border-top: 4px solid var(--hts-primary);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.t-PageBody--login .t-Login-logo img,
.t-PageBody--login .t-Login-header img {
  width: 96px;
  height: auto;
  border-radius: 8px;
}
.t-PageBody--login .t-Login-title {
  font-weight: 600;
}
/* the region text comes after the items in the login template: show the subtitle first */
.t-PageBody--login .t-Login-body {
  display: flex;
  flex-direction: column;
}
.t-PageBody--login .t-Login-header span.t-Login-logo:empty {
  display: none;
}
.hts-login-subtitle,
.hts-login-help {
  order: -1;
}
.hts-login-subtitle {
  margin: 0 0 1rem;
  text-align: center;
  opacity: 0.75;
}
.hts-login-help {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  opacity: 0.85;
}
.hts-login-link {
  display: block;
  margin-top: 0.75rem;
  text-align: center;
}
.hts-policy,
.hts-policy .display_only {
  font-size: 0.8125rem;
  font-weight: normal;
  opacity: 0.8;
  word-break: normal;
  overflow-wrap: break-word;
}

/* ---------- Home ---------- */
.hts-kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.375rem 1rem;
  margin: 0;
}
.hts-kv dt {
  font-weight: 600;
}
.hts-kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.hts-badge {
  display: inline-block;
  margin: 0 0.25rem 0.25rem 0;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--hts-accent);
  font-size: 0.8125rem;
}
.hts-muted {
  opacity: 0.75;
}

/* ---------- Admin Console ---------- */
.hts-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.hts-kpi {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  align-items: center;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  border-inline-start: 4px solid var(--hts-primary);
  background-color: var(--hts-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.hts-kpi-icon {
  grid-row: span 2;
  font-size: 1.5rem;
  color: var(--hts-primary);
}
.hts-kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}
.hts-kpi-label {
  font-size: 0.8125rem;
  opacity: 0.75;
}
.hts-reset-link-box {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px dashed var(--hts-primary);
}
.hts-reset-link-box input {
  width: 100%;
  font-family: monospace;
}

/* ---------- Admin Console: Transaction Explorer (Phase 7) ---------- */
.hts-txn-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.25rem 1.5rem;
}
.hts-txn-summary .hts-txn-title,
.hts-txn-summary > p {
  grid-column: 1 / -1;
  margin: 0 0 0.25rem;
}
.hts-field-label {
  font-size: 0.8125rem;
  opacity: 0.75;
}
.hts-field-label::after {
  content: ":";
}
.hts-field-value {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.hts-attempt {
  margin: 1rem 0 0.5rem;
  padding-inline-start: 0.5rem;
  border-inline-start: 4px solid var(--hts-primary);
}
.hts-payload {
  margin: 0.25rem 0;
}
.hts-payload > summary {
  cursor: pointer;
  font-weight: 600;
}
.hts-pre {
  max-height: 24rem;
  overflow: auto;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
}

/* ---------- Admin Console: routing and providers (Phase 9) ---------- */
textarea.hts-mono,
.hts-mono textarea {
  font-family: monospace;
  font-size: 0.8125rem;
}
.hts-provs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.hts-prov {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-inline-start: 4px solid var(--hts-accent);
  background-color: var(--hts-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.hts-prov--active {
  border-inline-start-color: var(--hts-primary);
}
.hts-prov-head {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.hts-prov-code {
  font-size: 1.125rem;
  font-weight: 700;
}
.hts-prov-name {
  font-size: 0.8125rem;
  opacity: 0.75;
  margin-bottom: 0.375rem;
}
.hts-prov-line {
  font-size: 0.8125rem;
}
.hts-sim-h {
  margin: 1rem 0 0.375rem;
  font-size: 1rem;
}
.hts-sim-table {
  width: 100%;
}
.hts-sim-table td,
.hts-sim-table th {
  white-space: nowrap;
}

/* Phase 10: cost and usage pages (App 200 pages 47, 80, 81, 82) - shares, budget use and check results */
.hts-bar-wrap {
  display: inline-block;
  vertical-align: middle;
  width: 7rem;
  height: 0.5rem;
  border-radius: 0.25rem;
  background: rgba(127, 127, 127, 0.18);
  overflow: hidden;
}
.hts-bar {
  display: block;
  height: 100%;
  border-radius: 0.25rem;
  background: var(--hts-primary);
}
.hts-bar--ok {
  background: var(--hts-surface-dark);
}
.hts-bar--warn {
  background: var(--ut-palette-warning);
}
.hts-bar--over {
  background: var(--hts-primary);
}
.hts-bar-num {
  display: inline-block;
  min-width: 3.25rem;
  margin-inline-start: 0.375rem;
  font-variant-numeric: tabular-nums;
}
.hts-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hts-match {
  font-weight: 700;
}
.hts-match--yes {
  color: var(--ut-palette-success);
}
.hts-match--no {
  color: var(--hts-primary);
}

/* Phase 11: Admin Console pages 61 (prompt versions compared), 101 (branding preview) - brand variables only */
.hts-diff {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: monospace;
  font-size: 0.8125rem;
  padding: 0 0.375rem;
  border-inline-start: 3px solid transparent;
}
.hts-diff--add {
  border-inline-start-color: var(--ut-palette-success);
  background: rgba(46, 125, 50, 0.10);
}
.hts-diff--del {
  border-inline-start-color: var(--hts-primary);
  background: rgba(127, 127, 127, 0.14);
  text-decoration: line-through;
}
.hts-swatch {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  vertical-align: middle;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.hts-color-input input {
  font-family: monospace;
  text-transform: uppercase;
}
.hts-brand-preview {
  --bp-primary: var(--hts-primary);
  --bp-secondary: var(--hts-secondary);
  --bp-accent: var(--hts-accent);
  --bp-surface: var(--hts-surface-dark);
  --bp-text: var(--hts-text);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.hts-bp-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: var(--bp-secondary);
  color: var(--bp-text);
  border-bottom: 3px solid var(--bp-primary);
}
.hts-bp-logo {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  background: var(--bp-primary);
}
.hts-bp-app {
  font-weight: 700;
}
.hts-bp-company {
  margin-inline-start: auto;
  font-size: 0.75rem;
  opacity: 0.8;
}
.hts-bp-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem;
  background: var(--bp-surface);
}
.hts-bp-bubble {
  max-width: 85%;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8125rem;
}
.hts-bp-bubble--user {
  align-self: flex-end;
  background: var(--bp-primary);
  color: var(--bp-text);
}
.hts-bp-bubble--ai {
  align-self: flex-start;
  background: var(--bp-accent);
  color: var(--bp-text);
}
.hts-bp-actions {
  display: flex;
  gap: 0.375rem;
  justify-content: flex-end;
}
.hts-bp-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  border: 1px solid var(--bp-text);
  color: var(--bp-text);
}
.hts-bp-btn--primary {
  background: var(--bp-primary);
  border-color: var(--bp-primary);
}
.hts-bp-btn--accent {
  background: var(--bp-accent);
  border-color: var(--bp-accent);
}
.hts-bp-contrast {
  margin: 0;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
}

/* ---------- Phase 13: notifications bell (navigation bar, Apps 100 and 200) ---------- */
.t-NavigationBar-item.hts-bell .t-Button-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.t-NavigationBar-item.hts-bell .t-Button-badge:empty { display: none; }
.t-NavigationBar-item.hts-bell .t-Button-badge {
  background-color: var(--hts-primary); color: var(--hts-text);
}

/* ---------- Phase 13: Admin Console monitoring (pages 96-99) ---------- */
.hts-svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.hts-svc {
  padding: 0.75rem 0.875rem; border-radius: 8px; border-inline-start: 4px solid var(--hts-accent);
  background-color: var(--hts-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.hts-svc--down { border-inline-start-color: var(--hts-primary); }
.hts-svc--degraded { border-inline-start-color: var(--ut-palette-warning, var(--hts-accent)); }
.hts-svc--healthy { border-inline-start-color: var(--ut-palette-success, var(--hts-accent)); }
.hts-svc-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-weight: 600; }
.hts-svc-status { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.hts-svc-reason { margin-top: 0.25rem; font-size: 0.8125rem; overflow-wrap: anywhere; }
.hts-svc-meta { margin-top: 0.25rem; font-size: 0.75rem; opacity: 0.75; }
.hts-sev--critical { color: var(--hts-primary); font-weight: 700; }
.hts-sev--warning { color: var(--ut-palette-warning, var(--hts-accent)); font-weight: 700; }
.hts-alert-detail { margin-top: 0.5rem; }

/* Phase 14 (P14-D2): page 9996 two-step verification - colours from the branding variables */
.hts-mfa-qr {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}
.hts-mfa-qr svg {
    width: 220px;
    height: 220px;
    padding: 8px;
    background: var(--hts-text);
}
.hts-mfa-key-label,
.hts-mfa-account {
    margin: 4px 0;
    text-align: center;
}
.hts-mfa-key {
    margin: 4px 0 12px;
    text-align: center;
    letter-spacing: 0.08em;
    font-size: 1.05em;
}
.hts-mfa-msg {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-left: 4px solid var(--hts-primary);
}
.hts-mfa-msg--ok {
    border-left-color: var(--hts-secondary);
}

/* AUD-02 (Task 6): copyright and version line added by HTS_APEX_PKG.page_init (both apps) */
.hts-footer {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  text-align: center;
  opacity: 0.7;
}
.t-PageBody--login .hts-footer {
  color: var(--hts-text);
}

/* =====================================================================
   AUD-03 (A100 18.6.0 / A200 17.4.0): dark premium design layer, both apps
   Base theme style: Vita - Dark (Light = Vita, per user in App 100).
   Every colour is mixed from the HTS_BRANDING variables --hts-* (no colour
   literals; shadows use transparent black only). The light version of the
   same tokens comes from HTS_USER_PREF_PKG.page_css (UI.THEME = LIGHT).
   ===================================================================== */
:root {
  /* surfaces, darkest to lightest */
  --hts-page:    var(--hts-secondary);
  --hts-panel:   var(--hts-surface-dark);
  --hts-panel-2: color-mix(in srgb, var(--hts-accent) 70%, var(--hts-surface-dark));
  --hts-raised:  var(--hts-accent);
  --hts-glass:   color-mix(in srgb, var(--hts-surface-dark) 78%, transparent);
  /* text and lines, mixed from the text colour */
  --hts-fg:      var(--hts-text);
  --hts-fg-2:    color-mix(in srgb, var(--hts-fg) 68%, transparent);
  --hts-border:  color-mix(in srgb, var(--hts-fg) 9%, transparent);
  --hts-border-2: color-mix(in srgb, var(--hts-fg) 16%, transparent);
  --hts-hover:   color-mix(in srgb, var(--hts-fg) 6%, transparent);
  /* red accents */
  --hts-red-08:  color-mix(in srgb, var(--hts-primary) 8%, transparent);
  --hts-red-16:  color-mix(in srgb, var(--hts-primary) 16%, transparent);
  --hts-red-40:  color-mix(in srgb, var(--hts-primary) 40%, transparent);
  --hts-red-grad: linear-gradient(135deg, var(--hts-primary) 0%, color-mix(in srgb, var(--hts-primary) 78%, var(--hts-secondary)) 100%);
  --hts-shadow:  0 1px 0 color-mix(in srgb, var(--hts-fg) 4%, transparent) inset, 0 8px 24px rgba(0, 0, 0, 0.28);
  --hts-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45);
  --hts-ring:    0 0 0 3px var(--hts-red-16);
  --hts-r:       14px;
  --hts-r-sm:    10px;
  --hts-font:    "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;

  /* Universal Theme mapped to the tokens */
  --ut-body-background-color: var(--hts-page);
  --ut-body-text-color: var(--hts-fg);
  --ut-component-background-color: var(--hts-panel);
  --ut-component-text-default-color: var(--hts-fg);
  --ut-component-border-color: var(--hts-border);
  --ut-component-border-radius: var(--hts-r);
  --ut-region-background-color: var(--hts-panel);
  --ut-region-header-background-color: transparent;
  --ut-header-background-color: var(--hts-glass);
  --ut-header-text-color: var(--hts-fg);
  --ut-nav-background-color: var(--hts-page);
  --ut-nav-text-color: var(--hts-fg-2);
  --ut-palette-primary: var(--hts-primary);
  --ut-palette-primary-contrast: var(--hts-text);
  --a-field-input-background-color: color-mix(in srgb, var(--hts-page) 60%, var(--hts-panel));
  --a-field-input-border-color: var(--hts-border-2);
  --a-field-input-text-color: var(--hts-fg);
  --a-field-input-focus-border-color: var(--hts-primary);
  --a-button-background-color: var(--hts-panel-2);
  --a-button-text-color: var(--hts-fg);
  --a-button-border-color: var(--hts-border);
  --a-button-border-radius: var(--hts-r-sm);
  --a-gv-background-color: var(--hts-panel);
  --a-gv-header-background-color: var(--hts-panel-2);
  --a-gv-row-hover-background-color: var(--hts-hover);
  --a-gv-border-color: var(--hts-border);
  --a-menu-background-color: var(--hts-panel-2);
  --a-menu-text-color: var(--hts-fg);
  --ut-focus-outline-color: var(--hts-primary);
  --ut-link-text-color: color-mix(in srgb, var(--hts-primary) 62%, var(--hts-text));
  color-scheme: dark;
}

/* ---------- page ---------- */
html body.t-PageBody,
body.t-PageBody .t-Body,
body.t-PageBody .t-Body-main,
body.t-PageBody .t-Body-content,
body.t-PageBody .t-Body-contentInner {
  background-color: var(--hts-page);
  color: var(--hts-fg);
}
body.t-PageBody {
  font-family: var(--hts-font);
  background-image: radial-gradient(1200px 520px at 100% -10%, var(--hts-red-08), transparent 60%),
                    radial-gradient(900px 480px at -10% 110%, color-mix(in srgb, var(--hts-accent) 30%, transparent), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body.t-PageBody .t-Body,
body.t-PageBody .t-Body-main,
body.t-PageBody .t-Body-content,
body.t-PageBody .t-Body-contentInner { background-color: transparent; }
::selection { background: var(--hts-red-40); color: var(--hts-text); }
* { scrollbar-width: thin; scrollbar-color: var(--hts-border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--hts-border-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- header: glass bar with a thin red line ---------- */
.t-Header {
  background-color: var(--hts-glass);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--hts-border);
  box-shadow: 0 1px 0 var(--hts-red-40);
}
.t-Header, .t-Header-logo, .t-Header-logo-link, .t-Header .t-Button--header, .t-Header .t-Button--header .t-Icon,
.t-Header .t-NavigationBar .t-Button { color: var(--hts-fg); }
.t-Header-branding { padding-inline: 0.75rem; }
.t-Header-logo, .t-Header-logo-link { font-weight: 650; letter-spacing: 0.01em; }
.t-Header-logo img, .t-Header-logo-link img { height: 28px; border-radius: 7px; box-shadow: 0 0 0 1px var(--hts-border-2); }
.t-Header .t-Button--header { border-radius: var(--hts-r-sm); }
.t-Header .t-Button--header:hover { background-color: var(--hts-hover); }
.t-Header .t-Button--headerTree { color: var(--hts-fg-2); }

/* ---------- side navigation ---------- */
.t-Body-nav, .t-TreeNav, .t-TreeNav .a-TreeView {
  background-color: color-mix(in srgb, var(--hts-page) 70%, var(--hts-panel));
  border-inline-end: 1px solid var(--hts-border);
}
.t-TreeNav .a-TreeView-content { margin: 2px 8px; border-radius: var(--hts-r-sm); }
.t-TreeNav .a-TreeView-label,
.t-TreeNav .a-TreeView-node .fa,
.t-TreeNav .a-TreeView-node .t-Icon { color: var(--hts-fg-2); }
.t-TreeNav .a-TreeView-content.is-hover { background-color: var(--hts-hover); }
/* AUD-03 fix: the full-width row behind each item stays clear; the item itself shows hover / current */
html body .t-TreeNav .a-TreeView-node .a-TreeView-row[class],
html body .t-TreeNav .a-TreeView-node.a-TreeView-node--topLevel .a-TreeView-row[class] { background-color: transparent; color: var(--hts-fg); }
/* Vita sets the hover row colour with !important */
html body .t-TreeNav .a-TreeView-node .a-TreeView-row.is-hover { background-color: transparent !important; }
/* Vita paints an opened sub-menu a fixed near-black: use the page colour, a guide line and an indent */
html body .t-TreeNav .a-TreeView-node--topLevel ul { background-color: transparent; color: var(--hts-fg); margin-inline-start: 1.6rem; border-inline-start: 1px solid var(--hts-border-2); }
html body .t-TreeNav .a-TreeView-node--topLevel ul .a-TreeView-content { margin-inline-start: 0.4rem; }
body:not(.js-navCollapsed) .t-TreeNav .a-TreeView-content.is-selected .a-TreeView-label,
body:not(.js-navCollapsed) .t-TreeNav .a-TreeView-content.is-current--top .a-TreeView-label { color: var(--hts-fg); }
body:not(.js-navCollapsed) .t-TreeNav .a-TreeView-content.is-hover .a-TreeView-label,
.t-TreeNav .a-TreeView-content.is-hover .fa, .t-TreeNav .a-TreeView-content.is-hover .t-Icon { color: var(--hts-fg); }
.t-TreeNav .a-TreeView-node--topLevel > .a-TreeView-content.is-current--top,
.t-TreeNav .a-TreeView-node--topLevel > .a-TreeView-content.is-current,
.t-TreeNav .a-TreeView-content.is-current {
  background: linear-gradient(90deg, var(--hts-red-16), var(--hts-red-08) 70%, transparent);
  box-shadow: inset 3px 0 0 var(--hts-primary);
}
.t-TreeNav .a-TreeView-content.is-current .a-TreeView-label,
.t-TreeNav .a-TreeView-content.is-current .fa,
.t-TreeNav .a-TreeView-content.is-current .t-Icon { color: var(--hts-fg); }
.t-TreeNav .a-TreeView-content.is-current .fa { color: var(--hts-primary); }

/* ---------- regions and cards: soft panels ---------- */
.t-Region, .t-ContentBlock, .t-Card .t-Card-wrap, .t-Alert--wizard, .t-Form--stretchInputs .t-Region,
.t-HeroRegion, .t-ButtonRegion--slim, .t-Region--accent1 {
  background-color: var(--hts-panel);
  border-color: var(--hts-border);
  border-radius: var(--hts-r);
  box-shadow: var(--hts-shadow);
}
.t-Region { overflow: hidden; }
.t-Region-header {
  background-color: transparent;
  border-bottom: 1px solid var(--hts-border);
  color: var(--hts-fg);
}
.t-Region-title { font-weight: 620; letter-spacing: 0.005em; }
.t-Region-body { color: var(--hts-fg); }
.t-Region--noUI, .t-Region--removeHeader.t-Region--noBorder { box-shadow: none; background: transparent; }
.t-HeroRegion {
  background-image: linear-gradient(120deg, var(--hts-red-08), transparent 55%);
  border: 1px solid var(--hts-border);
}
.t-HeroRegion-title { font-weight: 680; letter-spacing: -0.01em; }
.t-BreadcrumbRegion { background: transparent; border: 0; box-shadow: none; }
.t-Breadcrumb-label, .t-Breadcrumb-item a { color: var(--hts-fg-2); }
.t-Breadcrumb-item.is-active .t-Breadcrumb-label { color: var(--hts-fg); font-weight: 650; }

/* ---------- buttons ---------- */
.t-Button:not(.t-Button--header):not(.t-Button--noUI):not(.t-Button--link) {
  border-radius: var(--hts-r-sm);
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.t-Button:not(.t-Button--hot):not(.t-Button--header):not(.t-Button--noUI):not(.t-Button--link):not(.t-Button--simple) {
  background-color: var(--hts-panel-2);
  border: 1px solid var(--hts-border);
  color: var(--hts-fg);
  box-shadow: none;
}
.t-Button:not(.t-Button--hot):not(.t-Button--header):not(.t-Button--noUI):not(.t-Button--link):hover {
  background-color: color-mix(in srgb, var(--hts-panel-2) 88%, var(--hts-fg));
  color: var(--hts-fg);
}
.t-Button--hot,
.t-Button--hot:not(.t-Button--simple) {
  background: var(--hts-red-grad);
  border: 1px solid color-mix(in srgb, var(--hts-primary) 70%, var(--hts-text) 10%);
  color: var(--hts-text);
  box-shadow: 0 6px 18px var(--hts-red-40);
}
.t-Button--hot:hover, .t-Button--hot:focus { filter: brightness(1.08); box-shadow: 0 8px 24px var(--hts-red-40); }
.t-Button:active { transform: translateY(1px); }
.t-Button:focus-visible, .a-Button:focus-visible { outline: none; box-shadow: var(--hts-ring); }

/* ---------- form fields ---------- */
.t-Form-fieldContainer .t-Form-label, .t-Form-label { color: var(--hts-fg-2); font-weight: 560; }
.apex-item-text, .apex-item-textarea, .apex-item-select, .apex-item-datepicker, .apex-item-number,
.t-Form-field, .a-Form-field, select.selectlist, input.text_field, input.password, textarea.textarea {
  background-color: var(--a-field-input-background-color);
  border: 1px solid var(--hts-border-2);
  border-radius: var(--hts-r-sm);
  color: var(--hts-fg);
}
.apex-item-text:focus, .apex-item-textarea:focus, .apex-item-select:focus, .apex-item-datepicker:focus,
.t-Form-field:focus, select.selectlist:focus, input.text_field:focus, input.password:focus, textarea.textarea:focus,
.t-Form-fieldContainer .apex-item-text:focus-visible, .t-Form-fieldContainer .password:focus-visible {
  border-color: var(--hts-primary);
  box-shadow: var(--hts-ring);
  outline: none;
}
.t-Form-inlineHelp, .t-Form-help { color: var(--hts-fg-2); }

/* ---------- reports and grids ---------- */
.t-Report-report, .a-IRR-table, .a-GV-table, .t-Report-wrap { background-color: transparent; color: var(--hts-fg); }
.t-Report-colHead, .a-IRR-header, .a-GV-header, .a-IRR-table th {
  background-color: var(--hts-panel-2);
  color: var(--hts-fg-2);
  font-weight: 620;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-color: var(--hts-border);
}
.t-Report-cell, .a-IRR-table td, .a-GV-cell { border-color: var(--hts-border); color: var(--hts-fg); }
.t-Report-report tr:hover td, .a-IRR-table tr:hover td, .a-GV-row:hover .a-GV-cell { background-color: var(--hts-hover); }
.a-IRR-toolbar, .a-GV-toolbar, .a-Toolbar { background-color: transparent; border-color: var(--hts-border); }
.a-IRR, .a-IG { background-color: var(--hts-panel); border-color: var(--hts-border); border-radius: var(--hts-r); }
.t-Report-pagination, .a-IRR-pagination { color: var(--hts-fg-2); }
a, .t-Report-cell a, .a-IRR-table a { color: var(--ut-link-text-color); }
a:hover { color: var(--hts-fg); }

/* ---------- dialogs, menus, popups, alerts ---------- */
.ui-dialog, .t-Dialog-page, .ui-dialog .ui-dialog-content, .t-DialogRegion {
  background-color: var(--hts-panel);
  color: var(--hts-fg);
  border-radius: var(--hts-r);
}
.ui-dialog { border: 1px solid var(--hts-border-2); box-shadow: var(--hts-shadow-lg); overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { background-color: var(--hts-panel); border-bottom: 1px solid var(--hts-border); color: var(--hts-fg); }
.ui-widget-overlay { background: color-mix(in srgb, var(--hts-secondary) 70%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.a-Menu .a-Menu-content, .t-NavigationBar-menu .a-Menu-content, .a-PopupLOV-dialog {
  background-color: var(--hts-panel-2);
  border: 1px solid var(--hts-border-2);
  border-radius: var(--hts-r-sm);
  box-shadow: var(--hts-shadow-lg);
}
.a-Menu .a-Menu-item.is-focused, .a-Menu .a-Menu-item:hover { background-color: var(--hts-red-16); }
.t-Alert { background-color: var(--hts-panel); border: 1px solid var(--hts-border); border-radius: var(--hts-r); color: var(--hts-fg); }
.t-Alert--warning, .t-Alert--danger { border-inline-start: 4px solid var(--hts-primary); }
.t-Body-alert .t-Alert { box-shadow: var(--hts-shadow-lg); }
.t-Footer { background: transparent; border-top: 1px solid var(--hts-border); color: var(--hts-fg-2); }

/* ---------- badges, KPI and status cards (Admin) ---------- */
.hts-badge { border-color: var(--hts-border-2); background: var(--hts-hover); }
.hts-kpi, .hts-prov, .hts-svc {
  position: relative;
  background-color: var(--hts-panel);
  border: 1px solid var(--hts-border);
  border-inline-start-width: 1px;
  border-radius: var(--hts-r);
  box-shadow: var(--hts-shadow);
  overflow: hidden;
}
.hts-kpi::before, .hts-prov::before, .hts-svc::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--hts-red-grad);
}
.hts-prov:not(.hts-prov--active)::before, .hts-svc--healthy::before { background: var(--hts-border-2); }
.hts-svc--degraded::before { background: var(--ut-palette-warning, var(--hts-accent)); }
.hts-kpi-icon {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 12px;
  background: var(--hts-red-16); color: var(--hts-primary); font-size: 1.25rem;
}
.hts-kpi-value { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; }
.hts-kpi-label { color: var(--hts-fg-2); opacity: 1; }
.hts-pre { border-color: var(--hts-border); background: color-mix(in srgb, var(--hts-page) 70%, var(--hts-panel)); }
.hts-bar-wrap { background: var(--hts-hover); }
.hts-bar--ok { background: var(--hts-fg-2); }
.hts-mfa-qr svg { border-radius: var(--hts-r-sm); }

/* ---------- sign-in pages: dark glass card ---------- */
.t-PageBody--login {
  background-color: var(--hts-page);
  background-image: radial-gradient(900px 600px at 15% 0%, var(--hts-red-16), transparent 60%),
                    radial-gradient(800px 600px at 100% 100%, color-mix(in srgb, var(--hts-accent) 55%, transparent), transparent 60%);
}
.t-PageBody--login .t-Login-container { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; }
.t-PageBody--login .t-Login-region {
  background-color: var(--hts-glass);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--hts-border-2);
  border-top: 1px solid var(--hts-border-2);
  border-radius: 20px;
  box-shadow: var(--hts-shadow-lg), 0 0 0 1px var(--hts-red-08);
  color: var(--hts-fg);
  position: relative;
  overflow: hidden;
}
.t-PageBody--login .t-Login-region::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--hts-red-grad);
}
.t-PageBody--login .t-Login-title { color: var(--hts-fg); font-weight: 680; letter-spacing: -0.01em; }
.t-PageBody--login .t-Login-logo img, .t-PageBody--login .t-Login-header img {
  width: 84px; border-radius: 18px; box-shadow: 0 10px 30px var(--hts-red-40);
}
.t-PageBody--login .t-Button--hot { width: 100%; min-height: 2.75rem; font-weight: 650; }
.t-PageBody--login .t-Form-fieldContainer .apex-item-text,
.t-PageBody--login .t-Form-fieldContainer .password { min-height: 2.75rem; }
.t-PageBody--login .t-Login-region a { color: var(--hts-fg-2); }
.t-PageBody--login .t-Login-region a:hover { color: var(--hts-fg); }

/* ---------- footer line (AUD-02): bottom of the page, quiet ---------- */
.hts-footer { color: var(--hts-fg-2); opacity: 1; letter-spacing: 0.01em; }
.t-PageBody--login .hts-footer { order: 99; color: var(--hts-fg-2); margin-top: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
  .t-Button { transition: none; }
}
/* AUD-03 fix 4: one hover style for every list menu (user menu, side navigation, chat and project list):
   soft red tint, full-strength text, red icon. The theme's own focused-menu colours are mapped to the tokens. */
:root { --a-menu-focused-background-color: var(--hts-red-08); --a-menu-focused-text-color: var(--hts-fg); }
.a-Menu .a-Menu-item.is-focused, .a-Menu .a-Menu-item:hover,
.t-TreeNav .a-TreeView-content.is-hover { background-color: var(--hts-red-08); color: var(--hts-fg); }
.a-Menu .a-Menu-item.is-focused *, .a-Menu .a-Menu-item:hover * { color: var(--hts-fg); }
.a-Menu .a-Menu-item.is-focused .fa, .a-Menu .a-Menu-item:hover .fa,
.t-TreeNav .a-TreeView-content.is-hover .fa { color: var(--hts-primary); }

/* =====================================================================
   UI-03 (refinement, both apps): calmer surfaces, one spacing scale, less decoration.
   Appended at the end of hts-app.css. Tokens only (no colour literals); dark and light
   both work because every value comes from the existing --hts-* variables.
   Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 px.  Radius: 6 (controls) / 8 (panels).
   ===================================================================== */
:root {
  --hts-s1: 0.25rem; --hts-s2: 0.5rem; --hts-s3: 0.75rem; --hts-s4: 1rem; --hts-s5: 1.5rem; --hts-s6: 2rem;
  --hts-r: 8px;
  --hts-r-sm: 6px;
  /* one quiet elevation instead of glows */
  --hts-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --hts-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.18);
  /* the red gradient becomes the solid brand red everywhere it is used */
  --hts-red-grad: var(--hts-primary);
}

/* page: flat background, no decorative radial glows */
body.t-PageBody, .t-PageBody--login { background-image: none; }

/* header: solid bar, one crisp brand line (no glow, no blur) */
.t-Header {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background-color: var(--hts-panel);
  border-bottom: 1px solid var(--hts-border);
  box-shadow: inset 0 -2px 0 var(--hts-primary);
}
.t-Header-branding { padding-inline: var(--hts-s3) var(--hts-s4); }
.t-Header-logo img, .t-Header-logo-link img { box-shadow: none; }

/* buttons: solid, no glow, no press-jump */
.t-Button--hot, .t-Button--hot:not(.t-Button--simple) { box-shadow: none; border-color: var(--hts-primary); }
.t-Button--hot:hover, .t-Button--hot:focus { box-shadow: none; filter: brightness(0.94); }
.t-Button:active { transform: none; }

/* regions and cards: hairline border, no floating shadow */
.t-Region, .t-ContentBlock, .t-Card .t-Card-wrap, .t-HeroRegion, .t-ButtonRegion--slim, .t-Region--accent1 { box-shadow: none; }
.t-HeroRegion { background-image: none; }
.t-Region-header { padding-inline: var(--hts-s4); }
.t-Body-contentInner { padding: var(--hts-s5) var(--hts-s5) var(--hts-s4); }

/* admin KPI / provider / service cards: plain left status bar, quiet icon */
.hts-kpi, .hts-prov, .hts-svc { box-shadow: none; }
.hts-kpi-icon { width: 2.25rem; height: 2.25rem; border-radius: var(--hts-r-sm); font-size: 1.05rem; }
.hts-kpi-value { font-size: 1.5rem; }

/* sign-in card: solid panel, no blur or red halo */
.t-PageBody--login .t-Login-region {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background-color: var(--hts-panel);
  border-radius: 12px;
  box-shadow: var(--hts-shadow-lg);
}
.t-PageBody--login .t-Login-logo img, .t-PageBody--login .t-Login-header img { box-shadow: none; border-radius: 14px; }

/* readable minimum sizes */
.t-Report-colHead, .a-IRR-header, .a-GV-header, .a-IRR-table th { font-size: 0.75rem; letter-spacing: 0.02em; }
.hts-footer { font-size: 0.75rem; }
/* the version is already in the copyright line: do not show it twice */
.t-Footer-version { display: none; }
