.ann-badge {
    display: inline-block;
    vertical-align: top;
    background: rgb(255, 173, 20);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    padding: 0px 4px;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    position: absolute;
    top: -8px;
    right: -4px;
    z-index: 9000;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ann-badge:hover {
    filter: brightness(1.1);
}

.ann-badge-h1 {
    position: static;
    display: inline-block;
    vertical-align: super;
    margin-left: 8px;
    top: auto;
    right: auto;
}

.ann-panel {
    position: fixed;
    z-index: 9999;
    width: 450px;
    background: #fefefe;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
    overflow: hidden;
    user-select: text;
}

.ann-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fefefe;
    border-bottom: 1px solid #e5e7eb;
    cursor: move;
}

.ann-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.ann-panel-title-badge {
    display: inline-block;
    background: rgb(255, 173, 20);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    padding: 0px 4px;
    border-radius: 2px;
    vertical-align: middle;
}

.ann-panel-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #9ca3af;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
    padding: 0;
}

.ann-panel-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.ann-panel-body {
    padding: 16px;
    max-height: 520px;
    overflow-y: auto;
    line-height: 1.6;
    color: #374151;
    font-size: 13px;
}

.ann-panel-body::-webkit-scrollbar {
    width: 6px;
}

.ann-panel-body::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.ann-panel-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ann-panel-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.ann-md h1 {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 16px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

.ann-md h2 {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 12px 0 6px 0;
}

.ann-md h3 {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 10px 0 4px 0;
}

.ann-md p {
    margin-bottom: 12px;
}

.ann-md ul,
.ann-md ol {
    margin: 4px 0 12px 0;
    padding-left: 20px;
}

.ann-md li {
    margin-bottom: 4px;
}

.ann-md ul ul,
.ann-md ol ol,
.ann-md ul ol,
.ann-md ol ul {
    margin-top: 4px;
    margin-bottom: 4px;
}

.ann-md blockquote {
    border-left: 3px solid #d1d5db;
    margin: 8px 0 12px 0;
    padding: 8px 12px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 12px;
}

.ann-md blockquote p {
    margin-bottom: 4px;
}

.ann-md code {
    background: #f3f4f6;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    color: #1f2937;
}

.ann-md pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 11px;
    line-height: 1.5;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    margin: 8px 0 12px 0;
}

.ann-md pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.ann-md table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 12px 0;
    font-size: 12px;
}

.ann-md th {
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
    padding: 6px 8px;
    text-align: left;
    border: 1px solid #e5e7eb;
}

.ann-md td {
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    color: #374151;
}

.ann-md strong {
    font-weight: 700;
    color: #111827;
}

.ann-md em {
    color: #6b7280;
    font-style: italic;
}

.ann-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}

.ann-tag-role {
    background: #dbeafe;
    color: #1d4ed8;
}

.ann-tag-module {
    background: #e0e7ff;
    color: #4338ca;
}

.ann-tag-status {
    background: #ecfdf5;
    color: #059669;
}

.ann-tag-flow {
    background: #fef3c7;
    color: #d97706;
}

.ann-tag-risk {
    background: #fef2f2;
    color: #dc2626;
}

.ann-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.ann-dot-green {
    background: #10b981;
}

.ann-dot-red {
    background: #ef4444;
}

.ann-dot-orange {
    background: #f59e0b;
}

.ann-dot-blue {
    background: #3b82f6;
}

.ann-dot-purple {
    background: #8b5cf6;
}

.ann-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.ann-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ann-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ann-kv-row {
    display: flex;
    margin-bottom: 6px;
    font-size: 12px;
}

.ann-kv-label {
    font-weight: 600;
    color: #6b7280;
    min-width: 72px;
    flex-shrink: 0;
}

.ann-kv-value {
    color: #374151;
    flex: 1;
}

.ann-flow-diagram {
    background: #1f2937;
    color: #e5e7eb;
    padding: 10px 12px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 10px;
    line-height: 1.4;
    white-space: pre;
    overflow-x: auto;
    margin: 8px 0 12px 0;
}

.ann-highlight {
    background: #fef3c7;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 600;
}

.ann-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 12px 0;
    font-size: 12px;
}

.ann-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
    padding: 6px 8px;
    text-align: left;
    border: 1px solid #e5e7eb;
}

.ann-table td {
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    color: #374151;
}

.ann-section-desc {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.ann-formula {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #1e40af;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
}

.ann-md-ul {
    margin: 4px 0 12px 0;
    padding-left: 20px;
}

.ann-md-ul li {
    margin-bottom: 6px;
    font-size: 12px;
    color: #374151;
    line-height: 1.6;
}

.ann-md-ul li strong {
    font-weight: 700;
    color: #111827;
}