@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ---- CSS Variables ---------------------------------------- */
:root {
  --font:        'DM Sans', system-ui, sans-serif;
  --font-mono:   'DM Mono', 'Courier New', monospace;

  --primary:       #1a56db;
  --primary-light: #eff4ff;
  --primary-dark:  #1347c8;

  --success:  #0d9f6e;
  --danger:   #e02424;
  --warning:  #d97706;
  --info:     #1a56db;

  --bg-main:    #f8fafc;
  --bg-card:    #ffffff;
  --bg-sidebar: black;

  --text:        #0f172a;
  --text-muted:  #64748b;
  --text-light:  #94a3b8;

  --border:     #e2e8f0;
  --border-md:  #cbd5e1;

  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.12);

  --sidebar-w: 220px;
  --topbar-h:  56px;

  --transition: .18s cubic-bezier(.4,0,.2,1);
}

/* ---- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, select, input, textarea { font-family: inherit; }
code { font-family: var(--font-mono); font-size: .85em; }

/* ---- Utilities --------------------------------------------- */
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.text-muted   { color: var(--text-muted); font-size: .82rem; }
.w-100        { width: 100%; }
.mt-4         { margin-top: 4px; }
.mono         { font-family: var(--font-mono); }

/* ---- Scrollbar -------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   LOGIN
============================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url(../img/background_fuabc.png);
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: bottom;
}
.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 10%, rgba(26,86,219,.06) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 80% 80%, rgba(13,159,110,.04) 0%, transparent 70%);
  pointer-events: none;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
  animation: fadeUp .4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  border-radius:6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(26,86,219,.3);
}
.login-logo h1 { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }

/* ============================================================
   APP LAYOUT
============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgb(255 255 255 / 32%);
}
.logo-text { font-size: .88rem; font-weight: 700; color: #fff; }
.logo-sub  { font-size: .68rem; color: rgba(255,255,255,.35); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-label {
  font-size: .63rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: white;
  padding: 12px 10px 5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,.55);
  font-size: .82rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  user-select: none;
}
.nav-item:hover { background: rgb(255 255 255 / 12%); color: rgba(255,255,255,.85); }
.nav-item.active {
  background: rgba(26,86,219,.35);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(26,86,219,.5);
}
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-footer button {
    background: #3d3d3d5c !important;
    transition: .9s ease;
    color: white !important;
    width: 100%;
    text-align: left;
    padding: 10px 10px 10px 145px !important;
    border-radius:6px;
}

.sidebar-footer button:hover {
    background: red !important;
    transition: .6s ease;
    color: white !important;
    width: 100%;
    text-align: left;
    padding: 10px 10px 10px 10px !important;
    border-radius:6px;
}

/* ---- Main ------------------------------------------------- */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ----------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-actions-group { display:flex; align-items:center; gap:8px; }

/* ---- Page Content ----------------------------------------- */
.page-content { padding: 24px; flex: 1; }
.page { display: none; animation: fadeIn .2s ease; }
.page.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   COMPONENTS
============================================================ */

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
    background: #0736a9;
}
.btn-block:hover:not(:disabled) {
    background: #f4e1c8;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-md);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-main); color: var(--text); }
.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fca5a5;
}
.btn-danger:hover:not(:disabled) { background: #fee2e2; }
.btn-success {
  background: #ecfdf5;
  color: var(--success);
  border-color: #6ee7b7;
}
.btn-sm  { padding: 6px 10px; font-size: .78rem; }
.btn-xs  { padding: 2px 8px;  font-size: 13px; }
.btn-icon {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-main); color: var(--text); }

/* ---- Cards ------------------------------------------------ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius:6px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: .88rem; font-weight: 600; }
.card-body { padding: 0; }


.device-table-card {
  overflow: visible;
}
.device-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
}
.device-table-wrap .inv-table {
  position: relative;
}
.device-table-wrap .inv-table td {
  overflow: visible;
}
.device-table-wrap .status-menu {
  z-index: 80;
}
.device-table-wrap .status-menu.open {
  z-index: 120;
}
.device-table-wrap .status-menu-list {
  z-index: 130;
}

/* ---- Stats Grid ------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius:6px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0px 2px 2px #80808040;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #eff4ff; color: var(--primary); }
.stat-icon.green  { background: #ecfdf5; color: var(--success); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-icon.orange { background: #fffbeb; color: var(--warning); }
.stat-val   { font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Toolbar ---------------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.toolbar select {
  padding: 7px 24px 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color var(--transition);
}
.toolbar select:focus { outline: none; border-color: var(--primary); }

/* ---- Table ------------------------------------------------ */
.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  border: 1px solid #e1e1e1;
}
.inv-table thead { background: #f8fafc; }
.inv-table th {
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  user-select: none;
}
.inv-table th[onclick] { cursor: pointer; }
.inv-table th[onclick]:hover { color: var(--primary); }
.sort-icon { color: var(--text-light); margin-left: 3px; }
.inv-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-table tbody tr:hover td { background: var(--bg-main); }

/* ---- Status dot ------------------------------------------ */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-online  { background: var(--success); box-shadow: 0 0 0 2px rgba(13,159,110,.2); }
.dot-offline { background: #94a3b8; }
.dot-pulse { animation: pulse-dot 1.8s ease infinite; }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(13,159,110,.2); }
  50%       { box-shadow: 0 0 0 5px rgba(13,159,110,.1); }
}

