/* ==========================================================================
   YS USER MANUAL - SHIELD & FLOWCHART STYLE (You Services Pte Ltd - Ubi)
   ========================================================================== */

:root {
  /* Light Theme Colors (Crimson Shield & Silver Accents) */
  --bg-page: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f9fafb;
  --bg-header: linear-gradient(135deg, #160708 0%, #3d0c11 60%, #5c1218 100%);
  --text-main: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --border-color: #d1d5db;
  --border-strong: #9ca3af;

  /* Brand Crimson & Rose-Silver from Shield Logo */
  --primary: #991b1b;
  --primary-bright: #dc2626;
  --primary-hover: #7f1d1d;
  --primary-glow: rgba(185, 28, 28, 0.25);
  --primary-soft: #fef2f2;
  --metal-silver: #d4b499;
  --connector-line: #991b1b;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 14px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.16);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  /* Dark Metallic Shield Theme (Default) */
  --bg-page: #0c0d10;
  --bg-surface: #15171e;
  --bg-surface-alt: #1d202a;
  --bg-header: linear-gradient(135deg, #090506 0%, #2b090d 55%, #4a0e13 100%);
  --text-main: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: #2c303d;
  --border-strong: #4b5563;

  --primary: #b91c1c;
  --primary-bright: #ef4444;
  --primary-hover: #dc2626;
  --primary-glow: rgba(220, 38, 38, 0.35);
  --primary-soft: rgba(185, 28, 28, 0.18);
  --metal-silver: #e2c7b0;
  --connector-line: #dc2626;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.42rem 0.8rem;
}

.btn-block {
  width: 100%;
  padding: 0.78rem 1.25rem;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-outline:hover {
  border-color: var(--primary-bright);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #f3f4f6;
  cursor: pointer;
  font-size: 1.2rem;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   LOGIN VIEW (SHIELD THEME)
   ========================================================================== */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at center, #3b0a0e 0%, #090a0d 75%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid rgba(212, 180, 153, 0.3);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 1.65rem;
}

/* ==========================================================================
   SLOW MOTION ROTATING LOGO ANIMATION
   ========================================================================== */
@keyframes slowMotionRotate {
  0% {
    transform: perspective(900px) rotateY(0deg);
  }
  100% {
    transform: perspective(900px) rotateY(360deg);
  }
}

@keyframes slowMotionRotate2D {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.logo-rotate-2d {
  animation: slowMotionRotate2D 16s linear infinite !important;
}

.shield-logo-img {
  width: 135px;
  height: auto;
  display: block;
  margin: 0 auto 0.85rem;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 8px 22px rgba(220, 38, 38, 0.25)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  animation: slowMotionRotate 16s linear infinite;
  transform-style: preserve-3d;
  will-change: transform;
  cursor: pointer;
}

.shield-logo-img:hover {
  animation-play-state: paused;
}

.login-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
}

.location-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0.35rem auto 0;
  line-height: 1.45;
  max-width: 380px;
}

.domain-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  color: var(--metal-silver);
  font-size: 0.78rem;
  font-weight: 700;
}

[data-theme="light"] .domain-pill {
  color: var(--primary);
}

.alert-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #f87171;
  font-size: 0.84rem;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.8rem;
  color: var(--text-muted);
}

.input-wrapper input,
.admin-form input,
.admin-form textarea,
.select-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.input-wrapper input {
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

.input-wrapper input:focus,
.admin-form input:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: var(--primary-bright);
}

.icon-btn-inline {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
}

.form-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 0.75rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.login-footer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   HEADER (MATCHES SKETCH TOP: SHIELD LOGO + YOU SERVICES PTE LTD + UBI + URL)
   ========================================================================== */

.sketch-header {
  background: var(--bg-header);
  color: #ffffff;
  border-bottom: 2px solid var(--primary);
  box-shadow: var(--shadow-md);
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.company-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-shield-logo {
  width: 68px;
  height: auto;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6)) drop-shadow(0 2px 8px rgba(220, 38, 38, 0.25));
  animation: slowMotionRotate 16s linear infinite;
  transform-style: preserve-3d;
  will-change: transform;
  cursor: pointer;
}

.header-shield-logo:hover {
  animation-play-state: paused;
}

.company-banner-text h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.header-location {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--metal-silver);
  font-weight: 500;
  border-bottom: 1px solid rgba(212, 180, 153, 0.35);
  padding-bottom: 2px;
  margin-top: 3px;
  line-height: 1.35;
  max-width: 620px;
}

