/* =========================================================
   CAN JOINT VENTURE - CONTRACT 4-3 HIGH-SPEED RAILWAY
   Safety & Operation Dashboard Stylesheet
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --primary-navy: #0f172a;
  --secondary-navy: #1e293b;
  --accent-blue: #2563eb;
  --accent-cyan: #0284c7;
  --safety-orange: #ea580c;
  --safety-yellow: #f59e0b;
  --safety-green: #10b981;
  --safety-red: #ef4444;
  --bg-slate: #f8fafc;
  --card-border: #e2e8f0;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}

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

body {
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-slate);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header & Banner */
.site-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border-bottom: 4px solid var(--safety-yellow);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo-wrap {
  background: white;
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.brand-titles h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-titles .contract-badge {
  background: var(--safety-orange);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.brand-titles p {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Area Filter Controls */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
}

.area-btn {
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.area-btn:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.area-btn.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
  font-weight: 600;
}

.area-btn.active.bangpain {
  background: #ea580c;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.4);
}

.area-btn.active.chiangrak {
  background: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

/* Category Sub-Navigation Bar */
.category-nav-wrapper {
  background: white;
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  position: sticky;
  top: 76px;
  z-index: 40;
}

.category-nav {
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.cat-tab:hover {
  background: #e2e8f0;
  color: var(--text-dark);
}

.cat-tab.active {
  background: var(--secondary-navy);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25);
}

.cat-tab .tab-badge {
  background: rgba(255,255,255,0.25);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.725rem;
  font-weight: 700;
}

.cat-tab:not(.active) .tab-badge {
  background: #e2e8f0;
  color: #475569;
}

/* Category Views Visibility Control */
.category-view {
  display: none;
}

.category-view.active {
  display: block;
  animation: fadeInView 0.25s ease-out;
}

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

/* Back to Hub Button */
.btn-back-hub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.15s;
}

.btn-back-hub:hover {
  background: #e2e8f0;
  color: var(--text-dark);
  transform: translateX(-2px);
}

/* Overview Hub Cards Grid */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.hub-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hub-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.hub-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.hub-icon-box {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.hub-stat-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hub-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.hub-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.hub-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hub-link-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s;
}

.hub-card:hover .hub-link-text {
  gap: 10px;
}

/* Quick Actions in Header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-emergency {
  background: #dc2626;
  color: white;
  animation: pulse 2s infinite;
}

.btn-emergency:hover {
  background: #b91c1c;
}

.btn-admin {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-admin:hover {
  background: rgba(255,255,255,0.2);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Main Layout */
.main-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

/* KPI Summary Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: white;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--accent-blue);
}

.kpi-card.warning::before { background: var(--safety-yellow); }
.kpi-card.danger::before { background: var(--safety-red); }
.kpi-card.success::before { background: var(--safety-green); }
.kpi-card.orange::before { background: var(--safety-orange); }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #eff6ff;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-card.warning .kpi-icon { background: #fffbeb; color: var(--safety-yellow); }
.kpi-card.danger .kpi-icon { background: #fef2f2; color: var(--safety-red); }
.kpi-card.success .kpi-icon { background: #f0fdf4; color: var(--safety-green); }
.kpi-card.orange .kpi-icon { background: #fff7ed; color: var(--safety-orange); }

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Section Containers */
.dashboard-section {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.badge-blue { background: #eff6ff; color: #2563eb; }
.badge-orange { background: #fff7ed; color: #ea580c; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-green { background: #f0fdf4; color: #16a34a; }
.badge-purple { background: #faf5ff; color: #7c3aed; }
.badge-amber { background: #fffbeb; color: #d97706; }

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
}

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

/* Module 1: Team Members Grid */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.member-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: #ffffff;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.member-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.member-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.member-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #e2e8f0;
  flex-shrink: 0;
  background: #f1f5f9;
}

.avatar-wrapper {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.btn-change-photo {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent-blue);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.btn-change-photo:hover {
  transform: scale(1.2);
  background: #1d4ed8;
}

.member-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.member-role {
  font-size: 0.825rem;
  color: var(--accent-blue);
  font-weight: 500;
}

.area-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
  font-weight: 600;
}

.tag-bangpain { background: #ffedd5; color: #c2410c; }
.tag-chiangrak { background: #e0f2fe; color: #0369a1; }
.tag-general { background: #f1f5f9; color: #475569; }

.duty-list {
  list-style: none;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 16px;
  flex-grow: 1;
}

.duty-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.duty-list li::before {
  content: '▸';
  position: absolute;
  left: 4px;
  top: 0;
  color: var(--accent-blue);
  font-weight: bold;
}

.member-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.contact-link {
  color: var(--text-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: color 0.15s;
}

.contact-link:hover {
  color: var(--accent-blue);
}

/* Module 2: Look Out Man Grid (Safety High-Vis Style) */
.lookout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.lookout-card {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.lookout-badge-banner {
  position: absolute;
  top: 12px;
  right: -30px;
  background: #ea580c;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 34px;
  transform: rotate(45deg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.lookout-top {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.lookout-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #f59e0b;
  object-fit: cover;
  background: white;
}

.lookout-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #78350f;
}

.lookout-zone {
  font-size: 0.8rem;
  color: #92400e;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.lookout-details {
  background: white;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #fde68a;
  font-size: 0.825rem;
  color: #78350f;
  margin-bottom: 14px;
  flex-grow: 1;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-weight: 600;
  color: #92400e;
}

.btn-call {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #16a34a;
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: background 0.15s, transform 0.1s;
}

.btn-call:hover {
  background: #15803d;
  transform: translateY(-1px);
}

/* Module 3: SWN & NCN Tracker */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-dark);
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.doc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.doc-status-badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

.doc-status-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.doc-status-badge.success {
  background: #dcfce7;
  color: #166534;
}

.btn-view-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.15s;
}

/* Method Statement Category Grid & Cards */
.mos-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.mos-cat-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.mos-cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #94a3b8;
}

.mos-cat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.mos-cat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.mos-cat-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #334155;
}

.mos-cat-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.mos-cat-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
}

.mos-cat-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}

/* MOS Sub-navigation Bar inside category view */
.mos-subnav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mos-subnav-pill {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.825rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.mos-subnav-pill:hover {
  background: #e2e8f0;
  color: var(--text-dark);
}

.mos-subnav-pill.active {
  background: #10b981;
  color: white;
  border-color: #10b981;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.btn-back-mos {
  background: white;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.btn-back-mos:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Module 4: Method Statement Grid */
.mos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.mos-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: white;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.mos-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mos-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.mos-code {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: #eff6ff;
  padding: 3px 8px;
  border-radius: 4px;
}

.mos-rev {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.mos-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  line-height: 1.4;
}

.mos-desc {
  font-size: 0.825rem;
  color: #64748b;
  margin-bottom: 16px;
  flex-grow: 1;
}

.mos-meta {
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.775rem;
  color: #475569;
  margin-bottom: 14px;
}

/* Module 5: Launching Gantry (LG) & PT Bar Tracker */
.lg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 24px;
}

.lg-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: white;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.lg-img-container {
  height: 220px;
  background: #0f172a;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lg-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lg-tag-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2);
}

.lg-body {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.lg-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.lg-loc {
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* PT Bar Highlight Box */
.ptbar-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--accent-blue);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}

.ptbar-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ptbar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.8rem;
}

.ptbar-item-label {
  color: var(--text-muted);
}

.ptbar-item-val {
  font-weight: 600;
  color: var(--text-dark);
}

/* Module 6: Weekly Heavy Machinery Inspection */
.machinery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.machinery-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: white;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}

.machinery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.machinery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.machinery-code {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.machinery-type-badge {
  font-size: 0.725rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.type-lg { background: #dbeafe; color: #1d4ed8; }
.type-tc { background: #fef3c7; color: #b45309; }
.type-gc { background: #ccfbf1; color: #0f766e; }

.inspection-status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
}

.status-passed { background: #dcfce7; color: #15803d; }
.status-action-required { background: #fee2e2; color: #b91c1c; }
.status-pending { background: #fef3c7; color: #b45309; }

/* SWN/NCN Interactive Status Select */
.swn-status-select {
  padding: 6px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  display: inline-block;
  appearance: auto;
}
.swn-status-select.danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.swn-status-select.warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.swn-status-select.success {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

/* Admin Tabs & Tables */
.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar {
  display: none;
}
.admin-tab-btn {
  background: #f1f5f9;
  color: #475569;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.admin-tab-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.admin-tab-btn.active {
  background: #2563eb;
  color: white;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.admin-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: #334155;
  border-bottom: 2px solid #e2e8f0;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.admin-table tr:hover {
  background: #f8fafc;
}
.btn-sm-edit {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-sm-edit:hover {
  background: #dbeafe;
}
.btn-sm-delete {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-sm-delete:hover {
  background: #fee2e2;
}

/* Modal & Forms */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 20px;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: white;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.3s ease-out;
}

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

.modal-header {
  padding: 18px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Footer */
.site-footer {
  background: var(--primary-navy);
  color: #94a3b8;
  padding: 30px 24px;
  text-align: center;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 40px;
}

.site-footer p {
  margin-bottom: 6px;
}

/* Print Optimization */
@media print {
  .site-header, .filter-bar, .header-actions, .btn-call, .btn-view-doc, .btn-admin, .modal-backdrop {
    display: none !important;
  }
  body {
    background: white;
    color: black;
  }
  .dashboard-section {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar {
    justify-content: space-around;
  }
  .header-actions {
    justify-content: space-between;
  }
  .lg-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Cloudflare D1 Connection Badge */
.cf-badge {
  font-weight: 500;
  transition: all 0.3s ease;
  user-select: none;
}
.cf-badge.online {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.5) !important;
}
.cf-badge.syncing {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
}
.cf-badge.offline, .cf-badge.local {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

