/* ==========================================================================
   Tilnex — SCADA Green (light) theme for ThingsBoard
   Dark sidebar + light work area + green accent
   Serve at: /var/www/branding/tilnex-theme.css
   ========================================================================== */

/* UI font — to switch font, change the family name here AND in --tl-font below */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   1. PALETTE — change colors here only
   -------------------------------------------------------------------------- */
:root {
  /* Sidebar (dark) */
  --tl-side-bg: #0d1117;
  --tl-side-bg-hover: #161b22;
  --tl-side-line: #21262d;
  --tl-side-text: #8b949e;
  --tl-side-text-hover: #e6edf3;

  /* Work area (light) */
  --tl-bg: #f3f5f8;
  --tl-surface: #ffffff;
  --tl-line: #e3e8ef;
  --tl-line-strong: #cfd6e0;
  --tl-text: #0f172a;
  --tl-text-dim: #64748b;

  /* Accent */
  --tl-accent: #2ea043;
  --tl-accent-hover: #238636;
  --tl-accent-light: #8ddb8c;
  --tl-accent-soft: rgba(46, 160, 67, 0.12);

  /* Status */
  --tl-warn: #d29922;
  --tl-danger: #da3633;
  --tl-info: #2f81f7;

  --tl-radius: 6px;
  --tl-font: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --tl-mono: 'IBM Plex Mono', 'Consolas', monospace;
}

/* --------------------------------------------------------------------------
   1b. Font — replaces Roboto everywhere except icons, code editors,
       and text where a widget sets its own font
   -------------------------------------------------------------------------- */
html body * {
  --mat-app-font: var(--tl-font) !important;
  --mdc-typography-font-family: var(--tl-font) !important;
  --mat-option-label-text-font: var(--tl-font) !important;
  --mat-menu-item-label-text-font: var(--tl-font) !important;
  --mat-select-trigger-text-font: var(--tl-font) !important;
  --mat-form-field-container-text-font: var(--tl-font) !important;
  --mdc-outlined-text-field-label-text-font: var(--tl-font) !important;
  --mdc-filled-text-field-label-text-font: var(--tl-font) !important;
  --mat-table-header-headline-font: var(--tl-font) !important;
  --mat-table-row-item-label-text-font: var(--tl-font) !important;
  --mat-tab-header-label-text-font: var(--tl-font) !important;
  --mdc-text-button-label-text-font: var(--tl-font) !important;
  --mdc-filled-button-label-text-font: var(--tl-font) !important;
  --mdc-protected-button-label-text-font: var(--tl-font) !important;
  --mdc-outlined-button-label-text-font: var(--tl-font) !important;
  --mdc-dialog-subhead-font: var(--tl-font) !important;
  --mdc-dialog-supporting-text-font: var(--tl-font) !important;
  --mdc-plain-tooltip-supporting-text-font: var(--tl-font) !important;
  --mat-toolbar-title-text-font: var(--tl-font) !important;
  --mat-paginator-container-text-font: var(--tl-font) !important;
  --mdc-list-list-item-label-text-font: var(--tl-font) !important;
  --mat-expansion-header-text-font: var(--tl-font) !important;
  --mat-expansion-container-text-font: var(--tl-font) !important;
  --mdc-chip-label-text-font: var(--tl-font) !important;
  --mat-checkbox-label-text-font: var(--tl-font) !important;
  --mat-radio-label-text-font: var(--tl-font) !important;
  --mat-switch-label-text-font: var(--tl-font) !important;
}

/* :where() keeps specificity at zero, so the monospace number rules
   and icon fonts still win */
:where(html body, html body *
  :not(mat-icon):not(mat-icon *)
  :not(tb-icon):not(tb-icon *)
  :not([class*="icon"]):not([class*="icon"] *)
  :not([class*="material-"]):not([class*="material-"] *)
  :not([fonticon]):not([fontset])
  :not(.mdi):not([class^="mdi-"]):not([class*=" mdi-"])
  :not(.fa):not([class^="fa-"]):not([class*=" fa-"])
  :not(code):not(pre):not(kbd)
  :not(.ace_editor):not(.ace_editor *)
  :not([style*="font-family"])) {
  font-family: var(--tl-font) !important;
}

