/* ===== ISO 50001 能源管理体系 — 共享样式 ===== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark: #1a2a4a;
  --blue-mid: #243656;
  --blue-light: #3a5278;
  --green: #22c55e;
  --green-light: #4ade80;
  --green-bg: #f0fdf4;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 10px;
  --nav-width: 240px;
  --header-h: 60px;
}

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Top Header (mobile) --- */
.top-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--blue-dark);
  color: white;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}
.top-header .logo { font-size: 18px; font-weight: 700; }
.top-header .hamburger {
  background: none; border: none; color: white; font-size: 24px; cursor: pointer;
}

/* --- Sidebar Nav --- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--nav-width);
  background: var(--blue-dark);
  color: white;
  display: flex; flex-direction: column;
  z-index: 900;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header .logo {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, #47e5d8, #60a5fa);
  -webkit-background-clip: text; color: transparent;
}
.sidebar-header .subtitle { font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 4px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  color: white;
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: var(--green-light);
  border-left-color: var(--green);
  background: rgba(34,197,94,0.08);
}
.sidebar-nav .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-nav .nav-section {
  padding: 16px 20px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

/* --- Main Content --- */
.main {
  margin-left: var(--nav-width);
  min-height: 100vh;
  padding: 40px 48px 80px;
  max-width: 1060px;
}

/* --- Typography --- */
h1 { font-size: 28px; font-weight: 800; color: var(--blue-dark); margin-bottom: 8px; }
h2 { font-size: 22px; font-weight: 700; color: var(--blue-dark); margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--green); display: inline-block; }
h3 { font-size: 18px; font-weight: 700; color: var(--blue-mid); margin: 28px 0 12px; }
h4 { font-size: 15px; font-weight: 700; color: var(--gray-700); margin: 20px 0 8px; }
p { margin-bottom: 14px; color: var(--gray-700); }
ul, ol { margin: 0 0 16px 20px; color: var(--gray-700); }
li { margin-bottom: 6px; }

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 48px 40px;
  margin-bottom: 40px;
}
.hero h1 { color: white; font-size: 32px; margin-bottom: 12px; }
.hero p { color: rgba(255,255,255,0.8); font-size: 16px; max-width: 640px; }

/* --- Cards --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 32px;
}
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s;
  cursor: pointer;
}
.card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.card .card-icon { font-size: 32px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 16px; color: var(--blue-dark); }
.card p { font-size: 13px; color: var(--gray-500); margin: 0; }

/* --- Info Box --- */
.info-box {
  background: var(--green-bg);
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--gray-700);
}
.info-box.warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
}
.info-box.blue {
  background: #eff6ff;
  border-left-color: #3b82f6;
}

/* --- Table --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th {
  background: var(--blue-dark);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* --- Clause Block (standard.html) --- */
