/* =====================================================================
   IT Management System — Design System
   Direction: "control room" — dark instrumentation sidebar, calm paper
   workspace, monospace identifiers for anything technical (asset codes,
   IPs, serials, PO/REQ numbers), teal signal accent for primary actions,
   amber/coral for warning/critical states. Space Grotesk for numerals
   and page titles, Inter for UI, JetBrains Mono for identifiers.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Core palette */
  --ink:        #0B1120;
  --ink-soft:   #141C30;
  --ink-line:   #232D45;
  --paper:      #F1F4F9;
  --surface:    #FFFFFF;
  --border:     #E3E7EF;
  --text:       #1B2333;
  --text-muted: #6B7488;
  --text-faint: #9AA3B5;

  /* Signal accent (teal) */
  --signal:      #0D9488;
  --signal-600:  #0F766E;
  --signal-soft: #E3F7F4;
  --signal-ring: rgba(13,148,136,.25);

  /* Status colors */
  --amber:      #D97706;
  --amber-soft: #FDF1DE;
  --coral:      #DC2626;
  --coral-soft: #FBE9E9;
  --blue:       #2563EB;
  --blue-soft:  #E7EFFD;
  --slate:      #64748B;
  --slate-soft: #EEF1F6;

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --radius: 9px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow-md: 0 4px 16px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.14);

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

[data-theme="dark"] {
  --paper:      #0D1220;
  --surface:    #141B2C;
  --border:     #232D45;
  --text:       #E7EAF2;
  --text-muted: #8D96AC;
  --text-faint: #667089;
  --signal-soft: rgba(13,148,136,.16);
  --amber-soft: rgba(217,119,6,.15);
  --coral-soft: rgba(220,38,38,.15);
  --blue-soft:  rgba(37,99,235,.16);
  --slate-soft: rgba(100,116,139,.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.35);
}

* { -webkit-font-smoothing: antialiased; }

body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .835rem;
  line-height: 1.45;
}

h1 { font-size: 1.45rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1.02rem; }
h5 { font-size: .9rem; }
h6 { font-size: .82rem; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; color: var(--text); }

a { color: var(--signal); }
a:hover { color: var(--signal-600); }

/* Visible keyboard focus everywhere (accessibility floor) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .form-check-input:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------------
   Monospace identifier tag — the app's signature element. Used for
   asset codes, serials, IPs, MACs, PO/REQ numbers wherever they appear.
   --------------------------------------------------------------------- */
.id-tag {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 500;
  background: var(--slate-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .15rem .5rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}
.id-tag.accent { background: var(--signal-soft); color: var(--signal-600); border-color: transparent; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.status-dot.ok { background: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.status-dot.bad { background: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }

/* ---------------------------------------------------------------------
   Topbar
   --------------------------------------------------------------------- */
.app-topbar {
  background: var(--ink);
  height: var(--topbar-h);
  position: fixed; top: 0; left: 0; right: 0; z-index: 1030;
  border-bottom: 1px solid var(--ink-line);
  display: flex; align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
}
.app-topbar .brand {
  display: flex; align-items: center; gap: .6rem;
  color: #fff; text-decoration: none; font-family: var(--font-display);
  font-weight: 600; font-size: 1.02rem; flex-shrink: 0;
}
.app-topbar .brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--signal), #14B8A6);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: .95rem;
}
.app-topbar .page-title {
  color: var(--text-faint); font-size: .8rem; padding-left: 1rem; margin-left: .25rem;
  border-left: 1px solid var(--ink-line); display: none;
}
@media (min-width: 992px) { .app-topbar .page-title { display: block; } }
.app-topbar .page-title strong { color: #fff; font-weight: 600; display: block; font-size: .92rem; }

.topbar-search {
  flex-grow: 1; max-width: 420px; position: relative; display: none;
}
@media (min-width: 768px) { .topbar-search { display: block; } }
.topbar-search input {
  width: 100%; background: var(--ink-soft); border: 1px solid var(--ink-line); color: #fff;
  border-radius: 8px; padding: .4rem .7rem .4rem 2.1rem; font-size: .85rem;
}
.topbar-search input::placeholder { color: var(--text-faint); }
.topbar-search input:focus { outline: none; border-color: var(--signal); background: var(--ink); }
.topbar-search .bi-search { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: .85rem; }
.topbar-search kbd {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  background: var(--ink-line); color: var(--text-faint); font-size: .65rem; padding: .1rem .35rem; border-radius: 4px;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; z-index: 1050; display: none;
}
.search-results.show { display: block; }
.search-results a {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; color: var(--text);
  text-decoration: none; font-size: .85rem; border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.active-result { background: var(--signal-soft); color: var(--signal-600); }
.search-results .empty { padding: .8rem; color: var(--text-muted); font-size: .82rem; }

.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--ink-line);
  background: var(--ink-soft); color: var(--text-faint); display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
}
.topbar-icon-btn:hover { color: #fff; border-color: var(--signal); }
.topbar-icon-btn .dot-badge {
  position: absolute; top: -4px; right: -4px; background: var(--coral); color: #fff;
  font-size: .6rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; border: 2px solid var(--ink);
}
.notif-panel {
  width: 320px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.notif-panel .notif-header { padding: .7rem 1rem; font-weight: 600; font-size: .85rem; border-bottom: 1px solid var(--border); background: var(--paper); }
.notif-panel .notif-item { padding: .6rem 1rem; border-bottom: 1px solid var(--border); font-size: .82rem; display: flex; gap: .6rem; }
.notif-panel .notif-item:last-child { border-bottom: none; }
.notif-panel .notif-empty { padding: 1.2rem; text-align: center; color: var(--text-muted); font-size: .82rem; }

.user-chip {
  display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none;
}
.avatar-circle {
  width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--signal), #0EA5A0);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700;
  font-family: var(--font-display); flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   Sidebar & Backdrop Overlay
   --------------------------------------------------------------------- */
.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--ink-line);
  color: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: none; /* hidden on desktop */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
  background: var(--ink-soft);
  border-color: var(--signal);
  color: var(--signal);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.app-wrapper {
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  position: relative;
  background: var(--paper);
  display: flex;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  border-right: 1px solid var(--ink-line);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - var(--topbar-h));
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  scrollbar-width: thin;
  z-index: 1025;
}
.app-sidebar::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--ink-line); border-radius: 3px; }

