:root {
  --sidebar-w: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text-1: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text-1);
  font-size: 14px; line-height: 1.5;
  overflow: hidden; height: 100vh;
}

.app { display: flex; height: 100vh; }
.mono { font-family: "SF Mono", "Fira Code", "Consolas", monospace; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  color: var(--sidebar-text); overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.logo-icon {
  width: 36px; height: 36px;
  background: rgba(37,99,235,.15); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.logo-text h1 { font-size: 15px; font-weight: 600; color: #f1f5f9; letter-spacing: -.3px; }
.logo-text span { font-size: 11px; color: var(--sidebar-text); }

/* ---- City Selector ---- */
.city-selector {
  padding: 8px; position: relative;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.city-selected {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 6px;
  cursor: pointer; transition: background .15s;
  color: #e2e8f0; font-size: 14px; font-weight: 600;
}
.city-selected:hover { background: var(--sidebar-hover); }
.city-selected .chevron { margin-left: auto; transition: transform .2s; }
.city-selector.open .chevron { transform: rotate(180deg); }

.city-dropdown {
  display: none; position: absolute;
  left: 8px; right: 8px; top: calc(100% - 4px);
  background: #1e293b; border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px; z-index: 200;
  max-height: 360px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.city-selector.open .city-dropdown { display: block; }

.city-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer;
  font-size: 13px; color: var(--sidebar-text); transition: all .1s;
}
.city-option:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.city-option.active { color: #fff; background: rgba(37,99,235,.25); }
.city-option.disabled { opacity: .35; cursor: not-allowed; }
.city-option .co-right { font-size: 11px; color: var(--sidebar-text); display: flex; align-items: center; gap: 6px; }
.city-option .co-check { color: var(--accent); }
.city-option .co-badge { font-size: 10px; padding: 1px 6px; border-radius: 3px; background: rgba(255,255,255,.06); }

/* ---- Sidebar Nav ---- */
.sidebar-nav { padding: 12px 8px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; font-weight: 500; transition: all .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,.06);
  font-size: 11px; text-align: center;
}

/* ---- Main ---- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.main-header {
  padding: 16px 24px; background: var(--card);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}

.search-box { position: relative; max-width: 480px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }

#searchInput {
  width: 100%; padding: 8px 12px 8px 36px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; background: var(--bg);
  transition: all .15s; font-family: inherit;
}
#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); background: var(--card); }

.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  display: none; z-index: 100; max-height: 360px; overflow-y: auto;
}
.search-dropdown.show { display: block; }
.search-group-title { padding: 8px 12px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.search-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; transition: background .1s; }
.search-item:hover { background: var(--bg); }
.search-item .label { flex: 1; }
.search-item .meta { color: var(--text-3); font-size: 12px; }

/* ---- Breadcrumb ---- */
.breadcrumb { padding: 12px 24px; font-size: 13px; color: var(--text-2); flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--accent); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--text-3); }

/* ---- Content ---- */
.content { flex: 1; overflow-y: auto; padding: 0 24px 24px; }

/* ---- Stats Row ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--text-1); letter-spacing: -.5px; }
.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-value.danger { color: var(--danger); }
.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---- Dashboard Cards ---- */
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.dash-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.dash-card.full { grid-column: 1 / -1; }
.dash-card h3 { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 16px; }
.table-mini { max-height: 340px; overflow-y: auto; }
.table-mini table { width: 100%; }
.table-mini td, .table-mini th { padding: 6px 10px; font-size: 12px; }

/* ---- Tables ---- */
.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-header { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.table-header h3 { font-size: 15px; font-weight: 600; }
.table-actions { display: flex; align-items: center; gap: 12px; }
.table-search {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 12px; outline: none; width: 180px; font-family: inherit;
}
.table-search:focus { border-color: var(--accent); }
.count { font-size: 12px; color: var(--text-3); background: var(--bg); padding: 2px 10px; border-radius: 10px; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; transition: background .1s; }
tr.clickable:hover { background: var(--accent-light); }
.td-id { font-family: "SF Mono", "Fira Code", monospace; font-size: 12px; color: var(--accent); }
.td-addr { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-coord { font-family: "SF Mono","Fira Code",monospace; font-size: 11px; color: var(--text-3); }

/* ---- Pagination ---- */
.pagination { padding: 12px 20px; display: flex; justify-content: center; border-top: 1px solid var(--border); }
.pagination-inner { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 4px; background: var(--card);
  font-size: 13px; cursor: pointer; transition: all .15s; color: var(--text-1); font-family: inherit;
}
.page-btn:hover:not(.disabled):not(.active) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn.disabled { opacity: .3; cursor: not-allowed; }
.page-ellipsis { padding: 0 4px; color: var(--text-3); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-online  { background: var(--success-bg); color: var(--success); }
.badge-offline { background: var(--danger-bg);  color: var(--danger); }
.badge-active  { background: var(--success-bg); color: var(--success); }
.badge-charging    { background: var(--accent-light); color: var(--accent); }
.badge-charged     { background: var(--success-bg);   color: var(--success); }
.badge-idle        { background: var(--bg);            color: var(--text-3); }
.badge-discharging { background: var(--warning-bg);    color: var(--warning); }
.badge-fault       { background: var(--danger-bg);     color: var(--danger); }
.badge-available   { background: var(--success-bg);    color: var(--success); }
.badge-disabled    { background: var(--bg);            color: var(--text-3); }

/* ---- Info Section ---- */
.info-section { margin-bottom: 20px; }
.info-section .info-card { max-width: 500px; }
.info-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.info-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--text-2); }
.info-rows { }
.info-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--bg); }
.info-row:last-child { border-bottom: none; }
.info-row .ir-label { color: var(--text-2); }
.info-row .ir-value { font-weight: 500; }

/* ---- Section ---- */
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text-1); }

