/* =========================================================================
   TMR Client Interface — walkthrough theme (based on the "inapp" template)
   Self-contained: pairs with CDN Bootstrap 5.3, Tabler icons & ApexCharts.
   Brand: The Master Relay — deep blue #2F2F4F / navy #12233D / gold #C9A24B (highlight), Poppins.
   ========================================================================= */

:root {
  /* Brand palette — The Master Relay: blue / navy / gold */
  --brand-navy: #12233D;
  --brand-blue: #2F2F4F;
  --brand-blue-lt: #9DBDF5;
  --brand-gold: #C9A24B;
  --brand-slate: #6B7C93;

  --bs-primary: #2F2F4F;
  --bs-primary-rgb: 47, 47, 79;
  --bs-primary-text-emphasis: #262640;
  --bs-primary-bg-subtle: #e6e6ee;
  --bs-primary-border-subtle: #c2c2d2;

  --bs-success: #16A34A;  --bs-success-rgb: 22, 163, 74;
  --bs-success-text-emphasis: #0c6b30; --bs-success-bg-subtle: #d7f0df; --bs-success-border-subtle: #a9e0bb;
  --bs-info: #2F6FED;     --bs-info-rgb: 47, 111, 237;
  --bs-info-text-emphasis: #14408f; --bs-info-bg-subtle: #dae6fc; --bs-info-border-subtle: #a9c4f7;
  --bs-warning: #C9A24B;  --bs-warning-rgb: 201, 162, 75;
  --bs-warning-text-emphasis: #7c6120; --bs-warning-bg-subtle: #f6ecd3; --bs-warning-border-subtle: #ead6a4;
  --bs-danger: #E5484D;   --bs-danger-rgb: 229, 72, 77;
  --bs-danger-text-emphasis: #8f181c; --bs-danger-bg-subtle: #fbdcdd; --bs-danger-border-subtle: #f4a9ac;

  --bs-secondary: #6B7C93; --bs-secondary-rgb: 107, 124, 147;
  --bs-body-font-family: 'Poppins', system-ui, sans-serif;
  --bs-body-font-size: 0.875rem;
  --bs-body-color: #26313f;
  --bs-body-bg: #f7f9fa;
  --bs-border-color: #e5e9ee;
  --bs-link-color: #3b4658;
  --bs-link-color-rgb: 59, 70, 88;
  --bs-link-hover-color: #C9A24B;
  --bs-heading-color: #12233D;

  /* surface tokens (retuned per color mode) */
  --tmr-surface: #ffffff;
  --tmr-surface-2: #f4f6f8;
  --tmr-text: #26313f;
  --tmr-muted: #6B7C93;
  --tmr-line: #e5e9ee;
}