.app-sidebar .sidebar-heading {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  color: var(--text-faint); margin: .9rem .8rem .25rem; white-space: nowrap;
}
.app-sidebar .nav-link {
  color: #C6CCDA; border-radius: 7px; padding: .44rem .7rem; margin: .1rem .5rem;
  font-size: .81rem; display: flex; align-items: center; gap: .6rem; position: relative;
  white-space: nowrap; overflow: hidden; text-decoration: none;
  transition: all .12s ease;
}
.app-sidebar .nav-link i.bi { font-size: .92rem; width: 18px; text-align: center; flex-shrink: 0; color: var(--text-faint); }
.app-sidebar .nav-link:hover { background: var(--ink-soft); color: #fff; }
.app-sidebar .nav-link:hover i.bi { color: var(--signal); }
.app-sidebar .nav-link.active {
  background: var(--signal-soft); color: var(--signal);
  font-weight: 600;
}
.app-sidebar .nav-link.active::before {
  content: ''; position: absolute; left: -5px; top: 7px; bottom: 7px; width: 3px;
  background: var(--signal); border-radius: 2px;
}
.app-sidebar .nav-link.active i.bi { color: var(--signal); }
.badge-soon {
  margin-left: auto; font-size: .56rem; background: transparent; color: var(--text-faint);
  border: 1px solid var(--ink-line); border-radius: 1rem; padding: .06rem .4rem; letter-spacing: .03em;
}

.sidebar-collapse-btn { display: none !important; }

/* ---------------------------------------------------------------------
   Content area, page header
   --------------------------------------------------------------------- */
.app-content {
  flex-grow: 1;
  padding: .85rem;
  min-width: 0;
  margin-left: 0;
  width: 100%;
}

@media (min-width: 992px) {
  .app-content {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    padding: 1.25rem;
  }
}

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.1rem; gap: .85rem; flex-wrap: wrap; }
.page-header h4 { margin: 0; font-size: 1.15rem; }
.page-header .eyebrow { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; margin-bottom: .12rem; }

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: transparent; border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-weight: 600; font-size: .82rem;
  padding: .75rem 1rem;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: .9rem 1rem; display: flex; align-items: center; gap: .85rem;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card .icon {
  width: 38px; height: 38px; border-radius: 9px; display: flex;
  align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0;
}
.stat-card .value { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-card .label { font-size: .71rem; color: var(--text-muted); margin-top: .2rem; font-weight: 500; }

/* Tone helpers reused across icons/badges */
.tone-signal { background: var(--signal-soft); color: var(--signal-600); }
.tone-amber  { background: var(--amber-soft); color: var(--amber); }
.tone-coral  { background: var(--coral-soft); color: var(--coral); }
.tone-blue   { background: var(--blue-soft); color: var(--blue); }
.tone-slate  { background: var(--slate-soft); color: var(--slate); }

/* ---------------------------------------------------------------------
   Buttons — reskin bootstrap defaults to the signal palette
   --------------------------------------------------------------------- */
.btn { border-radius: 7px; font-weight: 500; font-size: .8rem; padding: .32rem .68rem; }
.btn-primary { background: var(--signal); border-color: var(--signal); }
.btn-primary:hover, .btn-primary:focus { background: var(--signal-600); border-color: var(--signal-600); }
.btn-outline-primary { color: var(--signal); border-color: var(--signal); }
.btn-outline-primary:hover { background: var(--signal); border-color: var(--signal); }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border); }
.btn-outline-danger { color: var(--coral); border-color: var(--coral); }
.btn-outline-danger:hover { background: var(--coral); border-color: var(--coral); }
.btn-outline-success { color: var(--signal-600); border-color: var(--signal); }
.btn-outline-success:hover { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-sm { padding: .2rem .48rem; font-size: .72rem; }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-control, .form-select {
  border-radius: 7px; border-color: var(--border); font-size: .81rem; padding: .32rem .6rem;
  background: var(--surface); color: var(--text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--signal); box-shadow: 0 0 0 .16rem var(--signal-ring);
}
.form-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); margin-bottom: .25rem; }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background: var(--ink-soft); border-color: var(--ink-line); }