/* ---- Badges ----------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-blue {
    background: #b2d5fd70;
    color: #373737;
    width: 110px;
    display: block;
    text-align: center;
}

.badge-green {
    background: #ecfdf5; 
    color: var(--success);
    width: 110px;
    display: block;
    text-align: center;
}

.badge-red {
    background: #fef2f2; 
    color: var(--danger);
    width: 110px;
    display: block;
    text-align: center;
}

.badge-orange {
    background: #fffbeb; 
    color: var(--warning);
    width: 110px;
    display: block;
    text-align: center;
}

.badge-gray {
    background: #f1f5f9; color: var(--text-muted);
    width: 110px;
    display: block;
    text-align: center;
}

/* ---- Pagination ------------------------------------------- */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.pagination { display: flex; gap: 4px; }
.pag-btn {
  min-width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  font-size: .78rem;
  color: var(--text-muted);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  padding: 0 6px;
}
.pag-btn:hover { background: var(--bg-main); color: var(--text); }
.pag-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pag-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Forms ------------------------------------------------ */
.form-group { margin-bottom: 14px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .83rem;
  background: var(--bg-main);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
  background: var(--bg-card);
}
.form-error { color: var(--danger); font-size: .75rem; margin-top: 4px; }
.form-hint  { color: var(--text-light); font-size: .72rem; margin-top: 3px; }

/* ---- Modals ----------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInOverlay .15s ease;
}
.modal-overlay.open { display: flex; }
@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: slideUp .2s cubic-bezier(.34,1.2,.64,1);
  border: 1px solid var(--border);
}
.modal-box.sm  { max-width: 380px; }
.modal-box.md  { max-width: 600px; }
.modal-box.lg  { max-width: 780px; }
.modal-box.xl  { max-width: 960px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: .95rem; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  border: none;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: #fee2e2; color: var(--danger); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- Device Detail Sections ------------------------------ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.detail-item {
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.detail-item-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-light);
  margin-bottom: 3px;
}
.detail-item-val {
  font-size: .82rem;
  color: var(--text);
  font-weight: 500;
  word-break: break-all;
}
.detail-section {
  margin-bottom: 16px;
}
.detail-section-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* App/Process list */
.app-list-wrap {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.app-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: .76rem;
  border-bottom: 1px solid var(--border);
}
.app-item:last-child { border-bottom: none; }
.app-item:nth-child(even) { background: var(--bg-main); }
.app-version { color: var(--text-muted); }

/* Tech tags */
.tech-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tech-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: .72rem;
  font-weight: 600;
}
.tech-tag-remove {
  cursor: pointer;
  color: var(--primary);
  line-height: 1;
  font-size: .8rem;
}
.tech-tag-remove:hover { color: var(--danger); }

/* ---- Technician Cards ------------------------------------- */
.tech-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tech-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius:6px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.tech-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.tech-avatar {
  width: 40px; height: 40px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.tech-info { flex: 1; min-width: 0; }
.tech-name { font-weight: 600; font-size: .88rem; }
.tech-meta { font-size: .76rem; color: var(--text-muted); margin-top: 2px; }
.tech-devices { margin-top: 6px; }

/* ---- Checkbox Group -------------------------------------- */
.checkbox-group { display: flex; flex-direction: column; gap: 6px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .82rem;
  cursor: pointer;
}
.checkbox-item input[type=checkbox] {
  width: 14px; height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---- Spinner ---------------------------------------------- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.full-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  font-size: .82rem;
}

/* ---- Toast ----------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--bg-sidebar);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  min-width: 240px;
  max-width: 360px;
  border-left: 3px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger);  }
.toast.warning { border-left-color: var(--warning); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- Remote Actions Bar ---------------------------------- */
.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

/* ---- Stale row highlight --------------------------------- */
.row-stale td:first-child { border-left: 3px solid var(--warning); }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { min-width: unset; }
  #sidebar-toggle { display: flex !important; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .modal-box { max-height: 95vh; }
}


/* ============================================================
   ADDITIONS v2.2
============================================================ */
.nav-item-dropdown { justify-content: space-between; }
.nav-item-dropdown > span:first-of-type { flex: 1; }
.nav-caret { margin-left: auto; font-size: .72rem; transition: transform var(--transition); }
.nav-item-dropdown.open .nav-caret { transform: rotate(180deg); }
.nav-submenu {
  display: none;
  margin: 2px 0 10px 0;
  padding-left: 10px;
}
.nav-submenu.open { display: block; }
.nav-subitem {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,.48);
  font-size: .78rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-subitem:hover { background: rgb(255 255 255 / 12%); color: rgba(255,255,255,.88); }
.nav-subitem.active {
  background: rgba(26,86,219,.26);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(26,86,219,.28);
}
.login-links-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.link-button {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }
.auth-panel { display: none; }
.auth-panel.active { display: block; }
.grid-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.detail-grid-single { grid-template-columns: 1fr; }
.geo-card {
  border: 1px solid var(--border);
  background: var(--bg-main);
  border-radius:6px;
  overflow: hidden;
}
.geo-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.geo-card-title { font-size: .86rem; font-weight: 700; }
.geo-card-sub { color: var(--text-muted); font-size: .78rem; margin-top: 2px; }
.geo-map-frame {
  width: 100%;
  height: 260px;
  border: 0;
  display: block;
  background: #eef2ff;
}
.geo-empty {
  padding: 18px;
  color: var(--text-muted);
  font-size: .8rem;
}
.table-actions-inline {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .grid-two-col { grid-template-columns: 1fr; }
}