/* Force icon fonts back on every icon element (stops icon names
   like "home" or "devices" appearing as text before labels) */
html body mat-icon:not([data-mat-icon-type="svg"]),
html body .mat-icon:not([data-mat-icon-type="svg"]),
html body .material-icons, html body tb-icon mat-icon:not([data-mat-icon-type="svg"]),
html body .tb-side-menu mat-icon:not([data-mat-icon-type="svg"]),
html body .tb-site-sidenav mat-icon:not([data-mat-icon-type="svg"]) {
  font-family: 'Material Icons', 'Material Icons Outlined', 'Material Symbols Outlined' !important;
  font-weight: normal !important;
  font-style: normal !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  white-space: nowrap !important;
  word-wrap: normal !important;
  direction: ltr !important;
  font-feature-settings: 'liga' !important;
  -webkit-font-feature-settings: 'liga' !important;
  -webkit-font-smoothing: antialiased;
}
html body .material-icons-outlined { font-family: 'Material Icons Outlined' !important; font-feature-settings: 'liga' !important; }
html body .material-symbols-outlined { font-family: 'Material Symbols Outlined' !important; font-feature-settings: 'liga' !important; }

html body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Slightly tighter headings for a more modern feel */
html body h1, html body h2, html body h3,
html body .mat-mdc-dialog-title, html body mat-toolbar .mat-toolbar-tools > span,
html body .tb-entity-table-title { letter-spacing: -0.01em; font-weight: 600; }

/* --------------------------------------------------------------------------
   2. Replace ThingsBoard's default blue primary with green
      (!important on tokens beats the per-component values Material sets)
   -------------------------------------------------------------------------- */
html body * {
  --mdc-checkbox-selected-icon-color: var(--tl-accent) !important;
  --mdc-checkbox-selected-hover-icon-color: var(--tl-accent-hover) !important;
  --mdc-checkbox-selected-focus-icon-color: var(--tl-accent) !important;
  --mdc-checkbox-selected-pressed-icon-color: var(--tl-accent) !important;
  --mdc-checkbox-selected-checkmark-color: #ffffff !important;

  --mdc-radio-selected-icon-color: var(--tl-accent) !important;
  --mdc-radio-selected-hover-icon-color: var(--tl-accent-hover) !important;
  --mdc-radio-selected-focus-icon-color: var(--tl-accent) !important;
  --mdc-radio-selected-pressed-icon-color: var(--tl-accent) !important;
  --mat-radio-checked-ripple-color: var(--tl-accent) !important;

  --mdc-switch-selected-handle-color: var(--tl-accent) !important;
  --mdc-switch-selected-hover-handle-color: var(--tl-accent-hover) !important;
  --mdc-switch-selected-focus-handle-color: var(--tl-accent-hover) !important;
  --mdc-switch-selected-pressed-handle-color: var(--tl-accent-hover) !important;
  --mdc-switch-selected-track-color: var(--tl-accent-light) !important;
  --mdc-switch-selected-hover-track-color: var(--tl-accent-light) !important;
  --mdc-switch-selected-focus-track-color: var(--tl-accent-light) !important;
  --mdc-switch-selected-pressed-track-color: var(--tl-accent-light) !important;

  --mdc-tab-indicator-active-indicator-color: var(--tl-accent) !important;
  --mat-tab-header-active-ripple-color: var(--tl-accent) !important;

  --mdc-outlined-text-field-focus-outline-color: var(--tl-accent) !important;
  --mdc-outlined-text-field-focus-label-text-color: var(--tl-accent) !important;
  --mdc-outlined-text-field-caret-color: var(--tl-accent) !important;
  --mdc-filled-text-field-focus-active-indicator-color: var(--tl-accent) !important;
  --mdc-filled-text-field-focus-label-text-color: var(--tl-accent) !important;
  --mdc-filled-text-field-caret-color: var(--tl-accent) !important;
  --mat-select-focused-arrow-color: var(--tl-accent) !important;

  --mat-option-selected-state-label-text-color: var(--tl-accent) !important;
  --mdc-linear-progress-active-indicator-color: var(--tl-accent) !important;
  --mdc-circular-progress-active-indicator-color: var(--tl-accent) !important;
  --mat-datepicker-calendar-date-selected-state-background-color: var(--tl-accent) !important;
  --mat-datepicker-calendar-date-today-outline-color: var(--tl-accent) !important;
}