.header-location svg,
.location-pin-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: #ef4444;
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
}

.user-name {
  font-weight: 600;
  color: #ffffff;
}

.user-role {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
}

/* URL Bar Strip ("# www.ys-manual.com" + Search) */
.url-bar-strip {
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.65rem 0;
}

.url-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.domain-display {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--metal-silver);
  letter-spacing: 0.03em;
}

.domain-hash {
  color: var(--primary-bright);
  font-weight: 800;
}

.quick-search-wrap {
  position: relative;
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
}

.quick-search-wrap .search-icon {
  position: absolute;
  left: 0.85rem;
  color: #9ca3af;
}

#search-input {
  width: 100%;
  padding: 0.52rem 2.2rem 0.52rem 2.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 17, 23, 0.85);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
}

#search-input:focus {
  outline: none;
  border-color: var(--metal-silver);
}

.clear-search-btn {
  position: absolute;
  right: 0.55rem;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.15rem;
  cursor: pointer;
}

/* ==========================================================================
   3-STEP HIERARCHY NAVIGATION (SYSTEM -> MANUAL TYPE -> BRAND & MANUALS)
   ========================================================================== */

.flowchart-main {
  padding-top: 1.5rem;
  padding-bottom: 3.5rem;
}

/* Breadcrumb & Navigation Bar - High Visibility & Prominent */
.portal-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(26, 32, 48, 0.96) 0%, rgba(17, 22, 35, 0.98) 100%);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-left: 6px solid var(--primary-bright);
  border-radius: 14px;
  padding: 1.15rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5), 0 0 16px -2px rgba(220, 38, 38, 0.2);
  gap: 1.25rem;
  flex-wrap: wrap;
  transition: all 0.2s ease;
}

[data-theme="light"] .portal-nav-bar {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #cbd5e1;
  border-left: 6px solid var(--primary);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 1.15rem;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 600;
  transition: all 0.18s ease;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .breadcrumb-item {
  color: #1e293b;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
}

.breadcrumb-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--primary-bright);
  transform: translateY(-1px);
}

[data-theme="light"] .breadcrumb-item:hover {
  color: var(--primary);
  background: #f1f5f9;
  border-color: var(--primary);
}

.breadcrumb-item.active {
  color: #ffffff !important;
  background: var(--primary-bright) !important;
  border-color: var(--primary-bright) !important;
  cursor: default;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
}

.breadcrumb-sep {
  color: #94a3b8;
  font-weight: 800;
  font-size: 1.25rem;
  opacity: 0.85;
  user-select: none;
  margin: 0 0.15rem;
}

.back-nav-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.55rem !important;
  font-size: 0.98rem !important;
  font-weight: 700 !important;
  padding: 0.55rem 1.35rem !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="light"] .back-nav-btn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

.back-nav-btn:hover {
  background: var(--primary-bright) !important;
  border-color: var(--primary-bright) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.5) !important;
  transform: translateY(-1px);
}

/* Step Views & Animation */
.step-view {
  animation: stepFadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes stepFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-header {
  margin-bottom: 1.75rem;
}

.step-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.step-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-bright);
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  margin-bottom: 0.6rem;
}

.step-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.step-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ==========================================================================
   STEP 1: 4 CORE SYSTEMS GRID (CCTV, DOOR ACCESS, INTERCOM, ALARM)
   ========================================================================== */

.systems-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .systems-grid {
    grid-template-columns: 1fr;
  }
}

.system-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.system-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.system-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: currentColor;
  opacity: 0.85;
}

/* Individual System Glow Accents */
.system-card-cctv {
  color: #38bdf8;
}
.system-card-cctv:hover {
  border-color: #38bdf8;
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.18);
}

.system-card-dooraccess {
  color: #10b981;
}
.system-card-dooraccess:hover {
  border-color: #10b981;
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.18);
}

.system-card-intercom {
  color: #818cf8;
}
.system-card-intercom:hover {
  border-color: #818cf8;
  box-shadow: 0 12px 28px rgba(129, 140, 248, 0.18);
}

.system-card-alarm {
  color: #f59e0b;
}
.system-card-alarm:hover {
  border-color: #f59e0b;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.18);
}

.system-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.system-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: inherit;
  transition: all 0.2s ease;
}