/* ============================================================
   ADDITIONS v2.3
============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: .76rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.status-pill-button {
  cursor: pointer;
  background: #fff;
}
.status-menu {
  position: relative;
  display: inline-flex;
  min-width: 116px;
  max-width: 160px;
}
.status-menu-list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius:6px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.status-menu.open .status-menu-list { display: block; }
.status-menu-caret { margin-left: 2px; color: var(--text-light); font-size: .68rem; }
.status-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text);
  font-size: .79rem;
  text-align: left;
}
.status-menu-item:hover,
.status-menu-item.active { background: #f8fafc; }
.dot-dev-operational { background: #16a34a; }
.dot-dev-maintenance { background: #f59e0b; }
.dot-dev-stolen { background: #dc2626; }
.dot-dev-robbed { background: #111827; }
.dot-dev-scrapped { background: #94a3b8; }
.dot-dev-replaced { background: #1e3a8a; }
.dot-dev-no-update { background: #c084fc; }
.dot-dev-reserve { background: #7e22ce; }
.status-summary-block { display: flex; align-items: center; }
#geo-map {
  width: 100%;
  height: 560px;
  background: #eef2ff;
}
.geo-filters-wrap { width: 100%; }
.geo-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.geo-filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.multi-select {
  border: 1px solid var(--border);
  border-radius:6px;
  background: #fff;
  overflow: hidden;
}
.multi-select summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select[open] summary { border-bottom: 1px solid var(--border); }
.multi-select-body {
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  background: #fff;
}
.multi-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius:6px;
  font-size: .8rem;
  cursor: pointer;
}
.multi-option:hover { background: #f8fafc; }
.multi-option input { accent-color: var(--primary); }
.multi-select-empty { color: var(--text-muted); font-size: .78rem; }
.stale-email-user-item {
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.stale-email-user-item:hover { background: #f8fafc; }
@media (max-width: 1100px) {
  .geo-filter-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #geo-map { height: 420px; }
  .status-menu { min-width: 100%; }
  .status-menu-list { width: 100%; }
}


/* ---- Floating status dropdown fix ------------------------- */
.status-menu-portal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}
.status-menu-portal.active {
  pointer-events: none;
}
.status-menu-list-floating {
  display: block !important;
  position: fixed !important;
  z-index: 10000 !important;
  pointer-events: auto !important;
}

/* ---- Instant chat ---------------------------------------- */
.instant-chat-modal-box {
  max-width: 1120px;
}
.instant-chat-modal-body {
  padding: 12px 16px 16px;
}
.instant-chat-launch-note {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius:6px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
  font-size: .8rem;
  font-weight: 600;
}
.instant-chat-frame {
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--border);
  border-radius:6px;
  background: #fff;
}
@media (max-width: 768px) {
  .instant-chat-modal-body { padding: 10px; }
  .instant-chat-frame { min-height: 74vh; border-radius:6px; }
}

/* ============================================================
   PRINTERS MODULE
============================================================ */
.printer-status-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .72rem;
}

#form-cad-printer{
    padding: 20px;
}


.printer-status-operacional { background:#ecfdf5; color:#166534; }
.printer-status-em-manutencao { background:#fff7ed; color:#9a3412; }
.printer-status-furtado { background:#fef2f2; color:#b91c1c; }
.printer-status-roubado { background:#111827; color:#fff; }
.printer-status-sucateado { background:#f1f5f9; color:#475569; }
.printer-status-trocado { background:#eff6ff; color:#1e3a8a; }
.printer-status-sem-atualizacao { background:#faf5ff; color:#7e22ce; }
.printer-status-reserva { background:#f5f3ff; color:#6d28d9; }


.printer-toner-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.printer-toner-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== MARCA =====*/

#page-cad-brand-models .card-body{
    padding: 20px;
}

/* ===== VOIPS =====*/

#form-asset-voips{
    padding: 20px;
}

/* ===== TABLETS =====*/

#form-asset-tablets{
    padding: 20px;
}

/* ===== TV =====*/

#form-asset-tvs{
    padding: 20px;
}

/* ===== SWITCH =====*/

#form-asset-switches{
    padding: 20px;
}

/* ===== SERVIDOR =====*/

#form-asset-servers{
    padding: 20px;
}

/* ===== CARRINHO DE COMPRA ==== */

#form-asset-tablet_carts{
    padding: 20px;
}

/* ==== CAMERAS ====*/

#form-asset-cameras{
    padding: 20px;
}

/* ==== LEITORES ====*/

#form-asset-readers{
    padding: 20px;
}

/* ==== MODENS ====*/

#form-asset-modems{
    padding: 20px;
}

/* ==== NOBREAK ====*/

#form-asset-nobreaks{
    padding: 20px;
}

/* ==== PONTOS ====*/

#form-asset-points{
    padding: 20px;
}

/* ==== PROJETORES ====*/

#form-asset-projectors{
    padding: 20px;
}

/* ==== ROTEADORES ====*/

#form-asset-routers{
    padding: 20px;
}

/* ==== SCANNER SUS ====*/

#form-asset-sus_card_scanners{
    padding: 20px;
}

/* ==== WEBCAM ====*/

#form-asset-webcams{
    padding: 20px;
}


/* ===== SALA E UNIDADES =====*/

#page-cad-local-unidade .card-body{
    padding: 20px;
}