/* --------------------------------------------------------------------------
   3. Work area background
   -------------------------------------------------------------------------- */
html body, tb-root,
.mat-drawer-container, .mat-sidenav-container,
.mat-drawer-content, .mat-sidenav-content {
  background-color: var(--tl-bg) !important;
}

::selection { background: var(--tl-accent-soft); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tl-line-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--tl-text-dim); }

/* --------------------------------------------------------------------------
   4. Sidebar (dark)
   -------------------------------------------------------------------------- */
html body mat-sidenav.tb-site-sidenav,
html body .tb-site-sidenav,
html body .tb-site-sidenav .mat-drawer-inner-container {
  background-color: var(--tl-side-bg) !important;
  border-right: 1px solid var(--tl-side-line) !important;
  box-shadow: none !important;
}

/* Logo bar at top of sidebar */
html body .tb-site-sidenav mat-toolbar,
html body .tb-site-sidenav .mat-toolbar {
  background-color: var(--tl-side-bg) !important;
  color: var(--tl-side-text-hover) !important;
  border-bottom: 1px solid var(--tl-side-line) !important;
  box-shadow: none !important;
}

/* Menu */
html body .tb-site-sidenav .tb-side-menu,
html body .tb-side-menu {
  background-color: transparent !important;
}
html body .tb-side-menu a, html body .tb-side-menu button,
html body .tb-site-sidenav tb-menu-link a, html body .tb-site-sidenav tb-menu-toggle button {
  color: var(--tl-side-text) !important;
  --mdc-text-button-label-text-color: var(--tl-side-text) !important;
  border-left: 3px solid transparent !important;
  border-radius: var(--tl-radius) !important;
  transition: background-color .15s, color .15s;
}
html body .tb-side-menu a:hover, html body .tb-side-menu button:hover {
  background-color: var(--tl-side-bg-hover) !important;
  color: var(--tl-side-text-hover) !important;
}
html body .tb-side-menu .tb-active,
html body .tb-side-menu a.tb-active,
html body .tb-site-sidenav tb-menu-link a.tb-active {
  background-color: rgba(46, 160, 67, 0.15) !important;
  color: #ffffff !important;
  border-left-color: var(--tl-accent) !important;
}

/* Sidebar icons follow their link color; active icon is green */
html body .tb-site-sidenav .mat-icon,
html body .tb-site-sidenav tb-icon,
html body .tb-side-menu .mat-icon { color: inherit !important; }
html body .tb-site-sidenav svg [fill]:not([fill="none"]) { fill: currentColor !important; }
html body .tb-site-sidenav svg [stroke]:not([stroke="none"]) { stroke: currentColor !important; }
html body .tb-side-menu .tb-active .mat-icon,
html body .tb-side-menu a.tb-active .mat-icon { color: var(--tl-accent-light) !important; }

/* Sub-menus and their toggle arrows */
html body .tb-side-menu ul, html body .tb-side-menu .tb-menu-toggle-list { background: transparent !important; }
html body .tb-side-menu .tb-toggle-icon, html body .tb-side-menu .md-toggle-icon { color: var(--tl-side-text) !important; }

