/* app.css extracted from app_shell.html; keep selectors stable */
    :root {
      --bg: #111827;
      --panel: #1f2937;
      --line: #374151;
      --text: #e5e7eb;
      --muted: #9ca3af;
      --accent: #3b82f6;
      --hover: #334155;
      --left-bg-a: #1f2937;
      --left-bg-b: #111827;
      --folder-active-a: #1e3a8a;
      --folder-active-b: #1d4ed8;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
      height: 100vh;
      overflow: hidden;
    }
    html[data-app-boot-mode="system"] body > main.layout { display: none; }
    html[data-app-boot-mode="system"] body > #systemPanel { display: block !important; }
    .app-shell-boot-loader { min-height: calc(100vh - 120px); display: grid; place-items: center; color: var(--muted); font-size: 14px; }
    .app-shell-boot-loader span::before { content: "Ładowanie modułu…"; }
    html[data-app-boot-module="calculator"] .app-shell-boot-loader span::before { content: "Ładowanie Kalkulatora…"; }
    html[data-app-boot-module="todo_v2"] .app-shell-boot-loader span::before { content: "Ładowanie Wniosków…"; }
    html[data-app-boot-module="contracts"] .app-shell-boot-loader span::before { content: "Ładowanie Umów…"; }
    .readonly { color: #0b7a2a; font-weight: 600; }
    .layout {
      height: calc(100vh - 52px);
      display: grid;
      grid-template-columns: 230px 420px 1fr;
      gap: 0;
    }
    .panel {
      background: var(--panel);
      border-right: 1px solid var(--line);
      overflow: auto;
    }
    .auth-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.5);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 120;
    }
    .auth-card {
      width: min(420px, 92vw);
      background: #0f172a;
      border: 1px solid #334155;
      border-radius: 14px;
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
      padding: 16px;
    }
    #foldersPanel {
      background: linear-gradient(160deg, var(--left-bg-a), var(--left-bg-b));
      padding: 8px;
    }
    .section {
      padding: 8px 8px 3px;
      font-weight: 700;
      font-size: 11px;
      text-transform: uppercase;
      color: #cbd5e1;
    }
    .account-toggle {
      width: 100%;
      border: 0;
      background: rgba(30, 41, 59, 0.8);
      text-align: left;
      padding: 8px 10px;
      font-weight: 700;
      font-size: 11px;
      text-transform: uppercase;
      color: #e5e7eb;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-radius: 12px;
      border: 1px solid #334155;
      margin: 5px 0;
      box-shadow: none;
    }
    .account-toggle:hover {
      background: #0f172a;
      border-color: #475569;
    }
    .account-caret {
      font-size: 10px;
      color: #cbd5e1;
      margin-left: 8px;
      flex: 0 0 auto;
    }
    .folder {
      width: 100%;
      border: 1px solid transparent;
      background: rgba(15, 23, 42, 0.6);
      text-align: left;
      padding: 7px 9px;
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      font-size: 12px;
      color: #e5e7eb;
      border-radius: 10px;
      margin: 2px 0;
      transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
    }
    .folder:hover {
      background: #0f172a;
      border-color: #475569;
      transform: translateX(1px);
    }
    .folder.active {
      background: linear-gradient(135deg, var(--folder-active-a), var(--folder-active-b));
      border-color: #60a5fa;
      color: #f8fafc;
      font-weight: 600;
      box-shadow: 0 4px 12px rgba(30, 64, 175, 0.35);
    }
    .folder-left {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      min-width: 0;
    }
    .folder-caret-toggle {
      width: 12px;
      display: inline-block;
      color: #cbd5e1;
      cursor: pointer;
      user-select: none;
      text-align: center;
      flex: 0 0 12px;
      font-size: 11px;
    }
    .list-header,
    .mail-header {
      position: sticky;
      top: 0;
      background: #0f172a;
      border-bottom: 1px solid #334155;
      padding: 10px 12px;
      z-index: 2;
      font-size: 13px;
      color: var(--muted);
    }
    #contentPanel .mail-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .list-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      padding: 6px 8px;
    }
    .thread-toggle {
      display: flex;
      align-items: center;
      gap: 6px;
      color: var(--text);
      font-size: 12px;
    }
    .view-controls {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .mail-toolbar {
      display: flex;
      flex-direction: column;
      gap: 4px;
      width: 100%;
    }
    .mail-toolbar-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      width: 100%;
      flex-wrap: wrap;
    }
    .mail-toolbar-left,
    .mail-toolbar-right {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }
    .mail-toolbar-search {
      min-width: 190px;
      max-width: 360px;
      margin: 0;
      border: 1px solid #8fa0b8;
      border-radius: 8px;
      background: #1a2434;
      color: #e5e7eb;
      padding: 4px 8px;
      font-size: 11px;
    }
    .mail-toolbar-count {
      border: 1px solid #475569;
      border-radius: 999px;
      background: #0f172a;
      color: #cbd5e1;
      padding: 1px 8px;
      font-size: 10px;
      font-weight: 700;
      white-space: nowrap;
    }
    #messageListTitle {
      font-size: 12px;
      font-weight: 700;
      line-height: 1.15;
    }
    .list-header .ctrl-select,
    .list-header .ctrl-btn {
      font-size: 11px;
      padding: 3px 7px;
      min-height: 30px;
    }
    .list-header .thread-toggle {
      font-size: 11px;
    }
    .ctrl-select {
      border: 1px solid #475569;
      border-radius: 8px;
      background: #0f172a;
      color: #e5e7eb;
      font-size: 12px;
      padding: 4px 8px;
    }
    .ctrl-btn {
      border: 1px solid #475569;
      border-radius: 8px;
      background: #1e293b;
      color: #e5e7eb;
      font-size: 12px;
      padding: 4px 8px;
      cursor: pointer;
    }
    .ctrl-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .ctrl-btn.is-active {
      background: #1b67c9;
      color: #fff;
      border-color: #1553a4;
    }

    .contract-signatures-table {
      width: 100%;
      table-layout: fixed;
      border-collapse: collapse;
      margin: 24pt 0 12pt;
      font-family: inherit;
      font-size: inherit;
    }
    .contract-signatures-table td {
      border: 0;
      padding: 0;
    }
    .contract-signature-cell {
      width: 45%;
      text-align: center;
      vertical-align: top;
    }
    .contract-signature-gap { width: 10%; }
    .contract-signature-role {
      margin-bottom: 10pt;
      font-weight: 600;
    }
    .contract-signature-box {
      width: 85%;
      height: 60pt;
      margin: 0 auto;
      border: 1px solid #000;
      box-sizing: border-box;
    }
    .contract-signature-caption {
      margin-top: 5pt;
      font-size: 9pt;
    }
    .ctrl-btn.ctrl-btn-create-case {
      background: #1d4d1d;
      border-color: #22c55e;
      color: #dcfce7;
      font-weight: 700;
    }
    .ctrl-btn.ctrl-btn-create-case:hover {
      background: #166534;
      border-color: #4ade80;
      color: #ecfdf5;
    }
    .ctrl-btn.ctrl-btn-attach-case {
      background: #1e40af;
      border-color: #60a5fa;
      color: #dbeafe;
      font-weight: 700;
    }
    .ctrl-btn.ctrl-btn-attach-case:hover {
      background: #1d4ed8;
      border-color: #93c5fd;
      color: #eff6ff;
    }
    .ctrl-btn.ctrl-btn-detach-case {
      background: #991b1b;
      border-color: #f87171;
      color: #fee2e2;
      font-weight: 700;
    }
    .ctrl-btn.ctrl-btn-detach-case:hover {
      background: #b91c1c;
      border-color: #fca5a5;
      color: #fff1f2;
    }
    .ctrl-btn.ctrl-btn-case-edit {
      background: #9a3412;
      border-color: #fdba74;
      color: #fff7ed;
      font-weight: 700;
    }
    .ctrl-btn.ctrl-btn-case-edit:hover {
      background: #c2410c;
      border-color: #fed7aa;
      color: #ffffff;
    }
    .btn-op-icon {
      display: inline-flex;
      align-items: center;
      gap: 1px;
      line-height: 1;
    }
    .btn-folder-icon {
      font-size: 14px;
      line-height: 1;
    }
    .btn-op-mark {
      color: #fff;
      font-size: 16px;
      font-weight: 800;
      line-height: 1;
      text-shadow: 0 0 1px rgba(15, 23, 42, 0.45);
    }
    .btn-gallery-scope {
      margin-left: 4px;
      font-size: 11px;
      font-weight: 700;
      line-height: 1;
      text-transform: lowercase;
      letter-spacing: 0.01em;
    }
    .filter-line-wrap {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex: 0 0 100%;
      width: 100%;
      margin-bottom: 2px;
    }
    .gallery-line-wrap {
      display: inline-flex;
      align-items: center;
      justify-content: flex-start;
      gap: 6px;
      flex: 0 0 100%;
      width: 100%;
      margin-bottom: 2px;
    }
    #gallerySelectedCountBadge {
      border: 1px solid #64748b;
      background: #0f172a;
      color: #e2e8f0;
      font-size: 11px;
      padding: 3px 8px;
      min-height: 30px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    #btnGallery {
      margin-left: auto;
    }
    .ctrl-btn.applications-has::after {
      content: attr(data-applications-count);
      margin-left: 6px;
      display: inline-block;
      min-width: 16px;
      height: 16px;
      line-height: 16px;
      text-align: center;
      border-radius: 999px;
      background: #f59e0b;
      color: #111827;
      font-size: 10px;
      font-weight: 700;
    }
    .yn-toggle {
      display: inline-flex;
      align-items: center;
      border: 1px solid #475569;
      border-radius: 999px;
      overflow: hidden;
      background: #0f172a;
      min-width: 110px;
    }
    .yn-toggle .yn-opt {
      border: 0;
      background: transparent;
      color: #cbd5e1;
      font-size: 12px;
      padding: 5px 12px;
      cursor: pointer;
      min-width: 54px;
      transition: background-color 120ms ease, color 120ms ease;
    }
    .yn-toggle .yn-opt.is-active[data-yn="yes"] {
      background: #166534;
      color: #ecfdf5;
      font-weight: 700;
    }
    .yn-toggle .yn-opt.is-active[data-yn="no"] {
      background: #7f1d1d;
      color: #fee2e2;
      font-weight: 700;
    }
    .local-badge {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      color: #bfdbfe;
      background: #1e3a8a;
      border: 1px solid #3b82f6;
      vertical-align: middle;
    }
    .mid-badge {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      color: #fed7aa;
      background: #7c2d12;
      border: 1px solid #fb923c;
      vertical-align: middle;
    }
    .att-badge {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      color: #0f5132;
      background: #d1fae5;
      border: 1px solid #86efac;
      vertical-align: middle;
    }
    .msg-chips {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      flex-wrap: wrap;
    }
    .mail-chip {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: .02em;
      line-height: 1.1;
      border: 1px solid #475569;
      background: #0f172a;
      color: #cbd5e1;
      vertical-align: middle;
      white-space: nowrap;
    }
    .mail-chip-att {
      border-color: #475569;
      background: #111827;
      color: #cbd5e1;
    }
    .mail-chip-case {
      border-color: #3b82f6;
      background: #1e3a8a;
      color: #dbeafe;
    }
    .mail-chip-client {
      border-color: #16a34a;
      background: #14532d;
      color: #dcfce7;
    }
    .mail-chip-flag {
      border-color: #64748b;
      background: #0f172a;
      color: #cbd5e1;
    }
    .mail-chip-sent,
    .mail-status-chip-sent {
      border-color: #38bdf8;
      background: #0c4a6e;
      color: #e0f2fe;
    }
    .mail-direction-icon {
      display: inline-grid;
      width: 14px;
      height: 14px;
      place-items: center;
      border-radius: 50%;
      background: #0284c7;
      color: #f0f9ff;
      font-size: 11px;
      font-weight: 900;
      line-height: 1;
    }
    .mail-subject-line .mail-chip-sent {
      flex: 0 0 auto;
      padding: 4px 9px;
      border-width: 2px;
      font-size: 11px;
      box-shadow: 0 0 0 1px rgb(56 189 248 / 20%);
    }
    .mail-item.unread .subject,
    .thread-child.unread .subject {
      font-weight: 700;
    }
    .unread-icon {
      display: inline-block;
      margin-right: 6px;
      font-size: 12px;
      line-height: 1;
      color: #93c5fd;
      vertical-align: middle;
    }
    #analysisPanel {
      padding: 10px;
    }
    .analysis-folder {
      border: 1px solid #334155;
      border-radius: 10px;
      background: #111827;
      margin-bottom: 10px;
      overflow: hidden;
    }
    .analysis-folder-head {
      padding: 8px 10px;
      background: #0f172a;
      border-bottom: 1px solid #334155;
      font-weight: 600;
      font-size: 12px;
      color: #cbd5e1;
    }
    .analysis-item {
      border-top: 1px solid #334155;
      padding: 8px 10px;
      font-size: 12px;
    }
    .analysis-item:first-child { border-top: 0; }
    .analysis-subject {
      color: #93c5fd;
      font-weight: 600;
      cursor: pointer;
      text-decoration: underline;
      text-decoration-color: #60a5fa;
    }
    .analysis-chip {
      display: inline-block;
      margin: 3px 5px 0 0;
      padding: 2px 7px;
      border-radius: 999px;
      border: 1px solid #475569;
      background: #1e293b;
      color: #cbd5e1;
      cursor: pointer;
      font-size: 11px;
    }
    .candidate-box {
      margin-top: 8px;
      border: 1px solid #334155;
      border-radius: 8px;
      padding: 6px 8px;
      background: #0b1220;
    }
    .candidate-row {
      border-top: 1px solid #334155;
      padding: 6px 0;
      font-size: 12px;
    }
    .candidate-row:first-child { border-top: 0; }
    .entity-card {
      border: 1px solid #8fa0b8;
      border-radius: 12px;
      background: #1a2434;
      padding: 10px;
      margin: 10px 0;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    }
    .bk-case-picker-list {
      padding: 8px;
      line-height: 1.25;
      white-space: normal;
      font-size: 12px;
    }
    .bk-case-picker-card {
      margin: 0 0 8px 0;
      padding: 8px;
      border: 1px solid #8fa0b8;
      border-radius: 10px;
      background: #1a2434;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
    }
    .bk-case-picker-card:last-child {
      margin-bottom: 0;
    }
    .bk-case-picker-lines {
      display: grid;
      grid-auto-rows: min-content;
      row-gap: 3px;
      margin: 0;
      padding: 0;
    }
    .bk-case-picker-line {
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.2;
      margin: 0;
      padding: 0;
    }
    .bk-case-picker-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .bk-case-picker-title {
      color: #e5e7eb;
      font-size: 14px;
      font-weight: 700;
      white-space: normal;
      overflow-wrap: anywhere;
      word-break: break-word;
      line-height: 1.2;
      margin: 0;
      padding: 0;
    }
    .bk-case-picker-status-row {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      margin: 0;
      padding: 0;
    }
    .bk-case-picker-status-row .cand-badge,
    .bk-case-picker-status-row .case-status-badge-new,
    .bk-case-picker-status-row .cand-warn {
      margin-left: 0;
    }
    .bk-case-picker-calc-badge {
      display: inline-block;
      margin-left: 0;
      padding: 1px 8px;
      border-radius: 999px;
      font-size: 10px;
      color: #dcfce7;
      background: #166534;
      border: 1px solid #22c55e;
      vertical-align: middle;
      white-space: nowrap;
    }
    .bk-case-picker-actions {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      margin-top: 6px;
      padding: 0;
    }
    .entity-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 6px;
    }
    .bk-panel-dark {
      border: 1px solid #8fa0b8;
      border-radius: 8px;
      background: #1a2434;
    }
    .bk-section-head {
      border-bottom: 1px solid #334155;
      background: #0f172a;
    }
    .bk-section-subhead {
      border-bottom: 1px solid #334155;
      background: #0b1220;
    }
    .bk-input-light-border {
      border: 1px solid #93a4bc !important;
      border-radius: 8px;
      background: #0f172a;
      color: #e2e8f0;
    }
    .bk-required-shadow {
      box-shadow: 2px 2px 0 0 rgba(245, 158, 11, 0.9);
    }
    .bk-input-unit {
      color: #cbd5e1;
      font-size: 12px;
    }
    .bk-file-input {
      border: 1px solid #93a4bc;
      border-radius: 8px;
      padding: 6px;
      background: #0f172a;
      color: #e2e8f0;
    }
    .case-operator-form,
    .case-operator-block,
    .case-operator-field {
      display: grid;
      gap: 10px;
    }
    .case-operator-section {
      margin: 0;
    }
    .case-assessment-analysis-item {
      min-width: 0;
      padding: 12px;
      border: 1px solid #475569;
      border-radius: 10px;
      background: #111827;
    }
    .case-ai-analysis-section {
      display: grid;
      gap: 4px;
    }
    .case-operator-ltv {
      display: flex;
      align-items: baseline;
      gap: 6px;
      flex-wrap: wrap;
      padding: 8px 10px;
      border: 1px solid #475569;
      border-radius: 8px;
      background: #111827;
    }
    .case-operator-block {
      padding: 12px;
      border: 1px solid #475569;
      border-radius: 10px;
      background: #0f172a;
    }
    .case-operator-block h4 {
      margin: 0;
    }
    .case-operator-rating {
      display: flex;
      align-items: center;
      gap: 7px;
      flex-wrap: wrap;
    }
    .case-operator-star-choice {
      border: 1px solid #64748b;
      border-radius: 8px;
      background: #1e293b;
      color: #f8fafc;
      cursor: pointer;
      font-size: 18px;
      padding: 5px 9px;
    }
    .case-operator-star-choice:hover,
    .case-operator-star-choice.is-selected {
      border-color: #fbbf24;
      background: #713f12;
    }
    .case-operator-reasons {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 7px 12px;
    }
    .case-operator-reason {
      display: flex;
      align-items: flex-start;
      gap: 7px;
      cursor: pointer;
    }
    .case-operator-reason input {
      margin-top: 2px;
    }
    @media (max-width: 760px) {
      .case-operator-reasons {
        grid-template-columns: 1fr;
      }
    }
    .case-status-badge-new {
      display: inline-block;
      margin-left: 8px;
      padding: 1px 8px;
      border-radius: 999px;
      border: 1px solid #f87171;
      background: #7f1d1d;
      color: #fee2e2;
      font-size: 10px;
      font-weight: 700;
      vertical-align: middle;
    }
    .cand-badge {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #3b82f6;
      background: #1e3a8a;
      color: #dbeafe;
    }
    .case-status-badge-signed {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #22c55e;
      background: #166534;
      color: #dcfce7;
    }
    .case-status-badge-analysis {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #475569;
      background: #e2e8f0;
      color: #1e293b;
    }
    .case-status-badge-accepted {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #22c55e;
      background: #14532d;
      color: #dcfce7;
    }
    .case-status-badge-supplementing {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #f59e0b;
      background: #78350f;
      color: #fef3c7;
    }
    .case-status-badge-ready-sign {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #818cf8;
      background: #312e81;
      color: #e0e7ff;
    }
    .case-status-badge-closed {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #475569;
      background: #1e293b;
      color: #e2e8f0;
    }
    .case-status-badge-collections {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 10px;
      border: 1px solid #fb923c;
      background: #7c2d12;
      color: #ffedd5;
    }
    .cand-warn {
      color: #fdba74;
      font-size: 11px;
      margin-left: 6px;
    }
    .client-section .card {
      border: 1px solid #334155;
      border-radius: 10px;
      background: #111827;
      padding: 10px;
      margin-bottom: 10px;
    }
    .client-section .card__header,
    .client-section .card__summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 8px;
    }
    .client-section .grid { display: grid; gap: 8px; }
    .client-section .grid--2 { grid-template-columns: 1fr 1fr; }
    .client-section .field label { display: block; color: #94a3b8; font-size: 12px; margin-bottom: 2px; }
    .client-section .value { font-size: 13px; color: #e2e8f0; }
    .client-section .badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 999px;
      background: #1e3a8a;
      border: 1px solid #3b82f6;
      color: #dbeafe;
      font-size: 11px;
      font-weight: 600;
    }
    .client-section .muted { color: #94a3b8; font-size: 12px; }
    .client-section .sensitive .value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 50;
    }
    .modal-backdrop.modal-top {
      z-index: 80;
    }
    #caseCalculatorModalBackdrop {
      z-index: 90;
    }
    #caseCalculatorUnsavedModalBackdrop {
      z-index: 100;
    }
    .modal {
      width: min(760px, 92vw);
      max-height: 84vh;
      overflow: auto;
      background: #0f172a;
      border: 1px solid #334155;
      border-radius: 14px;
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
      padding: 14px;
    }
    .modal-head {
      font-weight: 700;
      margin-bottom: 10px;
    }
    .modal-search {
      width: 100%;
      border: 1px solid #475569;
      border-radius: 8px;
      padding: 8px 10px;
      margin-bottom: 10px;
      font-size: 13px;
      background: #111827;
      color: #e5e7eb;
    }
    .modal-list {
      border: 1px solid #334155;
      border-radius: 10px;
      overflow: auto;
      max-height: 48vh;
      background: #111827;
    }
    .modal-item {
      width: 100%;
      border: 0;
      border-bottom: 1px solid #334155;
      background: transparent;
      text-align: left;
      padding: 8px 10px;
      cursor: pointer;
      font-size: 13px;
    }
    .modal-item:hover { background: #1e293b; }
    .modal-item.active { background: #1e3a8a; color: #e0f2fe; font-weight: 600; }
    .modal-foot {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-top: 10px;
    }
    .modal-picked { color: #cbd5e1; font-size: 12px; }
    /* Ensure high contrast inside "Znajdź pasujące maile" modal on dark theme. */
    #caseMatchModalBackdrop .modal {
      background: #0b1220;
      border-color: #334155;
      color: #e5e7eb;
    }
    #caseMatchModalBackdrop .modal-head,
    #caseMatchModalBackdrop label,
    #caseMatchModalBackdrop strong,
    #caseMatchModalBackdrop .candidate-row {
      color: #e5e7eb;
    }
    #caseMatchModalBackdrop .meta {
      color: #cbd5e1;
      white-space: normal;
      overflow: visible;
      text-overflow: clip;
    }
    #caseMatchModalBackdrop .modal-list {
      background: #0f172a;
      border-color: #334155;
    }
    #caseMatchModalBackdrop .candidate-row {
      border-top-color: #334155;
    }
    #caseMatchModalBackdrop .ctrl-select {
      background: #0f172a;
      color: #e5e7eb;
      border-color: #475569;
    }
    #caseDataModalBackdrop.case-drawer-backdrop {
      justify-content: flex-end;
      padding: 0;
      background: rgba(2, 6, 23, 0.58);
    }
    #caseDataModalBackdrop .case-drawer {
      width: min(980px, 96vw);
      height: 100vh;
      max-height: 100vh;
      overflow: hidden;
      background: #0b1220;
      border-left: 1px solid #334155;
      box-shadow: -18px 0 42px rgba(2, 6, 23, 0.55);
      display: grid;
      grid-template-rows: auto 1fr;
      border-radius: 0;
      padding: 0;
    }
    #caseDataModalBackdrop .case-drawer-head {
      position: sticky;
      top: 0;
      z-index: 2;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 10px;
      padding: 14px 16px 12px;
      border-bottom: 1px solid #334155;
      background: linear-gradient(180deg, #0f172a, #0b1220);
    }
    #caseDataModalBackdrop .case-drawer-head-main {
      min-width: 0;
    }
    #caseDataModalBackdrop .case-drawer-contract-lock-status {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin: 2px 0 6px;
    }
    #caseDataModalBackdrop .case-drawer-contract-lock-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      max-width: 100%;
      padding: 5px 8px;
      border: 1px solid #a16207;
      border-radius: 999px;
      background: #78350f;
      color: #fef3c7;
      font-size: 12px;
      font-weight: 700;
      line-height: 1.25;
    }
    #caseDataModalBackdrop .case-drawer-contract-lock-badge.is-locked {
      border-color: #166534;
      background: #14532d;
      color: #dcfce7;
    }
    #caseDataModalBackdrop .case-drawer-contract-lock-badge.is-unlocked {
      cursor: help;
    }
    #caseDataModalBackdrop .case-drawer-body {
      display: grid;
      grid-template-columns: 260px 1fr;
      min-height: 0;
    }
    #caseDataModalBackdrop .case-drawer-nav {
      border-right: 1px solid #334155;
      padding: 12px;
      overflow: auto;
      background: #0f172a;
      display: grid;
      gap: 6px;
      align-content: start;
    }
    #caseDataModalBackdrop .case-drawer-tab {
      width: 100%;
      text-align: left;
      justify-content: flex-start;
    }
    #caseDataModalBackdrop .case-drawer-tab.is-active {
      border-color: #60a5fa;
      background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
      color: #e0f2fe;
    }
    #caseDataModalBackdrop .case-drawer-divider {
      margin: 6px 0 2px;
      padding-top: 8px;
      border-top: 1px solid #334155;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.04em;
      color: #94a3b8;
      text-transform: uppercase;
    }
    #caseDataModalBackdrop .case-drawer-divider span {
      display: inline-block;
      padding: 0 2px;
    }
    #caseDataModalBackdrop .case-drawer-divider.is-head {
      margin-top: 0;
      padding-top: 0;
      border-top: 0;
    }
    #caseDataModalBackdrop .case-drawer-content {
      padding: 16px;
      overflow: auto;
      display: grid;
      gap: 12px;
      align-content: start;
      background: #0b1220;
    }
    #caseDataModalBackdrop .case-drawer-card {
      border: 1px solid #334155;
      border-radius: 12px;
      background: #111827;
      padding: 12px;
    }
    #caseDataModalBackdrop .case-drawer-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
    }
    .case-loan-inline-editor {
      display: grid;
      gap: 12px;
      color: #e5e7eb;
    }
    .case-loan-inline-status,
    .case-loan-inline-block,
    .case-loan-inline-row,
    .case-loan-inline-note {
      border: 1px solid #334155;
      border-radius: 10px;
      background: #0f172a;
      padding: 10px;
    }
    .case-loan-inline-status {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }
    .case-loan-inline-status.is-enabled {
      border-color: #16a34a;
      background: #0c1f17;
    }
    .case-loan-inline-status.is-disabled {
      border-color: #64748b;
    }
    .case-loan-inline-note {
      color: #cbd5e1;
      border-color: #475569;
    }
    .case-loan-inline-summary,
    .case-loan-inline-actions,
    .case-loan-inline-block-head,
    .case-loan-inline-row-head {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
    .case-loan-inline-summary span {
      padding: 4px 8px;
      border-radius: 999px;
      background: #1e293b;
    }
    .case-loan-inline-block {
      display: grid;
      gap: 8px;
    }
    .case-loan-inline-block-head,
    .case-loan-inline-row-head {
      justify-content: space-between;
    }
    .case-loan-inline-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(180px, 1fr));
      gap: 8px;
      margin-top: 8px;
    }
    .case-loan-inline-grid label {
      display: grid;
      gap: 4px;
      min-width: 0;
    }
    .case-loan-inline-grid label > span {
      color: #cbd5e1;
      font-size: 12px;
    }
    .case-loan-inline-grid .modal-search {
      width: 100%;
      max-width: none;
      margin: 0;
      box-sizing: border-box;
    }
    .case-loan-inline-empty {
      color: #94a3b8;
      padding: 8px 2px;
    }
    @media (max-width: 760px) {
      #caseDataModalBackdrop .case-drawer-head {
        flex-direction: column;
      }
      .case-loan-inline-grid {
        grid-template-columns: 1fr;
      }
      .case-loan-inline-status {
        align-items: flex-start;
        flex-direction: column;
      }
    }
    .thread-count {
      display: inline-block;
      min-width: 24px;
      text-align: center;
      padding: 1px 6px;
      border-radius: 999px;
      background: #334155;
      color: #bfdbfe;
      font-size: 11px;
      font-weight: 600;
      margin-left: 6px;
    }
    .mail-item {
      width: 100%;
      border: 1px solid #334155;
      background: #111827;
      text-align: left;
      padding: 10px;
      cursor: pointer;
      border-radius: 12px;
      margin: 6px 8px;
      box-shadow: 0 1px 2px rgba(2, 6, 23, 0.35);
      transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
    }
    .mail-item.entity-card {
      background: linear-gradient(160deg, #182334, #101a2a);
      border-color: #8fa0b8;
      box-shadow: 0 2px 8px rgba(2, 6, 23, 0.45);
    }
    .mail-item:hover {
      border-color: #475569;
      box-shadow: 0 6px 14px rgba(2, 6, 23, 0.45);
      transform: translateY(-1px);
    }
    .mail-item.entity-card:hover {
      border-color: #b7c4d8;
      box-shadow: 0 10px 18px rgba(2, 6, 23, 0.55);
    }
    .mail-item.active {
      background: linear-gradient(140deg, #1e3a8a, #1d4ed8);
      border-color: #60a5fa;
      box-shadow: 0 8px 18px rgba(30, 64, 175, 0.35);
    }
    .thread-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      width: 100%;
    }
    .thread-main-left {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      flex: 1 1 auto;
    }
    .thread-caret {
      width: 22px;
      height: 22px;
      color: #e5e7eb;
      background: #1e293b;
      border: 1px solid #475569;
      border-radius: 999px;
      flex: 0 0 22px;
      text-align: center;
      font-size: 13px;
      font-weight: 700;
      line-height: 20px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .mail-item:hover .thread-caret,
    .thread-child:hover .thread-caret {
      background: #334155;
      border-color: #64748b;
      color: #f8fafc;
    }
    .mail-item.active .thread-caret {
      background: rgba(15, 23, 42, 0.55);
      border-color: #93c5fd;
      color: #f8fafc;
    }
    .thread-children {
      margin: -2px 12px 8px 22px;
      padding: 4px 0 6px;
      border-left: 2px solid #334155;
      background: transparent;
    }
    .thread-child {
      width: 100%;
      border: 1px solid #334155;
      background: #0f172a;
      text-align: left;
      padding: 8px 10px 8px 14px;
      cursor: pointer;
      border-radius: 10px;
      margin: 4px 0 0 10px;
      font-size: 13px;
    }
    .thread-child.entity-card {
      background: linear-gradient(160deg, #141f30, #0f1726);
      border-color: #7f93ad;
    }
    .thread-child-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      width: 100%;
    }
    .thread-child:hover { background: #1e293b; border-color: #475569; }
    .thread-child.entity-card:hover { background: #1d2a3d; border-color: #aebed4; }
    .thread-child.active { background: #1e3a8a; border-color: #60a5fa; }
    .mail-item.in-case,
    .thread-child.in-case {
      border-left: 4px solid #16a34a;
      background: #052e1a;
    }
    .mail-item.in-case:hover,
    .thread-child.in-case:hover {
      background: #064e2a;
    }
    .pick-col {
      width: 24px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      margin-right: 6px;
      flex: 0 0 24px;
    }
    .subject {
      font-weight: 600;
      font-size: 14px;
      color: #f3f4f6;
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mail-from-line {
      font-size: 14px;
      font-weight: 700;
      color: #e5edf8;
      line-height: 1.25;
      margin-top: 2px;
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mail-subject-line {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      margin-bottom: 4px;
    }
    .mail-subject-line .subject {
      font-size: 14px;
      font-weight: 700;
      margin: 0;
    }
    .mail-snippet-line {
      font-size: 12px;
      color: #9fb0c7;
      line-height: 1.3;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      white-space: normal;
    }
    .subject-row {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      margin-bottom: 4px;
    }
    .flag-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex: 0 0 auto;
      border: 1px solid rgba(0, 0, 0, 0.15);
    }
    .flag-red { background: #ff4245; }
    .flag-orange { background: #ff9230; }
    .flag-yellow { background: #ffd600; }
    .flag-green { background: #30d158; }
    .flag-blue { background: #0091ff; }
    .flag-purple { background: #db34f2; }
    .flag-gray { background: #8e8e93; }
    .flag-unknown {
      border-color: #cbd5e1;
      background: transparent;
      box-shadow: inset 0 0 0 2px #0f172a;
    }
    .meta {
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mail-content {
      padding: 14px;
      line-height: 1.45;
      white-space: pre-wrap;
      word-break: break-word;
      font-size: 14px;
    }
    #messages {
      padding: 4px 0 10px;
      background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
      min-height: calc(100% - 46px);
    }
    #contentPanel {
      background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
    }
    #content {
      margin: 10px;
      padding: 14px;
      border: 1px solid #334155;
      border-radius: 14px;
      background: #0f172a;
      box-shadow: 0 4px 14px rgba(2, 6, 23, 0.35);
    }
    .mail-view-wrap {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .mail-view-card {
      border: 1px solid #8fa0b8;
      border-radius: 12px;
      background: #1a2434;
      box-shadow: 0 2px 8px rgba(2, 6, 23, 0.35);
      overflow: hidden;
    }
    .mail-view-card-head {
      padding: 10px 12px;
      border-bottom: 1px solid #41546d;
      background: #223146;
      color: #dbe7f5;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .02em;
    }
    .mail-view-meta {
      padding: 10px 12px;
      display: grid;
      gap: 8px;
    }
    .mail-meta-row {
      display: grid;
      grid-template-columns: 56px 1fr;
      gap: 10px;
      align-items: start;
    }
    .mail-meta-label {
      color: #9fb0c7;
      font-size: 12px;
      font-weight: 700;
    }
    .mail-meta-value {
      color: #e6eef9;
      font-size: 13px;
      line-height: 1.35;
      word-break: break-word;
    }
    .mail-status-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 2px;
    }
    .mail-status-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 2px 9px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: .02em;
      border: 1px solid #55677e;
      background: #111b2b;
      color: #d3dfef;
      max-width: 260px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mail-status-chip-case {
      border-color: #3b82f6;
      background: #1e3a8a;
      color: #dbeafe;
    }
    .mail-status-chip-client {
      border-color: #16a34a;
      background: #14532d;
      color: #dcfce7;
    }
    .mail-status-chip-att {
      border-color: #64748b;
      background: #1f2937;
      color: #d1d5db;
    }
    .mail-status-chip-flag {
      border-color: #64748b;
      background: #0f172a;
      color: #cbd5e1;
    }
    .mail-status-chip-read {
      border-color: #0ea5e9;
      background: #0c4a6e;
      color: #e0f2fe;
    }
    .mail-status-chip-unread {
      border-color: #60a5fa;
      background: #1e3a8a;
      color: #dbeafe;
    }
    .mail-view-body {
      padding: 12px;
      background: #202c3f;
      color: #e6eef9;
      white-space: pre-wrap;
      word-break: break-word;
      line-height: 1.48;
      font-size: 14px;
      border-top: 1px solid #41546d;
    }
    .mail-html {
      border-top: 1px dashed #5a6d87;
      margin-top: 10px;
      padding-top: 10px;
    }
    .mail-html-card {
      margin-top: 8px;
      background: #ffffff;
      border: 1px solid #d1d5db;
      border-radius: 8px;
      padding: 8px;
      color: #111827;
    }
    .mail-html-title {
      color: #111827;
      margin-bottom: 6px;
      font-size: 13px;
      font-weight: 600;
    }
    .attachments {
      border-top: 1px dashed #5a6d87;
      margin-top: 10px;
      padding-top: 10px;
    }
    .thread-content-list {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .thread-content-item {
      border: 1px solid #3f5167;
      border-radius: 12px;
      background: #172131;
      padding: 10px;
    }
    .thread-content-item-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
      font-size: 12px;
      color: #9fb0c7;
    }
    .att-item {
      border: 1px solid #334155;
      border-radius: 10px;
      padding: 8px;
      margin: 8px 0;
      background: #111827;
    }
    .att-head {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      align-items: center;
      font-size: 13px;
      margin-bottom: 6px;
    }
    .att-meta { color: var(--muted); font-size: 12px; }
    .att-preview-image {
      max-width: 100%;
      height: auto;
      border: 1px solid var(--line);
      border-radius: 6px;
      display: block;
    }
    .att-preview-pdf {
      width: 100%;
      height: 520px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: #111827;
    }
    .empty {
      padding: 14px;
      color: var(--muted);
      font-size: 14px;
    }
    #systemPanel {
      height: calc(100vh - 56px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    #systemContent {
      flex: 1 1 auto;
      min-height: 0;
      overflow: auto;
      padding-bottom: 18px;
    }

    /* Pełny formularz nieruchomości: /wnioski -> Edytuj/Edytuj2 -> Nieruchomości. */
    #casePropertyModalBackdrop {
      padding: 20px;
    }
    #casePropertyModalBackdrop .case-property-modal {
      width: min(1320px, 98vw);
      height: calc(100vh - 40px);
      height: calc(100dvh - 40px);
      max-height: none;
      padding: 0;
      overflow-x: hidden;
      overflow-y: scroll;
      display: block;
      box-sizing: border-box;
      border: 1px solid #334155;
      border-radius: 18px;
      background: #0b1220;
      box-shadow: 0 30px 90px rgba(2, 6, 23, .72);
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      scrollbar-color: #60a5fa #111827;
      scrollbar-gutter: stable;
      scrollbar-width: auto;
    }
    #casePropertyModalBackdrop .case-property-modal::-webkit-scrollbar {
      width: 14px;
    }
    #casePropertyModalBackdrop .case-property-modal::-webkit-scrollbar-track {
      border-left: 1px solid #263449;
      background: #111827;
    }
    #casePropertyModalBackdrop .case-property-modal::-webkit-scrollbar-thumb {
      min-height: 48px;
      border: 3px solid #111827;
      border-radius: 999px;
      background: #60a5fa;
    }
    #casePropertyModalBackdrop .case-property-modal::-webkit-scrollbar-thumb:hover {
      background: #93c5fd;
    }
    .case-property-modal__head {
      position: sticky;
      top: 0;
      z-index: 3;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 20px;
      padding: 20px 22px 16px;
      border-bottom: 1px solid #263449;
      background: linear-gradient(135deg, #111c30, #0f172a 58%, #12233c);
    }
    .case-property-modal__head .modal-head {
      margin: 2px 0 5px;
      font-size: 21px;
      line-height: 1.25;
    }
    .case-property-modal__eyebrow {
      color: #60a5fa;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .11em;
      text-transform: uppercase;
    }
    .case-property-add {
      flex: 0 0 auto;
      border-color: #2563eb;
      background: #1d4ed8;
      color: #eff6ff;
      font-weight: 700;
    }
    .case-property-modal__intro {
      padding: 10px 22px;
      border-bottom: 1px solid #263449;
      background: rgba(30, 64, 175, .1);
      color: #b8c5d8;
      font-size: 12px;
      line-height: 1.55;
    }
    .case-property-list {
      min-height: 0;
      overflow: visible;
      display: grid;
      align-content: start;
      gap: 18px;
      padding: 18px 22px 28px;
    }
    .case-property-modal__footer {
      position: sticky;
      bottom: 0;
      z-index: 3;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 13px 22px;
      border-top: 1px solid #334155;
      background: #0f172a;
      box-shadow: 0 -12px 30px rgba(2, 6, 23, .26);
    }
    .case-property-card {
      min-width: 0;
      overflow: hidden;
      border: 1px solid #3a4b64;
      border-radius: 16px;
      background: linear-gradient(180deg, #111a2b, #0f172a);
      box-shadow: 0 12px 28px rgba(2, 6, 23, .24);
    }
    .case-property-card__head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 15px 18px;
      border-bottom: 1px solid #334155;
      background: rgba(30, 41, 59, .72);
    }
    .case-property-card__title,
    .case-property-card__title > div,
    .case-property-person__head > div {
      display: flex;
      align-items: center;
      min-width: 0;
      gap: 11px;
    }
    .case-property-card__title > div {
      align-items: flex-start;
      flex-direction: column;
      gap: 2px;
    }
    .case-property-card__title > div > span {
      color: #7dd3fc;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: .1em;
      text-transform: uppercase;
    }
    .case-property-card__title strong {
      max-width: 760px;
      overflow: hidden;
      color: #f8fafc;
      font-size: 16px;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .case-property-card__index,
    .case-property-person__index {
      display: inline-grid;
      place-items: center;
      width: 34px;
      height: 34px;
      flex: 0 0 auto;
      border: 1px solid #2563eb;
      border-radius: 10px;
      background: #172554;
      color: #bfdbfe;
      font-size: 12px;
      font-weight: 800;
    }
    .case-property-remove,
    .case-property-remove-person {
      border-color: #7f1d1d;
      background: rgba(127, 29, 29, .18);
      color: #fecaca;
    }
    .case-property-section {
      padding: 18px;
      border-bottom: 1px solid #263449;
    }
    .case-property-section--last { border-bottom: 0; }
    .case-property-section__head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 14px;
    }
    .case-property-section__head > div {
      display: flex;
      align-items: center;
      gap: 9px;
    }
    .case-property-section__head > div > span {
      color: #60a5fa;
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .08em;
    }
    .case-property-section__head h3 {
      margin: 0;
      color: #f1f5f9;
      font-size: 14px;
    }
    .case-property-section__head p {
      max-width: 520px;
      margin: 0;
      color: #8495ad;
      font-size: 11px;
      line-height: 1.45;
      text-align: right;
    }
    .case-property-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      min-width: 0;
    }
    .case-property-field {
      display: grid;
      align-content: start;
      min-width: 0;
      gap: 6px;
      color: #cbd5e1;
      font-size: 11px;
      font-weight: 700;
    }
    .case-property-field.is-wide { grid-column: span 2; }
    .case-property-field.is-full { grid-column: 1 / -1; }
    .case-property-field.is-property-type-hidden { display: none; }
    .case-property-field > span { padding-left: 2px; }
    .case-property-field small {
      min-height: 15px;
      color: #7f91aa;
      font-size: 10px;
      font-weight: 500;
      line-height: 1.35;
    }
    .case-property-field .modal-search,
    .case-property-field .ctrl-select {
      width: 100%;
      max-width: none;
      min-height: 40px;
      margin: 0;
      border-color: #42536c;
      border-radius: 9px;
      background: #0b1322;
      color: #f1f5f9;
    }
    .case-property-field textarea.modal-search {
      min-height: 96px;
      padding: 10px 12px;
      resize: vertical;
      line-height: 1.5;
    }
    .case-property-details {
      border-bottom: 1px solid #263449;
      background: rgba(15, 23, 42, .5);
    }
    .case-property-details > summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 15px 18px;
      cursor: pointer;
      list-style: none;
      color: #e2e8f0;
    }
    .case-property-details > summary::-webkit-details-marker { display: none; }
    .case-property-details > summary::after {
      content: '⌄';
      margin-left: auto;
      color: #7dd3fc;
      font-size: 18px;
      transition: transform .18s ease;
    }
    .case-property-details[open] > summary::after { transform: rotate(180deg); }
    .case-property-details > summary > span:first-child {
      display: grid;
      gap: 2px;
    }
    .case-property-details > summary small {
      color: #8091a8;
      font-size: 10px;
      font-weight: 500;
    }
    .case-property-count {
      display: inline-grid;
      min-width: 26px;
      height: 26px;
      place-items: center;
      border: 1px solid #334155;
      border-radius: 999px;
      background: #111827;
      color: #bfdbfe;
      font-size: 11px;
      font-weight: 800;
    }
    .case-property-details__body {
      display: grid;
      gap: 15px;
      padding: 2px 18px 18px;
    }
    .case-property-toggles {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }
    .case-property-toggle {
      display: flex;
      align-items: flex-start;
      gap: 9px;
      min-width: 0;
      padding: 11px 12px;
      border: 1px solid #3b4b63;
      border-radius: 10px;
      background: #111827;
      color: #e2e8f0;
      cursor: pointer;
    }
    .case-property-toggle input {
      width: 17px;
      height: 17px;
      margin: 1px 0 0;
      accent-color: #2563eb;
    }
    .case-property-toggle > span { display: grid; gap: 3px; }
    .case-property-toggle strong { font-size: 11px; }
    .case-property-toggle small { color: #8495ad; font-size: 10px; font-weight: 500; }
    .case-property-list-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding-top: 3px;
    }
    .case-property-list-head > div { display: grid; gap: 2px; }
    .case-property-list-head strong { color: #e2e8f0; font-size: 12px; }
    .case-property-list-head span { color: #8495ad; font-size: 10px; }
    .case-property-people { display: grid; gap: 12px; }
    .case-property-person {
      display: grid;
      gap: 13px;
      padding: 14px;
      border: 1px solid #334155;
      border-radius: 12px;
      background: #0c1423;
    }
    .case-property-person__head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .case-property-person__index {
      width: 27px;
      height: 27px;
      border-color: #475569;
      background: #1e293b;
      color: #cbd5e1;
      border-radius: 8px;
      font-size: 10px;
    }
    .case-property-subhead {
      padding-top: 3px;
      border-top: 1px dashed #334155;
      color: #93a4ba;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: .06em;
      text-transform: uppercase;
    }
    .case-property-empty {
      display: grid;
      justify-items: center;
      gap: 5px;
      padding: 34px 18px;
      border: 1px dashed #475569;
      border-radius: 13px;
      background: rgba(15, 23, 42, .58);
      color: #94a3b8;
      text-align: center;
    }
    .case-property-empty strong { color: #dbeafe; font-size: 13px; }
    .case-property-empty span { font-size: 11px; }
    .case-property-empty--compact { padding: 18px; }

    @media (max-width: 1100px) {
      .layout { grid-template-columns: 200px 320px 1fr; }
      .case-property-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .case-property-field.is-full { grid-column: 1 / -1; }
      .case-property-toggles { grid-template-columns: 1fr 1fr; }
    }
    @media (max-width: 820px) {
      .layout { grid-template-columns: 1fr; }
      .panel { border-right: 0; border-bottom: 1px solid var(--line); height: 33vh; }
      .att-preview-pdf { height: 360px; }
      #systemPanel { height: calc(100vh - 56px); }
      #casePropertyModalBackdrop { padding: 0; }
      #casePropertyModalBackdrop .case-property-modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
      }
      .case-property-modal__head,
      .case-property-modal__footer,
      .case-property-section__head,
      .case-property-list-head,
      .case-property-person__head {
        align-items: stretch;
        flex-direction: column;
      }
      .case-property-modal__head { padding: 15px; }
      .case-property-modal__intro { padding: 10px 15px; }
      .case-property-list { padding: 12px 10px 22px; }
      .case-property-modal__footer { padding: 11px 15px; }
      .case-property-modal__footer .view-controls { width: 100%; }
      .case-property-modal__footer .ctrl-btn { flex: 1 1 auto; }
      .case-property-section__head p { text-align: left; }
      .case-property-grid,
      .case-property-toggles { grid-template-columns: 1fr; }
      .case-property-field.is-wide,
      .case-property-field.is-full { grid-column: auto; }
      .case-property-card__head { align-items: flex-start; }
      .case-property-card__title strong { white-space: normal; }
    }
/* Operator rate-change comparison, embedded in the existing V12 section. */
.rate-change { margin-top: 16px; padding-top: 12px; border-top: 1px solid #334155; color: inherit; }
.rate-change h3 { margin: 0 0 8px; font-size: 1rem; }
.rate-change__dependency, .rate-change__message { margin: 6px 0 10px; color: #cbd5e1; font-size: .9rem; }
.rate-change__chain { display: grid; gap: 12px; }
.rate-change__candidate { padding: 10px 0; border-top: 1px solid #334155; }
.rate-change__candidate > header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rate-change__candidate > header span { color: #cbd5e1; }
.rate-change__candidate > p { line-height: 1.55; color: #cbd5e1; }
.rate-change__options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rate-change__option { padding: 10px 12px; border: 1px solid #475569; border-radius: 8px; background: rgba(15, 23, 42, .45); }
.rate-change__option--selected { border-color: #2563eb; background: rgba(30, 64, 175, .16); }
.rate-change__option--unavailable { opacity: .72; }
.rate-change__option h4 { margin: 0; font-size: .95rem; }
.rate-change__option p { margin: 5px 0 10px; color: #cbd5e1; }
.rate-change__option dl { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(180px, 1.2fr); gap: 5px 12px; margin: 0 0 10px; font-size: .88rem; }
.rate-change__option dt { color: #cbd5e1; }
.rate-change__option dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.rate-change__option dd small { color: #cbd5e1; white-space: nowrap; }
.rate-change__missing { padding: 10px; color: #cbd5e1; }
.rate-change__actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.rate-change__audit, .rate-change__processing { color: #cbd5e1; font-size: .88rem; }
.rate-change__alert { margin: 8px 0; padding: 9px 11px; border-left: 3px solid #16a34a; background: rgba(22, 163, 74, .12); color: #e2e8f0; }
.rate-change__alert--error { border-left-color: #dc2626; background: rgba(220, 38, 38, .12); }
.rate-change__alert dl { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(180px, 1.2fr); gap: 4px 12px; margin: 8px 0 0; }
.rate-change__alert dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 980px) { .rate-change__options { grid-template-columns: 1fr; } }