/* ===== Regras ===== */
.user-group-muted{display:block;font-size:.73rem;color:var(--text-muted);margin-top:2px;line-height:1.25}
.policy-card{border:1px solid var(--border);background:var(--bg-main);border-radius:6px;padding:14px}
.policy-status-pill{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;font-size:.74rem;font-weight:600}
.policy-status-pill.active{background:#ecfdf5;color:#166534;border:1px solid #86efac}
.policy-status-pill.inactive{background:#f8fafc;color:#475569;border:1px solid #cbd5e1}
.policy-chip{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#eff6ff;border:1px solid #bfdbfe;color:#1d4ed8;font-size:.72rem;margin:0 6px 6px 0}
.policy-detail-list{display:flex;flex-direction:column;gap:8px}
.policy-detail-item{border:1px solid var(--border);border-radius:6px;padding:10px 12px;background:#fff}
.policy-detail-item.ok{border-color:#86efac;background:#f0fdf4}
.policy-detail-item.fail{border-color:#fca5a5;background:#fef2f2}
.policy-detail-title{font-size:.8rem;font-weight:600;margin-bottom:4px}
.policy-detail-meta{font-size:.74rem;color:var(--text-muted)}
.policy-actions-inline{display:flex;gap:8px;flex-wrap:wrap}
.policy-textarea{min-height:120px;resize:vertical}

.policy-option-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}.policy-option-chip{display:flex;align-items:center;justify-content:center;text-align:center;padding:10px 12px;border:1px solid var(--border);border-radius:6px;background:#fff;font-size:.82rem;font-weight:600;color:#334155;cursor:pointer;transition:.18s ease}.policy-option-chip:hover{border-color:#94a3b8;background:#f8fafc}.policy-option-chip.active{background:#eff6ff;border-color:#60a5fa;color:#1d4ed8;box-shadow:0 0 0 1px rgba(96,165,250,.18) inset}

/* ============================================================
   INVENTORY EXTENSION v2.5
============================================================ */
.nav-subgroup-title {
  color: rgba(255,255,255,.45);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 12px 12px 5px;
}

.inline-cell-control {
  width: 118px;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius:6px;
  background: #fff;
  color: var(--text);
  font-size: .74rem;
  padding: 5px 8px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.inline-cell-control:focus {
  border-color: rgba(26,86,219,.55);
  box-shadow: 0 0 0 3px rgba(26,86,219,.10);
}

.inline-cell-control:disabled {
  background: #f1f5f9;
  color: var(--text-muted);
  cursor: not-allowed;
}

.inline-cell-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 128px;
}

.inline-cell-stack .inline-cell-control {
  display: block;
  width: 100%;
}

.inline-patrimonio-control {
  background: #f8fafc;
  border-style: dashed;
}

.inline-serial {
  width: 135px;
  font-family: var(--font-mono);
}

.th-subline {
  display: block;
  margin-top: 3px;
  font-size: .66rem;
  line-height: 1;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .01em;
}

.cad-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cad-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mt-card {
  margin-top: 16px;
}

.mini-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mini-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .83rem;
}

@media (max-width: 1100px) {
  .cad-grid-2,
  .cad-form-grid {
    grid-template-columns: 1fr;
  }

  .inline-cell-control,
  .inline-serial {
    width: 100%;
    min-width: 110px;
  }
}

/* ============================================================
   PATCH v2.6 — grid com scroll isolado, topbar fixa e cadastros dropdown
============================================================ */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.app-layout {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow-x: hidden;
}

.main-wrap {
  width: calc(100vw - var(--sidebar-w));
  max-width: calc(100vw - var(--sidebar-w));
  min-width: 0;
  overflow-x: hidden;
}

.topbar,
.page-content,
.page,
.toolbar,
.stats-grid,
.card {
  max-width: 100%;
  min-width: 0;
}

.page-content {
  width: 100%;
  overflow-x: hidden;
}

.device-table-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.device-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
}

.device-table-wrap .inv-table {
  width: max-content;
  min-width: 1680px;
}

.stat-icon.purple {
  background: #f5f3ff;
  color: #7c3aed;
}

.nav-subitem-dropdown {
  justify-content: space-between;
  gap: 8px;
}

.nav-subitem-dropdown > span:first-child {
  flex: 1;
}

.nav-subitem-dropdown.open .nav-caret {
  transform: rotate(180deg);
}

.nav-nested-submenu {
    display: none;
    margin: 0 0 8px 20px;
    padding-left: 5px;
    border-left: 3px solid rgba(255, 255, 255, .08);
}

.nav-nested-submenu.open {
  display: block;
}

.nav-nested-submenu .nav-subitem {
  min-height: 31px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: .75rem;
}

@media (max-width: 900px) {
  .main-wrap {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ============================================================
   Marcas e modelos por tipo de equipamento
============================================================ */
.brand-catalog-list {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 4px;
}

.brand-mini-item > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-mini-item strong {
  color: var(--text);
  font-size: .84rem;
  line-height: 1.2;
}

.brand-mini-item small {
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.2;
}

/* Inventário patrimonial - páginas de visualização */
.nav-item-compact {
  font-size: .82rem;
  padding-top: 9px;
  padding-bottom: 9px;
}

.asset-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.asset-page-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.asset-page-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .83rem;
}

.asset-view-table td strong {
  font-weight: 800;
}

.asset-status-select {
  min-width: 150px;
  font-weight: 700;
}

.icon-btn-xs {
  width: 32px;
  height: 30px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}

@media (max-width: 768px) {
  .asset-page-head {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ============================================================
   Acessos dinâmicos e BI
============================================================ */
.ios-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-switch span {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #e5e7eb;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
  transition: background var(--transition), box-shadow var(--transition);
}

.ios-switch span::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .22);
  transition: transform var(--transition);
}

.ios-switch input:checked + span {
  background: #22c55e;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .25);
}

.ios-switch input:checked + span::before {
  transform: translateX(22px);
}

.ios-switch input:disabled + span {
  cursor: not-allowed;
  opacity: .55;
}

.access-header,
.bi-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 20px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius:6px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 62%, #eef2ff 100%);
  box-shadow: var(--shadow-sm);
}

.access-header h2,
.bi-hero h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 850;
  letter-spacing: -.03em;
}

.access-header p,
.bi-hero p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .86rem;
  max-width: 760px;
}

.bi-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: #475569;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.bi-hero-actions,
.access-actions-row,
.access-check-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bi-filter {
  min-width: 190px;
  height: 38px;
  border-radius:6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.access-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.access-panel,
.bi-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius:6px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.access-panel-head,
.bi-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
}

.access-panel-head h3,
.bi-panel-head h3 {
  margin: 0;
  font-size: .95rem;
  font-weight: 850;
  color: var(--text);
}

.access-panel-body,
.bi-panel-body {
  padding: 18px;
}

.access-profile-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  max-height: 640px;
  overflow-y: auto;
}

.access-profile-pill {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius:6px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}

.access-profile-pill:hover,
.access-profile-pill.active {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.access-profile-pill strong {
  display: block;
  font-size: .88rem;
  font-weight: 850;
}

.access-profile-pill small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: .74rem;
}

.access-profile-pill .access-profile-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.access-profile-pill .access-profile-state.on {
  background: #ecfdf5;
  color: #047857;
}

.access-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.access-section-title {
  margin: 22px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: .82rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.access-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.access-toggle-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius:6px;
  background: #fff;
}

.access-toggle-card strong {
  display: block;
  color: var(--text);
  font-size: .83rem;
  font-weight: 850;
}

.access-toggle-card small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.35;
}