/* ---- Utilities ---- */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-3); font-size: 14px; }
.empty { text-align: center; padding: 40px; color: var(--text-3); }

/* ======== Fault Type Styles ======== */

/* Severity Badges */
.badge-p0 { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-p1 { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.badge-p2 { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-p3 { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

.badge-scope-cabinet { background: #eff6ff; color: #2563eb; }
.badge-scope-grid    { background: #faf5ff; color: #7c3aed; }
.badge-scope-battery { background: #ecfdf5; color: #059669; }

/* Severity Stat Cards */
.severity-card.p0 { border-left: 3px solid #dc2626; }
.severity-card.p1 { border-left: 3px solid #ea580c; }
.severity-card.p2 { border-left: 3px solid #d97706; }
.severity-card.p3 { border-left: 3px solid #16a34a; }
.severity-card.p0 .stat-value { color: #dc2626; }
.severity-card.p1 .stat-value { color: #ea580c; }
.severity-card.p2 .stat-value { color: #d97706; }
.severity-card.p3 .stat-value { color: #16a34a; }

/* Fault Layout */
.fault-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }

.fault-sidebar-panel {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
  position: sticky; top: 0;
  max-height: calc(100vh - 200px); overflow-y: auto;
}

.panel-title { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }

/* Category List */
.category-list { display: flex; flex-direction: column; gap: 2px; }
.category-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; transition: all .15s; }
.category-item:hover { background: var(--bg); }
.category-item.active { background: var(--accent-light); }
.category-item.active .cat-name { color: var(--accent); font-weight: 600; }

.cat-icon-wrap { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg); color: var(--text-2); }
.category-item.active .cat-icon-wrap { background: var(--accent); color: #fff; }

.cat-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cat-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count { font-size: 11px; color: var(--text-3); }

/* Top Faults */
.top-faults-list { display: flex; flex-direction: column; gap: 8px; }
.top-fault-item { font-size: 12px; }
.tf-header { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.tf-rank { width: 18px; height: 18px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--text-2); flex-shrink: 0; }
.tf-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-1); }
.tf-bar-wrap { display: flex; align-items: center; gap: 6px; }
.tf-bar { height: 4px; background: var(--accent); border-radius: 2px; min-width: 4px; transition: width .3s; }
.tf-count { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* Fault Toolbar */
.fault-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.fault-search-box { position: relative; flex: 1; min-width: 200px; }
.fault-search-box .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.fault-search-box input { width: 100%; padding: 7px 10px 7px 30px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; background: var(--card); font-family: inherit; transition: all .15s; }
.fault-search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.fault-filters { display: flex; gap: 8px; }
.fault-filters select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-family: inherit; background: var(--card); color: var(--text-1); outline: none; cursor: pointer; }

/* Sub-categories */
.sub-categories { display: none; padding-left: 12px; }
.category-item.active + .sub-categories,
.sub-categories.expanded { display: flex; flex-direction: column; gap: 1px; animation: slideDown .2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.sub-item { padding: 5px 10px 5px 14px; }
.sub-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; margin-top: 5px; }
.sub-item.active .sub-dot { background: var(--accent); }
.cat-expand { color: var(--text-3); margin-left: auto; flex-shrink: 0; transition: transform .2s; }
.category-item.active .cat-expand { transform: rotate(180deg); color: var(--accent); }

/* Fault Cards */
.fault-card-list { display: flex; flex-direction: column; gap: 12px; }
.fault-card { background: var(--card); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); cursor: pointer; transition: all .2s; border: 1px solid transparent; }
.fault-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-1px); }
.fc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.fc-title-wrap { min-width: 0; }
.fc-title { font-size: 15px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-id { font-size: 11px; color: var(--text-3); font-family: monospace; }
.fc-badges { display: flex; gap: 6px; flex-shrink: 0; }
.fc-category { font-size: 12px; color: var(--accent); margin-bottom: 8px; font-weight: 500; }
.fc-symptoms { font-size: 13px; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fc-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.fc-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.tag-remote { background: #dbeafe; color: #1d4ed8; }
.tag-parts  { background: #fef3c7; color: #92400e; }
.tag-noparts { background: #ecfdf5; color: #065f46; }
.tag-power  { background: #fef2f2; color: #991b1b; }
.fc-stats-row { display: flex; gap: 10px; align-items: center; }
.fc-stat { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.fc-stat svg { opacity: .6; }
.fc-stat-warn { color: var(--danger); font-weight: 600; }
.fc-stat-warn svg { opacity: 1; }

/* Fault Detail */
.fd-header-bar { background: var(--card); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 16px; }
.fd-title-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 8px; }
.fd-title-row h2 { font-size: 20px; font-weight: 700; margin: 0; }
.fd-badges { display: flex; gap: 6px; }
.fd-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fd-id { font-size: 12px; color: var(--text-3); font-family: monospace; }
.fd-category { font-size: 13px; color: var(--accent); font-weight: 500; }
.fd-section { padding: 8px 0; }
.fd-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.fd-text { font-size: 13px; line-height: 1.6; color: var(--text-1); }
.fd-stars { color: #f59e0b; letter-spacing: 2px; }

/* Procedure Steps */
.fd-procedure-card { margin-bottom: 16px; }
.fd-procedure { display: flex; flex-direction: column; gap: 8px; }
.fd-step { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 6px; }
.fd-step-no { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.fd-step-text { font-size: 13px; line-height: 1.5; padding-top: 2px; }

/* Warning Card */
.fd-warning-card { border-left: 3px solid var(--danger); background: #fef2f2 !important; margin-bottom: 16px; }
.fd-warnings { list-style: none; padding: 0; }
.fd-warnings li { padding: 6px 0; font-size: 13px; color: #991b1b; padding-left: 20px; position: relative; }
.fd-warnings li::before { content: '⚠'; position: absolute; left: 0; }

/* Fault Detail Table */
.fd-table { width: 100%; border-collapse: collapse; }
.fd-table th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--bg); border-bottom: 1px solid var(--border); }
.fd-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }

/* Skills */
.fd-skills { display: flex; flex-wrap: wrap; gap: 8px; }
.fd-skill { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg); border-radius: 6px; font-size: 13px; }
.fd-skill-required { border: 1px solid var(--accent); background: var(--accent-light); }
.fd-skill-name { font-weight: 500; }
.fd-skill-level { font-size: 11px; color: var(--text-3); }

/* Escalation Arrow */
.fd-esc-arrow-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.fd-esc-window { font-size: 10px; color: var(--warning); font-weight: 600; white-space: nowrap; }
.fd-esc-intro { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }

/* KPI Row */
.fd-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.fd-kpi { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-align: center; }
.fd-kpi-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.fd-kpi-value { font-size: 20px; font-weight: 700; color: var(--text-1); }
.fd-kpi-value.danger { color: var(--danger); }

/* Escalation Chain */
.fd-escalation-card { border-left: 3px solid var(--warning); margin-bottom: 16px; }
.fd-escalation-list { display: flex; flex-direction: column; gap: 12px; }
.fd-escalation-item { background: var(--bg); border-radius: 6px; padding: 14px 16px; }
.fd-esc-flow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.fd-esc-from { font-size: 13px; font-weight: 600; color: var(--text-1); padding: 4px 10px; background: var(--card); border-radius: 4px; border: 1px solid var(--border); }
.fd-esc-arrow { color: var(--warning); flex-shrink: 0; }
.fd-esc-to { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.fd-esc-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 6px; }
.fd-esc-meta { display: flex; align-items: center; gap: 8px; }
.fd-esc-conf { font-size: 11px; color: var(--text-3); }

/* Detail Grid */
.detail-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-bottom: 16px; }

/* Full-width detail cards */
.fd-procedure-card,
.fd-warning-card,
.fd-escalation-card { max-width: none; }

/* Ticket warn cell */
.td-warn { color: var(--danger); font-weight: 600; }

/* Keywords */
.fd-keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.fd-keyword { display: inline-block; padding: 3px 10px; background: var(--bg); border-radius: 20px; font-size: 12px; color: var(--text-2); border: 1px solid var(--border); }

/* ======== Ops Personnel Styles ======== */

.ops-stat-on { border-left: 3px solid var(--success); }
.ops-stat-off { border-left: 3px solid var(--text-3); }
.ops-stat-leave { border-left: 3px solid var(--warning); }
.stat-card .stat-value.warning { color: var(--warning); }

.badge-ops-role { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.ops-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px; padding: 20px;
}

.ops-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 18px;
  cursor: pointer; transition: all .2s;
}
.ops-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-2px); }

.ops-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ops-avatar { flex-shrink: 0; border-radius: 50%; overflow: hidden; width: 40px; height: 40px; }
.ops-card-info { flex: 1; min-width: 0; }
.ops-card-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ops-card-id { font-size: 11px; color: var(--text-3); font-family: monospace; font-weight: 400; }
.ops-card-role { display: flex; gap: 4px; margin-top: 4px; }

.ops-status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-3);
}
.ops-status-dot.ops-status-on { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.ops-status-dot.ops-status-off { background: var(--text-3); }
.ops-status-dot.ops-status-leave { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }

.ops-card-body { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ops-card-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }
.ops-card-label { color: var(--text-3); flex-shrink: 0; }

.ops-card-certs { display: flex; flex-wrap: wrap; gap: 4px; }
.ops-cert-tag {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 10px; font-weight: 500; background: var(--bg);
  color: var(--text-2); border: 1px solid var(--border);
}

/* Personnel Detail */
.ops-detail-header {
  display: flex; align-items: center; gap: 20px;
  background: var(--card); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.ops-detail-avatar { flex-shrink: 0; border-radius: 50%; overflow: hidden; width: 64px; height: 64px; }
.ops-detail-title h2 { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.ops-detail-badges { display: flex; gap: 8px; align-items: center; }

.ops-status-inline {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 2px 10px;
  border-radius: 10px;
}
.ops-status-inline.ops-status-on { background: var(--success-bg); color: var(--success); }
.ops-status-inline.ops-status-off { background: var(--bg); color: var(--text-3); }
.ops-status-inline.ops-status-leave { background: var(--warning-bg); color: var(--warning); }
.ops-status-inline::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-grid .info-card { max-width: none; }

.ops-district-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ops-district-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 20px; font-size: 13px;
  background: var(--accent-light); color: var(--accent);
  font-weight: 500; border: 1px solid #bfdbfe;
}

.ops-cert-tags-detail { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ops-cert-tag-detail {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: #faf5ff; color: #7c3aed; border: 1px solid #ddd6fe;
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-row { grid-template-columns: 1fr; }
  .fault-layout { grid-template-columns: 1fr; }
  .fault-sidebar-panel { position: static; max-height: none; }
  .fd-rule-body { grid-template-columns: 1fr; }
  .fd-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .fd-esc-flow { flex-direction: column; align-items: flex-start; }
  .ops-card-grid { grid-template-columns: 1fr; }
  .ops-detail-header { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .fd-kpi-row { grid-template-columns: 1fr; }
  .fc-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}
