:root {
  --mc-mint-50: #f2faf6;
  --mc-mint-100: #e5f4ec;
  --mc-mint-200: #c9e8d8;
  --mc-mint-500: #3c8a68;
  --mc-mint-700: #246548;
  --mc-ink: #1f2d27;
  --mc-muted: #65736c;
  --mc-line: #dbe5df;
  --mc-paper: #ffffff;
  --mc-blue: #3a6e83;
  --mc-blue-soft: #eaf3f6;
  --mc-amber: #8a6418;
  --mc-amber-soft: #fbf3df;
  --mc-red: #a64d42;
  --mc-red-soft: #faece9;
}

body.material-case-enabled #intake > .section-heading,
body.material-case-enabled #intake > .onboarding-shell,
body.material-case-enabled #intake > .onboarding-recent-panel,
body.material-case-enabled #intake > .legacy-intake-shell,
body.material-case-enabled #intake > .intake-confirm-dialog {
  display: none !important;
}

body.material-case-enabled #intake {
  background: var(--mc-mint-50);
}

.material-case-shell {
  min-width: 0;
  color: var(--mc-ink);
}

.material-case-shell[hidden] {
  display: none !important;
}

.mc-session-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid #e7cf91;
  border-radius: 12px;
  color: var(--mc-amber);
  background: var(--mc-amber-soft);
}

.mc-session-gate[hidden] {
  display: none !important;
}

.mc-session-gate > div,
.mc-session-gate form {
  display: flex;
  gap: 8px;
}

.mc-session-gate > div {
  min-width: 0;
  flex-direction: column;
}

.mc-session-gate form {
  flex: 0 1 420px;
  align-items: center;
}

.mc-session-gate label {
  flex: 1 1 auto;
}

.mc-session-gate input {
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #d5bd82;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.mc-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.mc-page-head h3 {
  margin: 4px 0 8px;
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.2;
}

.mc-page-head p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--mc-muted);
}

.mc-page-tabs {
  display: inline-flex;
  max-width: 100%;
  padding: 4px;
  margin-bottom: 20px;
  background: #e9f1ed;
  border: 1px solid var(--mc-line);
  border-radius: 12px;
}

.mc-page-tabs button,
.mc-filters button {
  border: 0;
  font: inherit;
  color: var(--mc-muted);
  background: transparent;
  cursor: pointer;
}

.mc-page-tabs button {
  min-width: 138px;
  padding: 9px 16px;
  border-radius: 9px;
  font-weight: 700;
}

.mc-page-tabs button.active {
  color: var(--mc-mint-700);
  background: var(--mc-paper);
  box-shadow: 0 2px 8px rgb(35 83 62 / 8%);
}

.mc-page-tabs span {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  margin-left: 5px;
  padding: 0 5px;
  color: #fff;
  background: var(--mc-mint-500);
  border-radius: 999px;
  font-size: 12px;
}

.mc-view {
  min-width: 0;
}

.mc-view[hidden] {
  display: none !important;
}

.mc-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr);
  gap: 18px;
  align-items: start;
}

.mc-entry-form,
.mc-receipt {
  min-width: 0;
  border-color: var(--mc-line);
  background: var(--mc-paper);
  box-shadow: 0 10px 28px rgb(31 66 50 / 6%);
}

.mc-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mc-field {
  display: grid;
  min-width: 0;
  gap: 7px;
  margin-bottom: 14px;
}

.mc-field > span,
.mc-type-field legend {
  color: #405149;
  font-size: 13px;
  font-weight: 750;
}

.mc-field input,
.mc-field textarea,
.mc-rule-row input,
.mc-edit-grid input,
.mc-edit-grid select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 11px 12px;
  color: var(--mc-ink);
  font: inherit;
  background: #fbfdfc;
  border: 1px solid #cfdad4;
  border-radius: 9px;
  outline: none;
}

.mc-field textarea {
  resize: vertical;
}

.mc-field input:focus,
.mc-field textarea:focus,
.mc-rule-row input:focus,
.mc-edit-grid input:focus,
.mc-edit-grid select:focus {
  border-color: var(--mc-mint-500);
  box-shadow: 0 0 0 3px rgb(60 138 104 / 12%);
}

.mc-type-field {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 4px 0 16px;
  border: 0;
}

.mc-type-field legend {
  grid-column: 1 / -1;
  margin-bottom: 7px;
}

.mc-type-field label {
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}

.mc-type-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mc-type-field label > span {
  display: grid;
  gap: 3px;
  min-height: 72px;
  box-sizing: border-box;
  padding: 13px;
  background: #fbfdfc;
  border: 1px solid var(--mc-line);
  border-radius: 10px;
}

