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

        html { overflow-y: scroll; }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: #f6f8fa;
            color: #1a1a2e;
            min-height: 100vh;
        }

        body.home-mode { overflow: hidden; }
        body.home-mode html { overflow: hidden; }

        .hero {
            background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
            padding: 40px 40px 28px; text-align: center;
            position: relative; overflow: hidden;
            transition: padding 0.4s ease, min-height 0.4s ease;
            min-height: 100vh;
            display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
            padding-top: 30vh;
        }

        .hero.compact {
            padding: 12px 40px;
            min-height: 0;
            display: block;
            overflow: visible;
            z-index: 50;
        }

        .hero::before, .hero::after { display: none; }

        .hero-inner { width: 100%; max-width: 1200px; padding: 0 40px; }

        .hero.compact .hero-inner { max-width: 100%; }

        .hero-top {
            display: flex; align-items: center; justify-content: center;
            position: relative; z-index: 1; margin-bottom: 36px;
        }

        .hero.compact .hero-top {
            position: absolute; top: 50%; left: 20px; right: 20px;
            transform: translateY(-50%); margin-bottom: 0;
            justify-content: space-between;
        }

        .hero-title { cursor: pointer; line-height: 1; }
        .logo-svg { height: 42px; width: auto; display: block; }
        .hero.compact .logo-svg { height: 28px; margin-left: 40px; }

        .hero-sub { font-size: 16px; color: rgba(255,255,255,0.6); margin-top: 10px; font-weight: 400; }
        .hero.compact .hero-sub { display: none; }

        .hero-brand { display: none; }
        .hero.compact .hero-brand {
            display: block;
        }

        .hero-brand {
            font-size: 13px; color: rgba(255,255,255,0.9); white-space: nowrap; font-weight: 500;
        }

        .hero-brand a {
            color: #fff; text-decoration: none; font-weight: 800;
            background: rgba(255,255,255,0.2); padding: 4px 12px;
            border-radius: 6px; backdrop-filter: blur(8px);
        }

        .hero-brand a:hover { text-decoration: underline; }

        .hero-search-container {
            max-width: 700px; margin: 0 auto; position: relative; z-index: 2;
        }

        .hero.compact .hero-search-container { max-width: 900px; margin: 0 auto; padding: 15px 0; }

        .hero-search-bar {
            display: flex; position: relative; background: #fff; border-radius: 12px; overflow: hidden;
            box-shadow: 0 8px 32px rgba(0,0,0,0.2);
        }

        .hero.compact .hero-search-bar { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

        .hero-cat-btn {
            display: flex; align-items: center; gap: 6px;
            padding: 0 16px; background: #f6f8fa; border: none; border-right: 1px solid #e3e8ee;
            font-size: 13px; font-weight: 600; color: #1a1a2e; cursor: pointer;
            font-family: inherit; white-space: nowrap; transition: background 0.15s;
        }

        .hero-cat-btn:hover { background: #eef1f5; }
        .hero-cat-btn .arrow { font-size: 9px; color: #697386; }

        .hero-cat-dropdown {
            position: absolute; top: calc(100% + 6px); left: 0; width: 280px;
            background: #fff; border-radius: 10px; border: 1px solid #e3e8ee;
            box-shadow: 0 8px 32px rgba(0,0,0,0.12); display: none; z-index: 20;
            overflow: hidden; text-align: left;
        }

        .hero-cat-dropdown.visible { display: block; }

        .hero-cat-search {
            padding: 10px 12px; border-bottom: 1px solid #e3e8ee;
        }

        .hero-cat-search input {
            width: 100%; padding: 8px 12px; border: 1px solid #d8dee4; border-radius: 6px;
            font-size: 13px; outline: none; background: #f6f8fa; font-family: inherit;
        }

        .hero-cat-search input:focus { border-color: #2563eb; }

        .hero-cat-options { max-height: 260px; overflow-y: auto; }

        .hero-cat-option {
            padding: 9px 14px; font-size: 13px; cursor: pointer; transition: background 0.1s;
            display: flex; justify-content: space-between; align-items: center;
        }

        .hero-cat-option:hover { background: #f6f8fa; }
        .hero-cat-option.active { background: #eff6ff; color: #2563eb; font-weight: 600; }
        .hero-cat-option.hidden { display: none; }
        .hero-cat-option .cat-count { font-size: 11px; color: #697386; }

        .hero-search-input {
            flex: 1; padding: 10px 20px; font-size: 16px; border: none; outline: none;
            font-family: inherit; color: #1a1a2e; min-width: 500px;
        }

        .hero-search-input::placeholder { color: #b0b8c4; }

        .hero-search-clear {
            background: none; border: none; font-size: 16px; color: #697386;
            cursor: pointer; padding: 0 12px; line-height: 1; flex-shrink: 0;
        }
        .hero-search-clear:hover { color: #1a1a2e; }

        .hero-search-btn {
            padding: 10px 36px; background: rgba(255,255,255,0.15); color: #fff; border: 2px solid rgba(255,255,255,0.4);
            font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
            transition: all 0.2s; white-space: nowrap; border-radius: 10px; margin-left: 12px;
            backdrop-filter: blur(4px); letter-spacing: 0.3px;
        }

        .hero-search-btn:hover { background: rgba(255,255,255,0.95); color: #1e3a5f; border-color: #fff; }

        .hero-search-dropdown {
            position: absolute; top: calc(100% + 6px); left: 0; right: 0;
            background: #fff; border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
            display: none; overflow: hidden; z-index: 15; text-align: left;
        }

        .hero-search-dropdown.visible { display: block; }

        .hero-dd-item {
            display: flex; align-items: center; justify-content: space-between;
            padding: 11px 18px; cursor: pointer; transition: background 0.1s;
            border-bottom: 1px solid #f0f2f5;
        }

        .hero-dd-item:hover { background: #f6f8fa; }
        .hero-dd-item:last-child { border-bottom: none; }
        .hero-dd-separator {
            padding: 8px 18px; margin-top: 25px; font-size: 12px; font-weight: 800; color: #1a1a2e;
            letter-spacing: 0.3px;
            background: #f0f2f5; border-top: 2px solid #e3e8ee;
        }
        .hero-dd-separator:first-child { margin-top: 0; border-top: none; }
        .hero-dd-noresult { padding: 10px 18px; color: #999; font-size: 13px; font-style: italic; }
        .hero-dd-kw { font-size: 14px; font-weight: 500; }
        .hero-dd-kw mark { background: #dbeafe; color: #2563eb; border-radius: 2px; padding: 0 1px; }
        .hero-dd-meta { display: flex; gap: 8px; align-items: center; }
        .hero-dd-vol { font-size: 11px; color: #697386; background: #f0f2f5; padding: 2px 8px; border-radius: 4px; }
        .hero-dd-cat { font-size: 11px; color: #2563eb; }

        .quick-tags {
            display: flex; gap: 8px; justify-content: center; margin-top: 100px;
            flex-wrap: wrap; position: relative; z-index: 1;
            max-width: 1200px; margin-left: auto; margin-right: auto;
        }

        .hero.compact .quick-tags { margin-top: 10px; }

        .quick-tag {
            display: inline-flex; align-items: center; position: relative;
            padding: 5px 12px; background: rgba(255,255,255,0.15); color: #fff;
            border-radius: 18px; font-size: 12px; cursor: pointer; backdrop-filter: blur(8px);
            border: 1px solid rgba(255,255,255,0.2); transition: background 0.2s;
        }

        .quick-tag:hover { background: rgba(255,255,255,0.25); }

        .quick-tag .tag-remove {
            position: absolute; right: -6px; top: -6px;
            font-size: 10px; display: none; cursor: pointer; line-height: 1;
            background: rgba(255,255,255,0.9); color: #333; width: 16px; height: 16px;
            border-radius: 50%; text-align: center; line-height: 16px;
        }

        .quick-tag:hover .tag-remove { display: block; opacity: 0.8; }
        .quick-tag .tag-remove:hover { opacity: 1; }

        .breadcrumb {
            display: flex; align-items: center; gap: 8px;
            padding: 14px 32px; background: #fff; border-bottom: 1px solid #e3e8ee;
            font-size: 13px; color: #697386;
        }
        .breadcrumb-item { cursor: pointer; }
        .breadcrumb-item:hover { color: #1a1a2e; }
        .breadcrumb-home { font-size: 18px; line-height: 1; }
        .breadcrumb-sep { color: #888; font-size: 14px; }
        .breadcrumb-current { color: #1a1a2e; font-weight: 600; cursor: default; }

        .controls {
            display: none;
            align-items: center;
            gap: 16px;
            padding: 14px 32px;
            background: #fff;
            border-bottom: 1px solid #e3e8ee;
            flex-wrap: wrap;
        }

        .controls.visible { display: flex; }

        .controls label { font-size: 13px; color: #697386; font-weight: 500; }

        .toggle-wrapper {
            display: flex; align-items: center; gap: 10px; white-space: nowrap;
        }
        .toggle-wrapper span {
            font-size: 13px; color: #697386; font-weight: 500;
        }
        .toggle-switch {
            position: relative; width: 44px; height: 24px;
            background: #ddd; border-radius: 12px;
            cursor: pointer; transition: background 0.3s;
            flex-shrink: 0;
        }
        .toggle-switch.active { background: #2563eb; }
        .toggle-switch::after {
            content: '';
            position: absolute; top: 2px; left: 2px;
            width: 20px; height: 20px;
            background: #fff; border-radius: 50%;
            transition: transform 0.3s;
            box-shadow: 0 1px 3px rgba(0,0,0,0.15);
        }
        .toggle-switch.active::after { transform: translateX(20px); }

        .url-count-badge {
            display: inline-block; font-size: 10px; font-weight: 600;
            background: #f0f2f5; color: #697386; padding: 2px 6px;
            border-radius: 4px; margin-left: 8px; vertical-align: middle;
        }

        /* Custom searchable select */
        .custom-select { position: relative; min-width: 240px; }

        .custom-select-trigger {
            background: #fff; color: #1a1a2e; border: 1px solid #d8dee4;
            padding: 10px 16px; border-radius: 8px; font-size: 14px;
            cursor: pointer; display: flex; align-items: center; justify-content: space-between;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .custom-select-trigger:hover, .custom-select.open .custom-select-trigger { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
        .custom-select-trigger .arrow { font-size: 10px; color: #697386; transition: transform 0.2s; }
        .custom-select.open .arrow { transform: rotate(180deg); }

        .custom-select-dropdown {
            position: absolute; top: calc(100% + 4px); left: 0; right: 0;
            background: #fff; border: 1px solid #e3e8ee; border-radius: 8px;
            z-index: 100; display: none; box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
            max-height: 320px; overflow: hidden; flex-direction: column;
        }

        .custom-select.open .custom-select-dropdown { display: flex; }
        .custom-select-search { padding: 10px 12px; border-bottom: 1px solid #e3e8ee; }

        .custom-select-search input {
            width: 100%; background: #f6f8fa; color: #1a1a2e;
            border: 1px solid #d8dee4; padding: 8px 12px; border-radius: 6px;
            font-size: 13px; outline: none;
        }

        .custom-select-search input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
        .custom-select-options { overflow-y: auto; max-height: 260px; }

        .custom-select-option {
            padding: 9px 14px; font-size: 13px; cursor: pointer; transition: background 0.1s; white-space: nowrap;
        }

        .custom-select-option:hover { background: #f6f8fa; }
        .custom-select-option.active { background: #2563eb0d; color: #2563eb; }
        .custom-select-option.hidden { display: none; }

        .custom-select-option .kw-count {
            font-size: 11px; color: #697386; margin-left: 6px;
        }

        /* URL search with autocomplete */
        .url-search-wrapper { position: relative; }

        .url-search-input {
            background: #fff; color: #1a1a2e; border: 1px solid #d8dee4;
            padding: 10px 16px 10px 36px; border-radius: 8px; font-size: 14px;
            min-width: 280px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
        }

        .url-search-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

        .url-search-icon {
            position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
            color: #697386; font-size: 14px; pointer-events: none;
        }

        .url-search-clear {
            position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
            background: none; border: none; color: #697386; font-size: 16px;
            cursor: pointer; display: none; padding: 2px 4px;
        }

        .url-search-clear:hover { color: #1a1a2e; }

        .url-autocomplete {
            position: absolute; top: calc(100% + 4px); left: 0; right: 0;
            background: #fff; border: 1px solid #e3e8ee; border-radius: 8px;
            z-index: 100; display: none; box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
            max-height: 300px; overflow-y: auto;
        }

        .url-autocomplete.visible { display: block; }

        .url-ac-item {
            display: flex; align-items: center; gap: 10px;
            padding: 9px 14px; cursor: pointer; transition: background 0.1s;
            border-bottom: 1px solid #f0f2f5;
        }

        .url-ac-item:last-child { border-bottom: none; }
        .url-ac-item:hover { background: #f6f8fa; }
        .url-ac-item img { width: 16px; height: 16px; border-radius: 2px; flex-shrink: 0; }
        .url-ac-domain { font-size: 13px; font-weight: 600; color: #1a1a2e; }

        .url-ac-path {
            font-size: 11px; color: #2563eb; overflow: hidden;
            text-overflow: ellipsis; white-space: nowrap;
        }

        .url-ac-highlight { background: #2563eb1a; color: #2563eb; border-radius: 2px; padding: 0 1px; }

        .url-ac-count {
            font-size: 11px; color: #697386; padding: 8px 14px;
            border-bottom: 1px solid #f0f2f5;
        }

        .stats {
            display: flex; gap: 16px; margin-left: auto; font-size: 13px; color: #697386;
        }

        .stats span {
            background: #f6f8fa; padding: 8px 14px; border-radius: 6px; border: 1px solid #e3e8ee;
        }

        .stats strong { color: #1a1a2e; }

        .btn-export-csv {
            background: #059669; color: #fff; border: none;
            padding: 8px 16px; border-radius: 6px; font-size: 12px;
            font-weight: 600; cursor: pointer; transition: background 0.2s;
        }
        .btn-export-csv:hover { background: #047857; }

        .container { padding: 24px 32px; }

        .table-wrapper {
            background: #fff; border-radius: 12px; border: 1px solid #e3e8ee; overflow-x: auto;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        }

        table { width: 100%; border-collapse: collapse; font-size: 13px; }

        thead th {
            background: #f9fafb; padding: 12px 14px; text-align: left;
            font-weight: 600; color: #697386; font-size: 11px;
            text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
            position: sticky; top: 0; border-bottom: 1px solid #e3e8ee;
        }

        thead th.rank-col { text-align: center; min-width: 36px; padding: 12px 4px; }
        .col-sticky { position: sticky; z-index: 2; background: inherit; }
        thead .col-sticky { z-index: 3; background: #f9fafb; }
        .col-rank { left: 0; }
        .col-url { left: 36px; }
        .col-btn { left: 336px; }
        .col-btn::after { content: ''; position: absolute; top: 0; bottom: 0; right: -6px; width: 6px; background: linear-gradient(to right, rgba(0,0,0,0.04), transparent); }
        tbody td.col-sticky { background: #fff; }
        tbody tr:hover td.col-sticky { background: #f9fafb; }
        thead th.date-header { text-align: center; padding: 12px 2px; font-size: 11px; }
        thead th.sortable { cursor: pointer; transition: background 0.2s, color 0.2s; user-select: none; }
        thead th.sortable:hover { background: #eff6ff; color: #2563eb; }
        thead th.sort-active, thead th.sort-active:hover { background: #2563eb; color: #fff; }
        td.col-active { background: rgba(37, 99, 235, 0.08); }

        tbody tr { border-bottom: 1px solid #f0f2f5; transition: background 0.15s; }
        tbody tr:hover { background: #f9fafb; }
        tbody tr.hidden-row { display: none; }
        tbody td { padding: 10px 0; vertical-align: middle; }

        .rank-num {
            font-weight: 700; font-size: 12px; color: #1a1a2e;
            text-align: center; width: 60px;
        }

        .rank-num.top1 { color: #059669; }
        .rank-num.top3 { color: #d97706; }
        .rank-num.top10 { color: #ea580c; }
        .rank-num.top20 { color: #2563eb; }

        .url-cell { max-width: 400px; overflow: hidden; }
        .url-info { display: flex; align-items: center; gap: 8px; }
        .favicon { width: 16px; height: 16px; border-radius: 2px; flex-shrink: 0; }

        .url-link {
            text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
            display: block; min-width: 0;
        }

        .url-link:hover .url-path { text-decoration: underline; }
        .url-domain { font-weight: 600; color: #1a1a2e; font-size: 13px; }
        .url-path { color: #8792a2; font-size: 13px; }

        .url-title {
            color: #8792a2; font-size: 11px; margin-top: 2px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px;
        }

        .avg-header, .avg-cell { width: 50px; min-width: 50px; max-width: 50px; }
        .avg-cell { text-align: center; font-weight: 700; font-size: 12px; }
        .avg-cell.good { color: #059669; }
        .avg-cell.mid { color: #ea580c; }
        .avg-cell.low { color: #dc2626; }

        .btn-cell { text-align: right; white-space: nowrap; padding-right: 10px; }

        .btn-mini {
            display: inline-block; padding: 3px 7px; border-radius: 4px;
            font-size: 11px; font-weight: 600; cursor: pointer; border: none;
            transition: opacity 0.15s; margin: 0 1px;
        }

        .btn-mini:hover { opacity: 0.8; }
        .btn-json { background: #05966915; color: #059669; }
        .btn-html { background: #ff573b15; color: #ff573b; }
        .btn-details { background: #3b82f615; color: #3b82f6; }

        /* Sparkline */
        .chart-col-header { text-align: center; width: 100px; padding: 12px 4px; font-size: 11px; }
        .chart-cell { padding: 6px 4px; text-align: center; width: 100px; cursor: pointer; }
        .chart-cell:hover { background: #f9fafb; }
        .sparkline-svg { display: block; margin: 0 auto; }
        .spark-tooltip {
            position: fixed; z-index: 300; pointer-events: none;
            background: #fff; border: 1px solid #e3e8ee; border-radius: 8px;
            padding: 6px 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            font-size: 12px; color: #1a1a2e; white-space: nowrap;
        }
        .spark-tooltip strong { color: #2563eb; }

        .pos-cell { text-align: center; padding: 10px 0; width: 36px; min-width: 36px; max-width: 36px; box-sizing: border-box; cursor: pointer; }

        .pos-badge {
            display: inline-block; width: 26px; height: 22px; line-height: 22px;
            border-radius: 4px; font-size: 12px; font-weight: 600; text-align: center;
            cursor: pointer; transition: transform 0.1s, box-shadow 0.1s;
        }

        .pos-badge:hover { box-shadow: 0 2px 8px rgba(37,99,235,0.2); }

        .pos-badge.p1 { background: #d1fae5; color: #065f46; }
        .pos-badge.p3 { background: #fef3c7; color: #92400e; }
        .pos-badge.p10 { background: #ffedd5; color: #9a3412; }
        .pos-badge.p20 { background: #dbeafe; color: #1e40af; }
        .pos-badge.p50 { background: #ede9fe; color: #5b21b6; }
        .pos-badge.p100 { background: #fee2e2; color: #991b1b; }
        .pos-badge.pout { background: #f3f4f6; color: #c4c7cf; }

        .pos-badge.pother {
            background: #fef3c7; color: #d97706; cursor: pointer;
            font-size: 9px; width: 26px; position: relative;
        }

        .pos-badge.pother:hover { transform: scale(1.3); box-shadow: 0 2px 8px rgba(217,119,6,0.2); }

        .tooltip-other {
            display: none;
            position: absolute;
            bottom: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            background: #fff;
            border: 1px solid #e3e8ee;
            border-radius: 10px;
            padding: 12px 16px;
            z-index: 200;
            width: 320px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.1);
            pointer-events: none;
        }

        .pos-badge.pother:hover .tooltip-other { display: block; }

        .tooltip-other::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-top-color: #e3e8ee;
        }

        .tooltip-other-label { font-size: 11px; color: #697386; margin-bottom: 6px; font-weight: 500; }
        .tooltip-other-url { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
        .tooltip-other-url img { width: 14px; height: 14px; border-radius: 2px; flex-shrink: 0; }
        .tooltip-other-url a { font-size: 11px; color: #2563eb; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .tooltip-other-pos { font-size: 13px; font-weight: 700; color: #d97706; }

        .day-separator { border-left: 1px solid #e3e8ee; }

        .loading { text-align: center; padding: 80px 32px; color: #697386; }

        .loading .spinner {
            width: 32px; height: 32px; border: 3px solid #e3e8ee;
            border-top-color: #2563eb; border-radius: 50%;
            animation: spin 0.8s linear infinite; margin: 0 auto 16px;
        }

        @keyframes spin { to { transform: rotate(360deg); } }

        .pagination {
            display: flex; align-items: center; justify-content: center; gap: 4px;
            padding: 16px 32px; background: #fff; border-top: 1px solid #e3e8ee;
        }
        .pagination button {
            min-width: 32px; height: 32px; border: 1px solid #e3e8ee; background: #fff;
            border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
            font-family: inherit; color: #1a1a2e; transition: all 0.15s;
        }
        .pagination button:hover { background: #f6f8fa; border-color: #d0d5dd; }
        .pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
        .pagination button:disabled { opacity: 0.4; cursor: default; }
        .pagination .page-info { font-size: 12px; color: #697386; margin: 0 8px; }
        .pagination .nav-arrow {
            display: flex; align-items: center; justify-content: center;
            width: 32px; height: 32px; border: none; background: none;
            cursor: pointer; color: #697386; transition: color 0.15s; border-radius: 6px;
        }
        .pagination .nav-arrow:hover { color: #2563eb; background: #f6f8fa; }
        .pagination .nav-arrow:disabled { opacity: 0.3; cursor: default; background: none; }
        .pagination .nav-arrow svg { width: 18px; height: 18px; }
        .rows-select { padding: 4px 8px; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 12px; color: #697386; background: #fff; cursor: pointer; margin-right: 8px; }

        .no-data { text-align: center; padding: 80px 32px; color: #8792a2; font-size: 15px; }
        .chart-tooltip {
            position: absolute; z-index: 10; pointer-events: none;
            background: #fff; border: 1px solid #e3e8ee; border-radius: 8px;
            padding: 8px 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            font-size: 12px; color: #1a1a2e; white-space: nowrap;
        }
        .chart-tip-row {
            display: flex; align-items: center; gap: 6px; margin-top: 8px;
        }
        .chart-tip-pos {
            font-weight: 800; font-size: 14px; min-width: 24px; text-align: right;
        }
        .chart-legend {
            display: flex; flex-wrap: wrap; gap: 12px 20px;
            margin-top: 16px; padding-top: 12px;
            border-top: 1px solid #e3e8ee;
        }
        .chart-legend-item {
            display: flex; align-items: center; gap: 6px;
            font-size: 12px; color: #1a1a2e;
        }
        .chart-legend-dot {
            width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
        }
        .chart-legend-url {
            max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }

        /* Modal */
        .modal-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.3);
            backdrop-filter: blur(4px); z-index: 1000;
            display: none; align-items: center; justify-content: center;
            opacity: 0; transition: opacity 0.2s;
        }

        .modal-overlay.visible { opacity: 1; }

        .modal {
            background: #fff; border: 1px solid #e3e8ee; border-radius: 16px;
            width: 780px; max-height: 90vh; display: flex; flex-direction: column;
            transform: scale(0.95); transition: transform 0.2s;
            box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
        }

        .modal-overlay.visible .modal { transform: scale(1); }

        .modal-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 20px 24px; border-bottom: 1px solid #e3e8ee;
        }

        .modal-header h2 { font-size: 16px; font-weight: 600; color: #1a1a2e; }
        .modal-header .subtitle { font-size: 12px; color: #697386; margin-top: 2px; }

        .modal-nav { display: flex; align-items: center; gap: 8px; }

        .modal-nav-btn {
            width: 36px; height: 36px; border: 1px solid #d8dee4; background: #fff;
            color: #697386; border-radius: 8px; font-size: 18px; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: background 0.15s, color 0.15s, border-color 0.15s;
        }

        .modal-nav-btn:hover:not(:disabled) { background: #f6f8fa; color: #1a1a2e; border-color: #2563eb; }
        .modal-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

        .modal-close {
            width: 36px; height: 36px; border: none; background: #f6f8fa;
            color: #697386; border-radius: 8px; font-size: 18px; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: background 0.15s, color 0.15s;
        }

        .modal-close:hover { background: #e3e8ee; color: #1a1a2e; }

        .modal-tabs { display: flex; border-bottom: 1px solid #e3e8ee; }

        .modal-tab {
            padding: 10px 20px; font-size: 13px; font-weight: 600;
            cursor: pointer; color: #697386; border-bottom: 2px solid transparent;
            transition: color 0.15s, border-color 0.15s;
        }

        .modal-tab:hover { color: #1a1a2e; }
        .modal-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

        .modal-body { overflow-y: auto; padding: 0; flex: 1; }

        .serp-list { list-style: none; }

        .serp-item {
            display: flex; align-items: center; gap: 14px;
            padding: 12px 24px; border-bottom: 1px solid #f0f2f5;
            transition: background 0.15s;
        }

        .serp-item:hover { background: #f9fafb; }
        .serp-item.serp-highlight { background: rgba(37, 99, 235, 0.12); border-left: 3px solid #2563eb; }
        .serp-item.serp-highlight:hover { background: rgba(37, 99, 235, 0.16); }

        .serp-rank {
            font-weight: 700; font-size: 14px; min-width: 28px;
            text-align: center; flex-shrink: 0;
        }

        .serp-rank.r1 { color: #059669; }
        .serp-rank.r3 { color: #d97706; }
        .serp-rank.r10 { color: #ea580c; }
        .serp-rank.r20 { color: #2563eb; }
        .serp-rank.r50 { color: #7c3aed; }
        .serp-rank.r100 { color: #dc2626; }

        .serp-favicon { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }
        .serp-info { flex: 1; min-width: 0; }

        .serp-title {
            font-size: 13px; color: #1a1a2e; font-weight: 500;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }

        .serp-url {
            font-size: 11px; color: #2563eb; text-decoration: none;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
            display: block; margin-top: 2px;
        }

        .serp-url:hover { text-decoration: underline; }

        .html-container { padding: 0; background: #fff; }
        .html-container { padding: 0; background: #fff; }
        .html-container iframe { width: 100%; border: 0; height: 5000px; scrollbar-width: none; }
        .html-container iframe::-webkit-scrollbar { display: none; }

        .html-pages-tabs { display: flex; background: #f9fafb; border-bottom: 1px solid #e3e8ee; }

        .html-page-tab {
            padding: 8px 16px; font-size: 12px; font-weight: 600;
            cursor: pointer; color: #697386; border-bottom: 2px solid transparent;
            transition: color 0.15s;
        }

        .html-page-tab:hover { color: #1a1a2e; }
        .html-page-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

        .pickers-row {
            display: flex; gap: 60px; margin-bottom: 16px; flex-wrap: wrap; align-items: center;
        }

        .day-picker {
            display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
        }

        .day-chip {
            padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 500;
            border: 1px solid #e3e8ee; background: #fff; color: #697386;
            cursor: pointer; transition: all 0.15s; white-space: nowrap;
        }

        .day-chip:hover { border-color: #2563eb; color: #2563eb; }
        .day-chip.active { background: #2563eb; color: #fff; border-color: #2563eb; }
        .day-chip.active:hover { background: #1d4ed8; border-color: #1d4ed8; }

        .day-picker-label { font-size: 12px; color: #697386; font-weight: 500; margin-right: 4px; }

        /* Keyword list view */
        .keyword-list-wrapper {
            background: #fff; border-radius: 12px; border: 1px solid #e3e8ee;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden;
        }

        .keyword-list-header {
            padding: 16px 20px; border-bottom: 1px solid #e3e8ee;
            display: flex; align-items: center; justify-content: space-between;
        }

        .keyword-list-header h3 { font-size: 15px; font-weight: 600; color: #1a1a2e; }

        .keyword-list-search {
            background: #f6f8fa; border: 1px solid #d8dee4; padding: 8px 14px;
            border-radius: 6px; font-size: 13px; outline: none; min-width: 240px;
        }

        .keyword-list-search:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

        .keyword-grid {
            display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 0;
        }

        .keyword-card {
            padding: 14px 20px; border-bottom: 1px solid #f0f2f5;
            border-right: 1px solid #f0f2f5;
            cursor: pointer; transition: background 0.15s;
            display: flex; align-items: center; justify-content: space-between;
        }

        .keyword-card:hover { background: #f9fafb; }
        .keyword-card-name { font-size: 13px; font-weight: 500; color: #1a1a2e; }
        .keyword-card-meta { display: flex; gap: 10px; align-items: center; }

        .keyword-card-volume {
            font-size: 11px; color: #697386; background: #f0f2f5;
            padding: 2px 8px; border-radius: 4px;
        }

        .keyword-card-top1 {
            font-size: 11px; color: #2563eb; font-weight: 600;
            max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }

        @media (max-width: 768px) {
            .hero { padding: 24px 20px 16px; }
            .hero-search-bar { flex-direction: column; border-radius: 10px; }
            .hero-cat-btn { padding: 10px 16px; border-right: none; border-bottom: 1px solid #e3e8ee; justify-content: space-between; }
            .hero-search-input { padding: 12px 16px; min-width: 0; }
            .hero-search-btn { padding: 12px 24px; margin-left: 0; margin-top: 10px; width: 100%; }
            .controls { padding: 16px 20px; flex-direction: row; align-items: center; justify-content: space-between; }
            .url-search-input { min-width: 0; width: 100%; }
            .container { padding: 16px 12px; }
            .stats { margin-left: 0; flex-wrap: nowrap; justify-content: center; }
            .keyword-grid { grid-template-columns: 1fr; }

            /* ===== Mobile table ===== */
            .table-wrapper { border-radius: 8px; }
            table { font-size: 12px; }
            thead th { padding: 8px 6px; font-size: 10px; }
            tbody td { padding: 6px 0; }

            /* Hide sparkline + buttons */
            .chart-cell, .chart-col-header { display: none !important; }
            .btn-cell { display: none !important; }
            .col-btn::after { display: none; }

            /* URL sticky at 40vw */
            .url-cell { max-width: 40vw; width: 40vw; }
            .url-domain { font-size: 12px; }
            .url-path { display: none; }
            .favicon { width: 14px; height: 14px; }

            .rank-num { font-size: 11px; }
            .avg-cell { font-size: 11px; }
            .pos-cell { width: 32px; min-width: 32px; }
            .pos-badge { font-size: 10px; min-width: 22px; padding: 2px 4px; }

            /* Pagination compact */
            .pagination { padding: 12px 16px; gap: 2px; }

            /* Modal responsive */
            .modal {
                width: 90vw;
                max-width: 90vw;
                max-height: 80vh;
                overflow: hidden;
                margin: 10vh auto;
            }
            .modal-body { overflow-x: hidden; }

            .breadcrumb {
                padding: 10px 16px;
                font-size: 12px;
            }

            .hero { transition: none; }
            .hero:not(.compact) .hero-top { flex-direction: column; align-items: center; }
            .hero:not(.compact) .hero-title { display: flex; justify-content: center; }
            .quick-tags {
                justify-content: center;
                padding: 0 16px;
                margin-top: 60px;
            }
            .hero.compact .quick-tags {
                flex-wrap: nowrap;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                justify-content: flex-start;
                scrollbar-width: none;
            }
            .hero.compact .quick-tags::-webkit-scrollbar { display: none; }
            .hero.compact .quick-tag { white-space: nowrap; }
            #heroCatBtn { display: none; }
            .hero.compact { padding-left: 0; padding-right: 0; }
            .hero-inner { padding: 0; }
            .hero.compact .hero-inner { display: flex; flex-direction: column; }
            .hero.compact .hero-top { position: static; transform: none; order: 1; margin-bottom: 10px; }
            .hero.compact .hero-search-container { order: 2; }
            .hero.compact .quick-tags { order: 3; margin-bottom: 10px; max-width: 100vw; }
            .hero.compact .logo-svg { margin-left: 10px; }
            .hero.compact .hero-brand { margin-right: 10px; }
            .toggle-wrapper { flex: 1; min-width: 0; }
            .toggle-label { font-size: 0 !important; }
            .toggle-label::after { content: "Par domaine"; font-size: 13px; }
            .url-search-wrapper { flex: 1; min-width: 0; overflow: hidden; }
            .hero-search-bar { width: 80vw; }
            .btn-export-csv, #statUrls { display: none !important; }
            .pickers-row { flex-wrap: nowrap; gap: 12px; align-items: center; justify-content: space-between; }
            #dayPicker { justify-content: flex-end; }
            .day-select { padding: 5px 10px; border-radius: 6px; border: 1px solid #e3e8ee; font-size: 12px; color: #697386; background: #fff; }
            .hero-search-bar { position: relative; }
            .hero-search-clear { position: absolute; right: 12px; top: 12px; padding: 0; }
        }

        .legal-footer { text-align: center; padding: 10px; font-size: 12px; position: absolute; bottom: 10px; left: 0; right: 0; z-index: 1; }
        .legal-footer a { color: rgba(255,255,255,0.7); text-decoration: none; }
        .hero.compact .legal-footer { display: none; }
        .legal-footer a:hover { text-decoration: underline; }
        .legal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 9999; align-items: center; justify-content: center; }
        .legal-box { background: #fff; border-radius: 12px; padding: 32px; max-width: 560px; width: 90vw; max-height: 80vh; overflow-y: auto; position: relative; }
        .legal-box h2 { margin-bottom: 16px; font-size: 18px; color: #1a1a2e; }
        .legal-box p { margin-bottom: 12px; font-size: 13px; color: #4a5568; line-height: 1.6; }
        .legal-close { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 24px; cursor: pointer; color: #697386; }