:root {
  --ink: #193d35;
  --muted: #637970;
  --bg: #f4f7f3;
  --line: #dce6de;
  --green: #22644f;
  --light: #e7f0e8;
  --orange: #926324;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
  14px/1.5 -apple-system,
  BlinkMacSystemFont,
  "Segoe UI",
  sans-serif;
}
button, input, select, textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 15px;
  font-weight: 600;
}
button:hover {
  background: var(--light);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover {
  background: #164b3b;
}
input, select, textarea {
  border: 1px solid #c7d6cb;
  border-radius: 8px;
  padding: 10px;
  background: white;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #7aa88e;
  outline-offset: 2px;
}
h1, h2, h3, p {
  margin-top: 0;
}
h1 {
  font-size: 32px;
  letter-spacing: -1px;
}
h2 {
  font-size: 21px;
}
h3 {
  font-size: 16px;
}
.muted, small {
  color: var(--muted);
}
.hidden {
  display: none !important;
}
.brand {
  font-weight: 750;
  letter-spacing: 1px;
  font-size: 20px;
}
.logo {
  display: inline-grid;
  place-items: center;
  background: var(--green);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  margin-right: 10px;
}
.login {
  grid-template-columns: 1.1fr 1fr;
  margin: auto;
  align-items: center;
  gap: 90px;
}
.intro h1 {
  font-size: 48px;
  line-height: 1.1;
  max-width: 500px;
  margin: 36px 0 20px;
}
.intro p {
  font-size: 17px;
  max-width: 430px;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 6px 28px #163e3210;
}
.login label {
  display: block;
}
.login input {
  width: 100%;
}
.login button {
  width: 100%;
  margin-top: 24px;
  padding: 12px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 25px 32px;
}
.source-tabs {
  display: flex;
  gap: 8px;
}
.source-tabs button {
  padding: 12px 24px;
}
.active {
  background: var(--ink) !important;
  color: white !important;
}
.notice {
  border: 1px solid #e2d8bc;
  background: #fffaf0;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  color: #775a28;
}
.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
}
th {
  background: #f7faf7;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
td, th {
  padding: 13px 16px;
  border-bottom: 1px solid #e9eee9;
  vertical-align: top;
}
td:first-child {
  max-width: 440px;
}
tr:last-child td {
  border-bottom: none;
}
.badge {
  display: inline-block;
  border-radius: 5px;
  padding: 3px 7px;
  background: var(--light);
  font-size: 12px;
  white-space: nowrap;
}
/* every combination that linked a case: one badge each, wrapping in narrow cells */
.match-rules {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.case-summary .match-rules {
  margin: 6px 0;
}
.empty {
  padding: 55px;
  text-align: center;
  color: var(--muted);
}
.error {
  color: #a13d36;
}
.dialog {
  position: fixed;
  inset: 0;
  background: #112c2670;
  z-index: 5;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 17px 0;
}
textarea {
  width: 100%;
  min-height: 80px;
}
pre {
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow: auto;
}
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 13px 22px;
  border-radius: 10px;
  z-index: 20;
  max-width: 90vw;
}
.field {
  display: block;
  margin: 12px 0;
}
.field input {
  width: 100%;
}
@media (max-width: 800px) {
  .login {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 25px;
  }
  .intro h1 {
    font-size: 36px;
  }
  .top, .shell {
    padding: 18px;
  }
  .dialog {
    padding: 8px;
  }
}
/* MGH login */
      .login {
  max-width: none;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: block;
  padding: 32px 3.4vw 36px;
}
.mgh-wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--green);
  font-family: Arial, sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -2px;
}
.mgh-wordmark:before {
  content: "";
  width: 18px;
  height: 25px;
  margin-right: 3px;
  background: repeating-linear-gradient(to bottom, transparent 0 5px, #b8c8be 5px 7px);
}
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 48px;
  align-items: center;
  margin: 64px auto 0;
  max-width: 1100px;
}
.login .intro h1 {
  font:
  700 38px/1.12 Georgia,
  serif;
  letter-spacing: -1px;
  margin: 16px 0;
  max-width: none;
}
.login .intro > p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 560px;
}
.group-badge {
  display: inline-block;
  background: var(--light);
  color: var(--green);
  border-radius: 22px;
  padding: 5px 12px;
  letter-spacing: 1px;
  font-weight: 700;
  font-size: 11px;
}
.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}
.login-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.login-feature strong {
  display: block;
  font-size: 14px;
}
.login-feature p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.feature-icon {
  background: var(--light);
  color: var(--green);
  border-radius: 13px;
  padding: 9px;
  display: grid;
  place-items: center;
}
.login svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.login .card {
  padding: 26px;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 45px -25px #193d3550;
}
.login .card h2 {
  font-size: 23px;
  margin: 0 0 8px;
}
.login .card > p {
  color: var(--muted);
  font-size: 14px;
}
.login label {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  margin: 16px 0 8px;
}
.login-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 16px;
  color: #849c90;
  gap: 12px;
  background: white;
}
.login-input:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px #dceadf;
  color: var(--green);
}
.login .login-input input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 11px 0;
  font-size: 14px;
  color: var(--ink);
  box-shadow: none;
}
.login .password-toggle {
  margin: 0;
  padding: 6px;
  width: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.login #loginButton {
  background: var(--green);
  color: white;
  border: 0;
  border-radius: 13px;
  font-size: 14px;
  padding: 12px;
  margin-top: 22px;
}
.login #loginButton:hover {
  background: #164b3b;
}
.login-help {
  display: block;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 22px;
  padding-top: 18px;
}
.login #loginError:empty {
  display: none;
}
.login #loginError:not(:empty) {
  background: #fff2f2;
  border: 1px solid #ffc9c9;
  border-radius: 12px;
  padding: 14px 16px;
  color: #c62121;
  margin: 24px 0 0;
}
.profile-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.profile-avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  font-weight: 700;
}
@media (max-width: 850px) {
  .login {
    padding: 24px;
  }
  .login-layout {
    grid-template-columns: 1fr;
    max-width: 540px;
    margin-top: 30px;
    gap: 28px;
  }
  .login .intro h1 {
    font-size: 32px;
  }
  .login .intro > p {
    font-size: 14px;
  }
  .login-features {
    display: none;
  }
  .login .card {
    padding: 26px;
  }
  .mgh-wordmark {
    font-size: 34px;
  }
}
.profile-area {
  position: relative;
}
.profile-avatar {
  border: 0;
  padding: 0;
  width: 36px;
  height: 36px;
  font-size: 14px;
}
.profile-avatar:hover {
  background: #164b3b;
}
.profile-menu {
  position: absolute;
  right: 0;
  top: 45px;
  min-width: 180px;
  max-width: 280px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px #163e3220;
  z-index: 12;
}
.profile-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}
.profile-menu button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-menu .menu-signout {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  padding-top: 11px;
}
.profile-details {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0 16px;
  margin: 0;
  font-size: 13px;
}
.profile-details dt, .profile-details dd {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.profile-details dt:last-of-type, .profile-details dd:last-of-type {
  border-bottom: 0;
}
.profile-details dt {
  color: var(--muted);
}
.profile-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 2px;
  background: white;
  border: 1px solid #c7d6cb;
  border-radius: 8px;
  width: min(340px, 100%);
}
.search-box:focus-within {
  outline: 2px solid #7aa88e;
  outline-offset: 2px;
}
.search-box input:not([type="checkbox"]) {
  flex: 1;
  width: 0;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
}
.search-box button {
  border: 0;
  background: transparent;
  padding: 5px 10px;
  font-size: 21px;
  line-height: 1.2;
}
.search-box button:last-child {
  margin-right: 4px;
}
.search-box button:hover {
  background: var(--light);
}
/* Keep review tables easy to scan without heavy body text. */
      .panel table td {
  font-weight: 400;
}
.panel table td b, .panel table td strong {
  font-weight: 400;
}
.panel table th {
  font-weight: 600;
}
.panel table td button {
  font-weight: 500;
}
.case-id {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: nowrap;
  min-width: 70px;
  max-width: 130px;
}
#companyInfoBody {
  font-size: 13px;
}
/* Match the workspace typography to the compact review cards. */
      #app {
  font-size: 12px;
  line-height: 1.5;
}
#app .brand {
  font-size: 18px;
  font-weight: 600;
}
#app .brand .muted {
  font-weight: 400;
}
#app .top {
  padding-top: 14px;
  padding-bottom: 14px;
}
#app .source-tabs button {
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
}
#app .nav button, #app .panel button {
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
}
#app input, #app select {
  font-size: 12px;
}
#app .panel table {
  font-size: 12px;
}
#app .panel th {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
#app .panel td, #app .panel th {
  padding: 10px 12px;
}
#app .badge, #app .case-id {
  font-size: 12px;
}
#app .search-box button {
  font-size: 18px;
  padding: 5px 10px;
}
/* Lock the page and give review content its own scroll area. */
      html.mdm-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}