.system-card:hover .system-icon-wrap {
  transform: scale(1.05);
}

.system-card-count-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.system-card-body h3 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.system-card-subtitle {
  font-size: 0.88rem;
  font-weight: 600;
  color: inherit;
  margin-bottom: 0.65rem;
}

.system-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.system-brands-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.4rem;
  align-items: center;
}

.system-brand-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  padding: 4px 10px;
  height: 32px;
  min-width: 68px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.system-brand-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: #ffffff;
}

.system-brand-chip-logo {
  height: 20px;
  width: auto;
  max-width: 78px;
  object-fit: contain;
  display: block;
}
}

.system-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.system-card:hover .system-card-cta {
  color: inherit;
}

.system-card-cta svg {
  transition: transform 0.2s ease;
}

.system-card:hover .system-card-cta svg {
  transform: translateX(4px);
}

/* ==========================================================================
   STEP 2: USER MANUAL vs INSTALLER MANUAL
   ========================================================================== */

.type-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .type-selection-grid {
    grid-template-columns: 1fr;
  }
}

.type-select-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.type-select-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-bright);
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--primary-glow);
}

.type-select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.type-select-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-bright);
}

.type-select-user .type-select-icon {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.type-select-installer .type-select-icon {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}

.type-select-count {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.type-select-body h3 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.type-select-sub {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-bright);
  margin-bottom: 0.85rem;
}

.type-select-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.type-features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.type-features-list li {
  font-size: 0.84rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.type-features-list li svg {
  color: #10b981;
  flex-shrink: 0;
}

.type-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.type-select-card:hover .type-select-btn {
  color: var(--primary-bright);
}

/* ==========================================================================
   STEP 3: BRAND FILTER & MANUALS GRID
   ========================================================================== */

.step-3-brand-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.brand-filter-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  font-size: 0.84rem;
}

.brand-filter-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.active-brand-indicator {
  font-weight: 700;
  color: var(--primary-bright);
}

.step-3-brands-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.brand-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.95rem;
  background: var(--bg-surface-alt);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.brand-filter-btn:hover {
  border-color: var(--primary-bright);
  transform: translateY(-1px);
}

.brand-filter-btn.active {
  border-color: var(--primary-bright);
  background: var(--primary-soft);
  color: #ffffff;
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.brand-filter-btn img {
  height: 20px;
  width: auto;
  max-width: 50px;
  object-fit: contain;
}

.brand-filter-count {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.brand-filter-btn.active .brand-filter-count {
  background: var(--primary-bright);
  color: #ffffff;
  border-color: transparent;
}

.type-box-icon-alarm {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid #eab308;
  color: #eab308;
}

.type-box.active .type-box-icon-alarm {
  background: #eab308;
  color: #0f172a;
}

.type-box[data-type="Alarm Manual"].active {
  border-color: #eab308;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.4), var(--shadow-md);
}

.type-box-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.type-box-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.type-box-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.15rem;
}

.down-arrow-indicator {
  display: none !important;
}

/* Flow Connector Arrows Between Levels (Removed per user request) */
.flow-connector {
  display: none !important;
}

/* LEVEL 2: CLEAN MODERN BRAND GRID (ALL REMARK LINES REMOVED) */
.brand-boxes-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 1.1rem;
}

.brand-node-wrap {
  width: 100%;
  display: flex;
}

.brand-box {
  width: 100%;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface-alt);
}

.brand-box-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
}

.brand-count-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.brand-box.active .brand-count-pill {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Horizontal Link Line (Removed per user request) */
.horizontal-link {
  display: none !important;
}

/* LEVEL 3: CONNECTED PDF MANUAL BOXES ([iVMS 4200] - [Hik-Connect] - [Face Recon] - [Face and CCTV]) */
.level-header-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.active-path-heading {
  font-size: 1.25rem;
  font-weight: 800;
}

.results-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-bright);
  border: 1px solid var(--primary);
}

.pdf-boxes-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.15rem;
}

.pdf-manual-card {
  background: var(--bg-surface-alt);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.18s ease;
  position: relative;
}