/* Sidebar scrollbar */
html body .tb-site-sidenav ::-webkit-scrollbar-thumb { background: var(--tl-side-line); }

/* --------------------------------------------------------------------------
   5. Top toolbar (white, replaces TB blue)
   -------------------------------------------------------------------------- */
html body .mat-drawer-content > mat-toolbar,
html body mat-toolbar.tb-primary-toolbar,
html body .tb-primary-toolbar,
html body .tb-default .mat-drawer-content mat-toolbar.mat-primary,
html body section > mat-toolbar.mat-primary {
  background-color: var(--tl-surface) !important;
  color: var(--tl-text) !important;
  border-bottom: 1px solid var(--tl-line) !important;
  box-shadow: none !important;
}
html body .tb-primary-toolbar .mat-icon,
html body .tb-primary-toolbar button,
html body .mat-drawer-content > mat-toolbar .mat-icon,
html body .mat-drawer-content > mat-toolbar button,
html body .tb-default .mat-drawer-content mat-toolbar.mat-primary button,
html body .tb-default .mat-drawer-content mat-toolbar.mat-primary .mat-icon {
  color: var(--tl-text-dim) !important;
  --mdc-icon-button-icon-color: var(--tl-text-dim) !important;
}
html body .tb-primary-toolbar button:hover .mat-icon,
html body .mat-drawer-content > mat-toolbar button:hover .mat-icon { color: var(--tl-text) !important; }

/* Breadcrumb */
html body tb-breadcrumb, html body tb-breadcrumb a, html body tb-breadcrumb span,
html body tb-breadcrumb .mat-icon { color: var(--tl-text) !important; }
html body tb-breadcrumb .divider, html body tb-breadcrumb .tb-breadcrumb-divider { color: var(--tl-text-dim) !important; }

/* User menu (name + role in the top right) */
html body tb-user-menu, html body tb-user-menu .tb-user-display-name,
html body tb-user-menu .tb-user-info { color: var(--tl-text) !important; }
html body tb-user-menu .tb-user-authority { color: var(--tl-text-dim) !important; }

/* Other primary-colored toolbars (details panels, dialogs) → white with border */
html body .tb-details-panel mat-toolbar.mat-primary,
html body .mat-mdc-dialog-surface mat-toolbar.mat-primary,
html body .mat-dialog-container mat-toolbar.mat-primary {
  background-color: var(--tl-surface) !important;
  color: var(--tl-text) !important;
  border-bottom: 1px solid var(--tl-line) !important;
}
html body .tb-details-panel mat-toolbar.mat-primary .mat-icon,
html body .tb-details-panel mat-toolbar.mat-primary button,
html body .mat-mdc-dialog-surface mat-toolbar.mat-primary .mat-icon,
html body .mat-mdc-dialog-surface mat-toolbar.mat-primary button {
  color: var(--tl-text-dim) !important;
}

/* Every remaining primary toolbar in the work area → white
   (sidebar logo bar is excluded and stays dark) */
html body mat-toolbar.mat-primary:not(.tb-site-sidenav *),
html body .mat-toolbar.mat-primary:not(.tb-site-sidenav *),
html body .tb-default mat-toolbar.mat-primary:not(.tb-site-sidenav *),
html body .tb-default .mat-toolbar.mat-primary:not(.tb-site-sidenav *) {
  background-color: var(--tl-surface) !important;
  color: var(--tl-text) !important;
  border-bottom: 1px solid var(--tl-line) !important;
  box-shadow: none !important;
  --mat-toolbar-container-background-color: var(--tl-surface) !important;
  --mat-toolbar-container-text-color: var(--tl-text) !important;
}
html body mat-toolbar.mat-primary:not(.tb-site-sidenav *) .mat-icon,
html body mat-toolbar.mat-primary:not(.tb-site-sidenav *) button,
html body .mat-toolbar.mat-primary:not(.tb-site-sidenav *) .mat-icon,
html body .mat-toolbar.mat-primary:not(.tb-site-sidenav *) button {
  color: var(--tl-text-dim) !important;
  --mdc-icon-button-icon-color: var(--tl-text-dim) !important;
  --mdc-text-button-label-text-color: var(--tl-text-dim) !important;
}
html body mat-toolbar.mat-primary:not(.tb-site-sidenav *) button:hover .mat-icon,
html body .mat-toolbar.mat-primary:not(.tb-site-sidenav *) button:hover .mat-icon {
  color: var(--tl-accent) !important;
}
html body mat-toolbar.mat-primary:not(.tb-site-sidenav *) .mat-mdc-raised-button.mat-primary,
html body mat-toolbar.mat-primary:not(.tb-site-sidenav *) .mat-mdc-unelevated-button.mat-primary {
  color: #ffffff !important;
}

