﻿    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      background: #f0f2f5;
      color: #1a1a2e;
      min-height: 100vh;
    }

    /* ── Auth overlay ────────────────────────────────────────────────────── */
    #auth-overlay {
      position: fixed;
      inset: 0;
      background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
      z-index: 9999;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .auth-card {
      background: #fff;
      border-radius: 16px;
      padding: 36px 32px;
      width: 380px;
      box-shadow: 0 8px 40px rgba(0,0,0,.3);
    }
    .auth-logo {
      text-align: center;
      font-size: 2rem;
      margin-bottom: 6px;
    }
    .auth-title {
      text-align: center;
      font-size: 1.1rem;
      font-weight: 700;
      color: #0f3460;
      margin-bottom: 22px;
    }
    .auth-tab-bar {
      display: flex;
      border-bottom: 2px solid #e9ecef;
      margin-bottom: 22px;
    }
    .auth-tab-btn {
      flex: 1;
      padding: 8px;
      border: none;
      background: none;
      font-size: .9rem;
      font-weight: 600;
      color: #888;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      transition: color .15s;
    }
    .auth-tab-btn.active { color: #0f3460; border-bottom-color: #0f3460; }
    .auth-field { margin-bottom: 13px; }
    .auth-field label { display: block; font-size: .82rem; font-weight: 600; color: #555; margin-bottom: 5px; }
    .auth-field input {
      width: 100%;
      border: 1.5px solid #d0d7de;
      border-radius: 8px;
      padding: 9px 12px;
      font-size: .93rem;
      outline: none;
      transition: border-color .2s;
    }
    .auth-field input:focus { border-color: #0f3460; }
    .auth-submit {
      width: 100%;
      padding: 10px;
      background: linear-gradient(135deg, #0f3460, #533483);
      color: #fff;
      border: none;
      border-radius: 8px;
      font-size: .95rem;
      font-weight: 700;
      cursor: pointer;
      margin-top: 4px;
      transition: opacity .15s;
    }
    .auth-submit:hover { opacity: .88; }
    .auth-submit:disabled { opacity: .4; cursor: not-allowed; }
    .auth-error { color: #b91c1c; font-size: .83rem; margin-top: 10px; min-height: 18px; }

    /* ── Header ─────────────────────────────────────────────────────────── */
    header {
      background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
      color: #fff;
      padding: 0 20px;
      display: flex;
      align-items: center;
      gap: 12px;
      box-shadow: 0 2px 8px rgba(0,0,0,.3);
      position: sticky;
      top: 0;
      z-index: 100;
      height: 56px;
    }
    .logo { font-size: 1.35rem; flex-shrink: 0; }
    header h1 { font-size: 1rem; font-weight: 600; flex-shrink: 0; }

    nav { display: flex; gap: 2px; }
    nav a {
      color: rgba(255,255,255,.65);
      text-decoration: none;
      padding: 7px 13px;
      border-radius: 8px;
      font-size: .85rem;
      font-weight: 500;
      transition: background .15s, color .15s;
      white-space: nowrap;
    }
    nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
    nav a.active { background: rgba(255,255,255,.2); color: #fff; }

    .header-spacer { flex: 1; }

    /* site selector */
    .site-selector-wrap {
      display: flex;
      align-items: center;
      gap: 6px;
      background: rgba(255,255,255,.1);
      border-radius: 8px;
      padding: 4px 10px;
      flex-shrink: 0;
    }
    .site-selector-label { font-size: .75rem; color: rgba(255,255,255,.55); white-space: nowrap; }
    #site-select {
      background: transparent;
      border: none;
      color: #fff;
      font-size: .85rem;
      font-weight: 600;
      cursor: pointer;
      outline: none;
      max-width: 180px;
    }
    #site-select option { color: #1a1a2e; background: #fff; }

    /* user badge */
    .user-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }
    .user-name { font-size: .83rem; color: rgba(255,255,255,.8); white-space: nowrap; }
    .btn-logout {
      background: rgba(255,255,255,.15);
      border: 1px solid rgba(255,255,255,.25);
      color: #fff;
      border-radius: 6px;
      padding: 4px 10px;
      font-size: .8rem;
      cursor: pointer;
      transition: background .15s;
      white-space: nowrap;
    }
    .btn-logout:hover { background: rgba(255,255,255,.25); }

    /* ── Layout ──────────────────────────────────────────────────────────── */
    main {
      max-width: 1400px;
      margin: 28px auto;
      padding: 0 16px;
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .page { display: flex; flex-direction: column; gap: 20px; }
    .hidden { display: none !important; }

    /* ── Cards ───────────────────────────────────────────────────────────── */
    .card {
      background: #fff;
      border-radius: 12px;
      padding: 22px 24px;
      box-shadow: 0 1px 4px rgba(0,0,0,.1);
    }
    .card-title {
      font-size: .97rem;
      font-weight: 700;
      margin-bottom: 16px;
      color: #0f3460;
    }
    .card-title.gen-toggleable {
      cursor: pointer;
      user-select: none;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .card-title.gen-toggleable::after {
      content: '▾';
      font-size: .85em;
      opacity: .45;
      transition: transform .2s;
    }
    .gen-card-collapsed .card-title.gen-toggleable::after {
      content: '▸';
    }
    .gen-card-collapsed > *:not(.card-title) {
      display: none !important;
    }
    .gen-card-collapsed {
      margin-bottom: 6px;
    }
    .gen-card-collapsed .card-title {
      margin-bottom: 0;
    }

    /* ── Buttons ─────────────────────────────────────────────────────────── */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 20px;
      border-radius: 8px;
      font-size: .9rem;
      font-weight: 600;
      cursor: pointer;
      border: none;
      transition: opacity .15s, transform .1s;
    }
    .btn:hover:not(:disabled) { opacity: .88; }
    .btn:active:not(:disabled) { transform: scale(.98); }
    .btn:disabled { opacity: .4; cursor: not-allowed; }
    .btn-primary { background: linear-gradient(135deg, #0f3460, #533483); color: #fff; }
    .btn-secondary { background: #f6f8fa; border: 1.5px solid #d0d7de; color: #333; }
    .btn-danger { background: #fde8e8; border: 1.5px solid #fca5a5; color: #b91c1c; }
    .btn-sm { padding: 5px 12px; font-size: .82rem; }

    /* ── Form elements ───────────────────────────────────────────────────── */
    textarea {
      width: 100%;
      border: 1.5px solid #d0d7de;
      border-radius: 8px;
      padding: 10px 12px;
      font-size: .92rem;
      font-family: inherit;
      resize: vertical;
      transition: border-color .2s;
      outline: none;
    }
    textarea:focus { border-color: #0f3460; }
    input[type="text"], input[type="email"], input[type="password"], input:not([type]) {
      border: 1.5px solid #d0d7de;
      border-radius: 8px;
      padding: 8px 12px;
      font-size: .9rem;
      font-family: inherit;
      outline: none;
      transition: border-color .2s;
      width: 100%;
    }
    input:focus { border-color: #0f3460; }
    label { display: block; font-size: .85rem; font-weight: 600; color: #444; margin-bottom: 6px; }
    .hint { font-size: .78rem; color: #777; margin-top: 6px; line-height: 1.5; }

    /* ── Badges ──────────────────────────────────────────────────────────── */
    .badge {
      display: inline-block;
      padding: 2px 9px;
      border-radius: 20px;
      font-size: .73rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .4px;
    }
    .badge-running   { background: #fff3cd; color: #856404; }
    .badge-done      { background: #d1e7dd; color: #0a3622; }
    .badge-failed    { background: #f8d7da; color: #58151c; }
    .badge-pending   { background: #e9ecef; color: #495057; }
    .badge-published { background: #cff4fc; color: #055160; }
    .badge-trash { background: #f1f0ef; color: #6b6459; }
    .badge-regen { background: #fef3c7; color: #92400e; }
    .pub-btn { font-size: .72rem; padding: 2px 8px; border-radius: 20px; border: 1px solid #adb5bd; background: #f8f9fa; color: #495057; cursor: pointer; white-space: nowrap; }
    .pub-btn.published { border-color: #0e7490; background: #cff4fc; color: #055160; }
    .articles-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
    .articles-search { flex: 1; min-width: 220px; padding: 7px 12px; border: 1px solid #ced4da; border-radius: 6px; font-size: .9rem; outline: none; }
    .articles-search:focus { border-color: #0f3460; box-shadow: 0 0 0 2px rgba(15,52,96,.12); }
    .pub-filter { display: flex; border: 1px solid #ced4da; border-radius: 6px; overflow: hidden; font-size: .82rem; flex-shrink: 0; }
    .pub-filter-btn { padding: 6px 12px; background: #fff; border: none; cursor: pointer; color: #555; white-space: nowrap; transition: background .15s, color .15s; }
    .pub-filter-btn:not(:last-child) { border-right: 1px solid #ced4da; }
    .pub-filter-btn.active { background: #0f3460; color: #fff; font-weight: 600; }
    .pagination { display: flex; align-items: center; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
    .pg-btn { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid #ced4da; border-radius: 5px; background: #fff; color: #333; font-size: .82rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
    .pg-btn:hover:not(:disabled) { background: #f0f2f5; }
    .pg-btn.active { background: #0f3460; color: #fff; border-color: #0f3460; font-weight: 700; cursor: default; }
    .pg-btn:disabled { opacity: .35; cursor: default; }
    .pg-info { font-size: .8rem; color: #888; margin-left: 6px; }
    .row-published td { background: #f0fdf4 !important; }
    .row-published:hover td { background: #e0faf0 !important; }
    .row-trash td { background: #f5f5f4 !important; opacity: .65; }
    .row-trash:hover td { background: #ebebe9 !important; }
    .btn.btn-secondary.btn-sm.active { background: #6b6459; color: #fff; border-color: #6b6459; }
    .dup-badge {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700;
      white-space: nowrap; cursor: default;
    }
    .dup-badge-low  { background: #d1e7dd; color: #0a3622; }
    .dup-badge-med  { background: #fff3cd; color: #856404; }
    .dup-badge-high { background: #f8d7da; color: #58151c; }
    .dup-badge-none { background: #e9ecef; color: #6c757d; }

    /* ── Spinner ─────────────────────────────────────────────────────────── */
    .spinner {
      width: 15px; height: 15px;
      border: 2.5px solid #ccc;
      border-top-color: #0f3460;
      border-radius: 50%;
      animation: spin .7s linear infinite;
      flex-shrink: 0;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ── Status bar ──────────────────────────────────────────────────────── */
    .status-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

    /* ── Log box ─────────────────────────────────────────────────────────── */
    .log-box {
      background: #0d1117;
      border-radius: 8px;
      padding: 10px 14px;
      font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
      font-size: .76rem;
      max-height: 260px;
      overflow-y: auto;
      line-height: 1.6;
    }
    .log-info    { color: #58a6ff; }
    .log-warning { color: #e3b341; }
    .log-error   { color: #f85149; }
    .log-time    { color: #484f58; margin-right: 6px; }
    .log-step    { color: #7ee787; margin-right: 6px; }

    /* ── Sources ─────────────────────────────────────────────────────────── */
    .source-item { border: 1px solid #e9ecef; border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
    .source-header {
      display: flex; align-items: center; gap: 10px;
      padding: 9px 13px; background: #f8f9fa;
      cursor: pointer; user-select: none;
    }
    .source-header:hover { background: #f0f2f5; }
    .source-url { flex: 1; font-size: .8rem; color: #0f3460; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .source-chars { font-size: .76rem; color: #999; white-space: nowrap; }
    .source-chevron { font-size: .7rem; color: #999; transition: transform .2s; flex-shrink: 0; }
    .source-chevron.open { transform: rotate(180deg); }
    .source-body {
      display: none; padding: 12px 14px; font-size: .79rem;
      white-space: pre-wrap; font-family: "Cascadia Code","Fira Code","Consolas",monospace;
      color: #333; background: #fdfdfd; max-height: 320px; overflow-y: auto;
      border-top: 1px solid #e9ecef;
    }
    .source-body.open { display: block; }
    .source-link { font-size: .74rem; color: #888; text-decoration: none; display: block; margin-bottom: 8px; }
    .source-link:hover { color: #0f3460; }

    .match-badge { font-size: .71rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }
    .match-zero { background: #fde8e8; color: #b91c1c; }
    .match-low  { background: #fef3c7; color: #92400e; }
    .match-mid  { background: #fef9c3; color: #713f12; }
    .match-high { background: #dcfce7; color: #14532d; }
    .source-excluded .source-header { opacity: .6; }
    .source-excluded .source-url { text-decoration: line-through; }

    /* ── Article tabs ────────────────────────────────────────────────────── */
    .article-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
    .meta-chip { background: #f0f4ff; border: 1px solid #c8d8ff; border-radius: 6px; padding: 3px 10px; font-size: .78rem; color: #0f3460; }
    .article-tab-bar { display: flex; gap: 0; border-bottom: 2px solid #e9ecef; margin-bottom: 16px; }
    .tab-btn {
      padding: 7px 18px; border: none; background: none;
      font-size: .87rem; font-weight: 600; color: #888; cursor: pointer;
      border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s;
    }
    .tab-btn.active { color: #0f3460; border-bottom-color: #0f3460; }
    .tab-btn:hover:not(.active) { color: #333; }
    .tab-pane { display: none; }
    .tab-pane.active { display: block; }
    .article-preview { line-height: 1.8; font-size: .93rem; color: #24292f; }
    .article-preview h1 { font-size: 1.45rem; font-weight: 700; margin: 0 0 14px; color: #0f3460; }
    .article-preview h2 { font-size: 1.18rem; font-weight: 700; margin: 22px 0 9px; color: #16213e; }
    .article-preview h3 { font-size: 1rem; font-weight: 700; margin: 16px 0 7px; color: #16213e; }
    .article-preview p  { margin: 0 0 11px; }
    .article-preview ul, .article-preview ol { padding-left: 22px; margin: 0 0 11px; }
    .article-preview li { margin-bottom: 5px; }
    .article-preview strong { font-weight: 700; }
    .article-preview em { font-style: italic; }
    .article-code {
      display: block; background: #0d1117; color: #c9d1d9; border-radius: 8px;
      padding: 14px 16px; font-family: "Cascadia Code","Fira Code","Consolas",monospace;
      font-size: .76rem; line-height: 1.65; white-space: pre-wrap; word-break: break-all;
      max-height: 540px; overflow-y: auto;
    }

    /* ── Actions ─────────────────────────────────────────────────────────── */
    .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

    /* ── Tables ──────────────────────────────────────────────────────────── */
    .data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
    .data-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid #e9ecef; color: #555; font-weight: 600; white-space: nowrap; }
    .data-table td { padding: 8px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
    .data-table tr:hover td { background: #f8f9fa; }
    .clickable-row { cursor: pointer; }
    .text-muted { color: #999; }
    .col-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* ── Accordion ───────────────────────────────────────────────────────── */
    .accordion { display: flex; flex-direction: column; gap: 8px; }
    .acc-item { border: 1px solid #e9ecef; border-radius: 10px; overflow: hidden; }
    .acc-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 13px 18px; background: #f8f9fa; cursor: pointer;
      font-weight: 600; font-size: .93rem; user-select: none; transition: background .15s;
    }
    .acc-header:hover { background: #eef1f5; }
    .acc-header.open { background: #eef1f5; }
    .acc-chevron { font-size: .75rem; transition: transform .25s; }
    .acc-header.open .acc-chevron { transform: rotate(180deg); }
    .acc-body { display: none; padding: 18px; background: #fff; border-top: 1px solid #e9ecef; }
    .acc-body.open { display: block; }

    /* ── Search results by URL ───────────────────────────────────────────── */
    .url-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid #f0f2f5; align-items: flex-start; }
    .url-row:last-child { border-bottom: none; }
    .url-coverage { flex-shrink: 0; width: 72px; text-align: center; }
    .url-cov-count { font-size: .78rem; font-weight: 700; color: #0f3460; margin-bottom: 4px; }
    .url-cov-bar { height: 5px; background: #e9ecef; border-radius: 3px; overflow: hidden; }
    .url-cov-fill { height: 100%; background: linear-gradient(90deg, #0f3460, #533483); border-radius: 3px; }
    .url-info { flex: 1; min-width: 0; }
    .url-title { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
    .url-href { font-size: .75rem; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 6px; }
    .url-href a { color: #888; text-decoration: none; }
    .url-href a:hover { color: #0f3460; text-decoration: underline; }
    .url-kw-list { display: flex; flex-wrap: wrap; gap: 5px; }
    .url-kw-tag { background: #f0f4ff; border: 1px solid #d0deff; border-radius: 4px; padding: 2px 7px; font-size: .73rem; color: #333; }
    .url-kw-pos { color: #aaa; font-size: .7rem; margin-left: 2px; }

    /* ── Prompt display & editor ─────────────────────────────────────────── */
    .prompt-box { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 12px 14px; font-size: .79rem; white-space: pre-wrap; font-family: "Cascadia Code","Fira Code","Consolas",monospace; max-height: 380px; overflow-y: auto; color: #333; }
    .prompt-label { font-size: .83rem; font-weight: 700; color: #555; margin: 14px 0 6px; }
    .prompt-label:first-child { margin-top: 0; }
    .prompt-check-step { border: 1px solid #e9ecef; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
    .prompt-check-step-title { font-weight: 600; margin-bottom: 4px; }
    .prompt-section { margin-bottom: 20px; }
    .prompt-section textarea { height: 190px; font-family: "Cascadia Code","Fira Code","Consolas",monospace; font-size: .8rem; }
    #user-prompt-tmpl { height: 260px; }

    /* ── Sites management ────────────────────────────────────────────────── */
    .site-form-row { display: flex; gap: 10px; margin-bottom: 10px; }
    .site-form-row input { flex: 1; }
    .site-list { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
    .site-item {
      border: 1px solid #e9ecef; border-radius: 10px; padding: 14px 16px;
      display: flex; align-items: flex-start; gap: 14px;
    }
    .site-item-body { flex: 1; min-width: 0; }
    .site-item-name { font-size: .95rem; font-weight: 700; color: #0f3460; margin-bottom: 3px; }
    .site-item-domain { font-size: .82rem; color: #888; margin-bottom: 6px; }
    .site-item-desc { font-size: .82rem; color: #555; white-space: pre-wrap; line-height: 1.5; }
    .site-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
    .site-active-badge { background: #d1e7dd; color: #0a3622; border-radius: 4px; padding: 2px 8px; font-size: .72rem; font-weight: 700; margin-left: 8px; }
    .site-edit-form { display: none; flex-direction: column; gap: 8px; margin-top: 10px; }
    .site-edit-form.open { display: flex; }

    /* ── Back row ────────────────────────────────────────────────────────── */
    .back-row { display: flex; align-items: center; gap: 12px; }
    .back-row h2 { font-size: 1.05rem; font-weight: 700; color: #0f3460; }

    /* ── Empty / loading ─────────────────────────────────────────────────── */
    .empty { color: #aaa; font-size: .9rem; text-align: center; padding: 32px 0; }
    .no-site-msg { color: #888; font-size: .9rem; padding: 20px 0; }
    .no-site-msg a { color: #0f3460; font-weight: 600; }

    /* ── Save message ────────────────────────────────────────────────────── */
    .save-msg { font-size: .84rem; color: #0a3622; align-self: center; }

    /* ── Wordstat ────────────────────────────────────────────────────────── */
    .ws-item { border-bottom: 1px solid #f0f2f5; }
    .ws-item:last-child { border-bottom: none; }
    .ws-kw-row {
      display: flex; align-items: center; gap: 12px;
      padding: 10px 4px; cursor: pointer; border-radius: 6px;
      transition: background .12s;
    }
    .ws-kw-row:hover { background: #f8f9fa; }
    .ws-kw { flex: 1; font-weight: 600; font-size: .9rem; color: #0f3460; }
    .ws-total { font-size: .84rem; color: #555; white-space: nowrap; }
    .ws-chevron { font-size: .7rem; color: #aaa; transition: transform .2s; flex-shrink: 0; }
    .ws-chevron.open { transform: rotate(180deg); }
    .ws-err { font-size: .82rem; color: #b91c1c; }
    .ws-body { padding: 2px 8px 12px 8px; }
    .ws-section-label {
      font-size: .73rem; font-weight: 700; color: #aaa;
      text-transform: uppercase; letter-spacing: .5px; margin: 8px 0 4px;
    }
    .ws-phrase-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 4px 6px; border-radius: 4px; font-size: .83rem;
      transition: background .1s;
    }
    .ws-phrase-row:hover { background: #f0f4ff; }
    .ws-phrase-row:hover .ws-add { opacity: 1; }
    .ws-phrase { color: #333; flex: 1; margin-right: 8px; }
    .ws-assoc .ws-phrase { color: #666; font-style: italic; }
    .ws-count { color: #888; font-size: .79rem; white-space: nowrap; }
    .ws-add {
      opacity: 0; margin-left: 8px; font-size: .72rem; font-weight: 700;
      color: #0f3460; cursor: pointer; border: 1px solid #c8d8ff;
      background: #f0f4ff; border-radius: 4px; padding: 1px 6px;
      transition: opacity .15s; white-space: nowrap; flex-shrink: 0;
    }
    .ws-add:hover { background: #dbe8ff; }

    /* ── SEO keyword highlight ───────────────────────────────────────────── */
    .kw-mark { border-radius: 3px; padding: 0 2px; cursor: default; }
    .kw-0  { background: #fff176; color: #333; }
    .kw-1  { background: #b9f6ca; color: #1b5e20; }
    .kw-2  { background: #bbdefb; color: #0d3c61; }
    .kw-3  { background: #ffccbc; color: #7c2d00; }
    .kw-4  { background: #e1bee7; color: #4a148c; }
    .kw-5  { background: #b2dfdb; color: #004d40; }
    .kw-6  { background: #ffe0b2; color: #7c3a00; }
    .kw-7  { background: #f8bbd0; color: #7c0030; }
    .kw-8  { background: #f0f4c3; color: #33691e; }
    .kw-9  { background: #cfd8dc; color: #1c313a; }
    .seo-legend {
      display: flex; flex-wrap: wrap; gap: 8px;
      padding: 10px 14px; border-bottom: 1px solid #e9ecef;
      background: #fafafa;
    }
    .seo-legend-chip {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600;
    }
    .seo-stats {
      padding: 8px 14px; font-size: .8rem; color: #777;
      border-bottom: 1px solid #e9ecef; background: #fafafa;
    }
    .seo-stats strong { color: #333; }
    .seo-article-wrap { padding: 16px 20px; line-height: 1.8; }
    .seo-article-wrap h1, .seo-article-wrap h2, .seo-article-wrap h3 { margin: 1em 0 .4em; }
    .seo-article-wrap p  { margin-bottom: .8em; }
    .seo-article-wrap ul, .seo-article-wrap ol { margin: .4em 0 .8em 1.5em; }

    /* ── Duplicate check ─────────────────────────────────────────────────── */
    .dup-card {
      margin-top: 16px; border-radius: 10px; border: 1.5px solid #e9ecef;
      overflow: hidden; background: #fff;
    }
    .dup-header {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 14px; background: #f8f9fa;
      font-size: .88rem; font-weight: 600; color: #444;
    }
    .dup-body { padding: 14px 16px; font-size: .87rem; }
    .dup-verdict-low  { color: #15803d; font-weight: 700; }
    .dup-verdict-med  { color: #b45309; font-weight: 700; }
    .dup-verdict-high { color: #b91c1c; font-weight: 700; }
    .dup-score-bar { height: 8px; border-radius: 4px; background: #e9ecef; margin: 6px 0 10px; }
    .timing-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
    .timing-table th { text-align: left; padding: 6px 10px; background: #f0f2f5; font-size: .78rem; color: #666; }
    .timing-table td { padding: 7px 10px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
    .timing-table tr:last-child td { border-bottom: none; }
    .timing-bar-wrap { width: 160px; background: #e9ecef; border-radius: 3px; height: 7px; display: inline-block; vertical-align: middle; }
    .timing-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg,#533483,#0f3460); }
    .timing-total td { font-weight: 700; background: #f8f9fb; }
    .dup-score-fill { height: 100%; border-radius: 4px; transition: width .4s; }
    .dup-url { font-size: .82rem; color: #555; margin-bottom: 8px; }
    .dup-url a { color: #0f3460; text-decoration: none; }
    .dup-url a:hover { text-decoration: underline; }
    .dup-phrases { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
    .dup-phrase-chip {
      background: #f0f4ff; border: 1px solid #c8d8ff; border-radius: 20px;
      padding: 2px 10px; font-size: .78rem; color: #0f3460;
    }
    .dup-not-found { color: #888; font-style: italic; }
    .dup-checked-list { border: 1px solid #e9ecef; border-radius: 6px; overflow: hidden; }
    .dup-checked-row {
      display: flex; align-items: center; justify-content: space-between; gap: 10px;
      padding: 6px 10px; border-bottom: 1px solid #f0f2f5; font-size: .82rem;
    }
    .dup-checked-row:last-child { border-bottom: none; }
    .dup-checked-best { background: #f0f4ff; }
    .dup-checked-url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #333; }
    .dup-checked-url a { color: #0f3460; text-decoration: none; }
    .dup-checked-url a:hover { text-decoration: underline; }
    .dup-checked-score { flex-shrink: 0; font-size: .82rem; }

    /* ── Statistics ─────────────────────────────────────────────────────── */
    .stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
    .stat-card { background: #f8f9fb; border: 1px solid #e9ecef; border-radius: 10px; padding: 14px 16px; }
    .stat-card-value { font-size: 1.6rem; font-weight: 800; color: #0f3460; line-height: 1.1; }
    .stat-card-label { font-size: .75rem; color: #888; margin-top: 4px; }
    .stat-card-sub { font-size: .78rem; color: #aaa; margin-top: 2px; }
    .stat-section-title { font-size: .82rem; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
    .stat-api-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
    .stat-api-table th { text-align: left; padding: 6px 10px; background: #f0f2f5; font-size: .78rem; color: #666; }
    .stat-api-table td { padding: 7px 10px; border-bottom: 1px solid #f0f2f5; }
    .stat-api-table tr:last-child td { border-bottom: none; }
    .stat-chart-wrap { overflow-x: auto; }
    .stat-chart { display: flex; align-items: flex-end; gap: 4px; height: 80px; padding-bottom: 20px; min-width: 0; }
    .stat-bar-col { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 22px; }
    .stat-bar { width: 16px; background: linear-gradient(180deg,#533483,#0f3460); border-radius: 3px 3px 0 0; min-height: 2px; }
    .stat-bar-label { font-size: .6rem; color: #aaa; margin-top: 4px; white-space: nowrap; transform: rotate(-45deg); transform-origin: top left; }
    .stat-jobs-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
    .stat-jobs-table th { text-align: left; padding: 6px 10px; background: #f0f2f5; font-size: .78rem; color: #666; white-space: nowrap; }
    .stat-jobs-table td { padding: 6px 10px; border-bottom: 1px solid #f0f2f5; vertical-align: top; }
    .stat-jobs-table tr:last-child td { border-bottom: none; }
    .stat-jobs-table tr:hover td { background: #f8f9fb; }
    .stat-cluster { font-weight: 600; color: #0f3460; }
    .stat-kw-list { color: #888; font-size: .78rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* ── Batch generation ────────────────────────────────────────────────── */
    #batch-dropzone:hover { border-color: #0f3460; color: #0f3460; }
    .batch-preview-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
    .batch-preview-table th { background: #f0f2f5; text-align: left; padding: 6px 10px; font-size: .8rem; color: #555; }
    .batch-preview-table td { padding: 6px 10px; border-bottom: 1px solid #f0f2f5; }
    .batch-preview-table tr:last-child td { border-bottom: none; }
    .batch-skip-row td { color: #aaa; text-decoration: line-through; }
    .batch-progress-bar-wrap { background: #e9ecef; border-radius: 6px; height: 12px; margin: 10px 0; }
    .batch-progress-bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg,#0f3460,#533483); transition: width .5s; }
    .batch-stats-row { display: flex; gap: 20px; font-size: .85rem; color: #555; margin: 8px 0; }
    .batch-stats-row span strong { color: #1a1a2e; }
    .batch-current { font-size: .9rem; color: #0f3460; font-weight: 600; margin: 8px 0 4px; }
    .batch-eta { font-size: .82rem; color: #888; }
    .batch-done-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .82rem; font-weight: 700; }
    .batch-done-badge.done { background: #dcfce7; color: #15803d; }
    .batch-done-badge.cancelled { background: #fef3c7; color: #92400e; }
    .batch-done-badge.running { background: #dbeafe; color: #1d4ed8; }
