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

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
}

.header {
    background: #1a1a2e;
    color: #fff;
    padding: 2rem 0;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header p {
    color: #a0a0c0;
    margin-top: 0.25rem;
    font-size: 0.95rem;
}

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Index page */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1a1a2e;
}

.hero p {
    color: #555;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.search-form {
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    gap: 0;
}

.search-form input[type="url"] {
    flex: 1;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border: 2px solid #d0d0e0;
    border-right: none;
    border-radius: 8px 0 0 8px;
    outline: none;
    transition: border-color 0.2s;
}

.search-form input[type="url"]:focus {
    border-color: #4a6cf7;
}

.search-form button {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    background: #4a6cf7;
    color: #fff;
    border: 2px solid #4a6cf7;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background 0.2s;
}

.search-form button:hover {
    background: #3a5ce5;
    border-color: #3a5ce5;
}

/* Score badge */
.score-section {
    text-align: center;
    margin-bottom: 2rem;
}

.score-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 6px solid;
    margin-bottom: 0.75rem;
}

.score-badge .score-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.score-badge .score-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.grade-text {
    font-size: 1.25rem;
    font-weight: 700;
}

.score-badge.grade-a { border-color: #22c55e; color: #16a34a; }
.score-badge.grade-b { border-color: #84cc16; color: #65a30d; }
.score-badge.grade-c { border-color: #eab308; color: #ca8a04; }
.score-badge.grade-d { border-color: #f97316; color: #ea580c; }
.score-badge.grade-f { border-color: #ef4444; color: #dc2626; }

.grade-a { color: #16a34a; }
.grade-b { color: #65a30d; }
.grade-c { color: #ca8a04; }
.grade-d { color: #ea580c; }
.grade-f { color: #dc2626; }

.audited-url {
    color: #555;
    font-size: 0.9rem;
    word-break: break-all;
}

.audited-url a {
    color: #4a6cf7;
    text-decoration: none;
}

.audited-url a:hover {
    text-decoration: underline;
}

/* Breakdown bar */
.breakdown-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #e0e0e8;
    margin-bottom: 2rem;
}

.breakdown-bar .segment {
    transition: width 0.3s;
}

/* Category cards */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #d0d0e0;
}

.card.status-pass { border-left-color: #22c55e; }
.card.status-warn { border-left-color: #eab308; }
.card.status-fail { border-left-color: #ef4444; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-points {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: #f0f2f5;
}

.card-points.status-pass { background: #dcfce7; color: #16a34a; }
.card-points.status-warn { background: #fef9c3; color: #ca8a04; }
.card-points.status-fail { background: #fee2e2; color: #dc2626; }

.card-feedback {
    color: #555;
    font-size: 0.9rem;
}

.card-details {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f2f5;
    font-size: 0.85rem;
    color: #666;
}

.card-details ul {
    list-style: none;
    padding: 0;
}

.card-details li {
    padding: 0.2rem 0;
}

.card-details li::before {
    content: "\2022 ";
    color: #4a6cf7;
    font-weight: 700;
}

/* Recommendations */
.recommendations {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.recommendations h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.recommendations ol {
    padding-left: 1.25rem;
}

.recommendations li {
    padding: 0.35rem 0;
    font-size: 0.9rem;
    color: #555;
}

/* Back link */
.back-link {
    text-align: center;
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.back-link a {
    color: #4a6cf7;
    text-decoration: none;
    font-weight: 600;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Error page */
.error-box {
    text-align: center;
    padding: 3rem 1rem;
}

.error-box h2 {
    color: #dc2626;
    margin-bottom: 0.75rem;
}

.error-box p {
    color: #555;
    margin-bottom: 1.5rem;
}

/* Audit mode toggle */
.audit-mode-toggle {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
}

.mode-option input[type="radio"] {
    accent-color: #4a6cf7;
}

/* Progress page */
.progress-container {
    text-align: center;
    padding: 3rem 1rem;
}

.progress-container h2 {
    margin-bottom: 0.5rem;
}

.progress-track {
    width: 100%;
    max-width: 500px;
    height: 14px;
    background: #e0e0e8;
    border-radius: 7px;
    margin: 1.5rem auto;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a6cf7, #22c55e);
    border-radius: 7px;
    transition: width 0.4s ease;
}

.progress-status {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.page-log {
    max-height: 280px;
    overflow-y: auto;
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.page-log-entry {
    padding: 0.35rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-log-entry:last-child {
    border-bottom: none;
}

.page-log-score {
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 32px;
    text-align: center;
}

.page-log-url {
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Site results */
.site-meta {
    color: #888;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.pages-section {
    margin-top: 2rem;
}

.pages-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.pages-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.pages-table thead {
    background: #f7f8fa;
}

.pages-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pages-table td {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-top: 1px solid #f0f2f5;
}

.page-row:hover {
    background: #f7f8fa;
}

.page-score-badge {
    display: inline-block;
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 36px;
    text-align: center;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    background: #f0f2f5;
}

.page-score-badge.grade-a { background: #dcfce7; color: #16a34a; }
.page-score-badge.grade-b { background: #ecfccb; color: #65a30d; }
.page-score-badge.grade-c { background: #fef9c3; color: #ca8a04; }
.page-score-badge.grade-d { background: #ffedd5; color: #ea580c; }
.page-score-badge.grade-f { background: #fee2e2; color: #dc2626; }

.page-url-cell {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-url-cell a {
    color: #4a6cf7;
    text-decoration: none;
}

.page-url-cell a:hover {
    text-decoration: underline;
}

.worst-performers {
    margin-top: 2rem;
}

.worst-performers h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.worst-performers .card-header h3 {
    font-size: 0.9rem;
}

.worst-performers .card-header h3 a {
    color: #4a6cf7;
    text-decoration: none;
}

.worst-performers .card-header h3 a:hover {
    text-decoration: underline;
}

/* Wide container for data-heavy views */
.container-wide {
    max-width: 1200px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e0e0e8;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab:hover { color: #1a1a2e; }
.tab.active { color: #4a6cf7; border-bottom-color: #4a6cf7; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Export bar */
.export-bar {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.btn-export {
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid #d0d0e0;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover {
    border-color: #4a6cf7;
    color: #4a6cf7;
}

/* Status chips */
.status-summary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.status-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-2xx { background: #dcfce7; color: #16a34a; }
.status-3xx { background: #fef9c3; color: #ca8a04; }
.status-4xx { background: #fee2e2; color: #dc2626; }
.status-5xx { background: #fce4ec; color: #c62828; }
.status-err { background: #f3e5f5; color: #7b1fa2; }

/* Crawl data toolbar */
.crawl-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.crawl-filter {
    flex: 1;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    border: 1.5px solid #d0d0e0;
    border-radius: 6px;
    outline: none;
}

.crawl-filter:focus { border-color: #4a6cf7; }

.crawl-select {
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    border: 1.5px solid #d0d0e0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

/* Crawl data table */
.crawl-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.crawl-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.82rem;
    white-space: nowrap;
}

.crawl-table thead {
    background: #f7f8fa;
    position: sticky;
    top: 0;
}

.crawl-table th {
    padding: 0.55rem 0.7rem;
    text-align: left;
    font-weight: 600;
    color: #666;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #e0e0e8;
    user-select: none;
}

.crawl-table th.sortable { cursor: pointer; }
.crawl-table th.sortable:hover { color: #4a6cf7; }
.crawl-table th.sort-asc::after { content: " \25B2"; font-size: 0.65rem; }
.crawl-table th.sort-desc::after { content: " \25BC"; font-size: 0.65rem; }

.crawl-table td {
    padding: 0.45rem 0.7rem;
    border-top: 1px solid #f0f2f5;
}

.crawl-row { cursor: pointer; }
.crawl-row:hover { background: #f7f8fa; }

.crawl-url {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #4a6cf7;
}

.crawl-title {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.75rem;
}

.len-good { color: #16a34a; }
.len-warn { color: #ca8a04; }
.len-bad { color: #dc2626; }

/* Row detail panel */
.row-detail {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.row-detail h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: #4a6cf7;
    word-break: break-all;
}

.detail-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.35rem 1rem;
    font-size: 0.85rem;
}

.detail-label {
    font-weight: 600;
    color: #888;
}

.detail-value {
    color: #333;
    word-break: break-word;
}

/* Visualization */
.viz-section {
    margin-bottom: 2rem;
}

.viz-section h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.stacked-bar {
    display: flex;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    background: #e0e0e8;
}

.bar-seg {
    transition: width 0.3s;
    min-width: 2px;
}

.bar-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* Site tree */
.site-tree {
    background: #fff;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    font-size: 0.85rem;
    max-height: 500px;
    overflow-y: auto;
}

.tree-node {
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-name {
    font-family: "Cascadia Code", "Fira Code", monospace;
    color: #333;
}

/* Scan History */
.history-section {
    margin-top: 2rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.history-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

.btn-clear-history {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1.5px solid #d0d0e0;
    border-radius: 6px;
    background: #fff;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-history:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.history-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.history-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
}

.history-score-num {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
}

.history-grade {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-domain {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: #888;
    margin-top: 0.15rem;
}

.history-mode {
    color: #4a6cf7;
    font-weight: 500;
}

/* Find Leads Page */
.leads-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.leads-hero h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1a1a2e;
}

.leads-hero p {
    color: #555;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.leads-form {
    max-width: 560px;
    margin: 0 auto;
}

.leads-inputs {
    display: flex;
    gap: 0;
}

.leads-inputs input[type="text"]:first-child {
    flex: 1;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border: 2px solid #d0d0e0;
    border-right: 1px solid #d0d0e0;
    border-radius: 8px 0 0 0;
    outline: none;
    transition: border-color 0.2s;
}

.leads-inputs input[type="text"]:last-child {
    flex: 1;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border: 2px solid #d0d0e0;
    border-left: 1px solid #d0d0e0;
    border-radius: 0 8px 0 0;
    outline: none;
    transition: border-color 0.2s;
}

.leads-inputs input[type="text"]:focus {
    border-color: #4a6cf7;
    z-index: 1;
}

.leads-form button {
    display: block;
    width: 100%;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    background: #4a6cf7;
    color: #fff;
    border: 2px solid #4a6cf7;
    border-radius: 0 0 8px 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.leads-form button:hover {
    background: #3a5ce5;
    border-color: #3a5ce5;
}

.leads-error {
    text-align: center;
    padding: 1rem;
    margin: 1rem auto;
    max-width: 560px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    font-size: 0.9rem;
}

.leads-results {
    margin-top: 2rem;
}

.leads-results h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1a1a2e;
}

.leads-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.88rem;
}

.leads-table thead {
    background: #f7f8fa;
}

.leads-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leads-table td {
    padding: 0.6rem 1rem;
    border-top: 1px solid #f0f2f5;
    vertical-align: top;
}

.leads-row:hover {
    background: #f7f8fa;
}

.leads-name a {
    color: #1a1a2e;
    text-decoration: none;
    font-weight: 600;
}

.leads-name a:hover {
    color: #4a6cf7;
}

.leads-status-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: #fef9c3;
    color: #ca8a04;
    margin-left: 0.3rem;
    text-transform: capitalize;
}

.leads-address {
    color: #555;
    max-width: 200px;
}

.leads-phone {
    white-space: nowrap;
    color: #555;
}

.leads-stars {
    font-weight: 700;
    color: #f59e0b;
}

.leads-review-count {
    font-size: 0.8rem;
    color: #888;
}

.leads-website a {
    color: #4a6cf7;
    text-decoration: none;
}

.leads-website a:hover {
    text-decoration: underline;
}

.leads-no-site {
    color: #bbb;
    font-style: italic;
}

.btn-audit {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: #4a6cf7;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-audit:hover {
    background: #3a5ce5;
}

.leads-link {
    margin-top: 1.5rem;
}

.leads-link a {
    color: #4a6cf7;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.leads-link a:hover {
    text-decoration: underline;
}

.btn-details {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: #e8ecf7;
    color: #4a6cf7;
    border: 1px solid #c5d0f0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-details:hover {
    background: #4a6cf7;
    color: #fff;
}

.btn-details.leads-loading {
    opacity: 0.6;
    cursor: wait;
}

.leads-details-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.leads-details-cell .leads-phone {
    font-size: 0.85rem;
    color: #555;
}

.leads-details-cell .leads-website-link {
    color: #4a6cf7;
    text-decoration: none;
    font-size: 0.85rem;
}

.leads-details-cell .leads-website-link:hover {
    text-decoration: underline;
}