.pdf-manual-card:hover {
  border-color: var(--primary-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.pdf-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.pdf-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: #dc2626;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.pdf-brand-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.pdf-box-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.pdf-box-desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.pdf-box-footer {
  border-top: 1px dashed var(--border-color);
  padding-top: 0.8rem;
  display: flex;
   flex-direction: column;
  gap: 0.65rem;
}

.pdf-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pdf-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* ==========================================================================
   BOTTOM INSTALLER MANUAL DIRECT STRIP (MATCHING SKETCH BOTTOM BOXES)
   ========================================================================== */

.installer-bottom-strip {
  margin-top: 2.25rem;
  background: var(--bg-surface);
  border: 2px solid var(--border-strong);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
}

.strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.strip-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.strip-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: var(--primary);
  color: #ffffff;
}

.strip-header h3 {
  font-size: 1rem;
  font-weight: 800;
}

.strip-arrow-hint {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--metal-silver);
}

[data-theme="light"] .strip-arrow-hint {
  color: var(--primary);
}

.installer-boxes-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}

.installer-mini-box {
  background: var(--bg-surface-alt);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: border-color 0.15s ease;
}

.installer-mini-box:hover {
  border-color: var(--primary-bright);
}

.installer-mini-info {
  display: flex;
  flex-direction: column;
}

.installer-mini-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
}

.installer-mini-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   EMPTY STATE, FOOTER & MODALS
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}

.empty-state h3 {
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.portal-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 1.15rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.footer-mini-logo {
  width: 28px;
  height: auto;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 0;
  animation: slowMotionRotate 20s linear infinite;
  transform-style: preserve-3d;
  will-change: transform;
}

.footer-links a {
  color: var(--primary-bright);
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   SCHEMATIC WIRING DIAGRAM MODAL & BUTTONS
   ========================================================================== */
.btn-schematic {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.4);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-schematic:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.btn-schematic-mini {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.4);
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-schematic-mini:hover {
  background: #dc2626;
  color: #ffffff;
}

.schematic-pill {
  background: linear-gradient(135deg, #dc2626, #991b1b) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem !important;
}

.schematic-modal-body {
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: #0b1120;
}

.schematic-svg-wrap {
  width: 100%;
  min-height: 440px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.schematic-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.schematic-info-section {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.schematic-section-heading {
  font-size: 0.92rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wire-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.wire-guide-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
}

.wire-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.wire-name {
  color: #f8fafc;
  line-height: 1.2;
}

.wire-spec {
  color: #94a3b8;
  margin-top: 2px;
}

.schematic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.schematic-table th {
  background: #0f172a;
  color: #cbd5e1;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 2px solid #334155;
  font-weight: 800;
}

.schematic-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #334155;
  color: #e2e8f0;
}

.schematic-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-wire {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  background: #334155;
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.75rem;
}

.field-notes-list {
  padding-left: 1.25rem;
  color: #cbd5e1;
  font-size: 0.84rem;
  line-height: 1.6;
}

.field-notes-list li {
  margin-bottom: 0.4rem;
}

.installer-mini-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 92vh;
}

.modal-xl {
  max-width: 1000px;
  height: 88vh;
}

.modal-lg {
  max-width: 680px;
}

.modal-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
}

.preview-body {
  background: #1e293b;
  display: flex;
}

#preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.admin-body {
  padding: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

@media (max-width: 768px) {
  .type-boxes-row {
    grid-template-columns: 1fr;
  }

  .brand-boxes-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .horizontal-link {
    display: none;
  }

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

  .hide-mobile {
    display: none;
  }
}

/* Product Badges & Image Styling */
.brand-boxes-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.brand-node-wrap {
  width: 100%;
}

.brand-badge-img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  border: 1px solid var(--border-color);
}

.card-badge-wrap {
  width: 100%;
  height: 90px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color);
  background: #0f172a;
}

.card-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.pdf-manual-card:hover .card-product-img {
  transform: scale(1.04);
}
/* Enhanced Brand Logo Presentation */
.brand-box {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  transition: all 0.2s ease;
  min-height: 150px;
}

.brand-box:hover {
  border-color: var(--primary-bright);
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.brand-box.active {
  border-color: var(--primary-bright);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px var(--primary-glow), var(--shadow-md);
}

.brand-logo-frame {
  width: 100%;
  height: 68px;
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 0.65rem;
}

.brand-logo-frame img {
  max-width: 100%;
  max-height: 52px;
  object-fit: contain;
}

.brand-box-text {
  width: 100%;
}

.card-badge-wrap {
  width: 100%;
  height: 85px;
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.card-badge-wrap img {
  max-width: 100%;
  max-height: 68px;
  object-fit: contain;
}