/* Safetyman Inspect Pro — adaptive shell (ERP-aligned) */

.insp-app,
.insp-app * {
  scrollbar-width: thin;
  scrollbar-color: var(--erp-scrollbar-thumb) var(--erp-scrollbar-track);
}
.insp-app *::-webkit-scrollbar { width: 8px; height: 8px; }
.insp-app *::-webkit-scrollbar-thumb {
  background-color: var(--erp-scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.insp-app *::-webkit-scrollbar-track { background: var(--erp-scrollbar-track); }

body.insp-ready {
  font-family: 'Inter', 'IBM Plex Sans Thai', system-ui, sans-serif;
  background: var(--background);
  color: var(--text);
  padding-bottom: calc(var(--nav-h, 68px) + env(safe-area-inset-bottom, 0px));
}
body.insp-ready::before { display: none; }
body.insp-ready::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--page-glow-purple), transparent 65%),
    radial-gradient(ellipse 45% 40% at 0% 100%, var(--page-glow-cyan), transparent 60%),
    radial-gradient(ellipse 70% 35% at 50% -5%, var(--page-glow-red), transparent 62%);
}
html { background: var(--background); }

@media (min-width: 768px) {
  body.insp-ready { padding-bottom: 24px; }
}

.insp-app { display: flex; min-height: 100vh; width: 100%; }
.insp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.insp-scroll { flex: 1; min-width: 0; }

.insp-sidebar {
  display: none;
  flex-direction: column;
  width: var(--insp-sidebar-w);
  background: var(--surface-glass, var(--card));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
  box-shadow: 4px 0 24px rgba(0, 0, 0, .08);
}
@media (min-width: 768px) {
  .insp-sidebar { display: flex; }
  .insp-mobile-bar { display: none !important; }
  .bottom-nav { display: none !important; }
}

.insp-sb-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px; border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.insp-sb-logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand-600);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
  box-shadow: 0 4px 10px rgba(200, 20, 20, .3);
}
.insp-sb-logo img { height: 20px; width: auto; filter: brightness(0) invert(1); }
.insp-sb-logo--sm { width: 32px; height: 32px; border-radius: 8px; }
.insp-sb-logo--sm img { height: 18px; }
.insp-sb-brandwrap { min-width: 0; line-height: 1.2; flex: 1; }
.insp-sb-brand { font-size: 15px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.insp-sb-brand span { color: var(--brand-600); }
.insp-sb-co {
  font-size: 10.5px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.insp-lock-logo {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px; background: var(--brand-600, #C81414);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(229, 57, 53, .18);
}
.insp-lock-logo img { height: 34px; width: auto; filter: brightness(0) invert(1); }

.insp-sb-nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.insp-sb-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: none; border-radius: var(--insp-radius-sm, 10px);
  background: transparent; font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text2); cursor: pointer; text-align: left;
  transition: background .15s, color .15s, box-shadow .15s;
}
.insp-sb-btn [data-lucide] { width: 18px; height: 18px; flex-shrink: 0; }
.insp-sb-btn:hover { background: var(--hover); color: var(--text); }
.insp-sb-btn.active {
  background: linear-gradient(135deg, rgba(200, 20, 20, .18), rgba(124, 58, 237, .12));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-600), 0 4px 16px rgba(229, 57, 53, .2);
}
html[data-theme="light"] .insp-sb-btn.active {
  color: var(--brand-700);
  background: linear-gradient(135deg, rgba(200, 20, 20, .1), rgba(124, 58, 237, .06));
}

.insp-sb-foot { padding: 10px; border-top: 1px solid var(--erp-border, var(--line)); display: flex; flex-direction: column; gap: 4px; }
.insp-sb-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--erp-text-muted, var(--text3));
  text-decoration: none; transition: background .15s, color .15s;
}
.insp-sb-link [data-lucide] { width: 16px; height: 16px; }
.insp-sb-link:hover { background: var(--erp-hover, var(--hover)); color: var(--erp-accent, var(--brand-600)); }

.insp-glass-header {
  display: none; position: sticky; top: 0; z-index: 150;
  align-items: center; gap: 14px; padding: 12px 24px;
  background: var(--header-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .insp-glass-header { display: flex; } }

.insp-gh-titles { flex: 1; min-width: 0; }
.insp-gh-titles h1 { font-size: 19px; font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.insp-gh-titles p { font-size: 12.5px; color: var(--text3); margin-top: 2px; }
.insp-gh-theme {
  display: flex; background: var(--surface-glass-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 3px; gap: 2px;
}
.insp-gh-theme button {
  display: flex; align-items: center; gap: 5px; padding: 6px 11px;
  border: none; border-radius: 7px; font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--text3);
}
.insp-gh-theme button.active {
  background: var(--surface-glass);
  color: var(--brand-600);
  box-shadow: var(--shadow-sm);
}
.insp-gh-primary {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px;
  border: none; border-radius: var(--insp-radius-sm, 10px);
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-glow-red); white-space: nowrap;
}
.insp-gh-primary [data-lucide] { width: 16px; height: 16px; }
.insp-gh-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.insp-gh-titles { flex: 1; min-width: 0; }
.insp-gh-titles h1,
.insp-gh-titles p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 767px) {
  .insp-mobile-bar.app-bar {
    background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
    box-shadow: 0 2px 16px rgba(0, 0, 0, .2);
  }
}

body.insp-ready .bottom-nav {
  background: var(--surface-glass);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .12);
}
body.insp-ready .nav-btn.active { color: var(--brand-600); }
body.insp-ready .nav-fab {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  box-shadow: var(--shadow-glow-red);
}

body.insp-ready .page {
  max-width: var(--insp-content-max);
  margin: 0 auto;
  padding: var(--insp-gutter-y) var(--insp-gutter-x);
  width: 100%;
}
@media (min-width: 768px) {
  :root { --insp-gutter-x: 24px; --insp-gutter-y: 20px; }
}

body.insp-ready .card,
body.insp-ready .stat-card,
body.insp-ready .qa-card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
body.insp-ready input,
body.insp-ready select,
body.insp-ready textarea {
  background: var(--surface-glass-2);
  border-color: var(--border);
  color: var(--text);
}
body.insp-ready .bottom-nav {
  background: var(--surface-glass);
  border-top-color: var(--border);
}

@media (min-width: 768px) {
  body.insp-ready .stats-row { grid-template-columns: repeat(4, 1fr); }
  body.insp-ready .quick-actions { grid-template-columns: repeat(4, 1fr); }
}

body.insp-serial-mode .insp-sidebar,
body.insp-serial-mode .insp-glass-header,
body.insp-serial-mode .insp-mobile-bar,
body.insp-serial-mode .bottom-nav { display: none !important; }
body.insp-serial-mode { padding-bottom: 16px; }