/* ---------------------------------------------------------------------
   Tables / DataTables
   --------------------------------------------------------------------- */
.table { color: var(--text); font-size: .8rem; }
.table > thead { background: var(--paper); }
.table > thead th {
  font-size: .67rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  font-weight: 600; border-bottom: 1px solid var(--border); padding: .55rem .65rem;
}
.table > tbody td { padding: .55rem .65rem; border-color: var(--border); vertical-align: middle; }
.table-hover > tbody > tr:hover { background: var(--signal-soft); }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: var(--paper); }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border-radius: 7px; border: 1px solid var(--border); padding: .26rem .55rem; font-size: .78rem; background: var(--surface); color: var(--text);
}
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_length label, .dataTables_wrapper .dataTables_filter label {
  font-size: .76rem; color: var(--text-muted);
}
.dataTables_wrapper .page-link { border-radius: 5px !important; margin: 0 2px; color: var(--text); border-color: var(--border); font-size: .76rem; padding: .28rem .55rem; }
.dataTables_wrapper .page-item.active .page-link { background: var(--signal); border-color: var(--signal); }

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge { font-weight: 600; font-size: .63rem; letter-spacing: .01em; padding: .28em .52em; border-radius: 5px; }
.bg-success { background-color: var(--signal-soft) !important; color: var(--signal-600) !important; }
.bg-warning { background-color: var(--amber-soft) !important; color: var(--amber) !important; }
.bg-danger  { background-color: var(--coral-soft) !important; color: var(--coral) !important; }
.bg-info    { background-color: var(--blue-soft) !important; color: var(--blue) !important; }
.bg-secondary, .bg-dark { background-color: var(--slate-soft) !important; color: var(--slate) !important; }
.bg-primary { background-color: var(--signal-soft) !important; color: var(--signal-600) !important; }

/* ---------------------------------------------------------------------
   Modals
   --------------------------------------------------------------------- */