/* Inner row of any toolbar: never paints its own color, follows the toolbar */
html body .mat-toolbar-tools,
html body .mat-toolbar-row {
  background-color: transparent !important;
  color: inherit !important;
}

/* --------------------------------------------------------------------------
   6. Dashboard floating toolbar (fab toolbar) — white, matches top bar
   -------------------------------------------------------------------------- */
html body .tb-default mat-fab-toolbar.mat-primary .mat-fab-toolbar-background,
html body mat-fab-toolbar .mat-fab-toolbar-background {
  background: var(--tl-surface) !important;
  color: var(--tl-text) !important;
  border: 1px solid var(--tl-line) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}
html body mat-fab-toolbar mat-toolbar, html body mat-fab-toolbar .mat-toolbar {
  background: transparent !important;
  color: var(--tl-text) !important;
  border: none !important;
}
html body mat-fab-toolbar .mat-icon,
html body mat-fab-toolbar .mat-mdc-icon-button,
html body mat-fab-toolbar .mat-mdc-button {
  color: var(--tl-text-dim) !important;
  --mdc-icon-button-icon-color: var(--tl-text-dim) !important;
}
html body mat-fab-toolbar .mat-mdc-icon-button:hover .mat-icon,
html body mat-fab-toolbar .mat-mdc-button:hover .mat-icon { color: var(--tl-accent) !important; }
html body mat-fab-toolbar .mat-mdc-fab, html body mat-fab-toolbar .mat-fab,
html body mat-fab-toolbar .mat-mdc-mini-fab, html body mat-fab-toolbar .mat-mini-fab,
html body mat-fab-toolbar .mat-fab-toolbar-trigger button {
  background-color: var(--tl-accent) !important;
  color: #ffffff !important;
}
html body mat-fab-toolbar .mat-mdc-fab .mat-icon,
html body mat-fab-toolbar .mat-mdc-mini-fab .mat-icon,
html body mat-fab-toolbar .mat-fab-toolbar-trigger .mat-icon { color: #ffffff !important; }

/* --------------------------------------------------------------------------
   7. Dashboards and widgets
   -------------------------------------------------------------------------- */
html body tb-dashboard-page, html body .tb-dashboard-page,
html body gridster, html body .gridster {
  background-color: var(--tl-bg) !important;
}

html body .tb-widget {
  border: 1px solid var(--tl-line) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transition: border-color .15s, box-shadow .15s;
}
html body .tb-widget:hover {
  border-color: var(--tl-line-strong) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06) !important;
}

/* Widget titles: small uppercase control-panel label */
html body .tb-widget-title .mat-subtitle-1,
html body .tb-widget-title-text,
html body .tb-widget .tb-widget-title > span {
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tl-text-dim) !important;
}

/* Numbers use monospace with fixed-width digits */
html body .tb-value-card-value, html body .tb-value-chart-card-value,
html body .tb-aggregated-value-card-value, html body .tb-digital-gauge-value,
html body .tb-label-value {
  font-family: var(--tl-mono) !important;
  font-variant-numeric: tabular-nums;
}

