* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f7f9fc;
    color: #1f2937;
}
.header {
    background: #0f172a;
    color: white;
    padding: 18px 28px;
}
.header h1 { margin: 0; font-size: 25px; }
.header p { margin: 5px 0 0; color: #cbd5e1; }
.nav {
    background: #111827;
    padding: 10px 28px;
}
.nav a {
    color: #e5e7eb;
    margin-right: 20px;
    text-decoration: none;
    font-weight: 600;
}
.layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: calc(100vh - 110px);
}
.sidebar {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: calc(100vh - 110px);
    overflow-y: auto;
}
.sidebar h3 { margin: 6px 8px 12px; }
.side-link {
    display: block;
    padding: 9px 10px;
    margin: 3px 0;
    border-radius: 9px;
    text-decoration: none;
    color: #334155;
    font-size: 14px;
}
.side-link:hover { background: #eff6ff; color: #1d4ed8; }
.side-link.active { background: #2563eb; color: white; font-weight: 700; }
.main {
    padding: 24px;
    max-width: 1400px;
}
.card {
    background: white;
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 20px;
    border: 1px solid #dbe3ef;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.process-title {
    font-size: 34px;
    line-height: 1.15;
    margin: 12px 0 10px;
}
.code { font-weight: 800; color: #1d4ed8; }
.badge {
    display: inline-block;
    background: #e8eef6;
    color: #475569;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 14px;
    margin-right: 5px;
}
.definition {
    font-size: 20px;
    line-height: 1.55;
    color: #334155;
    margin: 24px 0;
}
.tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
    margin: 0 0 22px;
}
.tab {
    display: block;
    text-align: center;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #cfd9e8;
    border-radius: 14px;
    text-decoration: none;
    color: #0f172a;
    font-weight: 800;
    font-size: 18px;
}
.tab.active, .tab:hover {
    background: #fff4df;
    border: 2px solid #0b70e0;
    padding: 13px 17px;
}
.two-col {
    display: grid;
    grid-template-columns: minmax(520px, 1.15fr) minmax(360px, 0.85fr);
    gap: 24px;
    align-items: start;
}
.workflow-title {
    font-size: 26px;
    margin: 6px 0 18px;
}
.workflow-row {
    display: grid;
    grid-template-columns: 190px 260px 190px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.flow-node {
    background: #e7f1ff;
    border: 1px solid #aad0ff;
    border-radius: 14px;
    padding: 14px 16px;
    text-align: center;
    font-size: 18px;
}
.flow-label {
    background: #eaf8ef;
    border: 1px solid #afe3c3;
    border-radius: 14px;
    padding: 14px 16px;
    text-align: center;
    font-size: 18px;
}
.summary-card {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}
.summary-card h3 {
    margin: 0 0 10px;
    font-size: 24px;
}
.kpi-line {
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.kpi {
    font-size: 48px;
    font-weight: 900;
    color: #0f172a;
}
.small { color: #64748b; font-size: 15px; }
.section-title {
    margin-top: 0;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}
.list { list-style: none; padding-left: 0; margin: 0; }
.list li {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 16px;
}
.list a { text-decoration: none; color: #1d4ed8; }
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}
.index-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
}
.searchbox input {
    padding: 12px;
    width: 70%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}
.searchbox button {
    padding: 12px 18px;
    border: 0;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    font-weight: 700;
}
.footer {
    margin: 40px 0 20px;
    color: #64748b;
    text-align: center;
    font-size: 13px;
}
@media (max-width: 1100px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid #e5e7eb; }
    .two-col { grid-template-columns: 1fr; }
    .workflow-row { grid-template-columns: 1fr; }
    .tabs { grid-template-columns: 1fr; }
}
/* v6 formula display */
.formula-box {
    margin-top: 12px;
    padding: 12px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    color: #7c2d12;
    line-height: 1.45;
}
.formula-box-main {
    margin: 18px 0;
    font-size: 17px;
}
.formula-label {
    font-weight: 900;
    color: #9a3412;
    margin-bottom: 6px;
}
.unit-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    color: #075985;
}

/* v9 metric hierarchy audit */
.audit-filter {
    margin-top: 16px;
}
.audit-filter select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
}
.audit-tree {
    display: grid;
    gap: 18px;
}
.audit-l1 {
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    padding: 16px;
    background: #ffffff;
}
.audit-l2 {
    margin-left: 22px;
    margin-top: 12px;
    border-left: 3px solid #e2e8f0;
    padding-left: 14px;
}
.audit-l3-list {
    margin-left: 22px;
    margin-top: 8px;
    display: grid;
    gap: 6px;
}
.audit-node {
    padding: 8px 10px;
    border-radius: 10px;
}
.audit-node-l1 {
    background: #e0f2fe;
    font-weight: 900;
}
.audit-node-l2 {
    background: #ecfdf5;
    font-weight: 800;
}
.audit-node-l3 {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.audit-warning {
    margin: 10px 0 0 22px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 800;
}
.audit-note {
    margin: 8px 0 0 22px;
    padding: 7px 10px;
    border-radius: 10px;
    background: #fff7ed;
    color: #9a3412;
}
.audit-table {
    width: 100%;
    border-collapse: collapse;
}
.audit-table th,
.audit-table td {
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    padding: 8px;
}
.ok {
    color: #047857;
    font-weight: 800;
}


/* v13 right-side horizontal navigation pills - clean patch */
.breadcrumb.compact,
.breadcrumb {
    display: flex;
    gap: 7px;
    align-items: center;
    font-size: 13px;
    margin: 0 0 10px 0;
    padding: 0;
    background: transparent;
    border: 0;
    color: #64748b;
}
.breadcrumb a { font-weight: 800; text-decoration: none; }
.right-summary { min-width: 0; }
.summary-pill-card { overflow: hidden; }
.summary-pill-card h3 { margin-bottom: 6px; }
.summary-pill-wrap { margin-top: 12px; min-width: 0; }
.pill-section {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px;
    background: #ffffff;
    max-width: 100%;
    overflow: hidden;
    margin: 10px 0;
}
.summary-pill-wrap .pill-section,
.pill-section.compact-pills {
    border: 0;
    padding: 0;
    background: transparent;
    margin: 0;
}
.summary-pill-wrap .pill-title,
.pill-section.compact-pills .pill-title { display: none; }
.pill-title { font-weight: 900; margin-bottom: 8px; }
.pill-title span { color: #64748b; }
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    max-width: 100%;
    overflow: hidden;
}
.kg-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
    text-decoration: none;
    color: #1d4ed8;
    white-space: nowrap;
}
.kg-pill:hover { background: #eff6ff; border-color: #93c5fd; }
.pill-empty { color: #94a3b8; font-size: 13px; }
.metric-context-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
    margin: 12px 0;
}
.linked-from {
    display: inline-block;
    margin: 0 0 12px 0;
    padding: 8px 10px;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    font-size: 13px;
    font-weight: 800;
}
.muted { color: #94a3b8; }
@media (max-width: 1100px) {
    .right-summary { width: 100%; }
    .metric-context-compact { grid-template-columns: 1fr; }
}