.mc-type-field small {
  overflow-wrap: anywhere;
  color: var(--mc-muted);
  line-height: 1.4;
}

.mc-type-field input:checked + span {
  background: var(--mc-mint-100);
  border-color: var(--mc-mint-500);
  box-shadow: inset 0 0 0 1px var(--mc-mint-500);
}

.mc-path-note {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  color: #3f584c;
  background: var(--mc-mint-50);
  border: 1px solid var(--mc-mint-200);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.mc-form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.mc-form-actions > span {
  color: var(--mc-muted);
  font-size: 12px;
  line-height: 1.5;
}

.mc-empty {
  display: grid;
  min-height: 210px;
  place-content: center;
  gap: 8px;
  padding: 22px;
  text-align: center;
  color: var(--mc-muted);
}

.mc-empty strong {
  color: var(--mc-ink);
  font-size: 16px;
}

.mc-receipt-card {
  display: grid;
  gap: 15px;
}

.mc-receipt-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mc-receipt-card h4 {
  margin: 5px 0;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.mc-receipt-card p {
  margin: 0;
  color: var(--mc-muted);
  line-height: 1.6;
}

.mc-receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mc-pending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.mc-pending-head h4 {
  margin: 0 0 4px;
  font-size: 20px;
}

.mc-pending-head span {
  color: var(--mc-muted);
  font-size: 13px;
}

.mc-filters {
  display: flex;
  max-width: 100%;
  gap: 7px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.mc-filters button {
  flex: none;
  padding: 7px 11px;
  border: 1px solid var(--mc-line);
  border-radius: 999px;
  background: var(--mc-paper);
}

.mc-filters button.active {
  color: var(--mc-mint-700);
  background: var(--mc-mint-100);
  border-color: var(--mc-mint-200);
  font-weight: 700;
}

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

.mc-case-card {
  min-width: 0;
  padding: 17px;
  background: var(--mc-paper);
  border: 1px solid var(--mc-line);
  border-radius: 13px;
  box-shadow: 0 6px 18px rgb(31 66 50 / 5%);
}

.mc-case-card > header,
.mc-case-card > footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mc-case-card > header small {
  display: block;
  margin-top: 4px;
  color: var(--mc-muted);
}

.mc-case-id {
  overflow-wrap: anywhere;
  color: #33443c;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 750;
}

.mc-state-chip {
  flex: none;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.mc-state-chip.green { color: var(--mc-mint-700); background: var(--mc-mint-100); }
.mc-state-chip.blue { color: var(--mc-blue); background: var(--mc-blue-soft); }
.mc-state-chip.amber { color: var(--mc-amber); background: var(--mc-amber-soft); }
.mc-state-chip.red { color: var(--mc-red); background: var(--mc-red-soft); }

.mc-case-main {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  gap: 12px;
  margin: 15px 0;
}

.mc-step-marker {
  background: var(--mc-mint-500);
  border-radius: 4px;
}

.mc-case-main strong {
  font-size: 15px;
}

.mc-case-main p {
  margin: 5px 0 0;
  color: var(--mc-muted);
  line-height: 1.55;
}

.mc-case-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0 0 14px;
  background: var(--mc-line);
  border: 1px solid var(--mc-line);
  border-radius: 9px;
}

.mc-case-facts > div {
  min-width: 0;
  padding: 9px 10px;
  background: #fbfcfb;
}

.mc-case-facts dt {
  margin-bottom: 4px;
  color: var(--mc-muted);
  font-size: 11px;
}

.mc-case-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.mc-case-card > footer {
  align-items: center;
  color: var(--mc-muted);
  font-size: 12px;
}

.mc-case-card > footer > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.mc-load-more {
  display: block;
  margin: 14px auto 0;
}

.mc-dialog,
.mc-drawer {
  color: var(--mc-ink);
  background: var(--mc-paper);
  border: 1px solid var(--mc-line);
  box-shadow: 0 26px 70px rgb(26 52 41 / 22%);
}

.mc-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border-radius: 15px;
}

.mc-dialog::backdrop,
.mc-drawer::backdrop {
  background: rgb(25 43 35 / 32%);
  backdrop-filter: blur(2px);
}

.mc-dialog form {
  margin: 0;
}

.mc-dialog header,
.mc-dialog footer,
.mc-summary {
  padding: 20px;
}

.mc-dialog header h4 {
  margin: 10px 0 6px;
  font-size: 21px;
}

.mc-dialog header p {
  margin: 0;
  color: var(--mc-muted);
  line-height: 1.6;
}

.mc-summary {
  display: grid;
  gap: 8px;
  padding-top: 0;
}

.mc-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1ef;
}

.mc-summary span {
  color: var(--mc-muted);
}

.mc-summary strong {
  overflow-wrap: anywhere;
  text-align: right;
}

.mc-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  background: #f8faf9;
  border-radius: 0 0 15px 15px;
}

