/* ===== DESIGN TOKENS ===== */
:root {
  --ctd-blue:      #1B75BC;   /* logo blue */
  --ctd-blue-dark: #14598F;
  --ctd-blue-deep: #0E3F66;
  --ctd-accent:    #C8202E;   /* logo red */
  --ctd-accent2:   #2B9DD4;   /* wave light blue */
  --white:         #FFFFFF;
  --off-white:     #F4F8FB;
  --gray-light:    #E2EAF1;
  --gray-mid:      #8FA4B8;
  --gray-dark:     #3A4E60;
  --text:          #1A2A38;
  --success:       #2A9D5C;
  --warning-bg:    #FFF3CD;
  --warning-bd:    #E8A020;
  --danger-bg:     #FDECEA;
  --danger-bd:     #D93025;
  --info-bg:       #E8F4FB;
  --info-bd:       #0071BC;

  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 2px 12px rgba(0,65,120,0.10);
  --shadow-lg:     0 6px 28px rgba(0,65,120,0.16);
  --transition:    0.2s ease;

  --sidebar-w:     280px;
  --header-h:      56px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--off-white);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--ctd-blue);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
#menu-btn {
  background: none; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  flex-shrink: 0; transition: background var(--transition);
}
#menu-btn:hover { background: rgba(255,255,255,0.12); }
#menu-btn span {
  display: block; width: 22px; height: 2px;
  background: white; border-radius: 2px; transition: all var(--transition);
}
#menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#menu-btn.open span:nth-child(2) { opacity: 0; }
#menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.header-logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.logo-text { color: white; font-size: 15px; font-weight: 700; line-height: 1.2; }
.logo-text span { display: block; font-size: 10px; font-weight: 400; opacity: 0.8; letter-spacing: 0.06em; text-transform: uppercase; }

#search-btn {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: white; font-size: 20px; padding: 8px;
  border-radius: var(--radius-sm); transition: background var(--transition);
}
#search-btn:hover { background: rgba(255,255,255,0.12); }

/* Overlay */
#overlay {
  display: none; position: fixed; inset: 0; z-index: 149;
  background: rgba(0,30,60,0.45); backdrop-filter: blur(2px);
}
#overlay.active { display: block; }

/* Sidebar */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 150;
  width: var(--sidebar-w);
  background: var(--ctd-blue-deep);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#sidebar.open { transform: translateX(0); }

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-mark {
  width: 44px; height: 44px; border-radius: 10px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.sidebar-logo-text { color: white; }
.sidebar-logo-text strong { display: block; font-size: 15px; }
.sidebar-logo-text small { font-size: 11px; opacity: 0.65; letter-spacing: 0.05em; }

#sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
#sidebar-nav::-webkit-scrollbar { width: 4px; }
#sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav-section { margin-bottom: 2px; }
.nav-section-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.78);
  font-size: 14px; font-weight: 500; text-align: left;
  transition: all var(--transition); border-radius: 0;
  position: relative;
}
.nav-section-btn:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-section-btn.active { background: rgba(0,168,225,0.20); color: white; }
.nav-section-btn.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--ctd-accent2); border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.nav-label { flex: 1; }
.nav-chevron { font-size: 11px; opacity: 0.5; transition: transform var(--transition); }
.nav-section-btn.open .nav-chevron { transform: rotate(90deg); }

.nav-subsections { overflow: hidden; max-height: 0; transition: max-height 0.25s ease; }
.nav-subsections.open { max-height: 600px; }
.nav-sub-btn {
  width: 100%; display: block; padding: 8px 20px 8px 56px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.55); font-size: 13px; text-align: left;
  transition: all var(--transition);
}
.nav-sub-btn:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.05); }
.nav-sub-btn.active { color: var(--ctd-accent2); font-weight: 600; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.10);
  font-size: 11px; color: rgba(255,255,255,0.4);
  flex-shrink: 0;
}

/* Main content */
#main {
  margin-top: var(--header-h);
  flex: 1;
  padding: 0;
}

/* Search bar */
#search-bar {
  display: none; position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 90;
  background: white; padding: 12px 16px;
  border-bottom: 1px solid var(--gray-light);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
#search-bar.active { display: block; }
#search-input {
  width: 100%; padding: 10px 14px;
  border: 2px solid var(--ctd-blue);
  border-radius: var(--radius-sm);
  font-size: 15px; outline: none;
}
#search-results {
  margin-top: 8px; max-height: 55vh; overflow-y: auto;
  background: white; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-light);
}
.search-result-item {
  padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--gray-light);
  display: flex; flex-direction: column; gap: 2px;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--info-bg); }
