    :root {
      --ink: #112031;
      --muted: #5b6b7a;
      --line: #d9e2ec;
      --paper: #f5f1e8;
      --card: rgba(255, 255, 255, 0.88);
      --accent: #0e7490;
      --accent-soft: rgba(14, 116, 144, 0.12);
      --warn: #b45309;
      --danger: #b91c1c;
      --ok: #166534;
      --shadow: 0 16px 40px rgba(17, 32, 49, 0.12);
    }

    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
      color: var(--ink);
      background:
        radial-gradient(circle at top left, rgba(14, 116, 144, 0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(180, 83, 9, 0.16), transparent 28%),
        linear-gradient(180deg, #f8f5ee 0%, var(--paper) 100%);
      height: 100vh;
      overflow: hidden;
    }

    .shell {
      display: grid;
      grid-template-columns: 320px 1fr;
      height: 100vh;
      overflow: hidden;
      transition: grid-template-columns 220ms ease;
    }

    .shell.sidebar-collapsed {
      grid-template-columns: 0px 1fr;
    }

    .sidebar {
      padding: 24px;
      border-right: 1px solid rgba(17, 32, 49, 0.08);
      background: rgba(255, 255, 255, 0.55);
      backdrop-filter: blur(18px);
      overflow: hidden;
      transition: padding 220ms ease;
      height: 100vh;
    }

    .shell.sidebar-collapsed .sidebar {
      padding: 0;
      border-right: 0;
    }

    .sidebar-inner {
      width: 272px; /* 320px - 2*24px padding */
      height: calc(100vh - 48px);
      display: flex;
      flex-direction: column;
    }

    .sidebar-toggle {
      position: absolute;
      top: 16px;
      right: 16px;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--card);
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-radius: 8px;
      cursor: pointer;
      font-size: 1.1rem;
      color: var(--muted);
      box-shadow: var(--shadow);
      transition: background 160ms ease, color 160ms ease;
      z-index: 10;
    }

    .sidebar-toggle:hover {
      background: #fff;
      color: var(--accent);
    }

    .sidebar-open-tab {
      display: none;
      position: fixed;
      top: 16px;
      left: 0;
      width: 28px;
      height: 44px;
      align-items: center;
      justify-content: center;
      background: var(--card);
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-left: 0;
      border-radius: 0 10px 10px 0;
      cursor: pointer;
      font-size: 1.1rem;
      color: var(--muted);
      box-shadow: var(--shadow);
      transition: background 160ms ease, color 160ms ease;
      z-index: 100;
    }

    .sidebar-open-tab:hover {
      background: #fff;
      color: var(--accent);
    }

    .shell.sidebar-collapsed ~ .sidebar-open-tab,
    .shell.sidebar-collapsed + .sidebar-open-tab {
      display: flex;
    }

    .brand {
      margin-bottom: 5px;
    }

    .brand-logo-row {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 4px;
    }

    .brand-logo {
      border-radius: 8px;
      flex-shrink: 0;
    }

    .brand h1 {
      margin: 0;
      font-size: 1.5rem;
      line-height: 1;
    }

    .brand-title-link {
      color: inherit;
      text-decoration: none;
      border-bottom: 1px solid transparent;
    }

    .brand-title-link:hover {
      color: var(--accent);
      border-bottom-color: rgba(14, 116, 144, 0.4);
    }

    .brand p {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 0.95rem;
    }

    .brand-feedback {
      display: inline-block;
      margin-top: 10px;
      font-size: 0.82rem;
      color: var(--accent);
      text-decoration: none;
      border-bottom: 1px dashed rgba(14, 116, 144, 0.45);
    }

    .brand-feedback:hover {
      color: #155e75;
      border-bottom-color: rgba(21, 94, 117, 0.7);
    }

    .brand-links {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      align-items: center;
      margin-top: 10px;
    }

    #helpLink {
      margin-left: auto;
    }

    .brand-doc-link {
      display: inline-block;
      font-size: 0.82rem;
      color: var(--accent);
      text-decoration: none;
      border-bottom: 1px dashed rgba(14, 116, 144, 0.45);
      cursor: pointer;
    }

    .brand-doc-link:hover {
      color: #155e75;
      border-bottom-color: rgba(21, 94, 117, 0.7);
    }

    .summary-strip {
      font-size: 0.85rem;
      color: var(--muted);
      margin-bottom: 12px;
      line-height: 1.6;
    }

    .summary-strip strong {
      color: var(--ink);
      font-weight: 600;
    }

    .summary-strip .matched-help {
      cursor: help;
      border-bottom: 1px dotted var(--muted);
    }

    .upload-notice {
      margin-bottom: 10px;
      padding: 10px 12px;
      border: 1px solid rgba(180, 83, 9, 0.2);
      border-radius: 12px;
      background: rgba(180, 83, 9, 0.08);
      color: var(--warn);
      font-size: 0.8rem;
      line-height: 1.4;
      display: none;
      word-break: break-word;
    }

    .upload-notice strong {
      display: block;
      margin-bottom: 4px;
      color: #8a3f06;
    }

    .accuracy-disclaimer {
      margin-top: 5px;
      padding: 0px 10px;
      border-radius: 8px;
      border: 1px solid rgba(255,255,255,0.10);
      font-size: 0.71rem;
      line-height: 1.45;
      color: rgba(40,40,40,0.45);
    }

    .upload-notice ul {
      margin: 0;
      padding-left: 18px;
    }

    .file-list {
      display: grid;
      gap: 10px;
      flex: 1 1 auto;
      min-height: 0;
      max-height: none;
      overflow: auto;
      padding-right: 4px;
    }

    .license-holder {
      margin: 12px 0 0;
      padding-top: 10px;
      border-top: 1px solid rgba(17, 32, 49, 0.08);
      font-size: 0.75rem;
      color: var(--muted);
      opacity: 0.9;
    }

    .app-version {
      margin: 4px 0 0;
      font-size: 0.75rem;
      color: var(--muted);
      opacity: 0.9;
    }

    .file-item {
      width: 100%;
      padding: 14px;
      border-radius: 16px;
      border: 1px solid rgba(17, 32, 49, 0.08);
      background: var(--card);
      transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
      box-shadow: var(--shadow);
    }

    .file-item:hover,
    .file-item.active {
      transform: translateY(-1px);
      border-color: var(--accent);
      background: #fff;
    }

    .file-item-main {
      flex: 1 1 0;
      min-width: 0;
      text-align: left;
      cursor: pointer;
    }

    .file-item-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 10px;
    }

    .file-item-main .name {
      display: block;
      flex: 1 1 auto;
      min-width: 0;
      font-size: 0.96rem;
      word-break: break-word;
      margin-bottom: 0;
    }

    .file-item-controls {
      display: inline-flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 6px;
      flex: 0 0 auto;
    }

    .badge-row {
      display: inline-flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      padding: 4px 8px;
      border-radius: 999px;
      font-size: 0.74rem;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      background: var(--accent-soft);
      color: var(--accent);
    }

    .badge.warn { background: rgba(180, 83, 9, 0.12); color: var(--warn); }
    .badge.danger { background: rgba(185, 28, 28, 0.12); color: var(--danger); }
    .badge.ok { background: rgba(22, 101, 52, 0.12); color: var(--ok); }

    .file-item-visibility {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      flex: 0 0 auto;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      background: rgba(255, 255, 255, 0.9);
      color: var(--muted);
      font-size: 0.76rem;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      cursor: pointer;
      white-space: nowrap;
    }

    .file-item-visibility input[type="checkbox"] {
      margin: 0;
      accent-color: var(--accent);
    }

    .file-item-info {
      padding: 2px 7px;
      border-radius: 999px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      background: rgba(14, 116, 144, 0.06);
      color: var(--accent);
      font-size: 0.9rem;
      cursor: pointer;
      line-height: 1.4;
      transition: background 160ms ease;
    }

    .file-item-info:hover {
      background: rgba(14, 116, 144, 0.18);
    }

    .file-item-unload {
      padding: 3px 9px;
      border-radius: 999px;
      border: 1px solid rgba(185, 28, 28, 0.22);
      background: rgba(185, 28, 28, 0.08);
      color: var(--danger);
      font-size: 0.72rem;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      cursor: pointer;
      transition: background 160ms ease;
      white-space: nowrap;
    }

    .file-item-unload:hover {
      background: rgba(185, 28, 28, 0.16);
    }

    .main {
      padding: 28px;
      height: 100vh;
      overflow-y: auto;
    }

    .hero {
      display: flex;
      align-items: stretch;
      gap: 24px;
      margin-bottom: 20px;
    }

    .hero-text {
      flex: 1 1 200px;
      min-width: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
    }

    .hero-text h2 {
      margin: 0 0 8px;
      font-size: 2.1rem;
    }

    .hero-text p {
      margin: 0;
      color: var(--muted);
      max-width: 40ch;
    }

    .hero-tools {
      flex: 2 1 340px;
      min-width: 0;
    }

    .dropzone {
      position: relative;
      border: 2px dashed rgba(14, 116, 144, 0.32);
      border-radius: 26px;
      padding: 18px 20px;
      background: rgba(255, 255, 255, 0.72);

    .upload-progress {
      margin-top: 10px;
      padding: 10px 12px;
      border: 1px solid rgba(14, 116, 144, 0.22);
      border-radius: 12px;
      background: rgba(14, 116, 144, 0.08);
    }

    .upload-progress-head {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 10px;
      margin-bottom: 6px;
      font-size: 0.82rem;
      color: #0c4a5f;
    }

    .upload-progress-track {
      height: 8px;
      border-radius: 999px;
      overflow: hidden;
      background: rgba(14, 116, 144, 0.18);
      position: relative;
    }

    .upload-progress-fill {
      width: 0%;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, #0e7490, #06b6d4);
      transition: width 180ms ease;
    }

    .upload-progress.indeterminate .upload-progress-fill {
      width: 45%;
      animation: upload-indeterminate 1s linear infinite;
      background: linear-gradient(90deg, rgba(14, 116, 144, 0.95), rgba(6, 182, 212, 0.55));
    }

    .upload-progress.indeterminate .upload-progress-track {
      background: rgba(14, 116, 144, 0.12);
    }

    @keyframes upload-indeterminate {
      from { transform: translateX(-130%); }
      to { transform: translateX(280%); }
    }
      transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
    }

    .dropzone.active {
      border-color: var(--accent);
      background: rgba(14, 116, 144, 0.08);
      transform: translateY(-1px);
    }

    .dropzone p {
      margin: 0;
      color: var(--muted);
      font-size: 0.92rem;
    }

    .dropzone strong {
      display: block;
      margin-bottom: 6px;
      font-size: 1rem;
    }

    .button-row {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      margin-top: 12px;
    }

    .button,
    .toolbar button {
      border: 0;
      border-radius: 999px;
      padding: 10px 16px;
      font: inherit;
      cursor: pointer;
      color: white;
      background: linear-gradient(135deg, #0e7490 0%, #155e75 100%);
      box-shadow: var(--shadow);
    }

    .button.secondary,
    .toolbar button.secondary {
      color: var(--ink);
      background: rgba(255, 255, 255, 0.92);
      border: 1px solid rgba(17, 32, 49, 0.12);
    }

    .toolbar-left,
    .toolbar-right {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
    }

    .hero-badge-row {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
    }

    .license-buy-link {
      color: var(--accent);
      font-size: 0.84rem;
      font-weight: 700;
      text-decoration: underline;
      text-underline-offset: 2px;
      white-space: nowrap;
    }

    .license-buy-link:hover {
      color: var(--accent-strong);
    }

    .license-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      padding: 5px 14px;
      border-radius: 999px;
      font-size: 0.75rem;
      font-weight: 700;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      user-select: none;
    }

    .license-badge.community {
      background: #fef3c7;
      border: 2px solid #d97706;
      color: #92400e;
      box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25);
      font-size: 0.8rem;
    }

    .license-badge.community::before {
      content: '⚠';
      font-style: normal;
      margin-right: 4px;
    }

    .license-badge.pro {
      background: linear-gradient(135deg, #14532d 0%, #166534 45%, #15803d 100%);
      border: 1px solid rgba(22, 101, 52, 0.4);
      color: #fff;
      box-shadow: 0 2px 10px rgba(22, 101, 52, 0.35), 0 0 0 3px rgba(22, 101, 52, 0.12);
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    }

    .license-badge.pro::before {
      content: '✦';
      font-size: 0.65rem;
      opacity: 0.85;
    }

    .toolbar button.pro-locked-hover {
      cursor: not-allowed;
    }

    .export-split {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 2px;
    }

    .export-split-main {
      border-top-right-radius: 12px;
      border-bottom-right-radius: 12px;
      padding-right: 14px;
    }

    .export-split-toggle {
      min-width: 36px;
      padding: 10px 10px;
      border-top-left-radius: 12px;
      border-bottom-left-radius: 12px;
      border-top-right-radius: 12px;
      border-bottom-right-radius: 12px;
      font-size: 0.78rem;
      line-height: 1;
    }

    .export-menu {
      position: absolute;
      right: 0;
      top: calc(100% + 6px);
      min-width: 230px;
      padding: 6px;
      border-radius: 12px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      background: #fff;
      box-shadow: 0 12px 30px rgba(17, 32, 49, 0.18);
      z-index: 30;
      display: none;
    }

    .export-menu.open {
      display: grid;
      gap: 4px;
    }

    .export-menu button {
      width: 100%;
      text-align: left;
      border-radius: 10px;
      padding: 9px 10px;
      font-size: 0.86rem;
      color: var(--ink);
      border: 1px solid transparent;
      background: rgba(17, 32, 49, 0.02);
      box-shadow: none;
    }

    .export-menu button:hover {
      background: rgba(14, 116, 144, 0.08);
      border-color: rgba(14, 116, 144, 0.22);
    }

    .export-menu button:disabled,
    .export-menu button:disabled:hover {
      color: rgba(17, 32, 49, 0.45);
      background: rgba(17, 32, 49, 0.04);
      border-color: rgba(17, 32, 49, 0.1);
      cursor: not-allowed;
      text-decoration: line-through;
      box-shadow: none;
    }

    .hero h2 {
      margin: 0 0 8px;
      font-size: 2.1rem;
    }

    .hero p {
      margin: 0;
      color: var(--muted);
      max-width: 60ch;
    }

    .panel-grid {
      display: block;
    }

    .panel {
      background: var(--card);
      border: 1px solid rgba(17, 32, 49, 0.08);
      border-radius: 22px;
      box-shadow: var(--shadow);
      padding: 20px;
    }

    .panel h3 {
      margin: 0 0 14px;
      font-size: 1.1rem;
    }

    .diag-modal-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(17, 32, 49, 0.35);
      backdrop-filter: blur(4px);
      z-index: 200;
      align-items: center;
      justify-content: center;
    }

    .diag-modal-backdrop.open {
      display: flex;
    }

    .diag-modal {
      background: #fff;
      border-radius: 22px;
      box-shadow: 0 8px 40px rgba(17,32,49,0.18);
      padding: 28px 28px 24px;
      width: min(520px, 92vw);
      max-height: 80vh;
      overflow-y: auto;
      position: relative;
    }

    .diag-modal h3 {
      margin: 0 0 16px;
      font-size: 1.15rem;
    }

    .readme-content {
      font-size: 0.9rem;
      line-height: 1.6;
      color: var(--ink);
      background: rgba(14, 116, 144, 0.03);
      border: 1px solid rgba(17, 32, 49, 0.1);
      border-radius: 12px;
      padding: 14px;
      max-height: 60vh;
      overflow: auto;
      margin: 0;
    }

    .readme-content h1,
    .readme-content h2,
    .readme-content h3,
    .readme-content h4,
    .readme-content h5,
    .readme-content h6 {
      margin: 1em 0 0.5em;
      line-height: 1.25;
    }

    .readme-content h1 { font-size: 1.45rem; }
    .readme-content h2 { font-size: 1.25rem; }
    .readme-content h3 { font-size: 1.1rem; }

    .readme-content p {
      margin: 0.5em 0;
    }

    .readme-content ul,
    .readme-content ol {
      margin: 0.4em 0 0.8em 1.2em;
      padding: 0;
    }

    .readme-content code {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
      font-size: 0.85em;
      background: rgba(17, 32, 49, 0.08);
      padding: 0.1em 0.35em;
      border-radius: 6px;
    }

    .readme-content pre {
      background: rgba(17, 32, 49, 0.08);
      padding: 10px;
      border-radius: 10px;
      overflow-x: auto;
    }

    .readme-content pre code {
      background: transparent;
      padding: 0;
      border-radius: 0;
    }

    .readme-content a {
      color: var(--accent);
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 2px;
    }

    .readme-content blockquote {
      margin: 0.75em 0;
      padding: 0.35em 0.8em;
      border-left: 3px solid rgba(14, 116, 144, 0.35);
      background: rgba(14, 116, 144, 0.05);
      border-radius: 6px;
    }

    .diag-modal-close {
      position: absolute;
      top: 16px;
      right: 18px;
      background: none;
      border: none;
      font-size: 1.3rem;
      cursor: pointer;
      color: var(--muted);
      line-height: 1;
      transition: color 160ms ease;
    }

    .diag-modal-close:hover {
      color: var(--accent);
    }

    .diag-button {
      width: 100%;
      margin-top: 12px;
      text-align: left;
      padding: 10px 14px;
      border-radius: 12px;
      border: 1px solid rgba(17, 32, 49, 0.10);
      background: var(--card);
      cursor: pointer;
      font-size: 0.9rem;
      color: var(--muted);
      box-shadow: var(--shadow);
      transition: background 160ms ease, color 160ms ease;
    }

    .diag-button:hover {
      background: #fff;
      color: var(--accent);
    }

    .meta-list {
      display: grid;
      gap: 10px;
      margin: 0;
    }

    .meta-row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid rgba(17, 32, 49, 0.06);
      padding-bottom: 8px;
    }

    .meta-row:last-child { border-bottom: 0; padding-bottom: 0; }

    .meta-row span:first-child { color: var(--muted); }

    .candidate-list,
    .warning-list {
      display: grid;
      gap: 10px;
      margin-top: 12px;
    }

    .candidate,
    .warning {
      border-radius: 14px;
      padding: 12px 14px;
      background: rgba(255, 255, 255, 0.78);
      border: 1px solid rgba(17, 32, 49, 0.08);
    }

    .toolbar {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }

    .toolbar-secondary {
      margin-top: -4px;
      padding-top: 4px;
      border-top: 1px solid rgba(17, 32, 49, 0.06);
    }

    .agg-bar {
      display: flex;
      align-items: center;
      gap: 14px;
      flex-wrap: wrap;
      padding: 8px 12px;
      background: rgba(14, 116, 144, 0.07);
      border: 1px solid rgba(14, 116, 144, 0.18);
      border-radius: 8px;
      margin-bottom: 8px;
      font-size: 0.82rem;
      font-family: ui-monospace, "Cascadia Code", "Fira Mono", monospace;
    }

    .agg-bar label {
      font-family: Georgia, serif;
      font-size: 0.8rem;
      color: var(--muted);
      margin-right: 2px;
    }

    .agg-bar select {
      border: 1px solid rgba(14, 116, 144, 0.3);
      border-radius: 6px;
      padding: 3px 8px;
      background: white;
      font-size: 0.82rem;
      cursor: pointer;
    }

    .agg-cell {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 2px 10px;
      background: rgba(255,255,255,0.7);
      border-radius: 6px;
      border: 1px solid rgba(17, 32, 49, 0.1);
    }

    .agg-cell .agg-label {
      color: var(--muted);
    }

    .agg-cell .agg-value {
      color: var(--ink);
      font-weight: 600;
    }

    .agg-cell .agg-value.negative { color: var(--danger); }
    .agg-cell .agg-value.positive { color: var(--ok); }

    .toolbar input,
    .toolbar select {
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-radius: 999px;
      padding: 10px 14px;
      background: rgba(255, 255, 255, 0.9);
      color: var(--ink);
      font: inherit;
    }

    .toolbar-toggle {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      background: rgba(255, 255, 255, 0.9);
      color: var(--ink);
      font-size: 0.9rem;
      cursor: pointer;
      user-select: none;
    }

    .toolbar-toggle input[type="checkbox"] {
      margin: 0;
      accent-color: var(--accent);
    }

    .toolbar-date-field {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: var(--muted);
      font-size: 0.84rem;
      font-weight: 600;
      white-space: nowrap;
    }

    .toolbar-date-field input[type="date"] {
      min-width: 146px;
    }

    .table-control-row {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 8px;
      flex-wrap: wrap;
    }

    .table-control-row #searchInput {
      min-width: 390px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-radius: 999px;
      padding: 10px 14px;
      background: rgba(255, 255, 255, 0.9);
      color: var(--ink);
      font: inherit;
    }

    .status-stack {
      display: grid;
      gap: 2px;
      justify-items: end;
      text-align: right;
      margin-left: auto;
    }

    #rowsRegion {
      padding-right: 2px;
    }

    .table-wrap {
      max-height: min(70vh, 960px);
      overflow: auto;
      border-radius: 18px;
      border: 1px solid rgba(17, 32, 49, 0.08);
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.92rem;
      background: rgba(255, 255, 255, 0.85);
    }

    th,
    td {
      text-align: left;
      padding: 12px 14px;
      border-bottom: 1px solid rgba(17, 32, 49, 0.06);
      vertical-align: top;
    }

    th {
      position: sticky;
      top: 0;
      background: #fdfcf9;
      z-index: 1;
    }

    th.sortable {
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }

    th.sortable:hover {
      color: var(--accent);
    }

    th.resizable {
      position: sticky;
    }

    .header-cell {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-width: 0;
    }

    .header-cell.numeric {
      justify-content: flex-end;
    }

    .header-label {
      display: inline-flex;
      align-items: center;
      min-width: 0;
    }

    .sort-indicator {
      display: inline-block;
      min-width: 1.25em;
      color: var(--muted);
    }

    .column-resize-handle {
      flex: 0 0 auto;
      align-self: stretch;
      width: 10px;
      margin-right: -8px;
      cursor: col-resize;
      border-radius: 999px;
      background: linear-gradient(180deg, rgba(17, 32, 49, 0.06) 0%, rgba(14, 116, 144, 0.32) 100%);
    }

    .column-resize-handle:hover,
    .column-resize-handle.active {
      background: linear-gradient(180deg, rgba(14, 116, 144, 0.28) 0%, rgba(14, 116, 144, 0.72) 100%);
    }

    th.numeric,
    td.numeric {
      text-align: right;
    }

    td.numeric {
      font-variant-numeric: tabular-nums;
    }

    .empty {
      color: var(--muted);
      padding: 24px 0;
    }

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

    .category-manager {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
    }

    .category-manager input {
      min-width: 180px;
    }

    .row-category {
      width: 100%;
      min-width: 120px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.92);
      color: var(--ink);
      font: inherit;
      padding: 6px 10px;
    }

    .row-category-editor {
      display: grid;
      gap: 6px;
      min-width: 156px;
    }

    .row-category-actions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .row-category-rule {
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.92);
      color: var(--ink);
      font: inherit;
      font-size: 0.78rem;
      padding: 5px 10px;
      cursor: pointer;
      white-space: nowrap;
    }

    .row-category-rule:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .row-category-uncategorize {
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.92);
      color: var(--ink);
      font: inherit;
      font-size: 0.78rem;
      padding: 5px 10px;
      cursor: pointer;
      white-space: nowrap;
    }

    .row-category-uncategorize:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .row-category-save-rule {
      border: 1px solid rgba(14, 116, 144, 0.32);
      border-radius: 10px;
      background: rgba(14, 116, 144, 0.07);
      color: var(--accent);
      font: inherit;
      font-size: 0.78rem;
      padding: 5px 10px;
      cursor: pointer;
      white-space: nowrap;
    }

    .row-category-save-rule:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .row-note-input {
      width: 100%;
      min-width: 160px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.92);
      color: var(--ink);
      font: inherit;
      padding: 6px 10px;
    }

    .review-flag-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 22px;
      height: 22px;
      border-radius: 999px;
      font-size: 0.75rem;
      font-weight: 700;
      line-height: 1;
      border: 1px solid rgba(17, 32, 49, 0.12);
      cursor: help;
      user-select: none;
    }

    .review-flag-chip.flagged {
      color: #8a4b00;
      background: rgba(180, 83, 9, 0.12);
      border-color: rgba(180, 83, 9, 0.28);
    }

    .review-flag-chip.clear {
      color: var(--muted);
      background: rgba(17, 32, 49, 0.06);
      cursor: default;
    }

    .confidence-value {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 3.9rem;
      padding: 4px 10px;
      border-radius: 999px;
      border: 1px solid rgba(17, 32, 49, 0.12);
      background: rgba(17, 32, 49, 0.06);
      font-weight: 700;
      line-height: 1;
      white-space: nowrap;
    }

    .confidence-value.low {
      background: rgba(185, 28, 28, 0.12);
      border-color: rgba(185, 28, 28, 0.24);
      color: var(--danger);
    }

    .confidence-value.medium {
      background: rgba(180, 83, 9, 0.12);
      border-color: rgba(180, 83, 9, 0.24);
      color: var(--warn);
    }

    .confidence-value.high {
      background: rgba(5, 150, 105, 0.12);
      border-color: rgba(5, 150, 105, 0.24);
      color: var(--ok);
    }

    .save-rule-modal-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(17, 32, 49, 0.35);
      backdrop-filter: blur(4px);
      z-index: 200;
      align-items: center;
      justify-content: center;
    }

    .save-rule-modal-backdrop.open {
      display: flex;
    }

    .save-rule-modal {
      background: #fff;
      border-radius: 22px;
      box-shadow: 0 8px 40px rgba(17,32,49,0.18);
      padding: 28px 28px 24px;
      width: min(560px, 92vw);
      max-height: 86vh;
      overflow-y: auto;
      position: relative;
    }

    .save-rule-modal h3 { margin: 0 0 16px; font-size: 1.15rem; }

    .save-rule-modal label {
      display: block;
      font-size: 0.88rem;
      color: var(--muted);
      margin-bottom: 4px;
      margin-top: 14px;
    }

    .save-rule-modal label:first-of-type { margin-top: 0; }

    .save-rule-modal input,
    .save-rule-modal textarea {
      width: 100%;
      box-sizing: border-box;
      border: 1px solid rgba(17, 32, 49, 0.18);
      border-radius: 10px;
      padding: 9px 12px;
      font: inherit;
      font-size: 0.9rem;
      background: var(--card);
      color: var(--ink);
    }

    .save-rule-modal textarea {
      resize: vertical;
      min-height: 90px;
      font-family: ui-monospace, "Cascadia Code", "Fira Mono", monospace;
      font-size: 0.85rem;
    }

    .save-rule-modal .hint {
      font-size: 0.78rem;
      color: var(--muted);
      margin-top: 6px;
      line-height: 1.5;
    }

    .save-rule-modal .hint code {
      background: rgba(17,32,49,0.07);
      border-radius: 4px;
      padding: 1px 4px;
      font-size: 0.82rem;
    }

    .save-rule-modal .modal-actions {
      display: flex;
      gap: 10px;
      margin-top: 20px;
      justify-content: flex-end;
    }

    .save-rule-modal-close {
      position: absolute;
      top: 16px;
      right: 18px;
      background: none;
      border: none;
      font-size: 1.3rem;
      cursor: pointer;
      color: var(--muted);
      line-height: 1;
      transition: color 160ms ease;
    }

    .save-rule-modal-close:hover { color: var(--accent); }

    .category-editor {
      margin-top: 12px;
      padding: 12px;
      border: 1px solid rgba(17, 32, 49, 0.1);
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.85);
      display: grid;
      gap: 10px;
    }

    .category-editor .row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .category-editor textarea,
    .category-editor input,
    .category-editor select {
      width: 100%;
      box-sizing: border-box;
      border: 1px solid rgba(17, 32, 49, 0.18);
      border-radius: 10px;
      padding: 9px 12px;
      font: inherit;
      background: var(--card);
      color: var(--ink);
    }

    .category-editor textarea {
      min-height: 96px;
      resize: vertical;
    }

    .license-public-key-wrap {
      display: grid;
      gap: 6px;
    }

    .license-public-key-toggle {
      justify-self: start;
      padding: 0;
      border: none;
      background: transparent;
      color: var(--accent);
      font: inherit;
      font-weight: 600;
      cursor: pointer;
      text-decoration: underline;
      text-underline-offset: 2px;
    }

    .license-public-key-toggle:hover {
      color: var(--accent-strong);
    }

    .category-editor-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .small-hint {
      font-size: 0.8rem;
      color: var(--muted);
      margin: 0;
    }

    .group-list {
      display: grid;
      gap: 12px;
    }

    .group {
      border: 1px solid rgba(17, 32, 49, 0.08);
      border-radius: 16px;
      background: rgba(255, 255, 255, 0.84);
      overflow: hidden;
    }

    .group summary {
      cursor: pointer;
      list-style: none;
      padding: 12px 14px;
      font-weight: 600;
      border-bottom: 1px solid rgba(17, 32, 49, 0.06);
      background: rgba(14, 116, 144, 0.06);
    }

    .group summary::-webkit-details-marker {
      display: none;
    }

    .group .table-wrap {
      max-height: none;
      border: 0;
      border-radius: 0;
    }

    @media (max-width: 980px) {
      .shell,
      .panel-grid {
        grid-template-columns: 1fr;
      }

      .sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(17, 32, 49, 0.08);
      }
    }