body.mdm-modal-open {
  position: fixed;
  top: var(--mdm-scroll-offset, 0px);
  left: 0;
  width: 100%;
  overflow: hidden;
}
.dialog {
  overscroll-behavior: none;
}
#companyInfo {
  overscroll-behavior: contain;
}
/* Shared modal structure: stationary header/footer, one scrolling body. */
      .mdm-modal-panel {
  box-sizing: border-box;
  width: min(1280px, 100%);
  max-height: 94vh;
  max-height: 94dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 100px #102c2650;
}
.dialog-box.mdm-modal-panel, dialog.mdm-modal-panel[open] {
  display: flex;
  flex-direction: column;
}
dialog.mdm-modal-panel {
  width: min(1000px, calc(100vw - 24px));
}
dialog.mdm-modal-panel::backdrop {
  background: #112c2680;
}
.mdm-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 20px 12px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mdm-modal-header > div {
  min-width: 0;
}
.mdm-modal-header h2 {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}
.mdm-modal-header p {
  font-size: 12px;
  line-height: 1.4;
  margin: 3px 0 0;
}
.mdm-modal-header > button {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 6px 10px;
}
.mdm-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 14px 20px;
  font-size: 12px;
}
.profile-dialog .mdm-modal-panel {
  width: min(440px, 100%);
}
.profile-dialog .mdm-modal-body {
  padding: 6px 20px 14px;
  background: white;
}
.download-dialog .mdm-modal-panel {
  width: min(480px, 100%);
}
@media (max-width: 600px) {
  .mdm-modal-header {
    padding: 12px;
  }
  .mdm-modal-body {
    padding: 12px 16px 12px 12px;
  }
  .mdm-modal-header h2 {
    font-size: 16px;
  }
}
#sync,
#howItWorks {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  white-space: nowrap;
  background: #dcece2;
  color: #174f3c;
  border: 1px solid #abcab7;
}
#sync:hover,
#howItWorks:hover {
  background: #cbe2d4;
  border-color: var(--green);
}
.guide-dialog .mdm-modal-panel {
  width: min(700px, 100%);
}
.guide-steps {
  display: grid;
  gap: 10px;
}
.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.guide-step-number {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  height: 26px;
  background: var(--green);
  color: white;
  border-radius: 50%;
  font-weight: 600;
}
.guide-step > div {
  min-width: 0;
  flex: 1;
}
.guide-step h3 {
  font-size: 14px;
  margin: 1px 0 6px;
}
.guide-step p {
  margin: 0;
  line-height: 1.55;
}
.guide-help {
  border-top: 1px solid var(--line);
  padding: 11px 0;
}
.guide-help summary {
  cursor: pointer;
  font-weight: 500;
}
.guide-help p {
  margin: 9px 0 0;
}
.guide-help ul {
  padding-left: 18px;
  margin: 9px 0 0;
}
.guide-help li {
  margin-bottom: 7px;
}
@media (max-width: 600px) {
  #app .top {
    gap: 10px;
    flex-wrap: wrap;
  }
}
.top-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.top-pagination small {
  min-width: 45px;
  text-align: center;
  font-size: 12px;
}
#app .top-pagination button {
  padding: 7px 10px;
}
.mdm-modal-header > .modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 6px;
  flex-shrink: 0;
}
.modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.progress-grid {
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
}
.progress-card {
  padding:18px 20px;
}
.progress-card + .progress-card {
  border-left:1px solid var(--line);
}
.progress-head {
  display:flex;align-items:center;justify-content:space-between;gap:10px;
}
.progress-head h2 {
  margin:0;font-size:16px;
}
.progress-head button {
  padding:4px 10px;font-size:12px;
}
.progress-kpi {
  margin:14px 0 12px;
}
.progress-kpi strong {
  display:block;font-size:30px;line-height:1.2;
}
.progress-steps {
  font-size:13px;
}
.panel .progress-steps td, .panel .progress-steps th {
  padding:6px 8px;
}
.progress-steps td:nth-child(2), .progress-steps th:nth-child(2) {
  text-align:right;
}
.progress-steps .better {
  color:var(--green);font-weight:600;
}
.progress-steps .worse {
  color:var(--orange);font-weight:600;
}
@media (max-width:760px) {
  .progress-grid {
    grid-template-columns:1fr;
  }
  .progress-card + .progress-card {
    border-left:none;border-top:1px solid var(--line);
  }
}

