:root {
      color-scheme: light dark;
      font-family: 'Inter', sans-serif;
      background-color: #f5f7fb;
      color: #1f2933;
    }

    body {
      margin: 0;
      padding: 0;
    }

    main {
      max-width: 1200px;
      margin: 0 auto 64px auto;
      padding: 32px 24px 80px 24px;
      border-radius: 18px;
    }

    .card {
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 18px;
      padding: 24px;
      box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    }

    .upload-card {
      margin-bottom: 32px;
    }

    .upload-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 24px;
      align-items: flex-end;
    }

    .upload-grid > div {
      flex: 1 1 280px;
    }

    .file-control {
      display: flex;
      flex-direction: column;
    }

    .theme-filter-card {
      margin-top: 16px;
    }

    .combined-panel {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .combined-panel .subsection + .subsection {
      padding-top: 16px;
      border-top: 1px solid #e2e8f0;
    }

    .subsection h3 {
      margin-top: 0;
    }

    #filters.theme-grid {
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      grid-auto-flow: dense;
    }

    .upload-label {
      font-size: 14px;
      font-weight: 600;
      color: #374151;
      display: inline-block;
      margin-bottom: 6px;
    }

    .file-input::file-selector-button,
    .file-input::-webkit-file-upload-button {
      background: #4f46e5;
      color: #ffffff;
      border: none;
      border-radius: 999px;
      padding: 10px 18px;
      margin-right: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.15s ease;
    }

    .file-input::file-selector-button:hover,
    .file-input::-webkit-file-upload-button:hover {
      background: #4338ca;
    }

    .file-hint {
      margin-top: 6px;
    }

    .page-header {
      text-align: center;
      margin-bottom: 24px;
    }

    .page-title {
      margin: 0;
      font-size: 30px;
      font-weight: 700;
      color: #4f46e5;
    }

    .text-small {
      font-size: 12px;
      color: #6b7280;
      margin-top: 6px;
    }

    section {
      margin-bottom: 32px;
    }

    h2 {
      margin: 24px 0 12px 0;
      font-size: 20px;
      font-weight: 600;
      color: #4f46e5;
    }

    p {
      line-height: 1.6;
      margin: 0 0 8px 0;
    }

    input[type="file"],
    input[type="search"],
    select,
    button {
      font: inherit;
    }

    input[type="search"] {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid #d1d9e6;
      border-radius: 8px;
      background: #f8fafc;
    }

    button {
      padding: 10px 16px;
      border: none;
      border-radius: 8px;
      background: #4f46e5;
      color: #ffffff;
      cursor: pointer;
      transition: background 0.15s ease;
    }

    button.secondary {
      background: #4f46e5;
      color: #e5e7eb;
    }

    button:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    button:hover:not(:disabled) {
      background: #4338ca;
    }

    button.secondary:hover:not(:disabled) {
      background: #d1d5db;
    }

    label {
      font-weight: 600;
      display: block;
      margin-bottom: 4px;
    }

    .control-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 16px;
      margin-top: 16px;
    }

    .control-grid.three-column {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .control {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .control select {
      min-height: 32px;
      padding: 8px;
      border-radius: 10px;
      border: 1px solid #d1d9e6;
      background: #f8fafc;
    }

    #controls .controls-layout {
      display: block;
    }

    .participant-filters {
      border: 1px solid #e2e8f0;
      border-radius: 14px;
      padding: 16px;
      background: #fff;
      margin-bottom: 16px;
    }

    .participant-filters h3 {
      margin: 0 0 4px 0;
      font-size: 16px;
      color: #1d334f;
    }

    .toggle-list {
      display: flex;
      flex-wrap: nowrap;
      gap: 8px;
      margin-top: 8px;
      overflow-x: auto;
      padding-bottom: 6px;
    }

    .toggle-option {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      border-radius: 10px;
      border: 1px solid #d1d9e6;
      background: #ffffff;
      cursor: pointer;
      transition: border 0.15s ease, background 0.15s ease;
      flex: 1 1 auto;
      min-width: 120px;
      font-size: 12px;
      white-space: nowrap;
    }

    .toggle-option input {
      width: 16px;
      height: 16px;
      accent-color: #4f46e5;
    }

    .toggle-option:hover {
      border-color: #4338ca;
      background: #ede9fe;
    }

    .toggle-option.toggle-disabled {
      opacity: 0.6;
      cursor: not-allowed;
      background: #f1f5f9;
    }

    .toggle-option.toggle-disabled:hover {
      border-color: #d1d5db;
      background: #f1f5f9;
    }

    .controls-main h3 {
      margin: 24px 0 8px 0;
      font-size: 16px;
      font-weight: 600;
      color: #1d334f;
    }

    #base-filter-region {
      display: grid;
      gap: 8px;
    }

    .control-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }

    .remove-filter {
      border: none;
      border-radius: 999px;
      padding: 6px 12px;
      background: #e2e8f0;
      color: #0f172a;
      font-size: 12px;
      cursor: pointer;
      transition: background 0.15s ease;
    }

    .remove-filter:hover {
      background: #cbd5f5;
    }

    .hint {
      font-size: 13px;
      color: #475569;
    }

    .message {
      padding: 12px 14px;
      border-radius: 10px;
      margin-top: 12px;
      font-size: 14px;
      display: none;
    }

    .message.error {
      background: #fee2e2;
      color: #7f1d1d;
      border: 1px solid #fecaca;
    }

    .message.success {
      background: #dcfce7;
      color: #14532d;
      border: 1px solid #bbf7d0;
    }

    .summary-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 20px;
      margin-top: 16px;
    }

    .summary-card {
      border: 1px solid #e2e8f0;
      border-radius: 14px;
      padding: 16px;
      background: #fff;
      display: flex;
      flex-direction: column;
      height: 360px;
    }

    .summary-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 8px;
    }

    .summary-card h3 {
      margin: 0;
      font-size: 16px;
      color: #0f172a;
    }

    .icon-button {
      border: 1px solid transparent;
      background: #ede9fe;
      color: #312e81;
      border-radius: 999px;
      padding: 6px 10px;
      cursor: pointer;
      font-size: 14px;
      transition: background 0.15s ease, border 0.15s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .icon-button svg {
      width: 16px;
      height: 16px;
      fill: currentColor;
      pointer-events: none;
    }

    .icon-button:hover {
      background: #ddd6fe;
      border-color: #c4b5fd;
    }

    .icon-button:focus-visible {
      outline: 2px solid #4f46e5;
      outline-offset: 2px;
    }

    .icon-button:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      background: #ede9fe;
      border-color: #e2e8f0;
    }

    .summary-card ul {
      list-style: none;
      padding: 0;
      margin: 0;
      font-size: 14px;
    }

    .summary-table-wrapper {
      flex: 1;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      overflow: auto;
      background: #ffffff;
      margin-top: 8px;
    }

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

    .summary-table thead {
      background: #ede9fe;
      color: #4f46e5;
    }

    .summary-table th,
    .summary-table td {
      padding: 6px 8px;
      border: 1px solid #e2e8f0;
      text-align: left;
      vertical-align: top;
    }

    .summary-table td.count {
      text-align: right;
      color: #4f46e5;
      font-weight: 600;
      white-space: nowrap;
    }

    .summary-empty {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      border: 1px dashed #cbd5f5;
      border-radius: 10px;
      margin-top: 8px;
      padding: 16px;
      background: #ffffff;
    }

    .table-container {
      overflow-x: auto;
      border-radius: 12px;
      border: 1px solid #e2e8f0;
    }

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

    thead {
      background: #4f46e5;
      color: #ffffff;
    }

    th,
    td {
      padding: 10px 12px;
      border-bottom: 1px solid #e2e8f0;
      text-align: left;
      vertical-align: top;
    }

    tbody tr:nth-child(odd) {
      background: #f8fafc;
    }

    tbody tr:nth-child(even) {
      background: #ffffff;
    }

    .sticky-actions {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      margin-top: 16px;
    }

    .panel-toggle-wrap {
      display: flex;
      justify-content: flex-end;
      margin: 16px 0;
    }

    .panel-toggle {
      border: none;
      border-radius: 999px;
      padding: 10px 18px;
      background: #e0e7ff;
      color: #312e81;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.15s ease, color 0.15s ease;
    }

    .panel-toggle:hover:not(:disabled) {
      background: #c7d2fe;
      color: #1e1b4b;
    }

    .panel-toggle:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    .panel-collapsed {
      display: none !important;
    }

    .view-panel {
      margin-top: 8px;
    }

    .results-header {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .view-toggle {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }

    .view-toggle-label {
      font-size: 13px;
      font-weight: 600;
      color: #475569;
    }

    .radio-option {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      border: 1px solid #d1d9e6;
      border-radius: 999px;
      background: #f8fafc;
      cursor: pointer;
      font-size: 13px;
    }

    .radio-option input {
      accent-color: #4f46e5;
    }

    .results-actions {
      margin-top: 12px;
      display: flex;
      justify-content: flex-end;
    }

    .result-filter-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      color: #475569;
    }

    .result-filter-toggle .radio-option {
      margin: 0;
    }

    .checkbox-cell {
      text-align: center;
      white-space: nowrap;
    }

    .checkbox-cell label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-weight: 500;
    }

    tr.row-use-quote td {
      background: #f8efc9 !important;
    }

    tr.row-added td {
      background: #dcfce7 !important;
    }

    tr.row-discrepancy td {
      background: #fee2e2 !important;
    }

    tr.row-discrepancy.row-use-quote td {
      background: #fee2e2 !important;
    }

    .participant-panel {
      margin-top: 24px;
      border: 1px solid #e2e8f0;
      border-radius: 14px;
      padding: 16px;
      background: #fff;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .participant-panel-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .participant-panel-header h3 {
      margin: 0 0 4px 0;
      font-size: 16px;
      color: #1d334f;
    }

    .participant-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      max-height: 160px;
      overflow-y: auto;
    }

    .participant-chip {
      padding: 6px 12px;
      border-radius: 999px;
      border: 1px solid #d1d9e6;
      background: #f8fafc;
      font-size: 13px;
      color: #1f2933;
    }

    .participant-list-empty {
      padding: 12px;
      border-radius: 10px;
      background: #f1f5f9;
      color: #475569;
      font-size: 13px;
      width: 100%;
    }

    @media (max-width: 720px) {
      main {
        margin: 0 12px;
        padding: 24px 16px 64px 16px;
      }

      #controls .controls-layout {
        display: block;
      }

      .control-grid.three-column {
        grid-template-columns: 1fr;
      }

      .summary-grid {
        grid-template-columns: 1fr;
      }

      .participant-panel-header {
        flex-direction: column;
        align-items: flex-start;
      }
    }