.search-result-item:last-child { border-bottom: none; }
.result-section { font-size: 11px; color: var(--ctd-blue); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.result-title { font-size: 14px; font-weight: 600; }
.result-preview { font-size: 12px; color: var(--gray-mid); }

/* Home / Landing */
#home-view {
  padding: 24px 16px 40px;
}
.home-hero {
  background: linear-gradient(135deg, var(--ctd-blue) 0%, var(--ctd-blue-deep) 100%);
  border-radius: var(--radius);
  padding: 28px 20px;
  color: white;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.home-hero::after {
  content: '';
  position: absolute; bottom: -20px; right: -20px;
  width: 120px; height: 120px;
  background: rgba(232,64,28,0.20);
  border-radius: 50%;
}
.home-hero h1 { font-size: 22px; font-weight: 800; line-height: 1.2; margin-bottom: 6px; }
.home-hero p { font-size: 13px; opacity: 0.8; }
.home-hero .version-badge {
  display: inline-block; margin-top: 12px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px; padding: 3px 12px;
  font-size: 11px; letter-spacing: 0.05em;
}

.home-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 24px;
}
.home-card {
  background: white; border-radius: var(--radius);
  padding: 18px 14px;
  box-shadow: var(--shadow);
  cursor: pointer; border: 2px solid transparent;
  transition: all var(--transition);
  text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.home-card:hover { border-color: var(--ctd-blue); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.home-card-icon { font-size: 28px; }
.home-card-title { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3; }
.home-card-count { font-size: 11px; color: var(--gray-mid); }

.safety-banner {
  background: linear-gradient(135deg, var(--ctd-accent) 0%, #C0310E 100%);
  color: white; border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(232,64,28,0.25);
}
.safety-banner:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,64,28,0.35); }
.safety-banner-icon { font-size: 32px; flex-shrink: 0; }
.safety-banner-text strong { display: block; font-size: 15px; font-weight: 800; }
.safety-banner-text span { font-size: 12px; opacity: 0.85; }

/* Content view */
#content-view { display: none; }
#content-view.active { display: block; }

.content-header {
  background: var(--ctd-blue);
  color: white; padding: 20px 16px 18px;
}
.breadcrumb {
  font-size: 11px; opacity: 0.7; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.breadcrumb-back {
  background: none; border: none; color: rgba(255,255,255,0.8);
  cursor: pointer; font-size: 11px; padding: 0;
  display: flex; align-items: center; gap: 4px;
  transition: color var(--transition);
}
.breadcrumb-back:hover { color: white; }
.content-title { font-size: 20px; font-weight: 800; line-height: 1.2; }
.content-subtitle { font-size: 13px; opacity: 0.8; margin-top: 4px; }

.content-body { padding: 20px 16px 40px; }

/* Section listing */
.subsection-list { display: flex; flex-direction: column; gap: 10px; }
.subsection-card {
  background: white; border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  cursor: pointer; display: flex; align-items: center; gap: 14px;
  transition: all var(--transition); border: 2px solid transparent;
}
.subsection-card:hover { border-color: var(--ctd-blue); transform: translateX(3px); }
.subsection-card-icon { font-size: 20px; color: var(--ctd-blue); flex-shrink: 0; }
.subsection-card-title { font-size: 14px; font-weight: 600; flex: 1; }
.subsection-card-arrow { color: var(--gray-mid); font-size: 16px; }

/* Article content */
.article { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.ppe-strip {
  background: var(--ctd-blue-deep);
  padding: 14px 16px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.ppe-strip-label {
  color: rgba(255,255,255,0.6); font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
  width: 100%; margin-bottom: 2px; font-weight: 600;
}
.ppe-tag {
  background: rgba(255,255,255,0.15); color: white;
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 500;
}

.note-strip {
  background: var(--info-bg); border-left: 4px solid var(--ctd-blue);
  padding: 10px 16px; font-size: 13px; color: var(--ctd-blue-dark); font-weight: 500;
}

.photos-strip {
  background: #FFF8F0; border-left: 4px solid var(--ctd-accent);
  padding: 10px 16px; font-size: 13px; color: #7A3010; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}

.article-content { padding: 20px 16px; }

/* Steps */
.steps-list { counter-reset: steps; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.step-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 14px; background: var(--off-white); border-radius: var(--radius-sm);
  position: relative; transition: background var(--transition);
}
.step-item.done { background: #EDFBF2; }
.step-item.done .step-num { background: var(--success); }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ctd-blue); color: white;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background var(--transition);
}
.step-text { flex: 1; font-size: 14px; line-height: 1.5; padding-top: 4px; }
.step-check {
  width: 24px; height: 24px; border-radius: 50%;
  background: none; border: 2px solid var(--gray-light);
  cursor: pointer; flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); color: white; font-size: 12px;
}
.step-item.done .step-check { background: var(--success); border-color: var(--success); }

.steps-reset {
  margin-top: 14px; padding: 10px 16px;
  background: none; border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  width: 100%; color: var(--gray-dark); font-weight: 500;
  transition: all var(--transition);
}
.steps-reset:hover { border-color: var(--ctd-blue); color: var(--ctd-blue); }

/* Checklist items */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.check-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; background: var(--off-white); border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition);
}
.check-item.done { background: #EDFBF2; }
.check-box {
  width: 26px; height: 26px; border: 2px solid var(--gray-light);
  border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all var(--transition);
}
.check-item.done .check-box { background: var(--success); border-color: var(--success); color: white; }
.check-label { flex: 1; }
.check-label strong { display: block; font-size: 14px; font-weight: 600; }
.check-label small { font-size: 12px; color: var(--gray-mid); }

/* Contacts */
.contacts-list { display: flex; flex-direction: column; gap: 10px; }
.contact-card {
  background: white; border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.contact-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--ctd-blue); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.contact-info { flex: 1; }
.contact-info strong { display: block; font-size: 14px; font-weight: 600; }
.contact-info small { font-size: 12px; color: var(--gray-mid); }
.contact-call {
  background: var(--ctd-blue); color: white;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: block;
  transition: background var(--transition);
}
.contact-call:hover { background: var(--ctd-blue-dark); }

/* Locations */
.locations-list { display: flex; flex-direction: column; gap: 10px; }
.location-card {
  background: white; border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.location-pin {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--off-white); color: var(--ctd-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.location-info strong { display: block; font-size: 14px; font-weight: 700; }
.location-info small { font-size: 12px; color: var(--gray-mid); }

/* Info grid */
.info-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.info-card {
  background: var(--off-white); border-radius: var(--radius-sm);
  padding: 14px; border-left: 3px solid var(--ctd-blue);
}
.info-card strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; color: var(--ctd-blue-dark); }
.info-card p { font-size: 13px; color: var(--gray-dark); }

/* Product table */
.product-table {
  width: 100%; border-collapse: collapse; margin-top: 12px;
  font-size: 13px; border-radius: var(--radius-sm); overflow: hidden;
}
.product-table th {
  background: var(--ctd-blue); color: white;
  padding: 10px 12px; text-align: left; font-size: 12px;
}
.product-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-light); }
.product-table tr:last-child td { border-bottom: none; }
.product-table tr:nth-child(even) td { background: var(--off-white); }

/* PPE badges (inline in content) */
.ppe-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.ppe-badge {
  background: var(--ctd-blue-deep); color: white;
  border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 500;
}

/* Alerts */
.alert {
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin: 12px 0; font-size: 13px; line-height: 1.5;
}
.alert strong { display: block; margin-bottom: 4px; }
.alert ul { margin-top: 6px; padding-left: 18px; }
.alert-warning { background: var(--warning-bg); border-left: 4px solid var(--warning-bd); }
.alert-danger { background: var(--danger-bg); border-left: 4px solid var(--danger-bd); }
.alert-info { background: var(--info-bg); border-left: 4px solid var(--info-bd); }

/* Generic content typography */
.article-content h4 { font-size: 14px; font-weight: 700; margin: 16px 0 8px; color: var(--ctd-blue-dark); }
.article-content p { font-size: 14px; line-height: 1.6; margin-bottom: 10px; }
.article-content ul, .article-content ol { padding-left: 18px; font-size: 14px; margin-bottom: 10px; }
.article-content li { margin-bottom: 6px; line-height: 1.5; }
.article-content blockquote {
  border-left: 4px solid var(--ctd-blue);
  padding: 12px 16px; background: var(--info-bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0; font-size: 14px;
}
.article-content table { font-size: 13px; }

/* Desktop layout */
@media (min-width: 768px) {
  #sidebar {
    transform: translateX(0);
    position: fixed; top: 0; bottom: 0;
  }
  #main { margin-left: var(--sidebar-w); }
  #menu-btn { display: none; }
  #overlay { display: none !important; }
  .home-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