/* Cards (home page, login, settings) */
html body mat-card.mat-mdc-card, html body .mat-card {
  border: 1px solid var(--tl-line) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
html body .mat-mdc-raised-button.mat-primary,
html body .mat-mdc-unelevated-button.mat-primary,
html body .mat-raised-button.mat-primary,
html body .mat-flat-button.mat-primary,
html body .mat-mdc-fab.mat-primary, html body .mat-mdc-mini-fab.mat-primary,
html body .mat-fab.mat-primary, html body .mat-mini-fab.mat-primary {
  background-color: var(--tl-accent) !important;
  color: #ffffff !important;
  border-radius: var(--tl-radius) !important;
  box-shadow: none !important;
}
html body .mat-mdc-fab.mat-primary, html body .mat-mdc-mini-fab.mat-primary,
html body .mat-fab.mat-primary, html body .mat-mini-fab.mat-primary { border-radius: 50% !important; }
html body .mat-mdc-raised-button.mat-primary:hover,
html body .mat-mdc-unelevated-button.mat-primary:hover,
html body .mat-raised-button.mat-primary:hover,
html body .mat-flat-button.mat-primary:hover { background-color: var(--tl-accent-hover) !important; }
html body .mat-mdc-raised-button.mat-primary .mat-icon,
html body .mat-mdc-unelevated-button.mat-primary .mat-icon,
html body .mat-mdc-fab.mat-primary .mat-icon,
html body .mat-mdc-mini-fab.mat-primary .mat-icon { color: #ffffff !important; }

html body .mat-mdc-button.mat-primary, html body .mat-button.mat-primary,
html body .mat-mdc-outlined-button.mat-primary, html body .mat-stroked-button.mat-primary,
html body .mat-mdc-icon-button.mat-primary, html body .mat-icon-button.mat-primary {
  color: var(--tl-accent) !important;
  --mdc-text-button-label-text-color: var(--tl-accent) !important;
  --mdc-outlined-button-label-text-color: var(--tl-accent) !important;
}
html body .mat-mdc-outlined-button.mat-primary { border-color: var(--tl-accent) !important; }

/* --------------------------------------------------------------------------
   9. Tabs, links, form focus, selection
   -------------------------------------------------------------------------- */
html body .mat-mdc-tab.mdc-tab--active .mdc-tab__text-label,
html body .mat-mdc-tab-link.mdc-tab--active .mdc-tab__text-label,
html body .mat-tab-label-active { color: var(--tl-accent) !important; }
html body .mdc-tab-indicator__content--underline,
html body .mat-ink-bar { border-color: var(--tl-accent) !important; background-color: var(--tl-accent) !important; }

html body .tb-default a:not(.mat-mdc-button-base):not(.mat-button-base):not(.tb-side-menu a) { color: var(--tl-accent-hover); }

html body .mat-focused .mat-mdc-floating-label,
html body .mat-focused .mdc-floating-label,
html body .mat-focused .mat-form-field-label { color: var(--tl-accent) !important; }
html body .mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick { color: var(--tl-accent) !important; }
html body .mat-form-field.mat-focused .mat-form-field-ripple { background-color: var(--tl-accent) !important; }

/* Legacy (pre-MDC) checkbox / radio / toggle */
html body .mat-checkbox-checked.mat-primary .mat-checkbox-background,
html body .mat-checkbox-indeterminate.mat-primary .mat-checkbox-background { background-color: var(--tl-accent) !important; }
html body .mat-radio-button.mat-primary.mat-radio-checked .mat-radio-outer-circle { border-color: var(--tl-accent) !important; }
html body .mat-radio-button.mat-primary .mat-radio-inner-circle { background-color: var(--tl-accent) !important; }
html body .mat-slide-toggle.mat-primary.mat-checked .mat-slide-toggle-thumb { background-color: var(--tl-accent) !important; }
html body .mat-slide-toggle.mat-primary.mat-checked .mat-slide-toggle-bar { background-color: var(--tl-accent-light) !important; }

/* Progress / page-loading bar: green line on white, no red track
   (TB's loading bar uses the "warn" color, so all color variants are covered) */
html body * {
  --mdc-linear-progress-active-indicator-color: var(--tl-accent) !important;
  --mdc-linear-progress-track-color: var(--tl-surface) !important;
}
html body .mat-mdc-progress-bar,
html body .mat-mdc-progress-bar.mat-warn,
html body .mat-mdc-progress-bar.mat-accent,
html body .mat-mdc-progress-bar.mat-primary,
html body .mat-progress-bar {
  background-color: var(--tl-surface) !important;
}
/* MDC track + buffer */
html body .mat-mdc-progress-bar .mdc-linear-progress__buffer,
html body .mat-mdc-progress-bar .mdc-linear-progress__buffer-bar,
html body .mat-mdc-progress-bar .mdc-linear-progress__buffer-dots {
  background: var(--tl-surface) !important;
  background-color: var(--tl-surface) !important;
  background-image: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
/* MDC moving bar */
html body .mat-mdc-progress-bar .mdc-linear-progress__bar-inner {
  border-color: var(--tl-accent) !important;
  border-top-color: var(--tl-accent) !important;
}
/* Legacy (pre-MDC) track + buffer + moving bar */
html body .mat-progress-bar .mat-progress-bar-buffer,
html body .mat-progress-bar.mat-warn .mat-progress-bar-buffer,
html body .mat-progress-bar.mat-accent .mat-progress-bar-buffer {
  background-color: var(--tl-surface) !important;
}
html body .mat-progress-bar .mat-progress-bar-background,
html body .mat-progress-bar.mat-warn .mat-progress-bar-background {
  fill: var(--tl-surface) !important;
  background: var(--tl-surface) !important;
  display: none !important;
}
html body .mat-progress-bar .mat-progress-bar-fill::after,
html body .mat-progress-bar.mat-warn .mat-progress-bar-fill::after,
html body .mat-progress-bar.mat-accent .mat-progress-bar-fill::after {
  background-color: var(--tl-accent) !important;
}
html body .mat-mdc-progress-spinner circle, html body .mat-progress-spinner circle { stroke: var(--tl-accent) !important; }

/* --------------------------------------------------------------------------
   10. Tables
   -------------------------------------------------------------------------- */
html body .mat-mdc-header-cell, html body .mat-header-cell {
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tl-text-dim) !important;
}
html body .mat-mdc-row:hover, html body .mat-row:hover { background-color: #f8fafc !important; }
html body .mat-mdc-row.tb-current-entity, html body .mat-row.tb-current-entity,
html body .mat-mdc-row.tb-selected, html body .mat-row.tb-selected { background-color: var(--tl-accent-soft) !important; }

/* --------------------------------------------------------------------------
   11. Login page
   -------------------------------------------------------------------------- */
html body tb-login, html body .tb-login-content {
  background-color: var(--tl-side-bg) !important;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
}
html body tb-login mat-card, html body .tb-login-content mat-card {
  border-top: 3px solid var(--tl-accent) !important;
  border-radius: 8px !important;
}

/* --------------------------------------------------------------------------
   12. Helper classes for your own HTML / Markdown widgets
       Example: <span class="sc-status sc-ok">Running</span>
   -------------------------------------------------------------------------- */
.sc-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--tl-mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.sc-status::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.sc-ok    { color: var(--tl-accent); }
.sc-warn  { color: var(--tl-warn); }
.sc-alarm { color: var(--tl-danger); animation: sc-blink 1s steps(2, start) infinite; }
.sc-off   { color: var(--tl-text-dim); }
.sc-value { font-family: var(--tl-mono); font-variant-numeric: tabular-nums; }
@keyframes sc-blink { to { opacity: 0.35; } }