.access-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.access-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius:6px;
  background: #fff;
  color: var(--text);
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.access-check:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.access-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.access-users-table select {
  min-width: 190px;
}

.access-user-profile-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bi-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.bi-card {
  position: relative;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius:6px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.bi-card::after {
  content: '';
  position: absolute;
  width: 78px;
  height: 78px;
  right: -24px;
  top: -26px;
  border-radius: 50%;
  background: #f1f5f9;
}

.bi-card small {
  color: var(--text-muted);
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.bi-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -.04em;
}

.bi-card span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .76rem;
}

.bi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr);
  gap: 18px;
  margin-bottom: 18px;
}

.bi-bars {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.bi-bar-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 12px;
}

.bi-bar-label {
  color: var(--text);
  font-size: .8rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bi-bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.bi-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #64748b, #0f172a);
  min-width: 4px;
  transition: width var(--transition);
}

.bi-bar-value {
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 850;
  text-align: right;
}

.bi-donut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.bi-donut-wrap {
  position: relative;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: conic-gradient(#22c55e 0deg, #22c55e 120deg, #ef4444 120deg, #ef4444 240deg, #94a3b8 240deg, #94a3b8 360deg);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
}

.bi-donut-wrap::after {
  content: '';
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
}

.bi-donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bi-donut-number {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

.bi-donut-label {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.bi-legend {
  display: grid;
  gap: 8px;
  width: 100%;
}

.bi-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius:6px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 800;
}

.bi-legend-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bi-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.bi-legend-dot.online { background: #22c55e; }
.bi-legend-dot.offline { background: #ef4444; }
.bi-legend-dot.disabled { background: #94a3b8; }

.bi-empty,
.access-empty {
  padding: 22px;
  text-align: center;
  color: var(--text-muted);
  font-size: .84rem;
}

@media (max-width: 1180px) {
  .access-layout,
  .bi-grid {
    grid-template-columns: 1fr;
  }

  .bi-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .access-header,
  .bi-hero {
    flex-direction: column;
  }

  .bi-hero-actions,
  .bi-filter {
    width: 100%;
  }

  .access-toggle-grid,
  .access-check-grid,
  .bi-cards {
    grid-template-columns: 1fr;
  }

  .access-editor-grid {
    grid-template-columns: 1fr;
  }

  .bi-bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bi-bar-value {
    text-align: left;
  }
}

/* ============================================================
   Refinamento visual - Acessos e BI profissional
============================================================ */
.access-header {
  position: relative;
  padding: 28px 30px;
  margin-bottom: 22px;
  border-radius:6px;
  border: 1px solid rgba(148, 163, 184, .26);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, .12), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 55%, #eef5ff 100%);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .07);
  overflow: hidden;
}

.access-header::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  bottom: -90px;
  border-radius: 50%;
  background: rgba(37, 99, 235, .07);
}

.access-header > * { position: relative; z-index: 1; }

.access-layout {
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 22px;
}

.access-profile-list-card,
.access-editor-card,
.access-users-card {
  border-radius:6px;
  border: 1px solid rgba(148, 163, 184, .28);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .055);
  overflow: hidden;
}

.access-profile-list-card .card-header,
.access-editor-card .card-header,
.access-users-card .card-header {
  padding: 18px 22px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.access-profile-list-card .card-body { padding: 14px; }
.access-editor-card .card-body { padding: 26px; }
.access-users-card .card-body { padding: 0 0 10px !important; }

.access-profile-list { padding: 0; gap: 11px; }

.access-profile-pill {
  width: 100%;
  padding: 15px;
  border-radius:6px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.access-profile-pill.active {
  border-color: rgba(37, 99, 235, .35);
  background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.access-editor-card .form-row {
  gap: 18px;
  margin-bottom: 10px;
}

.access-toggle-group {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius:6px;
  background: #f8fafc;
  justify-content: space-between;
  display: flex;
  align-items: center;
  gap: 14px;
}

.access-section-title {
  margin: 28px 0 12px;
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.access-section-title::before {
    content: '';
    width: 8px;
    height: 3px;
    border-radius: 0%;
    background: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .1);
}

.access-toggle-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.access-toggle-card {
  min-height: 86px;
  padding: 16px 18px;
  border-radius:6px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.access-toggle-card:hover {
  border-color: rgba(37, 99, 235, .28);
  transform: translateY(-1px);
}

.access-toggle-copy { display: block; min-width: 0; }
.access-toggle-copy strong { font-size: .86rem; }
.access-toggle-copy small { font-size: .73rem; max-width: 440px; }

.access-check-toolbar {
  margin: -2px 0 12px;
  justify-content: flex-end;
}

.access-check-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
}

.access-check {
  min-height: 44px;
  padding: 10px 12px;
  border-radius:6px;
  background: #fff;
}

.access-check:has(input:checked) {
  border-color: rgba(37, 99, 235, .36);
  background: #eff6ff;
  color: #1d4ed8;
}

.access-actions-row {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.access-users-card { margin-top: 22px; }
.access-users-card .inv-table th,
.access-users-card .inv-table td { padding: 14px 16px; }

/* BI moderno */
.bi-dashboard-shell { display: grid; gap: 18px; }

.bi-dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 26px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius:6px;
  background:
    radial-gradient(circle at 92% 12%, rgba(37, 99, 235, .13), transparent 26%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 62%, #eef5ff 100%);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .06);
}

.bi-title-block { display: flex; gap: 14px; align-items: center; min-width: 0; }
.bi-title-icon {
  width: 50px;
  height: 50px;
  border-radius:6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #848484, #525252);
  flex: 0 0 auto;
}

.bi-dashboard-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -.04em;
}

.bi-dashboard-head p {
  margin: 4px 0 0;
  max-width: 760px;
  color: var(--text-muted);
  font-size: .88rem;
}

.bi-head-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.bi-update-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.bi-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.bi-filter-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 13px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius:6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .045);
}

.bi-filter-card span {
  color: #475569;
  font-size: .72rem;
  font-weight: 850;
}

.bi-filter-card select {
  border: 0;
  padding: 0;
  outline: 0;
  color: var(--text);
  font-size: .9rem;
  font-weight: 750;
  background: transparent;
}

.bi-refresh-btn { min-height: 68px; border-radius:6px; padding-inline: 18px; }

.bi-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
}

.bi-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 110px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius:6px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .055);
  overflow: hidden;
  position: relative;
}