.brand-sub {
  font-size: 13px;
  letter-spacing: 0;
  margin-left: 15px;
}
.refreshed-at {
  margin-top: 10px;
  font-size: 12px;
}
.panel td.codes, .panel small.codes {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
small.codes {
  display: block;
  margin-top: 3px;
}
.reason-cell {
  max-width: 360px;
  white-space: pre-wrap;
}
.status-in {
  background: #dff0e5;
  color: #1d5c44;
}
.status-possible {
  background: #fbefd9;
  color: var(--orange);
}
.status-none {
  background: #eceeed;
  color: #59625e;
}
.case-dialog .mdm-modal-panel {
  width: min(1200px, calc(100vw - 32px));
}
.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.closed-notice p {
  margin: 4px 0 0;
  white-space: pre-wrap;
}
.case-dialog .notice {
  margin-bottom: 14px;
}
.close-form {
  width: 100%;
  display: grid;
  gap: 8px;
}
.close-form label {
  font-weight: 700;
}
.reason-chips {
  display: grid;
  gap: 6px;
}
.reason-chips button {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}
.detail-section h3 {
  font-size: 15px;
  margin: 14px 0 6px;
}
.detail-fields {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 3px 14px;
  margin: 0;
  font-size: 13px;
}
.detail-fields dt {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.detail-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .record-grid {
    grid-template-columns: 1fr;
  }
  .detail-fields {
    grid-template-columns: 1fr;
  }
}
/* The cases dropdown, first in the view row: a light green tab with a chevron. */
#app .case-filter {
  appearance: none;
  -webkit-appearance: none;
  min-width: 170px;
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23193d35' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center / 13px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
#app .case-filter:hover {
  background-color: var(--light);
}
#app .case-filter {
  background-color: var(--light);
  border-color: #b9d3c1;
  color: var(--green);
  box-shadow: inset 0 0 0 1px #b9d3c1;
}
/* Case list: date and creator stay on one line; Review is the row's main action. */
.panel td.date-cell, .panel td.creator-cell {
  white-space: nowrap;
}
.date-cell small {
  display: block;
}
.panel td.action-cell {
  text-align: right;
  vertical-align: middle;
}
#app .panel .review-button {
  background: var(--green);
  border-color: var(--green);
  color: white;
  padding: 7px 14px;
  box-shadow: 0 1px 2px #102c2630;
  white-space: nowrap;
}
#app .panel .review-button::after {
  content: " →";
}
#app .panel .review-button:hover {
  background: #164b3b;
}
/* Case review: records scroll on the left, the review panel stays on the right. */
.case-dialog .mdm-modal-body {
  padding: 0;
  overflow: hidden;
  display: flex;
}
.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  flex: 1;
  min-height: 0;
}
.case-records {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 20px;
}
.case-side {
  overflow: auto;
  overscroll-behavior: contain;
  border-left: 1px solid var(--line);
  background: white;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.case-summary dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 10px 0 0;
}
.case-summary dt {
  color: var(--muted);
}
.case-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.case-side .notice {
  margin: 0;
}
.case-side textarea {
  min-height: 70px;
  resize: vertical;
}
.side-button {
  width: 100%;
  padding: 10px 14px;
}
@media (max-width: 760px) {
  .case-dialog .mdm-modal-body {
    overflow: auto;
    display: block;
  }
  .case-layout {
    grid-template-columns: 1fr;
  }
  .case-records {
    overflow: visible;
    padding: 12px;
  }
  .case-side {
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
/* Header: brand, the source tabs in the middle, help and profile on the right. */
#app .top {
  gap: 16px;
}
#app .top .source-tabs {
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}
#app .top .source-tabs button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 8px 20px;
}
#app .top .source-tabs button:hover:not(.active) {
  background: var(--light);
}
/* Under the header: the case tabs, with Refresh and Download on the right. */
.view-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.row-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
#app .row-actions > button {
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
}
@media (max-width: 760px) {
  #app .top {
    flex-wrap: wrap;
  }
  #app .top .source-tabs {
    order: 3;
    width: 100%;
    margin: 0;
  }
  #app .top .source-tabs button {
    flex: 1;
    padding: 8px 10px;
  }
  #app .brand-sub {
    display: none;
  }
}
/* Two levels, two looks: the source tabs in the header stay dark; the case tabs and match buttons under them are light green. */
#app #viewTabs button.active {
  background: var(--light) !important;
  color: var(--green) !important;
  border-color: #b9d3c1;
  box-shadow: inset 0 0 0 1px #b9d3c1;
}
/* Sortable column headers: look like the other headers, with an arrow; the sorted one is darker. */
#app .panel th .sort-head {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  color: inherit;
  font: inherit;
  text-transform: inherit;
}
/* the sort icon: two small arrows; the sorted direction is dark green, the other faint; unsorted columns show both in grey */
#app .panel th .sort-head svg {
  width: 10px;
  height: 14px;
  flex: 0 0 auto;
}
#app .panel th .sort-head svg path {
  fill: #a9b8ae;
}
#app .panel th .sort-head.sorted {
  color: var(--ink);
  font-weight: 600;
}
#app .panel th .sort-head.sorted svg path {
  fill: #d3ddd6;
}
#app .panel th .sort-head.sorted.asc svg .up, #app .panel th .sort-head.sorted.desc svg .down {
  fill: var(--green);
}
#app .panel th .sort-head:hover:not(.sorted) svg path {
  fill: var(--muted);
}
#app .panel th .sort-head:focus-visible {
  outline: 2px solid #7aa88e;
  outline-offset: 2px;
  border-radius: 4px;
}
/* Record card in the review: code and status left, copy and details right; name; one "created" line; facts; activity */
.record-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.record-card.inactive {
  background: #f7f8f7;
}
.record-card header, .cw-match-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.record-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.record-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
}
.record-tools {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
#dialog .icon-button, .panel .icon-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: white;
}
#dialog .icon-button:hover, .panel .icon-button:hover {
  background: var(--light);
}
.icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.record-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.record-facts {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.record-facts dt {
  color: var(--muted);
}
.record-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.record-facts dd div + div {
  margin-top: 4px;
}
.record-section {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.record-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
}
.record-section h4 span {
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}
.cw-matches summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}
.cw-matches summary::-webkit-details-marker {
  display: none;
}
.cw-matches summary::before {
  content: "▸";
  color: var(--green);
  font-size: 16px;
  line-height: 1;
  margin-bottom: 8px;
}
.cw-matches[open] summary::before {
  content: "▾";
}
.cw-matches:not([open]) summary h4 {
  margin-bottom: 0;
}
.cw-matches:not([open]) summary::before {
  margin-bottom: 0;
}
.activity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.activity-grid > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--light);
  font-size: 11px;
}
.activity-grid strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.activity-grid > div.zero {
  background: var(--bg);
  color: var(--muted);
}
.activity-grid > div.zero strong {
  font-weight: 400;
}
.cw-match {
  border-top: 1px solid var(--line);
  padding: 8px 0;
  font-size: 12px;
  display: grid;
  gap: 3px;
}
.activity-total {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .activity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .record-facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .record-facts dd {
    margin-bottom: 6px;
  }
}
.case-summary .codes {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.case-summary .code-box {
  display: block;
  max-height: 96px;
  overflow-y: auto;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  line-height: 1.6;
}
.copy-all {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font-size: 12px;
  cursor: pointer;
}
.copy-all:hover {
  text-decoration: underline;
}
/* Filters in the view row (country, SAP CargoWise status): look like the cases dropdown; an applied filter is highlighted, and one Reset clears them all. */
.filter-select {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
}
.filter-select.hidden {
  display: none;
}
#app .filter-select select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 230px;
  border: 0;
  border-radius: 9px;
  padding: 8px 32px 8px 12px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23193d35' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center / 13px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.filter-select.applied {
  background: var(--light);
  border-color: #b9d3c1;
}
#app .filter-select.applied select {
  color: var(--green);
  font-weight: 600;
}
#app .reset-filters {
  border-color: #e2c9a8;
  background: #fff7ec;
  color: var(--orange);
}
#app .reset-filters:hover {
  background: #fbefd9;
}
/* the right side of the view row: search, refresh, download, pages */
#app .row-actions {
  align-items: center;
  flex-wrap: wrap;
}
#app .row-actions .search-box {
  width: 210px;
}
#app .row-actions > .icon-text {
  font-size: 15px;
  padding: 5px 11px;
}
#app .view-row .nav {
  flex-wrap: nowrap;
}
@media (max-width: 1100px) {
  #app .view-row .nav {
    flex-wrap: wrap;
  }
}
#app .row-actions .search-box input {
  padding: 8px 10px;
}

/* reopen confirmation: a small dialog above the case window */
dialog.confirm-dialog {
  width: min(440px, calc(100% - 32px));
}
.confirm-dialog p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.confirm-dialog .actions {
  justify-content: flex-end;
  margin: 18px 0 0;
}

/* Closed cases: a plain toggle beside the open-cases dropdown */
#app .closed-cases {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}
#app .closed-cases:hover:not(.active) {
  background: var(--light);
}
#app .closed-cases.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
/* while closed cases show, the dropdown only takes you back to open cases */
#app .case-filter.muted-select {
  background-color: white;
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted);
}

/* closed list: View and Reopen side by side */
.panel td.closed-actions {
  white-space: nowrap;
}
.panel .closed-actions .icon-button {
  width: 32px;
  height: 32px;
  margin-right: 6px;
  vertical-align: middle;
}
