    :root {
      --win-blue: #00a4ef;
      --win-blue-dark: #0067b8;
      --win-green: #7fba00;
      --win-yellow: #ffb900;
      --win-red: #f25022;
      --bg: #f4f7fb;
      --panel: #ffffff;
      --panel-2: #eef6ff;
      --ink: #1f2937;
      --muted: #59677a;
      --line: #d9e2ec;
      --teal: #0067b8;
      --green: #5f9f00;
      --blue: #0067b8;
      --amber: #a86f00;
      --coral: #c2410c;
      --mint: #edf8d8;
      --sky: #e7f3ff;
      --warn: #fff4cc;
      --danger: #fff0eb;
      --radius: 8px;
      --shadow: 0 14px 34px rgba(31, 41, 55, 0.09);
      font-family: "Roboto", "Segoe UI", "Arial", sans-serif;
    }

    * {
      box-sizing: border-box;
      scrollbar-color: #8fa2b8 #eef3f8;
      scrollbar-width: thin;
    }

    *::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    *::-webkit-scrollbar-track {
      background: #eef3f8;
    }

    *::-webkit-scrollbar-thumb {
      border: 2px solid #eef3f8;
      border-radius: 8px;
      background: #8fa2b8;
    }

    *::-webkit-scrollbar-thumb:hover {
      background: #647b94;
    }

    .row-action-menu {
      display: inline-block;
      margin-left: 6px;
      vertical-align: top;
    }

    .row-action-menu summary {
      list-style: none;
      cursor: pointer;
    }

    .row-action-menu summary::-webkit-details-marker {
      display: none;
    }

    .row-action-menu-list {
      display: grid;
      gap: 6px;
      min-width: 150px;
      margin-top: 6px;
      padding: 8px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: var(--panel);
      box-shadow: var(--shadow);
    }

    .row-action-menu-list .btn {
      width: 100%;
      text-align: left;
    }

    .toast-action {
      margin-left: 12px;
      padding: 6px 10px;
      border: 1px solid rgba(255, 255, 255, 0.55);
      border-radius: 6px;
      color: #ffffff;
      background: transparent;
      font: inherit;
      font-weight: 700;
      cursor: pointer;
    }

    body {
      margin: 0;
      color: var(--ink);
      background: var(--bg);
      font-family: "Roboto", "Segoe UI", "Arial", sans-serif;
      font-size: 14px;
      line-height: 1.45;
      overflow-x: hidden;
    }

    body.mobile-nav-open {
      overflow: hidden;
    }

    small {
      font-size: 12px;
    }

    .restore-screen {
      display: none;
      min-height: 100vh;
      place-items: center;
      padding: 24px;
      background:
        radial-gradient(circle at 18% 18%, rgba(0, 164, 239, 0.34), transparent 32%),
        radial-gradient(circle at 82% 14%, rgba(127, 186, 0, 0.28), transparent 30%),
        linear-gradient(135deg, #132238, #0078d4),
        var(--bg);
    }

    .restore-card {
      width: min(420px, 100%);
      padding: 24px;
      border-radius: var(--radius);
      background: var(--panel);
      border: 1px solid var(--line);
      box-shadow: 0 24px 80px rgba(16, 31, 28, 0.22);
      text-align: center;
    }

    .restore-card img {
      width: 74px;
      height: 74px;
      object-fit: contain;
      margin-bottom: 12px;
    }

    .restore-card strong {
      display: block;
      font-size: 14.4px;
    }

    .restore-card span {
      display: block;
      margin-top: 6px;
      color: var(--muted);
    }

    .session-restoring .login-screen,
    .session-restoring .app {
      display: none !important;
    }

    .session-restoring .restore-screen {
      display: grid;
    }

    .public-intake-screen,
    .anonymous-case-screen {
      display: none;
      min-height: 100vh;
      padding: 22px;
      background:
        linear-gradient(180deg, rgba(0, 164, 239, 0.08), transparent 280px),
        var(--bg);
    }

    .public-intake-route .public-intake-screen,
    .public-intake-active .public-intake-screen {
      display: block;
    }

    .anonymous-case-route .anonymous-case-screen,
    .anonymous-case-active .anonymous-case-screen {
      display: block;
    }

    .public-intake-route .login-screen,
    .public-intake-route .app,
    .public-intake-route .restore-screen,
    .public-intake-active .login-screen,
    .public-intake-active .app,
    .public-intake-active .restore-screen,
    .anonymous-case-route .login-screen,
    .anonymous-case-route .app,
    .anonymous-case-route .restore-screen,
    .anonymous-case-active .login-screen,
    .anonymous-case-active .app,
    .anonymous-case-active .restore-screen {
      display: none !important;
    }

    .public-intake-shell,
    .anonymous-case-shell {
      width: min(1120px, 100%);
      margin: 0 auto;
      display: grid;
      gap: 16px;
    }

    .public-intake-header,
    .anonymous-case-header {
      display: flex;
      gap: 14px;
      align-items: center;
      padding: 18px;
      border-radius: var(--radius);
      background: var(--panel);
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
      border-top: 4px solid var(--win-blue);
    }

    .public-intake-header img,
    .anonymous-case-header img {
      width: 72px;
      height: 72px;
      object-fit: contain;
    }

    .public-intake-header h1,
    .anonymous-case-header h1 {
      margin: 0;
      font-size: 19.2px;
    }

    .public-intake-header p,
    .anonymous-case-header p {
      margin: 5px 0 0;
      color: var(--muted);
    }

    .public-intake-card,
    .anonymous-case-card {
      max-width: 100%;
      overflow: hidden;
      padding: 18px;
      border-radius: var(--radius);
      background: var(--panel);
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
    }

    .public-intake-section {
      min-width: 0;
      margin-top: 18px;
      padding-top: 16px;
      border-top: 1px solid var(--line);
    }

    .public-intake-section h2 {
      margin: 0 0 10px;
      font-size: 14.4px;
    }

    .anonymous-case-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .anonymous-case-note {
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #f8fafc;
      color: var(--muted);
    }

    .photo-upload-box {
      min-height: 150px;
      display: grid;
      place-items: center;
      padding: 16px;
      border: 1px dashed #94a3b8;
      border-radius: var(--radius);
      background: #f8fbff;
      color: var(--muted);
      text-align: center;
    }

    .public-intake-card .table-scroll {
      width: 100%;
      max-width: 100%;
      min-width: 0;
      display: block;
      overflow-x: auto;
      overflow-y: hidden;
    }

    .public-intake-card .family-table {
      min-width: 860px;
    }

    .family-actions {
      display: flex;
      justify-content: flex-end;
      margin-top: 10px;
    }

    .public-intake-card input[type="checkbox"] {
      width: auto;
      margin-right: 8px;
      transform: translateY(1px);
    }

    .public-intake-card .hp-field {
      position: absolute;
      left: -10000px;
      top: auto;
      width: 1px;
      height: 1px;
      overflow: hidden;
    }

    .bot-verification-section {
      display: grid;
      gap: 12px;
    }

    .turnstile-container {
      width: min(100%, 420px);
      min-height: 65px;
    }

    .verification-status {
      margin: 0;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .verification-status.verified {
      color: #176b45;
      font-weight: 700;
    }

    .consent-list {
      display: grid;
      gap: 10px;
    }

    .consent-list label {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      line-height: 1.45;
    }

    button,
    input,
    select,
    textarea {
      font: inherit;
    }

    button {
      cursor: pointer;
    }

    .app {
      min-height: 100vh;
      display: grid;
      grid-template-columns: 252px minmax(0, 1fr);
      overflow-x: hidden;
    }

    .mobile-appbar,
    .mobile-filter-toggle,
    .sidebar-close,
    .sidebar-backdrop {
      display: none;
    }

    .app.locked,
    .hidden-by-role {
      display: none !important;
    }

    .conditional-hidden {
      display: none !important;
    }

    .patient-mode .staff-only,
    .clinical-restricted .clinical-only,
    .finance-restricted .finance-only,
    .volunteer-mode .searchbar,
    .not-super-admin .super-admin-only {
      display: none !important;
    }

    .login-screen {
      min-height: 100vh;
      padding: 28px;
      display: grid;
      grid-template-columns: minmax(360px, 500px) minmax(420px, 520px);
      gap: 28px;
      align-items: center;
      justify-content: center;
      background:
        radial-gradient(circle at 14% 18%, rgba(0, 164, 239, 0.38), transparent 31%),
        radial-gradient(circle at 86% 18%, rgba(127, 186, 0, 0.28), transparent 28%),
        radial-gradient(circle at 16% 82%, rgba(255, 185, 0, 0.22), transparent 28%),
        radial-gradient(circle at 84% 82%, rgba(242, 80, 34, 0.22), transparent 28%),
        linear-gradient(135deg, #111827, #0f3b63 55%, #0078d4),
        var(--bg);
    }

    .login-brand {
      padding: 34px;
      border-radius: var(--radius);
      background: rgba(255, 255, 255, 0.96);
      border: 1px solid rgba(255, 255, 255, 0.4);
      box-shadow: var(--shadow);
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      gap: 28px;
    }

    .login-brand img {
      width: 112px;
      height: 112px;
      object-fit: contain;
      background: #ffffff;
      border-radius: 8px;
      padding: 6px;
      border: 1px solid var(--line);
    }

    .login-brand h1 {
      margin: 18px 0 10px;
      font-size: 24.8px;
      line-height: 1.1;
      letter-spacing: 0;
    }

    .login-brand p {
      margin: 0;
      color: var(--muted);
      max-width: 520px;
    }

    .login-card {
      align-self: center;
      width: min(520px, 100%);
      justify-self: center;
      padding: 24px;
      border-radius: var(--radius);
      background: var(--panel);
      border: 1px solid var(--line);
      box-shadow: 0 24px 80px rgba(16, 31, 28, 0.22);
    }

    .login-card h2 {
      font-size: 19.2px;
    }

    .auth-step {
      display: none;
      gap: 14px;
    }

    .auth-step.active {
      display: grid;
    }

    .auth-note {
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--sky);
      color: #075985;
      font-size: 12px;
    }

    .login-meta {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin-top: 8px;
    }

    .login-meta div {
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
    }

    .login-meta span {
      display: block;
      color: var(--muted);
      font-size: 12px;
    }

    .login-meta strong {
      display: block;
      margin-top: 4px;
      font-size: 12.8px;
    }

    .sidebar {
      background: #111827;
      color: #f8fafc;
      padding: 22px 18px;
      display: flex;
      flex-direction: column;
      gap: 22px;
      border-right: 1px solid #0f172a;
      position: sticky;
      top: 0;
      max-height: 100vh;
      overflow-x: hidden;
      overflow-y: auto;
      scrollbar-width: thin;
    }

    .sidebar::before {
      content: "";
      position: absolute;
      inset: 0 0 auto;
      height: 5px;
      background: linear-gradient(90deg, var(--win-blue) 0 25%, var(--win-green) 25% 50%, var(--win-yellow) 50% 75%, var(--win-red) 75% 100%);
    }

    .brand {
      display: flex;
      gap: 12px;
      align-items: center;
      padding: 0 4px 14px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    }

    .brand-mark {
      width: 42px;
      height: 42px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      color: #ffffff;
      background: var(--win-blue-dark);
      font-weight: 800;
      letter-spacing: 0;
    }

    .brand-logo {
      width: 48px;
      height: 48px;
      border-radius: 8px;
      object-fit: contain;
      background: #ffffff;
      padding: 3px;
    }

    .brand h1 {
      margin: 0;
      font-size: 12px;
      line-height: 1.2;
    }

    .brand p {
      margin: 3px 0 0;
      color: #cbd5e1;
      font-size: 12px;
    }

    .nav {
      display: grid;
      gap: 6px;
    }

    .nav-label {
      margin: 12px 10px 2px;
      color: #94a3b8;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .nav-label:first-child {
      margin-top: 0;
    }

    .nav button {
      border: 0;
      color: #dbeafe;
      background: transparent;
      text-align: left;
      padding: 11px 12px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 42px;
      gap: 10px;
    }

    .nav button.active,
    .nav button:hover {
      background: rgba(0, 120, 212, 0.28);
      color: #ffffff;
      box-shadow: inset 3px 0 0 var(--win-blue);
    }

    .nav .count {
      min-width: 28px;
      height: 22px;
      padding: 0 8px;
      display: none;
      place-items: center;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.16);
      color: #e9f6f1;
      font-size: 12px;
    }

    .sidebar-note {
      margin-top: auto;
      padding: 14px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.07);
      color: #cbd5e1;
      font-size: 12px;
    }

    .main {
      min-width: 0;
      display: flex;
      flex-direction: column;
    }

    .topbar {
      min-width: 0;
      min-height: 72px;
      padding: 16px 26px;
      display: grid;
      grid-template-columns: minmax(0, 1fr) max-content;
      gap: 16px;
      align-items: center;
      background: rgba(255, 255, 255, 0.92);
      border-bottom: 1px solid var(--line);
      position: sticky;
      top: 0;
      z-index: 5;
      backdrop-filter: blur(10px);
    }

    .searchbar {
      min-width: 0;
      position: relative;
      display: grid;
      grid-template-columns: minmax(280px, 1.35fr) minmax(430px, 1fr);
      gap: 10px;
    }

    .filter-controls {
      min-width: 0;
      display: grid;
      grid-template-columns: repeat(3, minmax(130px, 1fr));
      gap: 10px;
    }

    .search-input-wrap {
      min-width: 0;
      position: relative;
    }

    .search-input-wrap .input {
      width: 100%;
      padding-right: 42px;
    }

    .search-clear {
      position: absolute;
      top: 50%;
      right: 8px;
      width: 30px;
      height: 30px;
      padding: 0;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: var(--muted);
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
    }

    .search-clear:hover,
    .search-clear:focus-visible {
      background: #eaf4ff;
      color: var(--blue);
    }

    .smart-search-suggestions {
      position: absolute;
      left: 0;
      top: calc(100% + 8px);
      width: min(620px, calc(100vw - 32px));
      max-height: 360px;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
      display: none;
      z-index: 20;
    }

    .smart-search-suggestions.open {
      display: block;
    }

    .smart-search-item {
      width: 100%;
      border: 0;
      border-bottom: 1px solid var(--line);
      background: #ffffff;
      padding: 12px 14px;
      text-align: left;
      display: grid;
      gap: 3px;
      cursor: pointer;
      color: var(--ink);
    }

    .smart-search-item:hover,
    .smart-search-item:focus {
      background: #eef6ff;
      outline: 0;
    }

    .smart-search-item strong {
      font-size: 12px;
    }

    .smart-search-item span {
      color: var(--muted);
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .input,
    .select,
    textarea {
      min-width: 0;
      width: 100%;
      min-height: 40px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      color: var(--ink);
      padding: 9px 11px;
      outline: 0;
    }

    textarea {
      min-height: 88px;
      resize: none;
    }

    .select[multiple] {
      height: auto;
      min-height: 150px;
      padding: 8px;
    }

    .select[multiple] option {
      padding: 6px 8px;
    }

    .select[multiple] option[disabled] {
      color: var(--muted);
      background: #f8fafc;
      font-weight: 500;
    }

    .input:focus,
    .select:focus,
    textarea:focus {
      border-color: var(--win-blue);
      box-shadow: 0 0 0 3px rgba(0, 164, 239, 0.14);
    }

    .password-input-wrap {
      position: relative;
      width: 100%;
    }

    .password-input-wrap .input {
      padding-right: 46px;
    }

    .password-visibility-toggle {
      position: absolute;
      top: 50%;
      right: 4px;
      width: 36px;
      height: 36px;
      display: inline-grid;
      place-items: center;
      padding: 0;
      border: 0;
      border-radius: 7px;
      background: transparent;
      color: #475569;
      cursor: pointer;
      transform: translateY(-50%);
    }

    .password-visibility-toggle svg {
      width: 20px;
      height: 20px;
      fill: none;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
      pointer-events: none;
    }

    .password-visibility-toggle:hover {
      background: #eef6ff;
      color: #0067a3;
    }

    .password-visibility-toggle:focus-visible {
      outline: 2px solid var(--win-blue);
      outline-offset: 1px;
      background: #eef6ff;
      color: #0067a3;
    }

    .top-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 10px;
      align-items: center;
    }

    .user-chip {
      display: grid;
      grid-template-columns: 34px 1fr;
      gap: 9px;
      align-items: center;
      padding: 5px 9px 5px 5px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
      min-width: 210px;
    }

    .user-chip .avatar {
      width: 34px;
      height: 34px;
      font-size: 12px;
    }

    .user-chip strong,
    .user-chip span {
      display: block;
      line-height: 1.2;
    }

    .user-chip span {
      margin-top: 2px;
      color: var(--muted);
      font-size: 12px;
    }

    .btn {
      max-width: 100%;
      min-height: 40px;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 9px 13px;
      background: #ffffff;
      color: var(--ink);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-align: center;
      white-space: nowrap;
    }

    .btn.mobile-filter-toggle {
      display: none;
    }

    .btn.primary {
      border-color: var(--win-blue-dark);
      background: var(--win-blue-dark);
      color: #ffffff;
    }

    .btn.soft {
      border-color: #b8ddff;
      background: var(--sky);
      color: #075985;
    }

    .btn.warn {
      border-color: #f6d365;
      background: var(--warn);
      color: #7c4a03;
    }

    .btn.danger {
      border-color: #fecaca;
      background: #fee2e2;
      color: #991b1b;
    }

    .content {
      min-width: 0;
      padding: 26px;
      display: grid;
      gap: 20px;
    }

    .page {
      min-width: 0;
      display: none;
      gap: 20px;
    }

    .page.active {
      display: grid;
    }

    .page-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 18px;
    }

    .eyebrow {
      margin: 0 0 6px;
      color: var(--win-blue-dark);
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    h2 {
      margin: 0;
      font-size: 21.6px;
      letter-spacing: 0;
      line-height: 1.2;
      max-width: 100%;
      overflow-wrap: anywhere;
    }

    .lead {
      max-width: 760px;
      margin: 7px 0 0;
      color: var(--muted);
    }

    .surface {
      min-width: 0;
      max-width: 100%;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .metrics {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
      gap: 12px;
    }

    .metric {
      padding: 15px;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      min-height: 106px;
      border-top: 4px solid var(--win-blue);
    }

    .metric:nth-child(4n + 2) {
      border-top-color: var(--win-green);
    }

    .metric:nth-child(4n + 3) {
      border-top-color: var(--win-yellow);
    }

    .metric:nth-child(4n + 4) {
      border-top-color: var(--win-red);
    }

    .metric span {
      display: block;
      color: var(--muted);
      font-size: 12px;
    }

    .metric strong {
      display: block;
      margin-top: 9px;
      font-size: 21.6px;
      letter-spacing: 0;
    }

    .metric small {
      display: block;
      margin-top: 7px;
      color: var(--win-blue-dark);
      font-size: 12px;
    }

    .role-focus {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
      gap: 14px;
      margin: 0 0 18px;
    }

    .role-focus-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      padding: 16px;
      box-shadow: var(--shadow);
      min-width: 0;
    }

    .role-focus-card h3 {
      margin: 0;
      font-size: 14.4px;
      color: var(--ink);
    }

    .role-focus-card p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.45;
    }

    .focus-list {
      display: grid;
      gap: 9px;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .focus-list li {
      display: grid;
      grid-template-columns: 10px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
      color: var(--ink);
      font-size: 12px;
      line-height: 1.35;
    }

    .focus-list li::before {
      content: "";
      width: 8px;
      height: 8px;
      margin-top: 5px;
      border-radius: 999px;
      background: var(--win-blue);
    }

    .my-work-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
      gap: 14px;
    }

    .work-queue {
      display: grid;
      gap: 10px;
    }

    .work-card {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 13px;
      border: 1px solid var(--line);
      border-left: 4px solid var(--win-blue);
      border-radius: 8px;
      background: #ffffff;
    }

    .work-card.warning {
      border-left-color: var(--win-yellow);
      background: #fffdf4;
    }

    .work-card.danger {
      border-left-color: var(--win-red);
      background: #fff7f7;
    }

    .work-card.success {
      border-left-color: var(--win-green);
      background: #f6fff7;
    }

    .work-card strong {
      display: block;
      color: var(--ink);
      font-size: 12px;
      line-height: 1.3;
      overflow-wrap: anywhere;
    }

    .work-card span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }

    .work-card .btn {
      white-space: nowrap;
    }

    .work-summary-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

    .quick-action-grid,
    .pipeline-grid,
    .notification-grid,
    .report-card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
      gap: 10px;
    }

    .quick-action-grid .btn {
      min-height: 44px;
      justify-content: flex-start;
    }

    .report-shortcut {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
    }

    .pipeline-card,
    .notification-card,
    .report-card {
      min-width: 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      padding: 13px;
    }

    .pipeline-card {
      border-top: 4px solid var(--win-blue);
    }

    .pipeline-card.warning,
    .notification-card.warning {
      border-color: #f5d773;
      background: #fffdf4;
    }

    .pipeline-card.danger,
    .notification-card.danger {
      border-color: #f4a3a3;
      background: #fff7f7;
    }

    .pipeline-card.success,
    .notification-card.success {
      border-color: #9bd69f;
      background: #f6fff7;
    }

    .pipeline-card span,
    .notification-card span,
    .report-card span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }

    .pipeline-card strong,
    .notification-card strong,
    .report-card strong {
      display: block;
      margin-top: 7px;
      color: var(--ink);
      font-size: 17.6px;
      line-height: 1.1;
    }

    .report-card {
      display: grid;
      gap: 10px;
      align-content: space-between;
      min-height: 120px;
      width: 100%;
      color: inherit;
      text-align: left;
      cursor: pointer;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
      appearance: none;
      font: inherit;
    }

    .report-card:hover,
    .report-card:focus-visible {
      border-color: var(--win-blue);
      box-shadow: 0 12px 26px rgba(0, 120, 212, 0.12);
      transform: translateY(-1px);
      outline: none;
    }

    .report-card p {
      margin: 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.4;
    }

    .report-card span {
      color: var(--ink);
      font-size: 12px;
      font-weight: 800;
    }

    .setup-status-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
      gap: 10px;
    }

    .setup-status {
      min-width: 0;
      border: 1px solid var(--line);
      border-left: 4px solid var(--win-yellow);
      border-radius: 8px;
      padding: 12px;
      background: #fffdf4;
    }

    .setup-status.ready {
      border-left-color: var(--win-green);
      background: #f6fff7;
    }

    .setup-status strong {
      display: block;
      color: var(--ink);
      font-size: 12px;
    }

    .setup-status span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }

    .compact-metrics {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .pagination-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 16px;
      border-top: 1px solid var(--line);
      color: var(--muted);
    }

    .language-toggle {
      display: inline-flex;
      gap: 4px;
      margin-left: auto;
      padding: 4px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #f8fafc;
    }

    .language-toggle .btn,
    .calendar-view-toggle .btn {
      min-height: 34px;
      padding: 6px 10px;
    }

    .language-toggle .btn.active,
    .calendar-view-toggle .btn.active {
      border-color: var(--win-blue);
      background: var(--win-blue);
      color: #ffffff;
    }

    .payment-editor {
      margin-top: 16px;
    }

    .payment-editor[hidden] {
      display: none;
    }

    .grid-2 {
      display: grid;
      grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
      gap: 16px;
    }

    .users-grid {
      grid-template-columns: minmax(0, 1fr);
    }

    .grid-2 > *,
    .grid-3 > *,
    .metrics > *,
    .permission-grid > *,
    .volunteer-layout > *,
    .form-grid > *,
    .upload-lanes > *,
    .suggestions > *,
    .mini-grid > *,
    .detail-list > * {
      min-width: 0;
    }

    .grid-3 {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 16px;
    }

    .insight-stack {
      display: grid;
      gap: 16px;
    }

    .insight-stack .surface {
      width: 100%;
      overflow: hidden;
    }

    .panel-title {
      padding: 16px 16px 12px;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--line);
      gap: 12px;
    }

    .panel-title > div {
      min-width: 0;
    }

    .panel-title h3 {
      margin: 0;
      font-size: 12.8px;
    }

    .panel-title p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 12px;
    }

    .panel-body {
      min-width: 0;
      padding: 16px;
    }

    .scroll-panel {
      max-height: 640px;
      overflow: auto;
    }

    .section-scroll {
      max-height: min(70vh, 760px);
      overflow-y: scroll;
      overflow-x: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    #settings #masterSettingsPanels {
      max-height: none;
      overflow: visible;
      padding-right: 0;
      align-items: start;
    }

    #settings #masterSettingsPanels > .surface {
      align-self: start;
      display: flex;
      flex-direction: column;
      width: 100%;
      max-height: min(58vh, 560px);
    }

    #settings .master-option-list {
      min-height: 0;
      overflow-y: scroll;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    #trustadmin .surface > .panel-body,
    #foundation .surface > .panel-body {
      max-height: min(60vh, 420px);
      overflow-y: scroll;
      overflow-x: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    .patient-edit-panel,
    .duplicate-panel,
    .calendar-panel {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      margin: 14px 0;
      overflow: hidden;
    }

    .patient-edit-panel summary,
    .duplicate-panel summary {
      cursor: pointer;
      padding: 13px 14px;
      font-weight: 900;
      color: var(--ink);
      background: #f8fbff;
      border-bottom: 1px solid var(--line);
    }

    .patient-edit-scroll {
      max-height: min(68vh, 760px);
      overflow: auto;
      padding: 14px;
    }

    .modal-body .patient-edit-form,
    .modal-body .patient-payment-form {
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    }

    .modal-body .patient-upload-form {
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .modal-body input[type="file"].input {
      min-height: 46px;
      white-space: normal;
      overflow: hidden;
    }

    .registry-footer,
    .calendar-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      padding: 12px 16px;
      border-top: 1px solid var(--line);
      background: #f8fafc;
    }

    .duplicate-list {
      display: grid;
      gap: 10px;
      padding: 14px;
      max-height: 260px;
      overflow: auto;
    }

    .duplicate-item {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 11px;
      background: #fffaf0;
    }

    .calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(120px, 1fr));
      gap: 1px;
      background: var(--line);
      overflow: auto;
      max-height: 520px;
      border-top: 1px solid var(--line);
    }

    .calendar-cell {
      min-height: 112px;
      background: #ffffff;
      padding: 8px;
      display: grid;
      align-content: start;
      gap: 6px;
    }

    .calendar-cell.muted {
      background: #f8fafc;
      color: var(--muted);
    }

    .calendar-date {
      font-weight: 900;
      color: var(--ink);
    }

    .calendar-event {
      border-radius: 7px;
      padding: 6px 7px;
      background: #eef6ff;
      color: #075985;
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .calendar-view-toggle {
      display: inline-flex;
      gap: 4px;
      padding: 3px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #f8fafc;
    }

    .calendar-grid.calendar-week {
      grid-template-columns: repeat(7, minmax(150px, 1fr));
    }

    .calendar-grid.calendar-day {
      grid-template-columns: minmax(280px, 1fr);
    }

    .calendar-event-action {
      display: block;
      margin-top: 6px;
      padding: 3px 0;
      border: 0;
      background: transparent;
      color: inherit;
      font: inherit;
      font-weight: 800;
      text-decoration: underline;
      cursor: pointer;
    }

    .calendar-empty {
      color: var(--muted);
      font-size: 12px;
    }

    .appointment-calendar-list {
      display: grid;
      max-height: 340px;
      margin-top: 14px;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      scrollbar-gutter: stable;
    }

    .appointment-list-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto auto;
      gap: 12px;
      align-items: center;
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
    }

    .appointment-list-row:last-child {
      border-bottom: 0;
    }

    .appointment-list-row strong,
    .appointment-list-row span {
      display: block;
      overflow-wrap: anywhere;
    }

    .appointment-list-row div > span {
      margin-top: 2px;
      color: var(--muted);
      font-size: 12px;
    }

    .task-progress {
      position: fixed;
      right: 18px;
      bottom: 18px;
      z-index: 900;
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 240px;
      padding: 12px 14px;
      border-radius: var(--radius);
      background: #122036;
      color: #ffffff;
      box-shadow: var(--shadow);
    }

    .task-progress[hidden] {
      display: none;
    }

    .task-progress-spinner {
      width: 18px;
      height: 18px;
      flex: 0 0 auto;
      border: 2px solid rgba(255, 255, 255, .35);
      border-top-color: #ffffff;
      border-radius: 50%;
      animation: task-progress-spin .8s linear infinite;
    }

    @keyframes task-progress-spin {
      to { transform: rotate(360deg); }
    }

    @media (prefers-reduced-motion: reduce) {
      .task-progress-spinner { animation: none; }
    }

    .privacy-disclaimer {
      border: 1px solid #f1c453;
      background: #fff8e1;
      color: #5f4100;
      border-radius: 8px;
      padding: 12px 14px;
      font-size: 12px;
      line-height: 1.45;
    }

    .link-button {
      border: 0;
      padding: 0;
      background: transparent;
      color: var(--blue);
      font-weight: 700;
      text-align: left;
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    .filters {
      min-width: 0;
      display: grid;
      grid-template-columns: repeat(7, minmax(120px, 1fr));
      gap: 10px;
    }

    .filters.compact {
      grid-template-columns: repeat(5, minmax(130px, 1fr));
    }

    .dashboard-filter-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 12px;
      align-items: end;
    }

    .filter-field {
      min-width: 0;
      display: grid;
      gap: 5px;
    }

    .filter-field label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }

    .filter-field .select,
    .filter-field .input {
      width: 100%;
    }

    .filter-quick-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: end;
    }

    .filter-summary {
      margin-top: 12px;
      color: var(--muted);
      font-size: 12px;
    }

    .tabs {
      display: flex;
      gap: 8px;
      padding: 6px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #eef6ff;
      width: fit-content;
    }

    .tab-button {
      border: 0;
      border-radius: 7px;
      background: transparent;
      color: #075985;
      padding: 10px 14px;
      font-weight: 700;
      min-height: 40px;
    }

    .tab-button.active {
      background: #ffffff;
      color: var(--win-blue-dark);
      box-shadow: 0 1px 0 rgba(16, 63, 61, 0.08);
    }

    .tab-panel {
      display: none;
    }

    .tab-panel.active {
      display: grid;
      gap: 16px;
    }

    .volunteer-layout {
      display: grid;
      grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
      gap: 16px;
    }

    .checklist {
      display: grid;
      gap: 10px;
    }

    .check-item {
      display: grid;
      grid-template-columns: 22px 1fr;
      gap: 10px;
      align-items: start;
      padding: 11px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
    }

    .check-dot {
      width: 22px;
      height: 22px;
      border-radius: 999px;
      background: var(--sky);
      color: var(--win-blue-dark);
      display: grid;
      place-items: center;
      font-size: 12px;
      font-weight: 900;
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }

    .table-scroll {
      width: 100%;
      max-width: 100%;
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }

    .table-scroll table {
      width: max-content;
      min-width: 100%;
    }

    .data-table {
      table-layout: auto;
    }

    .bulk-check-col {
      width: 42px;
      min-width: 42px;
      text-align: center;
    }

    .patient-table {
      min-width: 1280px;
    }

    .registry-table,
    .donor-table,
    .audit-table {
      min-width: 1320px;
    }

    .volunteer-table {
      min-width: 1640px;
    }

    .user-table {
      min-width: 1120px;
    }

    .user-directory-toolbar {
      display: grid;
      grid-template-columns: minmax(220px, 1fr) minmax(150px, 180px) minmax(140px, 170px) auto;
      gap: 8px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
      background: #f8fafc;
      align-items: center;
    }

    .user-directory-toolbar .input,
    .user-directory-toolbar .select {
      min-height: 36px;
      padding: 7px 10px;
      font-size: 12px;
    }

    .user-count {
      padding: 7px 10px;
      border-radius: 8px;
      background: var(--sky);
      color: #075985;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .user-directory-scroll {
      max-height: 460px;
      overflow: auto;
    }

    .user-directory-scroll table {
      min-width: 980px;
    }

    .user-table th,
    .user-table td {
      padding: 8px 10px;
      font-size: 12px;
    }

    .user-table th {
      position: sticky;
      top: 0;
      z-index: 2;
    }

    .user-table td:last-child {
      min-width: 230px;
    }

    .user-action-buttons {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-wrap: nowrap;
    }

    .user-action-buttons .btn {
      width: auto;
      min-height: 32px;
      padding: 6px 9px;
      font-size: 12px;
      white-space: nowrap;
    }

    .family-table {
      min-width: 720px;
    }

    .family-action-heading,
    .family-remove-cell {
      width: 72px;
      min-width: 72px !important;
      text-align: center;
    }

    .icon-button {
      width: 34px;
      height: 34px;
      display: inline-grid;
      place-items: center;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: #ffffff;
      color: var(--coral);
      font: inherit;
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
    }

    .icon-button:hover,
    .icon-button:focus-visible {
      border-color: var(--win-red);
      background: var(--danger);
    }

    .table-scroll td:last-child {
      min-width: 180px;
    }

    th,
    td {
      padding: 12px 10px;
      border-bottom: 1px solid var(--line);
      text-align: left;
      vertical-align: middle;
      word-break: normal;
      overflow-wrap: break-word;
    }

    td .btn + .btn {
      margin-top: 6px;
    }

    td:last-child .btn {
      width: 100%;
      white-space: normal;
    }

    .user-table td:last-child .btn {
      width: auto;
      white-space: nowrap;
    }

    th {
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      background: #f8fafc;
    }

    tbody tr {
      cursor: pointer;
    }

    tbody tr:hover,
    tbody tr.selected {
      background: #eef6ff;
    }

    .status {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      border-radius: 999px;
      padding: 3px 9px;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .status.active {
      background: var(--sky);
      color: #075985;
    }

    .status.new {
      background: var(--mint);
      color: #3f6212;
    }

    .status.cured {
      background: #ecfccb;
      color: #3f6212;
    }

    .status.left,
    .status.due {
      background: var(--warn);
      color: #7c530f;
    }

    .status.risk {
      background: var(--danger);
      color: #87372f;
    }

    .profile {
      display: grid;
      gap: 14px;
    }

    .profile-head {
      display: grid;
      grid-template-columns: 54px 1fr;
      gap: 12px;
      align-items: center;
    }

    .avatar {
      width: 54px;
      height: 54px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      background: linear-gradient(135deg, var(--win-blue), var(--win-green));
      color: #ffffff;
      font-weight: 800;
      overflow: hidden;
    }

    .avatar img,
    .patient-photo-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .patient-photo-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-bottom: 12px;
    }

    .patient-photo-thumb {
      width: 86px;
      height: 102px;
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
      background: #f8fbff;
    }

    .patient-record-top {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: start;
    }

    .patient-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
    }

    .master-option-item {
      grid-template-columns: 34px minmax(0, 1fr) minmax(88px, auto);
      align-items: center;
    }

    .master-option-item .check-dot {
      width: 28px;
      height: 28px;
      font-size: 12px;
    }

    .master-option-item .btn {
      min-width: 88px;
      justify-content: center;
      white-space: nowrap;
    }

    .patient-tabs button {
      border: 1px solid #cfe0f3;
      border-radius: 8px;
      background: #ffffff;
      color: var(--ink);
      padding: 10px 13px;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
    }

    .patient-tabs button.active {
      border-color: var(--win-blue);
      background: var(--win-blue);
      color: #ffffff;
      box-shadow: 0 8px 18px rgba(0, 120, 212, .18);
    }

    .patient-tab-panel {
      display: none;
      gap: 14px;
      min-width: 0;
    }

    .patient-tab-panel.active {
      display: grid;
    }

    .patient-tab-shell {
      display: grid;
      gap: 14px;
      min-width: 0;
    }

    .patient-tab-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      padding: 14px;
      min-width: 0;
    }

    .patient-quick-strip {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 10px;
    }

    .patient-quick-strip .mini-card {
      min-height: 78px;
    }

    .patient-timeline {
      display: grid;
      gap: 10px;
    }

    .timeline-item {
      display: grid;
      grid-template-columns: 12px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
      padding: 10px;
      border: 1px solid #e5eef8;
      border-radius: 8px;
      background: #f8fbff;
    }

    .timeline-dot {
      width: 10px;
      height: 10px;
      margin-top: 5px;
      border-radius: 50%;
      background: var(--win-blue);
    }

    .timeline-item:nth-child(4n + 2) .timeline-dot {
      background: var(--win-green);
    }

    .timeline-item:nth-child(4n + 3) .timeline-dot {
      background: var(--win-yellow);
    }

    .timeline-item:nth-child(4n + 4) .timeline-dot {
      background: var(--win-red);
    }

    .timeline-item strong,
    .timeline-item span {
      display: block;
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .timeline-item span {
      color: var(--muted);
      font-size: 12px;
      margin-top: 2px;
    }

    .profile-head h3 {
      margin: 0;
      font-size: 13.6px;
    }

    .profile-head p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 12px;
    }

    .detail-list {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 9px 14px;
    }

    .detail {
      min-width: 0;
    }

    .detail span {
      display: block;
      color: var(--muted);
      font-size: 12px;
    }

    .detail strong {
      display: block;
      margin-top: 2px;
      word-break: break-word;
      font-weight: 650;
    }

    .patient-summary-card {
      display: grid;
      gap: 14px;
    }

    .patient-summary-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 10px;
    }

    .patient-summary-item {
      min-width: 0;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
    }

    .patient-summary-item span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }

    .patient-summary-item strong {
      display: block;
      margin-top: 4px;
      font-size: 12px;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }

    .patient-summary-actions {
      display: grid;
      gap: 8px;
    }

    .patient-summary-actions .btn {
      width: 100%;
    }

    .note-block {
      padding: 12px;
      border: 1px solid var(--line);
      background: #f8fafc;
      border-radius: 8px;
    }

    .note-block span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      margin-bottom: 4px;
    }

    .mini-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
      gap: 10px;
    }

    .mini-card {
      min-width: 0;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
      min-height: 92px;
      border-left: 4px solid var(--win-blue);
    }

    .mini-card:nth-child(4n + 2) {
      border-left-color: var(--win-green);
    }

    .mini-card:nth-child(4n + 3) {
      border-left-color: var(--win-yellow);
    }

    .mini-card:nth-child(4n + 4) {
      border-left-color: var(--win-red);
    }

    .mini-card span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
      word-break: normal;
      overflow-wrap: break-word;
    }

    .mini-card strong {
      display: block;
      margin-top: 7px;
      font-size: 16px;
      line-height: 1.15;
      word-break: normal;
      overflow-wrap: break-word;
    }

    .insight-items {
      display: flex;
      gap: 10px;
      padding: 16px;
      overflow-x: auto;
      overflow-y: hidden;
      scroll-snap-type: x proximity;
    }

    .insight-row {
      flex: 0 0 min(320px, 86vw);
      display: grid;
      gap: 10px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
      border-left: 4px solid var(--win-blue);
      scroll-snap-align: start;
    }

    .insight-row:nth-child(4n + 2) {
      border-left-color: var(--win-green);
    }

    .insight-row:nth-child(4n + 3) {
      border-left-color: var(--win-yellow);
    }

    .insight-row:nth-child(4n + 4) {
      border-left-color: var(--win-red);
    }

    .insight-row-title {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      font-weight: 800;
    }

    .insight-row-title span {
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .insight-pill {
      flex: 0 0 auto;
      padding: 4px 8px;
      border-radius: 999px;
      background: var(--sky);
      color: var(--win-blue-dark);
      font-size: 12px;
      font-weight: 800;
      white-space: nowrap;
    }

    .insight-row-meta {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }

    .insight-row-meta div {
      min-width: 0;
      padding: 8px;
      border-radius: 8px;
      background: #ffffff;
      border: 1px solid #e7eef7;
    }

    .insight-row-meta small {
      display: block;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.3;
    }

    .insight-row-meta strong {
      display: block;
      margin-top: 2px;
      font-size: 12.8px;
      overflow-wrap: anywhere;
    }

    .workload-card {
      display: grid;
      gap: 12px;
      padding: 16px;
    }

    .workload-chart {
      display: grid;
      gap: 12px;
      min-width: 0;
    }

    .workload-chart-row {
      display: grid;
      grid-template-columns: minmax(160px, .85fr) minmax(260px, 1.4fr) minmax(190px, .85fr);
      gap: 14px;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
      padding: 12px;
      min-width: 0;
    }

    .workload-person strong,
    .workload-person span,
    .workload-risk strong,
    .workload-risk span {
      display: block;
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .workload-person span,
    .workload-risk span {
      color: var(--muted);
      font-size: 12px;
      margin-top: 2px;
    }

    .workload-bars {
      display: grid;
      gap: 8px;
      min-width: 0;
    }

    .workload-bar {
      display: grid;
      grid-template-columns: 74px minmax(0, 1fr) 34px;
      gap: 8px;
      align-items: center;
      font-size: 12px;
      color: var(--muted);
    }

    .workload-bar-track {
      height: 9px;
      border-radius: 999px;
      background: #e8f0f8;
      overflow: hidden;
    }

    .workload-bar-fill {
      height: 100%;
      border-radius: inherit;
      background: var(--win-blue);
    }

    .workload-bar-fill.green {
      background: var(--win-green);
    }

    .workload-bar-fill.yellow {
      background: var(--win-yellow);
    }

    .workload-bar-fill.red {
      background: var(--win-red);
    }

    .tool-preview {
      display: grid;
      gap: 14px;
      min-height: 420px;
      align-content: start;
      overflow: auto;
    }

    .invoice-workbench {
      display: grid;
      grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
      gap: 18px;
      align-items: start;
    }

    .trust-tool-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
      gap: 16px;
      align-items: start;
    }

    .trust-tool-card {
      min-width: 0;
      overflow: hidden;
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: 0 14px 34px rgba(31, 41, 55, 0.08);
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      max-height: min(920px, calc(100vh - 120px));
    }

    .invoice-control-panel {
      overflow: auto;
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: 0 14px 34px rgba(31, 41, 55, 0.08);
    }

    .invoice-panel-head {
      padding: 18px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(180deg, #ffffff, #f7fbff);
    }

    .invoice-brand-lockup {
      display: grid;
      grid-template-columns: 58px 1fr;
      gap: 12px;
      align-items: center;
      margin-bottom: 14px;
    }

    .invoice-brand-lockup img {
      width: 58px;
      height: 58px;
      object-fit: contain;
    }

    .invoice-brand-lockup h3 {
      margin: 0;
      color: #0b2a4a;
      font-size: 14.4px;
      line-height: 1.12;
    }

    .invoice-brand-lockup p,
    .invoice-status-strip span {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 12px;
    }

    .invoice-action-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .invoice-status-strip {
      min-height: 38px;
      margin-top: 10px;
      padding: 10px 12px;
      border: 1px solid #bce5f2;
      border-radius: var(--radius);
      background: #eef8fb;
      color: #17536b;
      font-weight: 700;
    }

    .invoice-control-section {
      padding: 16px 18px;
      border-bottom: 1px solid var(--line);
    }

    .trust-tool-scroll {
      min-height: 0;
      overflow: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    .invoice-control-section:last-child {
      border-bottom: 0;
    }

    .invoice-control-section h3 {
      margin: 0 0 10px;
      color: #0b2a4a;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0;
    }

    .invoice-line-editor {
      display: grid;
      gap: 8px;
      padding: 10px;
      margin-bottom: 10px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #f8fafc;
    }

    .invoice-line-grid {
      display: grid;
      grid-template-columns: 1.15fr .8fr .55fr .75fr .6fr;
      gap: 8px;
    }

    .trust-tool-card .form-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trust-tool-card .field.full {
      grid-column: 1 / -1;
    }

    .invoice-preview-stage {
      min-width: 0;
      overflow: auto;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: linear-gradient(180deg, #eef6ff, #f8fafc);
    }

    .invoice-preview-topbar {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }

    .invoice-pill-row {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .invoice-pill {
      display: inline-flex;
      min-height: 28px;
      align-items: center;
      padding: 5px 9px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: #ffffff;
      color: #435568;
      font-size: 12px;
    }

    .invoice-paper {
      position: relative;
      width: 210mm;
      min-height: 297mm;
      margin: 0 auto;
      overflow: hidden;
      padding: 11mm 12mm;
      background: #ffffff;
      color: #142231;
      box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
    }

    .invoice-paper::before {
      content: "";
      position: absolute;
      inset: 0;
      border-top: 5mm solid #0b2a4a;
      pointer-events: none;
    }

    .eef-invoice-header {
      position: relative;
      display: grid;
      grid-template-columns: minmax(0, 1fr) 78mm;
      gap: 10mm;
      align-items: start;
      padding-top: 7mm;
      padding-bottom: 6mm;
      border-bottom: 1px solid var(--line);
    }

    .eef-invoice-brand {
      display: grid;
      grid-template-columns: 60px 1fr;
      gap: 11px;
      align-items: center;
    }

    .eef-invoice-brand img,
    .eef-invoice-watermark {
      object-fit: contain;
    }

    .eef-invoice-brand img {
      width: 60px;
      height: 60px;
    }

    .eef-invoice-brand h2 {
      margin: 0;
      color: #0b2a4a;
      font-size: 16px;
      line-height: 1.08;
    }

    .eef-invoice-brand p {
      margin: 5px 0 0;
      color: var(--muted);
      font-size: 7.84px;
      max-width: 74mm;
    }

    .eef-invoice-meta {
      text-align: right;
      min-width: 0;
    }

    .eef-document-title {
      margin-bottom: 11px;
      color: #0b2a4a;
      font-size: 24px;
      line-height: 1;
      font-weight: 900;
    }

    .eef-meta-grid {
      display: grid;
      grid-template-columns: 25mm minmax(0, 1fr);
      gap: 4px 8px;
      padding: 8px 9px;
      border: 1px solid #d9e2ec;
      border-radius: 8px;
      background: #f7fafc;
      font-size: 8px;
      text-align: left;
    }

    .eef-meta-grid dt {
      color: var(--muted);
      font-weight: 700;
    }

    .eef-meta-grid dd {
      margin: 0;
      color: #142231;
      font-weight: 800;
      text-align: right;
      overflow-wrap: anywhere;
    }

    .eef-invoice-body {
      display: grid;
      gap: 4.5mm;
      padding-top: 5mm;
    }

    .eef-info-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .eef-info-box {
      min-height: 88px;
      padding: 9px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
    }

    .eef-info-box h3,
    .eef-payment-section h3,
    .eef-note-box h3 {
      margin: 0 0 7px;
      color: #0583c7;
      font-size: 8.16px;
      text-transform: uppercase;
      letter-spacing: 0;
    }

    .eef-info-box p,
    .eef-info-box address,
    .eef-payment-box p {
      margin: 0;
      color: #142231;
      font-size: 8.8px;
      font-style: normal;
      white-space: pre-line;
      overflow-wrap: anywhere;
    }

    .eef-identity-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 5px;
    }

    .eef-identity-chip {
      min-height: 42px;
      padding: 5px;
      border: 1px solid #cadbe7;
      border-radius: 7px;
      background: #f4f9fb;
    }

    .eef-identity-chip span,
    .eef-invoice-footer,
    .eef-invoice-table .item-desc span {
      color: var(--muted);
    }

    .eef-identity-chip span {
      display: block;
      font-size: 6.4px;
      font-weight: 800;
      text-transform: uppercase;
    }

    .eef-identity-chip strong {
      display: block;
      margin-top: 2px;
      color: #0b2a4a;
      font-size: 7.2px;
      overflow-wrap: anywhere;
    }

    .eef-invoice-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 7.84px;
    }

    .eef-invoice-table thead {
      background: #0b2a4a;
      color: #ffffff;
    }

    .eef-invoice-table th,
    .eef-invoice-table td {
      padding: 6px;
      border-bottom: 1px solid var(--line);
      vertical-align: top;
    }

    .eef-invoice-table th {
      text-align: left;
      font-size: 7.04px;
      text-transform: uppercase;
      letter-spacing: 0;
    }

    .eef-invoice-table .num {
      text-align: right;
      white-space: nowrap;
    }

    .eef-invoice-table .item-desc strong {
      display: block;
      margin-bottom: 2px;
      color: #142231;
      font-size: 8.24px;
    }

    .eef-invoice-table .item-desc span {
      font-size: 7.04px;
    }

    .eef-summary-grid {
      display: grid;
      grid-template-columns: 1fr 70mm;
      gap: 10px;
      align-items: start;
    }

    .eef-note-box {
      min-height: 68px;
      padding: 9px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #f7fafc;
      color: #435568;
      font-size: 7.6px;
    }

    .eef-note-box p {
      margin: 0;
      white-space: pre-line;
    }

    .eef-totals {
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: var(--radius);
    }

    .eef-total-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      padding: 6px 9px;
      border-bottom: 1px solid var(--line);
      font-size: 8px;
    }

    .eef-total-row span:last-child {
      text-align: right;
      font-weight: 800;
    }

    .eef-total-row.grand {
      padding: 9px;
      border-bottom: 0;
      background: #0b2a4a;
      color: #ffffff;
      font-size: 10.4px;
    }

    .eef-payment-section {
      display: grid;
      grid-template-columns: .9fr 1.1fr;
      gap: 8px;
      padding-top: 4mm;
      border-top: 1px solid var(--line);
      font-size: 7.6px;
    }

    .eef-payment-box {
      min-height: 56px;
      padding: 8px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #fbfdfe;
    }

    .eef-system-note {
      margin-top: 3mm;
      padding: 7px 10px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #f7fafc;
      color: #0b2a4a;
      font-size: 7.6px;
      font-weight: 800;
      text-align: center;
    }

    .eef-invoice-footer {
      position: absolute;
      left: 12mm;
      right: 12mm;
      bottom: 8mm;
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      align-items: end;
      padding-top: 8px;
      border-top: 1px solid var(--line);
      font-size: 7.04px;
    }

    .eef-invoice-watermark {
      position: absolute;
      top: 270px;
      right: -55px;
      width: 290px;
      height: 290px;
      opacity: .035;
      pointer-events: none;
    }

    .id-card-sheet {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 276px));
      gap: 24px;
      justify-content: center;
      align-items: start;
    }

    .id-card-preview {
      --id-ink: #132238;
      --id-muted: #64748b;
      --id-line: #d9e5f1;
      --id-blue: #0077bd;
      --id-cyan: #14b6ed;
      --id-navy: #102645;
      --id-green: #21b36c;
      --id-leaf: #8fd15f;
      --id-red: #ef4053;
      position: relative;
      width: min(100%, 276px);
      height: 460px;
      overflow: hidden;
      background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
      border: 1px solid rgba(16, 38, 69, 0.18);
      border-radius: 18px;
      box-shadow: 0 18px 38px rgba(16, 38, 69, 0.18);
      color: var(--id-ink);
      font-family: "Inter", "Segoe UI", "Roboto", Arial, sans-serif;
      isolation: isolate;
    }

    .id-card-preview::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -3;
      background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    }

    .id-card-brand-rail {
      position: absolute;
      left: 0;
      top: 0;
      z-index: -2;
      width: 100%;
      height: 104px;
      background: linear-gradient(135deg, var(--id-navy) 0%, var(--id-blue) 48%, var(--id-cyan) 100%);
      clip-path: polygon(0 0, 100% 0, 100% 70%, 64% 88%, 0 74%);
    }

    .id-card-brand-rail::after {
      content: "";
      position: absolute;
      right: 18px;
      top: 17px;
      width: 72px;
      height: 72px;
      border: 12px solid rgba(255, 255, 255, 0.2);
      border-radius: 50%;
    }

    .id-card-security-strip {
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      height: 14px;
      background: linear-gradient(90deg, var(--id-green), var(--id-leaf) 24%, var(--id-cyan) 52%, var(--id-blue) 76%, var(--id-red));
    }

    .id-card-brand {
      display: grid;
      grid-template-columns: 54px 1fr;
      gap: 10px;
      align-items: center;
      padding: 14px 16px 0;
      color: #ffffff;
      text-align: left;
    }

    .id-card-brand img {
      width: 54px;
      height: 54px;
      object-fit: contain;
      filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.26));
    }

    .id-card-brand strong {
      display: block;
      font-size: 9.28px;
      line-height: 1.05;
      font-weight: 900;
      letter-spacing: 0.3px;
      text-transform: uppercase;
    }

    .id-card-brand span {
      display: block;
      margin-top: 5px;
      color: rgba(255, 255, 255, 0.86);
      font-size: 6.24px;
      line-height: 1.2;
      font-weight: 800;
      letter-spacing: 0;
    }

    .id-card-front-body {
      display: grid;
      justify-items: center;
      padding: 58px 20px 0;
    }

    .id-photo {
      width: 126px;
      height: 146px;
      padding: 7px;
      display: grid;
      place-items: center;
      overflow: hidden;
      background: linear-gradient(#fff, #fff) padding-box, linear-gradient(160deg, var(--id-cyan), var(--id-blue) 52%, var(--id-green)) border-box;
      border: 3px solid transparent;
      border-radius: 20px;
      color: var(--id-navy);
      font-size: 27.2px;
      font-weight: 900;
      box-shadow: 0 16px 28px rgba(16, 38, 69, 0.16);
    }

    .id-photo-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 14px;
    }

    .id-card-name-block {
      width: 100%;
      margin-top: 18px;
      text-align: center;
    }

    .id-card-name {
      margin: 0;
      color: var(--id-navy);
      font-size: 16.8px;
      line-height: 0.98;
      font-weight: 900;
      letter-spacing: 0;
      text-transform: uppercase;
      overflow-wrap: anywhere;
    }

    .id-card-surname {
      display: inline;
    }

    .id-card-role {
      margin: 7px 0 0;
      color: var(--id-blue);
      font-size: 8px;
      line-height: 1.2;
      font-weight: 900;
      letter-spacing: 1.8px;
      text-transform: uppercase;
    }

    .id-card-id-line {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      gap: 10px;
      align-items: center;
      width: 100%;
      margin-top: 12px;
    }

    .id-card-id-line::before,
    .id-card-id-line::after {
      content: "";
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(0, 119, 189, 0.45));
    }

    .id-card-id-line::after {
      background: linear-gradient(90deg, rgba(0, 119, 189, 0.45), transparent);
    }

    .id-card-number {
      padding: 7px 12px;
      border-radius: 10px;
      color: #ffffff;
      background: var(--id-navy);
      font-size: 8.8px;
      line-height: 1;
      font-weight: 900;
      letter-spacing: 0.8px;
    }

    .id-card-front-meta {
      position: absolute;
      left: 18px;
      right: 18px;
      bottom: 28px;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .id-card-meta-box {
      min-height: 41px;
      padding: 7px 9px;
      border-radius: 12px;
      background: rgba(245, 249, 252, 0.92);
      border: 1px solid rgba(16, 38, 69, 0.08);
    }

    .id-card-meta-box span {
      display: block;
      color: var(--id-muted);
      font-size: 6px;
      line-height: 1;
      font-weight: 800;
      letter-spacing: 0.7px;
      text-transform: uppercase;
    }

    .id-card-meta-box strong {
      display: block;
      margin-top: 5px;
      color: var(--id-ink);
      font-size: 7.2px;
      line-height: 1.12;
      font-weight: 900;
      overflow-wrap: anywhere;
    }

    .id-card-back {
      padding: 18px;
    }

    .id-card-back .id-card-brand-rail {
      height: 86px;
      clip-path: polygon(0 0, 100% 0, 100% 66%, 0 96%);
    }

    .id-card-back .id-card-brand {
      padding: 0;
      grid-template-columns: 46px 1fr;
    }

    .id-card-back .id-card-brand img {
      width: 46px;
      height: 46px;
    }

    .id-card-back-content {
      margin-top: 54px;
    }

    .id-back-title {
      margin: 0;
      color: var(--id-navy);
      font-size: 12px;
      line-height: 1;
      font-weight: 900;
      letter-spacing: 0.6px;
      text-transform: uppercase;
    }

    .id-card-back-bottom {
      display: grid;
      grid-template-columns: 86px 1fr;
      gap: 12px;
      align-items: center;
      margin-top: 12px;
      padding: 10px;
      border-radius: 16px;
      background: #ffffff;
      border: 1px solid rgba(16, 38, 69, 0.1);
      box-shadow: 0 10px 20px rgba(16, 38, 69, 0.08);
    }

    .id-card-qr {
      width: 86px;
      height: 86px;
      display: block;
      padding: 8px;
      background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, var(--id-cyan), var(--id-blue), var(--id-green)) border-box;
      border: 3px solid transparent;
      border-radius: 14px;
    }

    .id-card-verify-copy {
      min-width: 0;
      color: var(--id-muted);
      font-size: 6.72px;
      line-height: 1.3;
      font-weight: 700;
    }

    .id-card-verify-copy strong {
      display: block;
      margin-bottom: 6px;
      color: var(--id-blue);
      font-size: 8.8px;
      line-height: 1.15;
      font-weight: 900;
      text-transform: uppercase;
    }

    .id-card-terms {
      margin: 11px 0 0;
      padding: 11px 12px 10px 28px;
      border-radius: 16px;
      background: #f5f9fc;
      border: 1px solid rgba(16, 38, 69, 0.09);
      color: #26384d;
      font-size: 6.24px;
      line-height: 1.32;
      font-weight: 700;
      text-align: left;
    }

    .id-card-terms li + li {
      margin-top: 5px;
    }

    .id-card-back-contact {
      display: grid;
      gap: 5px;
      margin-top: 10px;
      text-align: left;
    }

    .id-card-back-contact div {
      display: grid;
      grid-template-columns: 50px 1fr;
      gap: 8px;
      align-items: start;
      padding-bottom: 4px;
      border-bottom: 1px solid rgba(16, 38, 69, 0.08);
      color: var(--id-ink);
      font-size: 6.4px;
      line-height: 1.18;
      font-weight: 800;
      overflow-wrap: anywhere;
    }

    .id-card-back-contact strong {
      display: block;
      color: var(--id-blue);
      font-size: 6.08px;
      line-height: 1.2;
      font-weight: 900;
      letter-spacing: 0.7px;
      text-transform: uppercase;
    }

    .id-card-card-id {
      display: none;
    }

    @media (max-width: 720px) {
      .id-card-sheet {
        grid-template-columns: 1fr;
      }
    }

    .report-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
      justify-content: flex-end;
    }

    .report-meta {
      display: grid;
      grid-template-columns: repeat(4, minmax(150px, 1fr));
      gap: 10px;
    }

    .report-note {
      margin-top: 12px;
      color: var(--muted);
      font-size: 12px;
    }

    .chart {
      display: grid;
      gap: 12px;
    }

    .bar-row {
      display: grid;
      grid-template-columns: 132px minmax(0, 1fr) 38px;
      gap: 10px;
      align-items: center;
    }

    .bar-track {
      height: 12px;
      border-radius: 999px;
      background: #e2e8f0;
      overflow: hidden;
    }

    .bar-fill {
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, var(--win-blue), var(--win-green));
    }

    .form-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 13px;
    }

    .trust-admin-form {
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .field.full {
      grid-column: 1 / -1;
    }

    .field {
      min-width: 0;
    }

    .field label {
      display: block;
      margin-bottom: 6px;
      color: #334155;
      font-weight: 650;
      font-size: 12px;
    }

    .field small {
      display: block;
      margin-top: 5px;
      color: var(--muted);
    }

    .section-subhead {
      margin: 8px 0 0;
      padding-top: 18px;
      border-top: 1px solid var(--line);
      font-size: 12px;
    }

    .upload-lanes {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
    }

    .upload-lane {
      min-height: 112px;
      padding: 13px;
      border: 1px dashed #94a3b8;
      border-radius: 8px;
      background: #f8fafc;
    }

    .upload-lane strong {
      display: block;
      margin-bottom: 5px;
    }

    .upload-lane p {
      margin: 0 0 10px;
      color: var(--muted);
      font-size: 12px;
    }

    .upload-selection-preview,
    .document-preview-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 9px;
    }

    .upload-preview-item,
    .document-preview-card {
      display: inline-flex;
      width: min(100%, 220px);
      min-width: 0;
      align-items: center;
      gap: 8px;
      padding: 7px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      color: var(--ink);
      text-align: left;
    }

    .document-preview-card {
      cursor: pointer;
      font: inherit;
    }

    .document-preview-card:hover,
    .document-preview-card:focus-visible {
      border-color: var(--teal);
      box-shadow: 0 0 0 2px rgba(14, 116, 144, 0.12);
      outline: none;
    }

    .upload-preview-item img,
    .document-preview-media,
    .document-preview-media img,
    .upload-preview-file-icon {
      width: 44px;
      height: 44px;
      flex: 0 0 44px;
      border-radius: 6px;
    }

    .upload-preview-item img,
    .document-preview-media img {
      display: block;
      object-fit: contain;
      background: #f8fafc;
    }

    .document-preview-media,
    .upload-preview-file-icon {
      display: grid;
      place-items: center;
      overflow: hidden;
      background: #eef6f8;
    }

    .document-preview-icon,
    .upload-preview-file-icon {
      color: #9f1239;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 0.04em;
    }

    .upload-preview-details,
    .document-preview-copy {
      display: grid;
      min-width: 0;
      gap: 2px;
    }

    .upload-preview-details strong,
    .document-preview-copy strong,
    .upload-preview-details small,
    .document-preview-copy small {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .upload-preview-details strong,
    .document-preview-copy strong {
      font-size: 12px;
    }

    .upload-preview-details small,
    .document-preview-copy small,
    .upload-preview-more {
      color: var(--muted);
      font-size: 12px;
    }

    .upload-limit-hint {
      display: block;
      margin-top: 5px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }

    .split-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
      margin-top: 14px;
    }

    .link-box {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
      align-items: center;
    }

    .link-box code {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: #075985;
    }

    .suggestions {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }

    .suggestion {
      padding: 13px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
    }

    .suggestion h4 {
      margin: 0 0 8px;
      font-size: 12px;
    }

    .suggestion ul {
      margin: 0;
      padding-left: 18px;
      color: var(--muted);
    }

    .suggestion li {
      margin: 5px 0;
    }

    .permission-grid {
      display: grid;
      grid-template-columns: repeat(5, minmax(150px, 1fr));
      gap: 12px;
    }

    .permission-card {
      padding: 13px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
      min-height: 150px;
    }

    .permission-card h4 {
      margin: 0 0 6px;
      font-size: 12px;
    }

    .permission-card p {
      margin: 0 0 10px;
      color: var(--muted);
      font-size: 12px;
    }

    .permission-card ul {
      margin: 0;
      padding-left: 18px;
      color: #3a4b42;
      font-size: 12px;
    }

    .audit-row {
      display: grid;
      grid-template-columns: 170px 1fr;
      gap: 12px;
      padding: 13px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
    }

    .audit-row > * {
      min-width: 0;
    }

    .audit-row time {
      color: var(--muted);
      font-size: 12px;
    }

    .audit-row strong {
      display: block;
      margin-bottom: 3px;
    }

    .audit-row p {
      margin: 0;
      color: var(--muted);
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .toast {
      position: fixed;
      right: 22px;
      bottom: 22px;
      min-width: 260px;
      padding: 12px 14px;
      color: #ffffff;
      background: #0f172a;
      border-radius: 8px;
      box-shadow: var(--shadow);
      transform: translateY(24px);
      opacity: 0;
      pointer-events: none;
      transition: 180ms ease;
      z-index: 20;
    }

    .toast.show {
      transform: translateY(0);
      opacity: 1;
    }

    .action-dialog {
      position: fixed;
      inset: 0;
      display: none;
      place-items: center;
      padding: 18px;
      background: rgba(15, 23, 42, 0.48);
      z-index: 50;
    }

    .action-dialog.open {
      display: grid;
    }

    .action-dialog-card {
      width: min(460px, 100%);
      max-height: calc(100vh - 32px);
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
    }

    .action-dialog-body {
      display: grid;
      gap: 14px;
      padding: 20px;
    }

    .action-dialog-body h3 {
      margin: 0;
      color: var(--ink);
      font-size: 16px;
    }

    .action-dialog-body p {
      margin: 0;
      color: var(--muted);
      line-height: 1.5;
    }

    .action-dialog-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      padding: 14px 20px 20px;
    }

    .action-dialog-actions .btn {
      min-width: 104px;
    }

    .modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
      background: rgba(16, 31, 28, 0.52);
      z-index: 30;
    }

    .modal.open {
      display: flex;
    }

    .modal-card {
      width: min(1040px, 100%);
      height: min(720px, calc(100vh - 32px));
      max-width: calc(100vw - 16px);
      max-height: calc(100vh - 16px);
      min-width: min(620px, calc(100vw - 16px));
      min-height: min(420px, calc(100vh - 16px));
      overflow: hidden;
      background: var(--panel);
      border-radius: 8px;
      box-shadow: 0 24px 80px rgba(16, 31, 28, 0.28);
      border: 1px solid var(--line);
      display: flex;
      flex-direction: column;
    }

    .modal-card.draggable {
      position: fixed;
      margin: 0;
      resize: none;
    }

    .modal-head {
      padding: 16px 18px;
      border-bottom: 1px solid var(--line);
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      cursor: move;
      user-select: none;
      touch-action: none;
      background: linear-gradient(180deg, #ffffff, #f8fafc);
    }

    .modal-title-wrap {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .modal-head h3 {
      margin: 0;
      font-size: 14.4px;
      overflow-wrap: anywhere;
    }

    .modal-move-hint {
      color: var(--muted);
      font-size: 12px;
      font-weight: 500;
    }

    .modal-body {
      padding: 18px;
      overflow: auto;
      flex: 1;
      min-height: 0;
      overscroll-behavior: contain;
    }

    .modal-resize-handle {
      position: absolute;
      right: 0;
      bottom: 0;
      width: 24px;
      height: 24px;
      cursor: nwse-resize;
      touch-action: none;
    }

    .modal-resize-handle::after {
      content: "";
      position: absolute;
      right: 6px;
      bottom: 6px;
      width: 12px;
      height: 12px;
      border-right: 2px solid #64748b;
      border-bottom: 2px solid #64748b;
      opacity: 0.75;
    }

    .modal-card.is-moving,
    .modal-card.is-resizing {
      user-select: none;
    }

    @media (max-width: 760px) {
      .modal {
        padding: 8px;
      }

      .modal-card,
      .modal-card.draggable {
        position: fixed;
        inset: 8px !important;
        width: auto !important;
        height: auto !important;
        min-width: 0;
        min-height: 0;
      }

      .modal-resize-handle {
        display: none;
      }

      .modal-move-hint {
        display: none;
      }
    }

    .empty {
      padding: 28px;
      text-align: center;
      color: var(--muted);
    }

    @media (max-width: 1320px) {
      .topbar {
        grid-template-columns: 1fr;
      }

      .top-actions {
        justify-content: flex-start;
      }
    }

    @media (max-width: 1180px) {
      .app {
        grid-template-columns: 224px minmax(0, 1fr);
      }

      .brand p,
      .sidebar-note {
        display: none;
      }

      .nav button {
        justify-content: flex-start;
      }

      .filters,
      .filters.compact,
      .metrics,
      .role-focus,
      .my-work-grid,
      .grid-2,
      .grid-3,
      .report-meta,
      .permission-grid,
      .form-grid,
      .upload-lanes,
      .suggestions,
      .user-directory-toolbar {
        grid-template-columns: 1fr 1fr;
      }

      .searchbar {
        grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.1fr);
      }

      .workload-chart-row {
        grid-template-columns: minmax(160px, .9fr) minmax(260px, 1.2fr);
      }

      .report-shortcut {
        grid-template-columns: 1fr;
      }

      .workload-risk {
        grid-column: 1 / -1;
      }

      .invoice-workbench {
        grid-template-columns: 1fr;
      }

      .trust-tool-grid {
        grid-template-columns: 1fr;
      }

      .trust-tool-card {
        max-height: min(860px, calc(100vh - 130px));
      }

      .invoice-control-panel {
        position: relative;
        top: auto;
      }

      .invoice-preview-stage {
        overflow-x: auto;
      }

      .public-intake-header h1 {
        font-size: 17.6px;
      }
    }

    @media (max-width: 900px) {
      button,
      .btn,
      .input,
      .select,
      input[type="button"],
      input[type="submit"],
      input[type="date"],
      input[type="time"] {
        min-height: 44px;
      }

      .tabs .tab-button,
      .calendar-view-toggle .btn,
      .user-action-buttons .btn,
      .user-directory-toolbar .input,
      .user-directory-toolbar .select {
        min-height: 44px;
      }

      .icon-button.remove-family-row {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
      }

      .password-visibility-toggle {
        right: 0;
        width: 44px;
        height: 44px;
      }

      .login-screen {
        grid-template-columns: 1fr;
        padding: 14px;
      }

      .login-brand {
        padding: 20px;
      }

      .login-meta {
        grid-template-columns: 1fr;
      }

      .app {
        grid-template-columns: 1fr;
      }

      .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 30;
        width: min(320px, 88vw);
        max-height: 100vh;
        padding: 16px 14px;
        overflow-x: hidden;
        overflow-y: auto;
        transform: translateX(-104%);
        transition: transform 180ms ease;
        box-shadow: 18px 0 48px rgba(15, 23, 42, 0.28);
      }

      .app.nav-open .sidebar {
        transform: translateX(0);
      }

      .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 29;
        border: 0;
        background: rgba(15, 23, 42, 0.48);
      }

      .app.nav-open .sidebar-backdrop {
        display: block;
      }

      .sidebar-close {
        display: grid;
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        margin-left: auto;
        padding: 0;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
        font-size: 22px;
      }

      .brand {
        border-bottom: 1px solid rgba(255, 255, 255, 0.14);
        padding-bottom: 14px;
        margin-bottom: 4px;
      }

      .brand h1,
      .nav span:first-child {
        display: block;
      }

      .brand p,
      .sidebar-note {
        display: none;
      }

      .nav {
        display: grid;
        gap: 5px;
        overflow: visible;
        padding-bottom: 12px;
      }

      .nav button {
        width: 100%;
        min-height: 42px;
        padding: 10px 12px;
        justify-content: space-between;
        text-align: left;
      }

      .nav .count {
        display: none;
      }

      .mobile-appbar {
        position: sticky;
        top: 0;
        z-index: 20;
        min-height: 58px;
        padding: 9px 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        background: #111827;
        color: #ffffff;
        border-top: 4px solid var(--win-blue);
        box-shadow: 0 2px 14px rgba(15, 23, 42, 0.16);
      }

      .mobile-menu-button {
        min-height: 38px;
        padding: 7px 11px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
      }

      .mobile-brand {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .mobile-brand img {
        width: 34px;
        height: 34px;
        padding: 2px;
        border-radius: 6px;
        background: #ffffff;
        object-fit: contain;
      }

      .mobile-brand strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .topbar,
      .page-header {
        grid-template-columns: 1fr;
        flex-direction: column;
      }

      .topbar {
        position: sticky;
        top: 58px;
        z-index: 18;
        padding: 10px 14px;
        gap: 10px;
      }

      .top-actions,
      .filters,
      .filters.compact,
      .metrics,
      .role-focus,
      .my-work-grid,
      .work-summary-grid,
      .grid-2,
      .grid-3,
      .report-meta,
      .permission-grid,
      .volunteer-layout,
      .form-grid,
      .upload-lanes,
      .suggestions,
      .user-directory-toolbar,
      .mini-grid,
      .detail-list,
      .patient-record-top,
      .workload-chart-row {
        grid-template-columns: 1fr;
      }

      .searchbar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
      }

      .btn.mobile-filter-toggle {
        display: inline-flex;
        min-width: 76px;
      }

      .filter-controls {
        display: none;
        grid-column: 1 / -1;
        grid-template-columns: 1fr;
      }

      .filter-controls.open {
        display: grid;
      }

      .patient-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }

      .patient-tabs button {
        flex: 0 0 auto;
      }

      .top-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        justify-content: stretch;
      }

      .top-actions .user-chip {
        width: 100%;
        min-width: 0;
      }

      .top-actions > [data-page-link="inpatients"] {
        display: none;
      }

      .top-actions #logoutButton {
        width: auto;
      }

      .mini-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      }

      .mini-card {
        min-height: 76px;
      }

      .invoice-action-row,
      .invoice-line-grid,
      .trust-tool-card .form-grid,
      .invoice-preview-topbar {
        grid-template-columns: 1fr;
      }

      .invoice-preview-topbar {
        display: grid;
      }

      .invoice-pill-row {
        justify-content: flex-start;
      }

      .invoice-preview-stage {
        padding: 10px;
      }

      .trust-tool-card {
        max-height: 760px;
      }

      .content {
        padding: 14px;
      }

      .link-box {
        grid-template-columns: 1fr;
      }

      .link-box .btn {
        width: 100%;
      }

      .public-intake-screen,
      .anonymous-case-screen {
        padding: 10px;
      }

      .public-intake-shell,
      .anonymous-case-shell {
        gap: 10px;
      }

      .public-intake-header,
      .anonymous-case-header {
        align-items: flex-start;
        gap: 10px;
        padding: 14px;
      }

      .public-intake-header img,
      .anonymous-case-header img {
        width: 54px;
        height: 54px;
      }

      .public-intake-header h1,
      .anonymous-case-header h1 {
        font-size: 16px;
        line-height: 1.15;
      }

      .public-intake-header p,
      .anonymous-case-header p {
        font-size: 12px;
      }

      .public-intake-card,
      .anonymous-case-card {
        padding: 12px;
      }

      .anonymous-case-grid {
        grid-template-columns: 1fr;
      }

      .public-intake-section {
        margin-top: 14px;
        padding-top: 12px;
      }

      .photo-upload-box {
        min-height: 96px;
        padding: 12px;
      }

      .public-intake-card .split-actions {
        display: grid;
        grid-template-columns: 1fr;
      }

      .public-intake-card .split-actions .btn {
        width: 100%;
      }
    }

    @media print {
      body {
        background: #ffffff;
      }

      .login-screen,
      .sidebar,
      .topbar,
      .page:not(#reports),
      #reports .page-header,
      #reports .surface:first-of-type,
      #toast,
      .modal {
        display: none !important;
      }

      .app,
      .main,
      .content,
      #reports {
        display: block !important;
      }

      .content {
        padding: 0;
      }

      .surface {
        box-shadow: none;
        border: 0;
      }

      .table-scroll {
        overflow: visible;
      }
    }

    .role-permission-workspace {
      display: grid;
      grid-template-columns: minmax(220px, 290px) minmax(0, 1fr);
      gap: 0;
      padding: 0;
      min-height: 520px;
      max-height: none;
      overflow: visible;
      align-items: start;
    }

    .role-list {
      padding: 10px;
      border-right: 1px solid var(--line);
      background: #f8fafc;
      overflow: visible;
    }

    .role-list-item {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 11px;
      margin: 0 0 7px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: #fff;
      color: var(--ink);
      text-align: left;
      cursor: pointer;
    }

    .role-list-item:hover,
    .role-list-item:focus-visible { border-color: #0ea5e9; }
    .role-list-item.active { border-color: #0784d1; background: #eaf6ff; box-shadow: inset 3px 0 #0784d1; }
    .role-list-item strong,
    .role-list-item small { display: block; }
    .role-list-item small { margin-top: 3px; color: var(--muted); font-size: 12px; }

    .permission-editor { min-width: 0; display: flex; flex-direction: column; overflow: visible; }
    .permission-editor-head { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
    .permission-editor-head h4 { margin: 0 0 4px; font-size: 15px; }
    .permission-editor-head p { margin: 0; color: var(--muted); }
    .permission-search { width: min(260px, 40%); font-size: 12px; color: var(--muted); }
    .permission-search span { display: block; margin-bottom: 4px; }
    .permission-notice { padding: 9px 16px; background: #fff8dd; border-bottom: 1px solid #f2d16b; color: #76550b; font-size: 12px; }
    .permission-category-list { flex: 1; padding: 12px 16px; overflow: visible; }
    .permission-category { border: 1px solid var(--line); border-radius: 7px; margin-bottom: 9px; background: #fff; }
    .permission-category summary { display: flex; justify-content: space-between; padding: 10px 12px; cursor: pointer; font-weight: 700; background: #f8fafc; }
    .permission-category summary small { color: var(--muted); font-weight: 500; }
    .permission-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .permission-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 10px 12px; border-top: 1px solid var(--line); }
    .permission-option:nth-child(odd) { border-right: 1px solid var(--line); }
    .permission-option input { margin-top: 3px; }
    .permission-option strong,
    .permission-option small { display: block; }
    .permission-option small { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
    .permission-option.disabled { opacity: .62; background: #f8fafc; }
    .permission-risk { padding: 2px 5px; border-radius: 4px; font-style: normal; font-size: 12px; text-transform: uppercase; }
    .permission-risk.standard { background: #e7f7ee; color: #166534; }
    .permission-risk.restricted { background: #fff4d6; color: #854d0e; }
    .permission-risk.protected { background: #fee2e2; color: #991b1b; }
    .permission-save-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px 16px; border-top: 1px solid var(--line); background: #f8fafc; }
    .permission-save-bar .field { margin: 0; }

    @media (max-width: 800px) {
      .role-permission-workspace { grid-template-columns: 1fr; max-height: none; }
      .role-list { display: flex; gap: 7px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
      .role-list-item { min-width: 210px; margin: 0; }
      .permission-editor { max-height: none; }
      .permission-editor-head { flex-direction: column; }
      .permission-search { width: 100%; }
      .permission-options { grid-template-columns: 1fr; }
      .permission-option:nth-child(odd) { border-right: 0; }
      .permission-save-bar { grid-template-columns: 1fr; }
    }

    @media (max-width: 720px) {
      #settings #masterSettingsPanels > .surface {
        max-height: min(62vh, 520px);
      }

      .audit-row {
        grid-template-columns: 1fr;
      }

      .public-intake-header {
        align-items: flex-start;
        flex-wrap: wrap;
      }

      .language-toggle {
        width: 100%;
        margin-left: 0;
      }

      .language-toggle .btn {
        flex: 1;
      }

      .calendar-head,
      .calendar-head .split-actions {
        align-items: stretch;
      }

      .calendar-view-toggle {
        width: 100%;
      }

      .calendar-view-toggle .btn {
        flex: 1;
      }

      .appointment-list-row {
        grid-template-columns: minmax(0, 1fr) auto;
      }

      .appointment-list-row .btn {
        grid-column: 1 / -1;
        width: 100%;
      }

      .task-progress {
        right: 10px;
        bottom: 10px;
        left: 10px;
        min-width: 0;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
      }
    }
