/* OX CiteMetrics v1.16 - Styles */
  :root {
    --bg: #f7f8fa;
    --card: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #f59e0b;
    --radius: 10px;
    --input-bg: #ffffff;
    --upload-hover-bg: #eff6ff;
    --upload-success-bg: #f0fdf4;
    --table-header-bg: #f8fafc;
    --table-hover-bg: #f8fafc;
    --log-bg: #1e293b;
    --log-text: #94a3b8;
    --stat-total-bg: #eff6ff;
    --stat-total-border: #bfdbfe;
    --stat-found-bg: #f0fdf4;
    --stat-found-border: #bbf7d0;
    --stat-notfound-bg: #fef2f2;
    --stat-notfound-border: #fecaca;
    --citation-high-bg: #dbeafe;
    --citation-high-text: #1e40af;
    --citation-med-bg: #fef3c7;
    --citation-med-text: #92400e;
    --citation-low-bg: #f1f5f9;
    --citation-low-text: #475569;
    --progress-track: #e2e8f0;
  }

  html.dark {
    --bg: #131314;
    --card: #1c1c1e;
    --primary: #4a90e2;
    --primary-hover: #6aa8f0;
    --text: #e4e4e7;
    --text-muted: #8e8e93;
    --border: #2c2c2e;
    --success: #30d158;
    --error: #ff453a;
    --input-bg: #131314;
    --upload-hover-bg: #1e2d42;
    --upload-success-bg: #14332030;
    --table-header-bg: #1a1a1b;
    --table-hover-bg: #232325;
    --log-bg: #0e0e0f;
    --log-text: #8e8e93;
    --stat-total-bg: #1a2744;
    --stat-total-border: #3a6bd550;
    --stat-found-bg: #14332040;
    --stat-found-border: #30d15840;
    --stat-notfound-bg: #3a1a1a30;
    --stat-notfound-border: #ff453a40;
    --citation-high-bg: #1a2744;
    --citation-high-text: #7abaff;
    --citation-med-bg: #3d280f40;
    --citation-med-text: #ffd060;
    --citation-low-bg: #2c2c2e;
    --citation-low-text: #c7c7cc;
    --progress-track: #2c2c2e;
  }

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

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 2rem 1rem;
    transition: background 0.3s, color 0.3s;
  }

  .container {
    max-width: 960px;
    margin: 0 auto;
  }

  /* Header */
  .header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
  }

  .header-brand {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
  }

  .header-brand a {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
  }

  .header-brand a:hover {
    color: var(--primary);
  }

  h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0;
  }

  .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
  }

  /* Dark mode toggle */
  .theme-toggle {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50px;
    width: 44px;
    height: 24px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background 0.3s, border-color 0.3s;
  }

  .theme-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    transition: transform 0.3s;
  }

  html.dark .theme-toggle::after {
    transform: translateX(20px);
  }

  .theme-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
  }

  .toggle-icons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 5px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    pointer-events: none;
  }

  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: background 0.3s, border-color 0.3s;
  }

  .card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
  }

  /* Upload area */
  .upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
  }

  .upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: var(--upload-hover-bg);
  }

  .upload-area.has-file {
    border-color: var(--success);
    background: var(--upload-success-bg);
  }

  .upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
  }

  .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
  }

  .upload-text {
    color: var(--text-muted);
    font-size: 0.9rem;
  }

  .upload-text strong {
    color: var(--primary);
  }

  .file-name {
    color: var(--success);
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 0.5rem;
  }

  /* Input tabs */
  .input-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
  }

  .input-tab {
    padding: 0.5rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
  }

  .input-tab:hover {
    color: var(--text);
  }

  .input-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
  }

  .paste-area {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    background: var(--input-bg);
    color: var(--text);
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, background 0.3s, color 0.3s;
    line-height: 1.5;
  }

  .paste-area:focus {
    border-color: var(--primary);
  }

  .paste-area::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
  }

  /* Form row */
  .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
  }

  .form-group {
    flex: 1;
    min-width: 200px;
  }

  .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
  }

  .form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, background 0.3s, color 0.3s;
    background: var(--input-bg);
    color: var(--text);
  }

  .form-group input:focus {
    border-color: var(--primary);
  }

  .hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
  }

  /* Button */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
  }

  .btn:hover:not(:disabled) { background: var(--primary-hover); }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }

  .btn-secondary {
    background: var(--card);
    color: var(--primary);
    border: 1px solid var(--primary);
  }

  .btn-secondary:hover:not(:disabled) {
    background: var(--upload-hover-bg);
  }

  .btn-success {
    background: var(--success);
  }

  .btn-success:hover:not(:disabled) {
    background: #15803d;
  }

  /* Progress */
  .progress-section { display: none; }
  .progress-section.visible { display: block; }

  .progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--progress-track);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
  }

  .progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
  }

  .progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .current-paper {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Results */
  .results-section { display: none; }
  .results-section.visible { display: block; }

  .stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }

  .stat {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
  }

  .stat-found {
    background: var(--stat-found-bg);
    color: var(--success);
    border: 1px solid var(--stat-found-border);
  }

  .stat-notfound {
    background: var(--stat-notfound-bg);
    color: var(--error);
    border: 1px solid var(--stat-notfound-border);
  }

  .stat-total {
    background: var(--stat-total-bg);
    color: var(--primary);
    border: 1px solid var(--stat-total-border);
  }

  .stat {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    user-select: none;
  }

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

  .stat.active {
    outline: 2px solid currentColor;
    outline-offset: -2px;
  }

  .stat strong {
    font-size: 1.25rem;
    display: block;
  }

  .actions-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }

  /* Table */
  .table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
  }

  th {
    background: var(--table-header-bg);
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 3;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
  }

  th:hover {
    background: var(--border);
  }

  .info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 700;
    font-style: normal;
    font-family: serif;
    margin-left: 0.3rem;
    cursor: help;
    flex-shrink: 0;
    vertical-align: middle;
    transition: border-color 0.15s, color 0.15s;
  }

  .info-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
  }

  .copy-apa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    transition: all 0.15s;
  }
  .copy-apa-btn:hover {
    border-color: var(--primary);
    background: var(--upload-hover-bg);
    transform: scale(1.1);
  }

  .col-tooltip {
    position: fixed;
    padding: 0.45rem 0.7rem;
    background: var(--log-bg);
    color: var(--log-text);
    font-size: 0.75rem;
    font-weight: 400;
    border-radius: 6px;
    white-space: normal;
    max-width: 260px;
    line-height: 1.4;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.15s;
  }

  .col-tooltip.visible {
    opacity: 1;
  }

  .col-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--log-bg);
  }

  th .sort-arrow {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.7rem;
    opacity: 0.3;
    transition: opacity 0.15s;
  }

  th.sort-asc .sort-arrow,
  th.sort-desc .sort-arrow {
    opacity: 1;
  }

  td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  tr:hover td { background: var(--table-hover-bg); }

  /* Sticky Title Column (nur aktiv wenn .sticky-enabled auf .table-wrapper) */
  .sticky-enabled .sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
    border-right: 2px solid var(--border);
    min-width: 200px;
    max-width: 350px;
  }

  .sticky-enabled .sticky-col-header {
    z-index: 4;
    background: var(--table-header-bg);
  }

  .sticky-enabled tr:hover .sticky-col { background: var(--table-hover-bg); }

  .toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
  }

  .toggle-label input { cursor: pointer; }

  .citation-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
  }

  .citation-high { background: var(--citation-high-bg); color: var(--citation-high-text); }
  .citation-med  { background: var(--citation-med-bg); color: var(--citation-med-text); }
  .citation-low  { background: var(--citation-low-bg); color: var(--citation-low-text); }

  .status-found     { color: var(--success); font-weight: 600; }
  .status-not-found { color: var(--error); font-weight: 600; }

  .type-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--citation-low-bg);
    color: var(--citation-low-text);
  }

  .mesh-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.05rem 0.1rem;
    white-space: nowrap;
  }

  .mesh-tag-type {
    background: var(--stat-total-bg);
    color: var(--primary);
    border: 1px solid var(--stat-total-border);
  }

  .mesh-tag-human {
    background: var(--stat-found-bg);
    color: var(--success);
    border: 1px solid var(--stat-found-border);
  }

  .mesh-tag-animal {
    background: var(--citation-med-bg);
    color: var(--citation-med-text);
    border: 1px solid var(--citation-med-bg);
  }

  .mesh-tag-invitro {
    background: var(--stat-notfound-bg);
    color: var(--error);
    border: 1px solid var(--stat-notfound-border);
  }

  /* Trust-Check Badges (Beall's List + DOAJ) */
  .trust-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
    cursor: help;
  }
  .trust-bad {
    background: var(--stat-notfound-bg, #fee2e2);
    color: var(--error, #dc2626);
    border: 1px solid var(--stat-notfound-border, #fecaca);
  }
  .trust-warn {
    background: var(--citation-med-bg, #fef3c7);
    color: var(--citation-med-text, #92400e);
    border: 1px solid var(--citation-med-bg, #fef3c7);
  }
  .trust-ok {
    background: var(--stat-found-bg, #dcfce7);
    color: var(--success, #16a34a);
    border: 1px solid var(--stat-found-border, #bbf7d0);
  }
  .trust-neutral {
    color: var(--text-muted, #9ca3af);
    font-weight: 400;
  }

  /* Log */
  .log {
    max-height: 150px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    background: var(--log-bg);
    color: var(--log-text);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.75rem;
    display: none;
  }

  .log.visible { display: block; }
  .log-entry { padding: 0.1rem 0; }
  .log-success { color: #4ade80; }
  .log-error { color: #f87171; }
  .log-info { color: #60a5fa; }

  /* Footer */
  .footer {
    margin-top: 2.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
  }

  .footer a:hover {
    color: var(--primary);
  }

  .footer-version {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
  }

  @media (max-width: 600px) {
    body { padding: 1rem 0.5rem; }
    .form-row { flex-direction: column; }
    .stats { flex-direction: column; }
    .header { flex-wrap: wrap; }
    .footer { flex-direction: column; text-align: center; }
    .version-switch { flex-direction: column; align-items: stretch; }
    .version-pill { justify-content: center; }
  }

  /* Version Switch (Web / Chrome Extension) */
  .version-switch {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0.75rem 0 1.5rem 0;
  }
  .version-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
  }
  a.version-pill:hover {
    border-color: var(--primary);
    background: var(--upload-hover-bg);
    transform: translateY(-1px);
  }
  .version-pill-active {
    border-color: var(--primary);
    background: var(--stat-total-bg);
    cursor: default;
    font-weight: 500;
  }
  .version-pill-icon {
    font-size: 1rem;
    line-height: 1;
  }
  .version-pill-badge {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
  }
  .version-pill-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: transform 0.15s, color 0.15s;
  }
  a.version-pill:hover .version-pill-arrow {
    color: var(--primary);
    transform: translateX(2px);
  }