.modal-content { border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.modal-header { border-bottom: 1px solid var(--border); padding: 1rem 1.2rem; }
.modal-header .modal-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.modal-footer { border-top: 1px solid var(--border); padding: .85rem 1.2rem; }
.modal-body { padding: 1.1rem 1.2rem; }

/* ---------------------------------------------------------------------
   Empty states
   --------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state i.bi { font-size: 2rem; color: var(--text-faint); margin-bottom: .6rem; display: block; }
.empty-state .empty-title { font-weight: 600; color: var(--text); margin-bottom: .25rem; }

/* Numbers styled with the display face where it matters */
.metric { font-family: var(--font-display); font-weight: 700; }

/* DataTables Buttons (Excel/PDF/Print export) - segmented toolbar look */
.dt-toolbar { gap: .5rem; }
.dt-buttons {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.dt-buttons .export-btn,
.dt-buttons .btn {
  border: none !important;
  border-right: 1px solid var(--border) !important;
  background: var(--surface, #ffffff) !important;
  color: var(--text, #1e293b) !important;
  font-size: .76rem;
  font-weight: 600;
  padding: .38rem .8rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border-radius: 0 !important;
  transition: background .12s ease, color .12s ease;
}
.dt-buttons .export-btn:last-child,
.dt-buttons .btn:last-child { border-right: none !important; }
.dt-buttons .export-btn i.bi,
.dt-buttons .btn i.bi { font-size: .85rem; }
.dt-buttons .export-btn:focus,
.dt-buttons .btn:focus { box-shadow: none; }
.export-btn-excel:hover,
.dt-buttons .btn-outline-success:hover { background: var(--signal-soft) !important; color: var(--signal-600) !important; }
.export-btn-pdf:hover,
.dt-buttons .btn-outline-danger:hover { background: var(--coral-soft) !important; color: var(--coral) !important; }
.export-btn-print:hover,
.dt-buttons .btn-outline-primary:hover,
.dt-buttons .btn-outline-secondary:hover { background: var(--slate-soft) !important; color: var(--slate) !important; }
.dt-button-collection { border-radius: var(--radius); }

/* Search box sits in the same toolbar row as the export buttons */
.dt-toolbar .dataTables_filter input {
  border-radius: 8px; border: 1px solid var(--border); padding: .35rem .7rem;
  font-size: .82rem; background: var(--surface); color: var(--text);
}
.dt-toolbar .dataTables_filter label { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .8rem; color: var(--text-muted); }


/* Home launcher (app-switcher style grid) */
.home-launcher .eyebrow { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; margin-bottom: .12rem; }
.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: .85rem;
}
.launcher-tile {
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  padding: .95rem .4rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease;
}
.launcher-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.launcher-icon {
  width: 46px; height: 46px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.launcher-label { font-size: .76rem; font-weight: 600; text-align: center; line-height: 1.25; }

@media (max-width: 575.98px) {
  .launcher-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: .65rem; }
  .launcher-tile { padding: .8rem .25rem; }
  .launcher-icon { width: 38px; height: 38px; font-size: 1.1rem; }
  .launcher-label { font-size: .72rem; }
}

/* ---------------------------------------------------------------------
   Hospital ITAM & Collapsible Sidebar Extensions
   --------------------------------------------------------------------- */
.sidebar-heading-collapsible {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  color: var(--text-faint); margin: .85rem .6rem .2rem; padding: .3rem .45rem;
  border-radius: 6px; transition: color .15s, background .15s;
}
.sidebar-heading-collapsible:hover { color: #fff; background: var(--ink-soft); }
.sidebar-heading-collapsible .toggle-icon { transition: transform .2s ease; }
.sidebar-heading-collapsible[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }
.nav-sub-link { padding-left: 1.35rem !important; font-size: .78rem !important; }

/* Hospital Criticality Badges */
.badge-critical {
  background: #fee2e2; color: #b91c1c; border: 1px solid #f87171;
  font-weight: 700; letter-spacing: .02em; padding: .25rem .55rem;
}
[data-theme="dark"] .badge-critical { background: rgba(239,68,68,.15); color: #f87171; border-color: rgba(239,68,68,.3); }

.badge-high {
  background: #fef3c7; color: #b45309; border: 1px solid #fcd34d;
  font-weight: 600; padding: .25rem .55rem;
}
[data-theme="dark"] .badge-high { background: rgba(245,158,11,.15); color: #fbbf24; border-color: rgba(245,158,11,.3); }

.badge-normal {
  background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1;
  font-weight: 500; padding: .25rem .55rem;
}
[data-theme="dark"] .badge-normal { background: rgba(148,163,184,.15); color: #94a3b8; border-color: rgba(148,163,184,.3); }

/* Asset Sub-navigation Hub Bar */
.asset-subnav-container {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .4rem .6rem; margin-bottom: 1.25rem; overflow-x: auto; white-space: nowrap;
  box-shadow: var(--shadow-sm); scrollbar-width: thin;
}
.asset-subnav { display: flex; gap: .35rem; align-items: center; margin: 0; padding: 0; list-style: none; }
.asset-subnav .subnav-item a {
  display: inline-flex; align-items: center; gap: .4rem; padding: .38rem .75rem;
  border-radius: 6px; font-size: .8rem; font-weight: 500; color: var(--text-muted);
  text-decoration: none; transition: all .15s ease;
}
.asset-subnav .subnav-item a:hover { background: var(--slate-soft); color: var(--text); }
.asset-subnav .subnav-item a.active {
  background: var(--signal-soft); color: var(--signal-600); font-weight: 600;
}
.asset-subnav .subnav-item a i { font-size: .88rem; }

/* Asset Profile Layout */
.asset-profile-header {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm);
}
.qr-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; text-align: center; box-shadow: var(--shadow-sm);
}
.qr-preview-box {
  background: #fff; padding: 12px; border-radius: 8px; display: inline-block;
  border: 1px solid var(--border); margin: .5rem 0;
}

/* Lifecycle Timeline */
.lifecycle-timeline {
  position: relative; padding-left: 2rem; margin: 1rem 0;
}
.lifecycle-timeline::before {
  content: ''; position: absolute; left: .75rem; top: 8px; bottom: 8px; width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative; margin-bottom: 1.4rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-marker {
  position: absolute; left: -2rem; top: 2px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--signal); display: flex; align-items: center;
  justify-content: center; font-size: .75rem; color: var(--signal);
}
.timeline-marker.danger { border-color: var(--coral); color: var(--coral); }
.timeline-marker.warning { border-color: var(--amber); color: var(--amber); }
.timeline-marker.success { border-color: #10b981; color: #10b981; }
.timeline-marker.info { border-color: #3b82f6; color: #3b82f6; }
.timeline-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .75rem 1rem; box-shadow: var(--shadow-sm);
}
.timeline-date { font-size: .75rem; color: var(--text-faint); font-family: var(--font-mono); }

/* ---------------------------------------------------------------------
   Responsive Layout & Off-canvas Mobile/Tablet Sidebar Drawer
   --------------------------------------------------------------------- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1045;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.sidebar-backdrop.show {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 991.98px) {
  .sidebar-toggle-btn {
    display: inline-flex !important;
  }

  .sidebar-mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--ink-base) !important;
  }

  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    width: 280px !important;
    max-width: 85vw !important;
    z-index: 1050 !important;
    transform: translateX(-105%) !important;
    transition: transform .28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.5) !important;
  }

  .app-sidebar.show {
    transform: translateX(0) !important;
  }

  /* On mobile/tablet, NEVER collapse into mini-icons; always show full text */
  .app-sidebar.collapsed {
    width: 280px !important;
  }
  .app-sidebar.collapsed .sidebar-heading,
  .app-sidebar.collapsed .nav-link span.label,
  .app-sidebar.collapsed .badge-soon,
  .app-sidebar.collapsed .sidebar-heading-collapsible .heading-text,
  .app-sidebar.collapsed .sidebar-heading-collapsible .toggle-icon {
    display: flex !important;
  }
  .app-sidebar.collapsed .sidebar-heading-collapsible {
    justify-content: space-between !important;
    padding: .35rem .5rem !important;
    margin: 1rem .8rem .25rem !important;
  }
  .app-sidebar.collapsed .nav-link {
    justify-content: flex-start !important;
    padding: .5rem .75rem !important;
    margin: .1rem .6rem !important;
  }
  .app-sidebar.collapsed .nav-link.nav-sub-link {
    padding-left: 1.4rem !important;
  }
  .app-sidebar.collapsed .nav-link i.bi {
    font-size: .95rem !important;
    width: 18px !important;
    margin-right: .65rem !important;
  }

  /* Hide bottom collapse button on mobile */
  .sidebar-collapse-btn {
    display: none !important;
  }

  /* Full width content on mobile/tablet */
  .app-content {
    margin-left: 0 !important;
    padding: .85rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: .75rem !important;
  }
  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
  }
}

@media (max-width: 767.98px) {
  .app-topbar {
    padding: 0 .75rem !important;
    gap: .5rem !important;
  }
  .app-topbar .brand span {
    font-size: .9rem !important;
  }
  .app-content {
    padding: .75rem !important;
  }
  .card-body {
    padding: .85rem !important;
  }
  .stat-card {
    padding: .85rem !important;
  }
  .stat-card .value {
    font-size: 1.3rem !important;
  }
  
  /* Filter grids stack cleanly */
  .filter-card .row,
  .card-body .row.g-2,
  .card-body .row.g-3 {
    --bs-gutter-y: .5rem;
  }

  /* DataTables toolbar stacks on mobile */
  .dt-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: .6rem !important;
  }
  .dt-toolbar .dt-buttons {
    display: flex;
    width: 100%;
    overflow-x: auto;
  }
  .dt-toolbar .dataTables_filter {
    width: 100%;
  }
  .dt-toolbar .dataTables_filter label {
    width: 100%;
  }
  .dt-toolbar .dataTables_filter input {
    width: 100% !important;
  }

  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 575.98px) {
  .btn {
    font-size: .8rem;
  }
  .btn-sm {
    font-size: .75rem;
    padding: .25rem .5rem;
  }
}

/* App Launcher / Switcher */
.app-launcher-panel {
  width: 320px;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
}
.app-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.app-launcher-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .65rem .35rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: all .15s ease;
  border: 1px solid transparent;
  background: var(--paper);
}
.app-launcher-card:hover {
  background: var(--signal-soft);
  color: var(--signal-600);
  border-color: rgba(13,148,136,.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.app-launcher-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  margin-bottom: .35rem;
}
.app-launcher-title {
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
