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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    line-height: 1.6;
}

.navbar {
    background: #2d3436;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.text-muted {
    color: #636e72;
    font-size: 14px;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card h2 {
    font-size: 20px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #2d3436;
}

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #0984e3;
    box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.1);
}

.form-row {
    display: flex;
    gap: 16px;
}

fieldset {
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

legend {
    font-weight: 600;
    font-size: 15px;
    padding: 0 8px;
    color: #2d3436;
}

.help-text {
    font-size: 13px;
    color: #636e72;
    margin-bottom: 12px;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    color: #2d3436;
    background: #fff;
    transition: all 0.15s;
}

.btn:hover {
    background: #f5f6fa;
}

.btn-primary {
    background: #0984e3;
    color: #fff;
    border-color: #0984e3;
}

.btn-primary:hover {
    background: #0773c5;
}

.btn-danger {
    color: #d63031;
    border-color: #d63031;
}

.btn-danger:hover {
    background: #d63031;
    color: #fff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 32px;
    font-size: 16px;
}

.btn-loading {
    opacity: 0.7;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.table th {
    font-weight: 600;
    color: #636e72;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-sm th,
.table-sm td {
    padding: 6px 8px;
    font-size: 13px;
}

.table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-summary {
    border-left: 4px solid #0984e3;
}

.summary-text {
    font-size: 16px;
    line-height: 1.7;
    color: #2d3436;
}

.finding {
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #ddd;
}

.finding-visibility_drop { border-left-color: #d63031; }
.finding-ranking_decay { border-left-color: #e17055; }
.finding-ctr_decline { border-left-color: #fdcb6e; }
.finding-engagement_decline { border-left-color: #a29bfe; }
.finding-cannibalization { border-left-color: #6c5ce7; }
.finding-technical_issue { border-left-color: #00b894; }

.finding-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-visibility_drop { background: #ffeaa7; color: #d63031; }
.badge-ranking_decay { background: #fab1a0; color: #6c3100; }
.badge-ctr_decline { background: #ffeaa7; color: #856404; }
.badge-engagement_decline { background: #dfe6e9; color: #6c5ce7; }
.badge-cannibalization { background: #e4dfff; color: #6c5ce7; }
.badge-technical_issue { background: #d4f5ed; color: #00765a; }

.badge-confidence-high { background: #d4f5ed; color: #00765a; }
.badge-confidence-medium { background: #ffeaa7; color: #856404; }
.badge-confidence-low { background: #fab1a0; color: #d63031; }

.badge-priority-high { background: #d63031; color: #fff; }
.badge-priority-medium { background: #fdcb6e; color: #6c3100; }
.badge-priority-low { background: #dfe6e9; color: #636e72; }

.finding-impact {
    font-size: 13px;
    font-weight: 500;
    color: #636e72;
}

.finding-description {
    font-size: 14px;
    margin-bottom: 8px;
}

.finding-details {
    margin-top: 8px;
}

.finding-details summary {
    cursor: pointer;
    font-size: 13px;
    color: #0984e3;
    font-weight: 500;
}

.finding-data {
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.finding-data pre {
    font-size: 12px;
    background: #f5f6fa;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
}

.explanation {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.explanation:last-child {
    border-bottom: none;
}

.explanation h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.recommendation {
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 12px;
}

.recommendation-high { border-left: 4px solid #d63031; }
.recommendation-medium { border-left: 4px solid #fdcb6e; }
.recommendation-low { border-left: 4px solid #dfe6e9; }

.rec-header {
    margin-bottom: 8px;
}

.rec-action {
    font-size: 15px;
    margin-bottom: 4px;
}

.rec-rationale {
    font-size: 13px;
    color: #636e72;
}

.act-now-card {
    border-left: 4px solid #d63031;
}

.act-now-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.act-now-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: background 0.15s;
}

.act-now-item:hover {
    background: #f8f9fa;
}

.act-now-item.priority-P1 {
    border-left: 4px solid #d63031;
}

.act-now-item.priority-P2 {
    border-left: 4px solid #e17055;
}

.act-now-item.priority-P3 {
    border-left: 4px solid #fdcb6e;
}

.act-now-item.priority-P4 {
    border-left: 4px solid #dfe6e9;
}

.act-now-rank {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 48px;
}

.rank-number {
    font-size: 18px;
    font-weight: 700;
    color: #2d3436;
}

.act-now-content {
    flex: 1;
    min-width: 0;
}

.act-now-url {
    font-size: 14px;
    font-weight: 600;
    color: #0984e3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.act-now-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.issue-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.issue-tag.primary {
    background: #fab1a0;
    color: #6c3100;
}

.issue-tag.secondary {
    background: #dfe6e9;
    color: #636e72;
}

.metric-change {
    font-size: 12px;
    font-weight: 600;
}

.metric-change.negative {
    color: #d63031;
}

.metric-change.positive {
    color: #00b894;
}

.negative {
    color: #d63031;
    font-weight: 600;
}

.positive {
    color: #00b894;
    font-weight: 600;
}

.act-now-action {
    font-size: 13px;
    color: #636e72;
}

.act-now-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.score-value {
    font-size: 20px;
    font-weight: 700;
    color: #2d3436;
}

.score-label {
    font-size: 11px;
    color: #636e72;
    text-transform: uppercase;
}

.badge-priority-p1 { background: #d63031; color: #fff; }
.badge-priority-p2 { background: #e17055; color: #fff; }
.badge-priority-p3 { background: #fdcb6e; color: #6c3100; }
.badge-priority-p4 { background: #dfe6e9; color: #636e72; }

.matrix-table td.url-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0984e3;
    font-weight: 500;
}

.matrix-row-P1 {
    background: #fff5f5;
}

.matrix-row-P2 {
    background: #fff9f0;
}

.cluster-card {
    border: 1px solid #e4dfff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    border-left: 4px solid #6c5ce7;
}

.cluster-header {
    margin-bottom: 8px;
    font-size: 14px;
}

.cluster-queries {
    margin-bottom: 8px;
}

.query-tag {
    display: inline-block;
    background: #f5f6fa;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px 4px 2px 0;
    color: #2d3436;
}

.cluster-urls {
    font-size: 13px;
}

.cluster-url {
    padding: 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cluster-url.primary-url {
    color: #00b894;
}

.cluster-url.secondary-url {
    color: #636e72;
}

.url-role {
    font-weight: 600;
    font-size: 12px;
    margin-right: 4px;
}

.target-url-tag {
    display: inline-block;
    background: #e8f4fd;
    color: #0984e3;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin: 4px 4px 0 0;
    font-weight: 500;
}

.rec-targets {
    margin-top: 8px;
}

.nav-link {
    color: #b2bec3;
    text-decoration: none;
    font-size: 14px;
    margin-left: 24px;
}

.nav-link:hover {
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid #0984e3;
    color: #0984e3;
}

.btn-outline:hover {
    background: #e8f4fd;
}

.evidence-details,
.decision-trace-details {
    margin-top: 4px;
    margin-bottom: 8px;
}

.evidence-toggle,
.trace-toggle {
    cursor: pointer;
    font-size: 13px;
    color: #6c5ce7;
    font-weight: 500;
    padding: 4px 0;
}

.evidence-toggle:hover,
.trace-toggle:hover {
    color: #5b4cdb;
}

.evidence-content,
.trace-content {
    margin-top: 8px;
    padding: 12px 16px;
    background: #f8f9ff;
    border: 1px solid #e4dfff;
    border-radius: 6px;
    font-size: 13px;
}

.evidence-section {
    margin-bottom: 12px;
}

.evidence-section:last-child {
    margin-bottom: 0;
}

.evidence-section h4 {
    font-size: 13px;
    color: #6c5ce7;
    margin-bottom: 4px;
    font-weight: 600;
}

.evidence-section ul {
    margin: 0;
    padding-left: 20px;
}

.evidence-section li {
    margin-bottom: 2px;
    font-size: 13px;
}

.evidence-section code {
    background: #f0edff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.evidence-basis {
    font-size: 13px;
    margin-top: 6px;
    padding: 4px 8px;
    background: #f8f9ff;
    border-left: 3px solid #6c5ce7;
    border-radius: 0 4px 4px 0;
}

.trace-content p {
    margin-bottom: 6px;
    font-size: 13px;
}

.trace-table {
    margin-top: 8px;
}

.trace-table th,
.trace-table td {
    padding: 4px 8px;
    font-size: 12px;
}

.rule-id-badge {
    display: inline-block;
    background: #e4dfff;
    color: #6c5ce7;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    font-family: monospace;
}

.inline-trace {
    display: inline;
}

.inline-trace summary {
    cursor: pointer;
    color: #6c5ce7;
    font-size: 12px;
    font-weight: 500;
}

.inline-trace-content {
    position: absolute;
    background: #fff;
    border: 1px solid #e4dfff;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10;
    max-width: 400px;
    font-size: 12px;
    right: 20px;
}

.inline-trace-content p {
    margin-bottom: 4px;
}

.methodology-section {
    margin-bottom: 24px;
}

.methodology-section h3 {
    font-size: 17px;
    margin-bottom: 12px;
    color: #2d3436;
}

.methodology-section ol,
.methodology-section ul {
    padding-left: 24px;
    margin-bottom: 12px;
}

.methodology-section li {
    margin-bottom: 6px;
    font-size: 14px;
}

.ai-boundaries {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.ai-allowed {
    background: #d4f5ed;
    padding: 16px;
    border-radius: 8px;
}

.ai-forbidden {
    background: #ffeaa7;
    padding: 16px;
    border-radius: 8px;
}

.ai-allowed h3 {
    color: #00765a;
}

.ai-forbidden h3 {
    color: #856404;
}

.rule-category {
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.rule-card {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #6c5ce7;
}

.rule-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.rule-id {
    display: inline-block;
    background: #e4dfff;
    color: #6c5ce7;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: monospace;
}

.rule-detail-table td {
    vertical-align: top;
    padding: 6px 10px;
    font-size: 13px;
}

.rule-detail-table td:first-child {
    width: 140px;
    white-space: nowrap;
}

.rule-detail-table code {
    background: #f0edff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    word-break: break-word;
    white-space: normal;
}

.compact-list {
    margin: 0;
    padding-left: 16px;
}

.compact-list li {
    font-size: 13px;
    margin-bottom: 2px;
}

.formula-block {
    background: #f0edff;
    padding: 12px 16px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    color: #6c5ce7;
    margin: 12px 0;
    text-align: center;
}

.finding-fragment_urls { border-left-color: #e84393; }
.badge-fragment_urls { background: #fce4ec; color: #c2185b; }

.blueprint-section {
    border-left: 4px solid #6c5ce7;
}

.blueprint-card {
    border: 1px solid #e4dfff;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.blueprint-card.priority-P1 {
    border-left: 5px solid #d63031;
}

.blueprint-card.priority-P2 {
    border-left: 5px solid #e17055;
}

.blueprint-header {
    background: #f8f9ff;
    padding: 14px 20px;
    border-bottom: 1px solid #e4dfff;
}

.blueprint-url-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.blueprint-url {
    font-size: 15px;
    font-weight: 600;
    color: #0984e3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.blueprint-score {
    font-size: 13px;
    font-weight: 600;
    color: #636e72;
}

.blueprint-body {
    padding: 16px 20px;
}

.blueprint-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.blueprint-block {
    margin-bottom: 16px;
}

.blueprint-label {
    font-size: 13px;
    font-weight: 600;
    color: #6c5ce7;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.blueprint-intent-value {
    font-size: 15px;
    font-weight: 600;
    color: #2d3436;
    padding: 6px 12px;
    background: #f0edff;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 4px;
}

.blueprint-role {
    font-size: 13px;
    margin-bottom: 8px;
}

.blueprint-competing-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.competing-url-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 4px 0;
}

.competing-role-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.competing-role-badge.primary {
    background: #d4f5ed;
    color: #00765a;
}

.competing-role-badge.secondary {
    background: #ffeaa7;
    color: #856404;
}

.competing-url-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.fragment-url-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fragment-url-entry {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fragment-url-entry code {
    background: #fce4ec;
    color: #c2185b;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.blueprint-actions-table td {
    font-size: 13px;
    white-space: normal;
    max-width: none;
}

.blueprint-actions-table th {
    font-size: 12px;
}

.domain-flag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.domain-content {
    background: #e8f4fd;
    color: #0984e3;
}

.domain-technical {
    background: #d4f5ed;
    color: #00765a;
}

.domain-internal-linking {
    background: #e4dfff;
    color: #6c5ce7;
}

.domain-ux {
    background: #ffeaa7;
    color: #856404;
}

.domain-summary-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.blueprint-verification-note {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 13px;
    color: #856404;
    font-weight: 500;
}

.confidence-safeguard {
    background: #fff3cd;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    margin: 4px 0;
}

.auth-body {
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.auth-logo {
    font-size: 20px;
    font-weight: 700;
    color: #6c5ce7;
    margin-bottom: 24px;
    text-align: center;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 4px;
    text-align: center;
}

.auth-subtitle {
    font-size: 14px;
    color: #636e72;
    text-align: center;
    margin-bottom: 24px;
}

.auth-form-group {
    margin-bottom: 16px;
}

.auth-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #2d3436;
    margin-bottom: 6px;
}

.auth-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.otp-input {
    text-align: center;
    font-size: 28px !important;
    letter-spacing: 8px;
    font-weight: 700;
    padding: 14px !important;
}

.auth-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    background: #6c5ce7;
    border-color: #6c5ce7;
}

.auth-btn:hover {
    background: #5b4cdb;
    border-color: #5b4cdb;
}

.auth-error {
    background: #fff5f5;
    border: 1px solid #fab1a0;
    color: #d63031;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.auth-success {
    background: #d4f5ed;
    border: 1px solid #00b894;
    color: #00765a;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.auth-resend-form {
    margin-top: 16px;
    text-align: center;
}

.auth-resend-btn {
    font-size: 13px;
    color: #6c5ce7;
    border-color: #6c5ce7;
}

.auth-resend-btn:hover {
    background: #f0edff;
}

.auth-back-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: #636e72;
    text-decoration: none;
}

.auth-back-link:hover {
    color: #2d3436;
}

.auth-footer {
    text-align: center;
    color: #b2bec3;
    font-size: 12px;
    margin-top: 16px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    color: #b2bec3;
    font-size: 13px;
}

.nav-logout-form {
    display: inline;
}

.nav-logout-btn {
    background: transparent;
    border: 1px solid #636e72;
    color: #b2bec3;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
}

.nav-logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    .container {
        padding: 16px 12px;
    }
    .act-now-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .act-now-rank {
        flex-direction: row;
        gap: 8px;
    }
    .ai-boundaries {
        grid-template-columns: 1fr;
    }
    .blueprint-grid {
        grid-template-columns: 1fr;
    }
}