.bi-kpi-card::after {
  content: '';
  position: absolute;
  width: 92px;
  height: 92px;
  right: -40px;
  top: -38px;
  border-radius: 50%;
  background: rgba(148, 163, 184, .10);
}

.bi-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius:6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.15rem;
  flex: 0 0 auto;
}

.bi-kpi-card span { display:block; color: var(--text-muted); font-size: .76rem; font-weight: 800; }
.bi-kpi-card strong { display:block; margin-top: 5px; color: var(--text); font-size: 1.7rem; font-weight: 950; letter-spacing: -.05em; }
.bi-kpi-card small { display:block; margin-top: 3px; color: var(--text-muted); font-size: .72rem; font-weight: 700; }
.bi-kpi-card.is-blue .bi-kpi-icon { background:#eff6ff; color:#2563eb; }
.bi-kpi-card.is-green .bi-kpi-icon { background:#ecfdf5; color:#16a34a; }
.bi-kpi-card.is-red .bi-kpi-icon { background:#fef2f2; color:#ef4444; }
.bi-kpi-card.is-gray .bi-kpi-icon { background:#f1f5f9; color:#64748b; }
.bi-kpi-card.is-orange .bi-kpi-icon { background:#fff7ed; color:#f59e0b; }
.bi-kpi-card.is-purple .bi-kpi-icon { background:#f5f3ff; color:#7c3aed; }

.bi-chart-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(280px, .8fr) minmax(420px, 1.35fr) minmax(280px, .9fr);
  gap: 16px;
}

.bi-panel {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius:6px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .055);
  overflow: hidden;
}

.bi-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.bi-panel-head h3 { margin:0; color: var(--text); font-size: .93rem; font-weight: 900; }
.bi-panel-head span { color: var(--text-light); font-size: .72rem; font-weight: 750; text-align:right; }
.bi-panel-body { padding: 18px; }

.bi-panel-stacked { grid-column: span 1; }
.bi-panel-bars .bi-panel-body { min-height: 300px; }

.bi-category-bars { display: grid; gap: 11px; }
.bi-category-row {
  display: grid;
  grid-template-columns: minmax(135px, 170px) minmax(0, 1fr) 58px;
  gap: 12px;
  align-items: center;
}
.bi-category-label,
.bi-table-type { display:flex; align-items:center; gap:9px; min-width:0; }
.bi-category-label strong { color: var(--text); font-size:.78rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bi-mini-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:#2563eb;
  background:#eff6ff;
  flex:0 0 auto;
}
.bi-mini-icon svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.bi-category-track { height: 10px; border-radius:999px; background:#e8eef7; overflow:hidden; }
.bi-category-track span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg, #2563eb, #60a5fa); }
.bi-category-value { text-align:right; font-size:.78rem; font-weight:900; color:#334155; }

.bi-donut-card { min-height: 300px; }
.bi-donut-wrap { width: 210px; height: 210px; box-shadow: 0 16px 34px rgba(15,23,42,.08); }
.bi-donut-wrap::after { inset: 34px; }
.bi-legend-dot.stale { background:#f59e0b; }

.bi-stack-legend { display:flex; gap:14px; flex-wrap:wrap; margin-bottom: 14px; color:var(--text-muted); font-size:.75rem; font-weight:800; }
.bi-stack-legend span { display:inline-flex; align-items:center; gap:6px; }
.bi-stack-legend i { width:9px; height:9px; border-radius:50%; display:inline-block; }
.bi-stack-legend .online { background:#22c55e; }
.bi-stack-legend .offline { background:#ef4444; }
.bi-stack-legend .disabled { background:#94a3b8; }
.bi-stack-bars { height: 270px; display:flex; align-items:flex-end; gap:12px; overflow-x:auto; padding: 4px 4px 0; }
.bi-stack-item { min-width: 38px; flex: 1 0 38px; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:8px; }
.bi-stack-bar { width: 34px; border-radius: 6px 6px 6px 6px; background:#f1f5f9; overflow:hidden; display:flex; flex-direction:column-reverse; box-shadow: inset 0 0 0 1px rgba(15,23,42,.05); }
.bi-stack-bar span { display:block; width:100%; min-height:2px; }
.bi-stack-online { background:#22c55e; }
.bi-stack-offline { background:#ef4444; }
.bi-stack-disabled { background:#94a3b8; }
.bi-stack-item small { max-width:54px; min-height:38px; transform: rotate(-45deg); transform-origin: top left; color:var(--text-muted); font-size:.66rem; font-weight:800; white-space:nowrap; }

.bi-trend-chart { min-height: 300px; display:flex; flex-direction:column; }
.bi-trend-svg { width:100%; height:245px; overflow:visible; }
.bi-trend-grid { stroke:#e2e8f0; stroke-width:1; fill:none; stroke-dasharray:4 4; }
.bi-trend-area { fill: rgba(37,99,235,.12); }
.bi-trend-line { fill:none; stroke:#2563eb; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.bi-trend-svg circle { fill:#2563eb; stroke:#fff; stroke-width:2; }
.bi-trend-axis { display:flex; justify-content:space-between; color:var(--text-light); font-size:.72rem; font-weight:800; }

.bi-bottom-grid { display:grid; grid-template-columns: minmax(0, 1.8fr) minmax(330px, .7fr); gap:16px; }
.bi-table-wrap { overflow-x:auto; }
.bi-summary-table th, .bi-summary-table td { padding: 13px 16px; white-space: nowrap; }
.bi-progress-cell { display:flex; align-items:center; gap:8px; min-width:110px; }
.bi-progress-cell span { width:42px; color:var(--text-muted); font-size:.76rem; font-weight:850; }
.bi-progress-cell i { flex:1; height:8px; border-radius:999px; background:#e2e8f0; overflow:hidden; }
.bi-progress-cell b { display:block; height:100%; border-radius:inherit; background:#22c55e; }
.bi-status-pill { display:inline-flex; align-items:center; gap:6px; padding:5px 11px; border-radius:999px; background:#f1f5f9; color:#475569; font-size:.74rem; font-weight:850; margin-right:6px; }
.bi-status-pill.ok { background:#ecfdf5; color:#047857; }
.bi-status-pill::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }

.bi-unit-ranking { display:grid; gap:13px; }
.bi-rank-row { display:grid; grid-template-columns:34px minmax(0,1fr) 58px; gap:11px; align-items:center; }
.bi-rank-number { width:30px; height:30px; display:inline-flex; align-items:center; justify-content:center; border-radius:999px; background:#eff6ff; color:#2563eb; font-size:.78rem; font-weight:950; }
.bi-rank-main strong { display:block; color:var(--text); font-size:.82rem; margin-bottom:6px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bi-rank-main i { display:block; height:7px; background:#e2e8f0; border-radius:999px; overflow:hidden; }
.bi-rank-main b { display:block; height:100%; background:linear-gradient(90deg,#2563eb,#60a5fa); }
.bi-rank-value { text-align:right; color:var(--text); font-weight:950; font-size:.88rem; }

.text-success { color:#16a34a !important; font-weight:800; }
.text-danger { color:#ef4444 !important; font-weight:800; }
.text-warning { color:#f59e0b !important; font-weight:800; }

@media (max-width: 1440px) {
  .bi-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bi-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .bi-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bi-refresh-btn { min-height: 46px; }
  .bi-bottom-grid, .access-layout { grid-template-columns: 1fr; }
  .access-check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .bi-dashboard-head, .access-header { flex-direction: column; padding: 20px; }
  .bi-filter-panel, .bi-kpi-grid, .bi-chart-grid, .access-toggle-grid, .access-check-grid { grid-template-columns: 1fr; }
  .bi-category-row { grid-template-columns: 1fr; gap: 6px; }
  .bi-category-value { text-align:left; }
}

@media print {
  .sidebar, .topbar, .bi-filter-panel, .bi-head-meta .btn { display:none !important; }
  .main-wrap { margin:0 !important; }
  .page-content { padding:0 !important; }
  .bi-panel, .bi-kpi-card, .bi-dashboard-head { box-shadow:none !important; break-inside: avoid; }
}

/* ============================================================
   PATCH BI v2.7 — Chart.js interativo, sem vazamento horizontal
============================================================ */
#page-bi,
#page-bi * {
  min-width: 0;
}

#page-bi {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.bi-dashboard-shell {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  gap: 16px;
}

.bi-filter-panel {
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(140px, 170px);
}

.bi-filter-card {
  min-width: 0;
  overflow: hidden;
}

.bi-filter-card select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.bi-refresh-btn {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.bi-kpi-grid {
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.bi-kpi-card {
  min-width: 0;
  gap: 12px;
}

.bi-kpi-card strong,
.bi-kpi-card small,
.bi-kpi-card span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-chart-grid {
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
}

.bi-panel {
  min-width: 0;
  max-width: 100%;
}

.bi-panel-bars { grid-column: span 4; }
.bi-panel-donut { grid-column: span 3; }
.bi-panel-stacked { grid-column: span 5; }
.bi-panel-trend { grid-column: span 12; }

.bi-panel-head {
  min-height: 60px;
}

.bi-panel-head h3 {
  line-height: 1.25;
}

.bi-panel-head span {
  max-width: 140px;
  line-height: 1.25;
}

.bi-chart-holder {
  position: relative;
  width: 100%;
  height: 320px;
  min-height: 260px;
}

.bi-chart-holder .bi-chart-canvas {
  position: relative;
  width: 100%;
  height: 100%;
}

.bi-chart-holder canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.bi-chart-holder-bars { height: 310px; }
.bi-chart-holder-donut { height: 310px; }
.bi-chart-holder-stacked { height: 310px; }
.bi-chart-holder-trend { height: 295px; }
.bi-chart-holder-units { height: 220px; min-height: 220px; margin-bottom: 16px; }

.bi-chart-cdn-warning,
.bi-empty {
  height: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius:6px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 800;
  padding: 18px;
}

.bi-chart-cdn-warning {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.bi-bottom-grid {
  width: 100%;
  max-width: 100%;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .65fr);
  align-items: start;
}

.bi-ranking-panel .bi-panel-body {
  padding-top: 14px;
}

.bi-unit-ranking {
  gap: 10px;
}

.bi-rank-row {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius:6px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
}

.bi-rank-row:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
  transform: translateY(-1px);
}

.bi-summary-table {
  min-width: 880px;
}

.bi-table-panel {
  overflow: hidden;
}

.bi-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 1600px) {
  .bi-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bi-panel-bars { grid-column: span 5; }
  .bi-panel-donut { grid-column: span 3; }
  .bi-panel-stacked { grid-column: span 4; }
  .bi-panel-trend { grid-column: span 12; }
}

@media (max-width: 1320px) {
  .bi-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bi-refresh-btn { min-height: 50px; }
  .bi-panel-bars,
  .bi-panel-donut,
  .bi-panel-stacked,
  .bi-panel-trend { grid-column: span 12; }
  .bi-chart-holder { height: 300px; }
}

@media (max-width: 1100px) {
  .bi-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bi-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .bi-filter-panel,
  .bi-kpi-grid,
  .bi-chart-grid { grid-template-columns: 1fr; }
  .bi-panel-bars,
  .bi-panel-donut,
  .bi-panel-stacked,
  .bi-panel-trend { grid-column: auto; }
  .bi-chart-holder { height: 280px; }
  .bi-dashboard-head { border-radius:6px; }
}

/* Unidade manual por item na tabela de computadores */
.unit-current-btn {
  width: 100%;
  min-width: 138px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #dbe3ef;
  background: #fff;
  color: var(--text-main);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: .16s ease;
}

.unit-current-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(37, 99, 235, .10);
}

.unit-current-caret {
  color: var(--text-muted);
  font-size: .72rem;
}

.unit-override-badge, .unit-auto-badge {
    display: inline-flex;
    margin-top: 5px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 700;
    white-space: nowrap;
    width: 100%;
}

.unit-override-badge {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.unit-auto-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.unit-cell-readonly,
.unit-cell-edit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 150px;
}

.unit-inline-select {
  min-width: 178px;
  max-width: 220px;
}

.unit-cell-hint {
  color: var(--text-muted);
  font-size: .66rem;
  line-height: 1.25;
  max-width: 220px;
}

/* Vinc. Técnico x Unidade / Abas Meus cuidados */
.care-tabs-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius:6px;
  background: rgba(255, 255, 255, .72);
}

.care-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 6px;
  background: var(--bg-main);
  border: 1px solid var(--border);
}

.care-tab {
  border: 0;
  border-radius: 6px;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .78rem;
  cursor: pointer;
  transition: all .18s ease;
}

.care-tab:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, .08);
}

.care-tab.active {
    border: 1px solid #3310ff47;
    color: var(--primary);
    background: #fff;
}

.care-tabs-hint {
  color: var(--text-muted);
  font-size: .78rem;
  text-align: right;
}

.tech-unit-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.tech-unit-select-group {
  margin-top: 14px;
}

.tech-unit-select-group select[multiple] {
  min-height: 220px;
  padding: 8px;
}

.tech-unit-units-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 720px;
}

.tech-unit-chip,
.all-items-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: .72rem;
  font-weight: 700;
  background: rgba(37, 99, 235, .10);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, .16);
}

.all-items-table td {
  vertical-align: middle;
}

@media (max-width: 820px) {
  .care-tabs-wrap {
    align-items: stretch;
    flex-direction: column;
  }

  .care-tabs {
    width: 100%;
  }

  .care-tab {
    flex: 1;
  }

  .care-tabs-hint {
    text-align: left;
  }

  .tech-unit-form-row {
    grid-template-columns: 1fr;
  }
}

.chip.chip-soft {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f1f5f9;
  color: #475569;
  font-size: .72rem;
  font-weight: 700;
}

/* Campo manual nos dropdowns de marca/modelo */
.select-manual-hidden {
  display: none !important;
}

.manual-select-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.manual-select-input {
  min-width: 0;
}

.manual-select-back {
  white-space: nowrap;
  min-height: 36px;
  padding-inline: 12px;
}

@media (max-width: 640px) {
  .manual-select-wrap {
    grid-template-columns: 1fr;
  }
  .manual-select-back {
    width: 100%;
  }
}