/* ================= Dark mode (data-bs-theme="dark") ================= */
[data-bs-theme="dark"] {
  --bs-body-bg: #0a1523;
  --bs-body-color: #c3cedb;
  --bs-heading-color: #eef3f8;
  --bs-border-color: #22344a;
  --bs-link-color: #c3cedb;
  --bs-link-color-rgb: 195, 206, 219;
  --bs-secondary-color: #8fa0b3;
  --bs-emphasis-color: #eef3f8;

  --tmr-surface: #0f2136;
  --tmr-surface-2: #16304c;
  --tmr-text: #dbe4ee;
  --tmr-muted: #8fa0b3;
  --tmr-line: #22344a;

  --bs-primary-text-emphasis: #b9b9d8; --bs-primary-bg-subtle: rgba(47,47,79,.35); --bs-primary-border-subtle: rgba(47,47,79,.60);
  --bs-success-text-emphasis: #6fe0a0; --bs-success-bg-subtle: rgba(22,163,74,.16); --bs-success-border-subtle: rgba(22,163,74,.40);
  --bs-info-text-emphasis: #8fb6f7;    --bs-info-bg-subtle: rgba(47,111,237,.16);   --bs-info-border-subtle: rgba(47,111,237,.40);
  --bs-warning-text-emphasis: #e6c874; --bs-warning-bg-subtle: rgba(201,162,75,.18);--bs-warning-border-subtle: rgba(201,162,75,.42);
  --bs-danger-text-emphasis: #f39aa0;  --bs-danger-bg-subtle: rgba(229,72,77,.16);  --bs-danger-border-subtle: rgba(229,72,77,.40);
  --bs-secondary-text-emphasis: #aeb9c7; --bs-secondary-bg-subtle: rgba(107,124,147,.20); --bs-secondary-border-subtle: rgba(107,124,147,.40);
  --bs-tertiary-bg: #16304c;
}
[data-bs-theme="dark"] .card { background: var(--tmr-surface); }
[data-bs-theme="dark"] .btn-light {
  --bs-btn-bg: #1a3350; --bs-btn-border-color: #1a3350; --bs-btn-color: #c3cedb;
  --bs-btn-hover-bg: #22456a; --bs-btn-hover-border-color: #22456a; --bs-btn-hover-color: #fff;
}
[data-bs-theme="dark"] .bg-white { background-color: var(--tmr-surface) !important; }
[data-bs-theme="dark"] .bg-light { background-color: var(--tmr-surface-2) !important; }
[data-bs-theme="dark"] .text-dark { color: var(--tmr-text) !important; }
[data-bs-theme="dark"] .input-group-text { background: var(--tmr-surface-2); color: var(--tmr-muted); border-color: var(--tmr-line); }
[data-bs-theme="dark"] .brand-name { color: #eef3f8; }
[data-bs-theme="dark"] .table { --bs-table-hover-bg: rgba(201,162,75,.10); }

/* Logo variants swap automatically with the color mode */
.tmr-dark-only { display: none !important; }
[data-bs-theme="dark"] .tmr-light-only { display: none !important; }
[data-bs-theme="dark"] .tmr-dark-only { display: inline-block !important; }

body { background: var(--bs-body-bg); }
h1,h2,h3,h4,h5,h6 { font-weight: 500; color: var(--bs-heading-color); }

/* ---- Buttons retinted to the orange primary (BS5.3 local vars) ---- */
.btn-primary {
  --bs-btn-bg: #2F2F4F; --bs-btn-border-color: #2F2F4F;
  --bs-btn-hover-bg: #262640; --bs-btn-hover-border-color: #262640;
  --bs-btn-active-bg: #1e1e34; --bs-btn-active-border-color: #1e1e34;
  --bs-btn-disabled-bg: #2F2F4F; --bs-btn-disabled-border-color: #2F2F4F;
}
.btn-outline-primary {
  --bs-btn-color: #2F2F4F; --bs-btn-border-color: #2F2F4F;
  --bs-btn-hover-bg: #2F2F4F; --bs-btn-hover-border-color: #2F2F4F;
  --bs-btn-active-bg: #2F2F4F; --bs-btn-active-border-color: #2F2F4F;
}
.form-check-input:checked { background-color: #2F2F4F; border-color: #2F2F4F; }
.form-check-input:focus { border-color: #c2c2d2; box-shadow: 0 0 0 .25rem rgba(47,47,79,.25); }
.form-control:focus, .form-select:focus { border-color: #c2c2d2; box-shadow: 0 0 0 .25rem rgba(47,47,79,.15); }
.form-switch .form-check-input:checked { background-color: #2F2F4F; border-color: #2F2F4F; }
.page-link { color: #3b4658; } .page-item.active .page-link { background:#2F2F4F; border-color:#2F2F4F; }

/* ---- Cards ---- */
.card {
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  background: var(--tmr-surface);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card-header { border-bottom: 1px solid var(--bs-border-color); }

/* =========================== Layout ================================= */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(1px); display: none; z-index: 1030; }
.overlay.show { display: block; }

.sidebar {
  width: 240px; background: var(--tmr-surface); transition: width .3s, left .3s;
  border-right: 1px solid var(--bs-border-color);
  height: 100vh; position: fixed; top: 0; left: 0; padding-top: 60px; z-index: 1031;
}
.sidebar .nav-link {
  color: var(--tmr-text); padding: 8px 10px; display: flex; align-items: center;
  font-size: 14px; font-weight: 400; gap: 12px; white-space: nowrap;
  margin: 1px 12px; border-radius: 8px;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: #C9A24B; background-color: rgba(201,162,75,.12); }
.sidebar .nav-link .ti { font-size: 18px; }
.sidebar .nav-text { transition: opacity .2s; }
.sidebar .nav-heading { padding: 16px 24px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #a3a3a3; }

/* collapsible groups (main menu -> secondary menu) */
.sidebar .nav-group { font-weight: 500; }
.sidebar .nav-caret { font-size: 14px; transition: transform .2s ease; color: #a3a3a3; }
.sidebar .nav-group:not(.collapsed) .nav-caret { transform: rotate(90deg); }
.sidebar .nav-group:not(.collapsed) { color: var(--brand-gold); }
/* secondary (child) items: smaller + muted, with a tree guide line */
.sidebar .nav-sub { margin: 1px 0 4px; padding: 0; position: relative; }
.sidebar .nav-sub::before { content: ""; position: absolute; left: 27px; top: 0; bottom: 4px; width: 1px; background: var(--tmr-line); }
.sidebar .nav-sub .nav-link { margin: 0 12px 0 0; padding: 6px 10px 6px 42px; font-size: 12.5px; font-weight: 400; color: var(--tmr-muted); gap: 9px; border-radius: 0 8px 8px 0; }
.sidebar .nav-sub .nav-link .ti { font-size: 15px; }
.sidebar .nav-sub .nav-link:hover { color: var(--brand-gold); background-color: rgba(201,162,75,.08); }
.sidebar .nav-sub .nav-link.active { color: var(--brand-gold); font-weight: 500; background-color: rgba(201,162,75,.14); }
.sidebar.collapsed .nav-caret { display: none; }
.sidebar.collapsed .nav-sub::before { display: none; }
.sidebar.collapsed .nav-sub .nav-link { padding-left: 18px; }
.sidebar .logo-area {
  position: absolute; top: 0; left: 0; height: 60px; width: 100%; background: var(--tmr-surface);
  display: flex; align-items: center; gap: 10px; padding-left: 17px; color: var(--tmr-text);
  border-bottom: 1px solid var(--bs-border-color);
}
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .nav-link { margin: 0; background-color: transparent; padding: 8px 18px; }
.sidebar.collapsed .nav-text, .sidebar.collapsed .nav-heading, .sidebar.collapsed .logo-text { display: none; }

.topbar { height: 60px; margin-left: 240px; z-index: 1029; background: var(--tmr-surface); }
.topbar.full { margin-left: 60px; }
.content { margin-left: 240px; }
.content.full { margin-left: 60px; }

@media (max-width: 992px) {
  .sidebar { left: -240px; }
  .sidebar.mobile-show { left: 0; }
  .topbar { margin-left: 0 !important; width: 100% !important; }
  .content { margin-left: 0 !important; }
}

/* ---- Brand mark ---- */
.brand-logo { width: 30px; height: 34px; display:inline-flex; align-items:center; justify-content:center; }
.brand-logo img, .brand-logo svg { width: 30px; height: 34px; display:block; }
.brand-name { font-weight: 700; color:var(--tmr-text); letter-spacing:.02em; line-height:1; font-size:15px; }
.brand-name small { display:block; font-size:9px; font-weight:600; color:var(--brand-slate); letter-spacing:.14em; text-transform:uppercase; margin-top:2px; }

/* ---- Icon shapes (from inapp) ---- */
.icon-shape { display: inline-flex; align-items: center; justify-content: center; text-align: center; vertical-align: middle; }
.icon-sm { width: 2rem; height: 2rem; } .icon-md { width: 2.5rem; height: 2.5rem; } .icon-lg { width: 3rem; height: 3rem; }

/* ---- Avatar ---- */
.avatar { position: relative; display: inline-flex; align-items:center; justify-content:center; width: 2.5rem; height: 2.5rem; }
.avatar-sm { width: 2rem; height: 2rem; } .avatar-md { width: 2.5rem; height: 2.5rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  text-transform:uppercase; font-weight:600; font-size:.8rem; }
.avatar-primary   .avatar-initials { color:#fff; background:#2F2F4F; }
.avatar-info      .avatar-initials { color:#fff; background:#2F6FED; }
.avatar-success   .avatar-initials { color:#fff; background:#16A34A; }
.avatar-secondary .avatar-initials { color:#fff; background:#6B7C93; }
.avatar-warning   .avatar-initials { color:#12233D; background:#C9A24B; }
.avatar-navy      .avatar-initials { color:#fff; background:#12233D; }

/* ---- Tables ---- */
.table { --bs-table-hover-bg: rgba(201,162,75,.10); }
.table > thead { background: var(--tmr-surface-2); }
.table > thead th { font-weight: 500; color:var(--tmr-muted); font-size:.8rem; text-transform:uppercase; letter-spacing:.02em; }
.table td { vertical-align: middle; }
.cell-strong { font-weight: 500; color:var(--tmr-text); }
.cell-sub { color:var(--tmr-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size:.8rem; }

/* ---- Badges / status dots ---- */
.badge { font-weight: 500; }
.status-dot { width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:6px; }
.dot-on { background:#16A34A; } .dot-off { background:#a3a3a3; } .dot-warn { background:#C9A24B; }

/* ---- KPI tiles ---- */
.kpi { border-radius:.75rem; }
.kpi .kpi-icon { width:2.5rem; height:2.5rem; border-radius:.6rem; display:flex; align-items:center; justify-content:center; font-size:1.25rem; }
.kpi h2 { font-size:.8rem; color:var(--tmr-muted); font-weight:500; margin-bottom:.5rem; }
.kpi h3 { font-size:1.6rem; font-weight:600; margin-bottom:0; }

/* ---- Misc ---- */
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.section-title { font-size:.75rem; text-transform:uppercase; letter-spacing:.06em; color:#a3a3a3; font-weight:600; }
a { text-decoration: none; }
.nav-tabs .nav-link { color:var(--tmr-muted); border:0; border-bottom:2px solid transparent; }
.nav-tabs .nav-link.active { color:#C9A24B; background:transparent; border-bottom-color:#C9A24B; }
.list-group-item { border-color: var(--bs-border-color); background: var(--tmr-surface); color: var(--tmr-text); }
.list-group-item-action:hover { color: var(--brand-gold); background-color: rgba(201,162,75,.07); }
.list-group-item.active { background-color: rgba(201,162,75,.14); border-color: var(--bs-border-color); color: var(--brand-gold); font-weight: 500; }
.form-section-head { font-size:.9rem; font-weight:600; color:var(--tmr-text); }

/* ---- Tabler icon font ----
   The @tabler/icons-webfont CSS ships only @font-face + `.ti-*:before{content}`
   glyphs; it does NOT apply the icon font to the element. Without this rule
   `<i class="ti ti-x">` shows nothing. Apply the font to every icon class. */
.ti, [class^="ti-"], [class*=" ti-"] {
  font-family: "tabler-icons" !important;
  font-style: normal; font-weight: 400; font-variant: normal;
  text-transform: none; line-height: 1; speak: none;
  display: inline-block;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