.mc-drawer {
  width: min(720px, calc(100vw - 28px));
  height: 100vh;
  max-height: 100vh;
  padding: 0;
  margin: 0 0 0 auto;
  border-width: 0 0 0 1px;
}

.mc-drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid var(--mc-line);
}

.mc-drawer-head h4 {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.mc-drawer-body {
  padding: 20px;
}

.mc-record-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}

.mc-record-overview > div,
.mc-rule-section {
  padding: 12px;
  background: #f8faf9;
  border: 1px solid var(--mc-line);
  border-radius: 10px;
}

.mc-record-overview span,
.mc-timeline time {
  color: var(--mc-muted);
  font-size: 11px;
}

.mc-record-overview strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.mc-timeline {
  display: grid;
  gap: 0;
}

.mc-timeline article {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 18px;
}

.mc-timeline article::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-top: 5px;
  background: var(--mc-mint-500);
  border: 2px solid var(--mc-mint-100);
  border-radius: 50%;
}

.mc-timeline article:not(:last-child)::after {
  position: absolute;
  top: 17px;
  bottom: 0;
  left: 5px;
  width: 1px;
  content: "";
  background: var(--mc-line);
}

.mc-timeline strong,
.mc-timeline p {
  display: block;
  margin: 0 0 4px;
}

.mc-timeline p {
  color: var(--mc-muted);
  line-height: 1.5;
}

.mc-edit-panel {
  padding: 14px;
  margin-bottom: 12px;
  background: var(--mc-amber-soft);
  border: 1px solid #ead9ac;
  border-radius: 10px;
}

.mc-edit-grid,
.mc-rule-list {
  display: grid;
  gap: 10px;
}

.mc-edit-grid label {
  display: grid;
  gap: 5px;
}

.mc-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.mc-rule-intro {
  padding: 13px;
  margin-bottom: 14px;
  color: #40544a;
  background: var(--mc-mint-50);
  border: 1px solid var(--mc-mint-200);
  border-radius: 10px;
  line-height: 1.55;
}

.mc-rule-section {
  margin-bottom: 12px;
  background: #fff;
}

.mc-rule-section h5 {
  margin: 0 0 4px;
  font-size: 16px;
}

.mc-rule-section > p {
  margin: 0 0 12px;
  color: var(--mc-muted);
  font-size: 12px;
}

.mc-rule-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(100px, .6fr) minmax(100px, .6fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid #edf1ef;
}

.mc-rule-row > strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.mc-rule-fixed {
  padding: 5px 8px;
  color: var(--mc-mint-700);
  background: var(--mc-mint-100);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.mc-rule-save {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
}

.mc-rule-save span {
  color: var(--mc-muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .mc-entry-grid {
    grid-template-columns: 1fr;
  }

  .mc-receipt {
    order: -1;
  }

  .mc-empty {
    min-height: 120px;
  }
}

@media (max-width: 680px) {
  .mc-session-gate,
  .mc-session-gate form {
    align-items: stretch;
    flex-direction: column;
  }

  .material-case-shell {
    padding-bottom: 76px;
  }

  .mc-page-head {
    display: grid;
    gap: 12px;
  }

  .mc-page-head .secondary-action {
    justify-self: start;
  }

  .mc-page-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    box-sizing: border-box;
  }

  .mc-page-tabs button {
    min-width: 0;
    padding-inline: 9px;
  }

  .mc-form-grid,
  .mc-type-field,
  .mc-case-facts,
  .mc-record-overview {
    grid-template-columns: 1fr;
  }

  .mc-form-actions,
  .mc-pending-head,
  .mc-case-card > header,
  .mc-case-card > footer,
  .mc-rule-save {
    align-items: stretch;
    flex-direction: column;
  }

  .mc-case-card > footer > div {
    justify-content: stretch;
  }

  .mc-case-card > footer button {
    flex: 1;
  }

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

  .mc-rule-row > strong,
  .mc-rule-row > .mc-rule-fixed {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .mc-drawer {
    width: 100vw;
    max-width: 100vw;
    border: 0;
  }
}