.clause-block {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.clause-header {
  background: var(--blue-dark);
  color: white;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.clause-header:hover { background: var(--blue-mid); }
.clause-header .arrow { transition: transform 0.2s; }
.clause-header.open .arrow { transform: rotate(90deg); }
.clause-body { padding: 20px; display: none; }
.clause-body.open { display: block; }
.clause-body h4 { margin-top: 0; }
.requirement-tag {
  display: inline-block;
  background: var(--green-bg);
  color: #16a34a;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-right: 8px;
}
.tip-tag {
  display: inline-block;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-right: 8px;
}
.nc-tag {
  display: inline-block;
  background: #fef2f2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-right: 8px;
}

/* --- PDCA Diagram --- */
.pdca-diagram {
  display: flex;
  justify-content: center;
  margin: 32px 0;
}
.pdca-ring {
  position: relative;
  width: 320px; height: 320px;
}
.pdca-quad {
  position: absolute;
  width: 140px; height: 140px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  color: white;
  text-align: center;
  line-height: 1.3;
}
.pdca-quad.plan    { top: 0; left: 90px; background: #3b82f6; }
.pdca-quad.do      { top: 90px; left: 180px; background: #22c55e; }
.pdca-quad.check   { top: 180px; left: 90px; background: #f59e0b; }
.pdca-quad.act     { top: 90px; left: 0; background: #ef4444; }
.pdca-quad .en { font-size: 11px; font-weight: 400; opacity: 0.85; }

/* --- Stat Cards (index.html) --- */
.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .stat-num {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 600;
}

/* --- Progress Bar (index.html) --- */
.progress-bar {
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  height: 24px;
  margin: 16px 0 8px;
  overflow: hidden;
}
.progress-fill {
  background: linear-gradient(90deg, var(--green), var(--green-light));
  height: 100%;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-dark);
  min-width: 40px;
  transition: width 0.5s ease;
}

/* --- Risk Board (index.html) --- */
.risk-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.risk-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.risk-card.red { border: 2px solid #ef4444; }
.risk-card.yellow { border: 2px solid #f59e0b; }
.risk-card.green { border: 2px solid #22c55e; }
.risk-header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  color: white;
}
.risk-card.red .risk-header { background: #ef4444; }
.risk-card.yellow .risk-header { background: #f59e0b; }
.risk-card.green .risk-header { background: #22c55e; }
.risk-list {
  list-style: none;
  margin: 0;
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.risk-list li {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.risk-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* --- Project Stats (index.html) --- */
.project-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.stat-item {
  text-align: center;
}
.stat-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
  margin: 0 auto 8px;
}
.stat-circle.green { background: #22c55e; }
.stat-circle.yellow { background: #f59e0b; }
.stat-circle.red { background: #ef4444; }
.stat-circle.gray { background: var(--gray-400); }
.stat-caption {
  font-size: 13px;
  color: var(--gray-500);
  max-width: 160px;
}

/* --- Timeline (guide.html override) --- */
.timeline { position: relative; padding-left: 32px; margin: 24px 0; }
.timeline::before {
  content: '';
  position: absolute; left: 7px; top: 0; bottom: 0;
  width: 2px; background: var(--gray-200);
}
.tl-item { position: relative; margin-bottom: 28px; }
.tl-dot {
  position: absolute; left: -32px; top: 4px;
  width: 16px; height: 16px;
  background: var(--green);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--green);
}
.tl-item:nth-child(odd) .tl-dot { background: #3b82f6; box-shadow: 0 0 0 2px #3b82f6; }
.tl-title { font-weight: 700; font-size: 16px; color: var(--blue-dark); margin-bottom: 4px; }
.tl-desc { font-size: 14px; color: var(--gray-500); }

/* --- Checklist --- */
.chk-list { list-style: none; margin-left: 0; }
.chk-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
}
.chk-list li:last-child { border-bottom: none; }
.chk-box {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 4px;
  margin-top: 1px;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: white;
}
.chk-list li.checked .chk-box { background: var(--green); border-color: var(--green); }
.chk-list li.checked .chk-text { text-decoration: line-through; color: var(--gray-400); }

/* --- Template Preview --- */
.template-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.template-card-header {
  background: var(--blue-dark);
  color: white;
  padding: 14px 20px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.template-card-header .clause-ref { font-size: 12px; background: rgba(255,255,255,0.15); padding: 2px 10px; border-radius: 20px; }
.template-preview {
  padding: 24px;
  font-size: 13.5px;
  line-height: 1.8;
  background: #fafbfc;
  max-height: 400px;
  overflow-y: auto;
}
.template-preview h4 { margin-top: 0; color: var(--blue-dark); }
.template-preview table { font-size: 13px; }
.print-btn {
  background: var(--green);
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.print-btn:hover { background: #16a34a; }

/* --- Gap Analysis Table (tools.html) --- */
.gap-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); }
.gap-table select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--gray-300); font-size: 13px; font-family: inherit; }

/* --- Footer --- */
.footer {
  margin-left: var(--nav-width);
  padding: 24px 48px;
  border-top: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-500);
  max-width: 1060px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .top-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 80px 20px 60px; }
  .footer { margin-left: 0; padding: 20px; }
  h1 { font-size: 24px; }
  .hero { padding: 32px 24px; }
  .hero h1 { font-size: 26px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
}

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

/* --- Print --- */
@media print {
  .sidebar, .top-header, .footer, .print-btn, .bgm-wrapper { display: none !important; }
  .main { margin-left: 0; padding: 0; max-width: 100%; }
  body { background: white; }
  .clause-body { display: block !important; }
  .template-preview { max-height: none; }
}
