:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --ink: #182848;
  --muted: #697178;
  --line: #ded8c9;
  --line-strong: #cfc3ae;
  --green: #182848;
  --green-2: #b09058;
  --green-3: #f2eadc;
  --blue: #244778;
  --orange: #b09058;
  --red: #d9372f;
  --yellow: #c7a35b;
  --shadow: 0 14px 36px rgba(24, 40, 72, 0.1);
  --radius: 8px;
  --radius-small: 6px;
}

* {
  box-sizing: border-box;
}

body * {
  min-width: 0;
}

html {
  min-width: 320px;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
  width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  width: 100%;
  overflow-x: hidden;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  width: 100dvw;
  max-width: 100%;
  overflow-x: hidden;
  padding: 22px 18px;
  background:
    linear-gradient(135deg, rgba(24, 40, 72, 0.05), rgba(176, 144, 88, 0.12)),
    var(--bg);
}

.login-card {
  width: min(360px, calc(100dvw - 36px));
  max-width: 100%;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-logo {
  display: block;
  width: 180px;
  max-width: 72%;
  height: auto;
  margin-bottom: 28px;
}

.login-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: 27px;
  line-height: 1.18;
  letter-spacing: 0;
}

.login-copy p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.login-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.sidebar {
  display: none;
}

.main {
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  padding-bottom: 92px;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: stretch;
  min-height: 72px;
  width: 100%;
  max-width: 100vw;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.mobile-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  width: 100%;
  grid-column: 1 / 2;
  grid-row: 1;
}

.mobile-brand strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.mobile-logo {
  display: block;
  width: 98px;
  height: 25px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

.brand-logo {
  display: block;
  width: 158px;
  height: auto;
  object-fit: contain;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  grid-column: 1 / -1;
  grid-row: 2;
}

.search-box svg,
.nav-icon,
.modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.top-actions {
  display: contents;
}

.shared-sync-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(191, 151, 83, 0.42);
  border-radius: var(--radius);
  background: #fff8ea;
  color: var(--ink);
}

.shared-sync-panel strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.shared-sync-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.shared-sync-panel .primary-button {
  min-height: 40px;
  white-space: nowrap;
}

.shared-sync-panel-warning {
  grid-template-columns: 1fr;
  background: #fff4f2;
  border-color: rgba(205, 74, 74, 0.28);
}

.top-log-button,
.logout-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.logout-button {
  width: 52px;
  grid-column: 2 / 3;
  grid-row: 1;
  align-self: center;
  justify-self: end;
}

.dashboard-head {
  gap: 10px;
}

.dashboard-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  width: 100%;
}

.dashboard-log-button {
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.dashboard-actions-row {
  width: 100%;
}

.account-types-panel {
  margin-bottom: 12px;
}

.account-type-list {
  display: grid;
  gap: 8px;
}

.account-type-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
}

.account-type-row summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  list-style: none;
}

.account-type-row summary::-webkit-details-marker {
  display: none;
}

.account-type-row summary strong,
.account-type-row summary span {
  overflow-wrap: anywhere;
}

.account-type-row summary span,
.account-type-row div span {
  color: var(--muted);
  font-size: 12px;
}

.account-type-row div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px 10px;
}

.account-type-row div b {
  color: var(--ink);
}

.view-root {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 14px 22px;
  overflow-x: hidden;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.page-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

.page-title h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: 0;
}

.page-date {
  color: var(--muted);
  font-size: 13px;
}

.page-copy {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.actions-row,
.toolbar-row {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
  max-width: 100%;
  scrollbar-width: none;
}

.actions-row::-webkit-scrollbar,
.toolbar-row::-webkit-scrollbar {
  display: none;
}

.primary-button,
.ghost-button,
.tiny-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-small);
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.ghost-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.tiny-button {
  min-height: 30px;
  padding: 0 9px;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--ink);
}

.primary-button svg,
.ghost-button svg,
.tiny-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.stat-card,
.panel,
.customer-row,
.case-card,
.document-card,
.payment-row,
.log-row,
.ocr-row,
.locked-panel,
.quick-record {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(16, 35, 26, 0.03);
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  min-height: 88px;
  padding: 13px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.stat-card:hover,
.stat-card:focus-visible {
  border-color: var(--green-2);
  box-shadow: 0 12px 26px rgba(24, 40, 72, 0.08);
  outline: 0;
}

.stat-card:active {
  transform: translateY(1px);
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  line-height: 1;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: var(--radius-small);
  background: var(--green-3);
  color: var(--green);
}

.stat-icon.warn {
  background: #fff2e0;
  color: var(--orange);
}

.stat-icon.danger {
  background: #feecea;
  color: var(--red);
}

.stat-icon.blue {
  background: #eaf1ff;
  color: var(--blue);
}

.stat-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-grid {
  display: grid;
  gap: 12px;
  max-width: 100%;
  overflow-x: hidden;
}

.panel {
  padding: 14px;
  max-width: 100%;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.panel-title span,
.panel-title button {
  color: var(--muted);
  font-size: 13px;
}

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

.stage-line {
  display: grid;
  grid-template-columns: minmax(72px, 86px) minmax(0, 1fr) 28px;
  gap: 9px;
  align-items: center;
  font-size: 13px;
}

.stage-line label {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.progress {
  position: relative;
  height: 9px;
  overflow: hidden;
  border-radius: 20px;
  background: #edf2ee;
}

.progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  border-radius: inherit;
  background: var(--c);
}

.stage-line b {
  text-align: right;
  font-size: 13px;
}

.recent-list,
.task-list,
.payment-list,
.log-list,
.ocr-list {
  display: grid;
  gap: 8px;
}

.recent-item,
.task-item,
.doc-strip-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recent-item {
  min-height: 54px;
}

.recent-customer-button {
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-small);
}

.recent-customer-button:focus-visible,
.recent-customer-button:hover {
  outline: 2px solid rgba(24, 40, 72, 0.18);
  outline-offset: 3px;
}

.avatar,
.mini-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green-3);
  color: var(--green);
  font-weight: 800;
}

.avatar {
  width: 38px;
  height: 38px;
}

.mini-avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.recent-main,
.task-main,
.payment-main,
.log-main,
.ocr-main {
  min-width: 0;
  flex: 1;
}

.recent-main strong,
.task-main strong,
.payment-main strong,
.log-main strong,
.ocr-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-main span,
.task-main span,
.payment-main span,
.log-main span,
.ocr-main span,
.small-muted {
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border-radius: var(--radius-small);
  background: var(--green-3);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.warn {
  background: #fff2df;
  color: #935100;
}

.tag.danger {
  background: #feecea;
  color: var(--red);
}

.tag.blue {
  background: #eaf1ff;
  color: var(--blue);
}

.tag.gray {
  background: #edf1ee;
  color: #48564f;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 118px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(20, 41, 79, 0.96);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 14px 32px rgba(20, 41, 79, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.task-item {
  align-items: flex-start;
  padding: 3px 0;
}

.task-item input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.task-item.is-done .task-main strong,
.task-item.is-done .task-main span {
  color: #8b9991;
  text-decoration: line-through;
}

.photo-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  scrollbar-width: none;
}

.photo-strip::-webkit-scrollbar {
  display: none;
}

.doc-strip-item {
  display: block;
  flex: 0 0 86px;
  width: 86px;
}

.doc-strip-item button,
.document-photo {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: #f0f4f1;
  border-radius: var(--radius-small);
}

.doc-strip-item img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border-radius: var(--radius-small);
  background: #f0f4f1;
}

.doc-strip-item strong,
.doc-strip-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 6px;
  font-size: 12px;
}

.doc-strip-item span {
  margin-top: 1px;
  color: var(--muted);
}

.quick-record {
  padding: 14px;
}

.quick-record form {
  display: grid;
  gap: 9px;
}

.form-grid {
  display: grid;
  gap: 8px;
}

.field {
  display: grid;
  gap: 5px;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  color: var(--ink);
  outline: 0;
}

.field input,
.field select {
  height: 40px;
  padding: 0 10px;
}

.field textarea {
  min-height: 72px;
  padding: 10px;
  resize: vertical;
}

.customers-list,
.case-board,
.documents-grid,
.payments-grid,
.logs-grid,
.ocr-grid {
  display: grid;
  gap: 10px;
  max-width: 100%;
}

.customer-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  padding: 12px;
}

.customer-row-clickable {
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.customer-row-clickable:focus-visible,
.customer-row-clickable:hover {
  border-color: var(--green-2);
  box-shadow: 0 10px 22px rgba(24, 40, 72, 0.08);
  outline: 0;
}

.row-action {
  margin-top: 10px;
  color: var(--green-2);
  font-size: 12px;
  font-weight: 700;
}

.customer-row .customer-main {
  min-width: 0;
}

.customer-row h3,
.case-card h3,
.document-card h3,
.locked-panel h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.customer-meta,
.case-meta,
.document-meta,
.payment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.customer-category-tag {
  background: #eef4f7;
  color: var(--green);
}

.new-customer-panel {
  margin-bottom: 12px;
}

.new-customer-form {
  display: grid;
  gap: 12px;
}

.customer-next,
.case-next,
.document-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.case-board {
  display: grid;
  gap: 14px;
  overflow: visible;
  width: 100%;
  max-width: 100%;
  padding-bottom: 8px;
  scroll-snap-type: none;
}

.case-board::-webkit-scrollbar {
  display: none;
}

.case-column {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  scroll-snap-align: none;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.column-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.column-head span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
}

.case-stack {
  display: grid;
  gap: 9px;
}

.case-card {
  padding: 11px;
  box-shadow: none;
}

.case-stack .case-editor-card {
  grid-template-columns: 1fr;
  padding: 12px;
  box-shadow: 0 10px 26px rgba(24, 40, 72, 0.06);
}

.case-stack .case-editor-photo {
  position: relative;
  height: clamp(154px, 47vw, 190px);
  max-height: none;
  aspect-ratio: auto;
}

.case-stack .case-editor-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
}

.case-stack .case-editor-fields {
  grid-template-columns: 1fr;
}

.case-stack .case-editor-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.case-stack .case-editor-actions > button {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
  font-size: 12px;
  white-space: nowrap;
}

.customer-detail-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-head h2 {
  margin: 0;
  font-size: 18px;
}

.profile-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.customer-compact-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.customer-compact-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.customer-compact-meta b {
  color: var(--ink);
}

.customer-compact-meta i {
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--line-strong);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-filter {
  display: block;
  width: 100%;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.summary-filter.is-active {
  border-color: var(--blue);
  background: #eaf1ff;
  box-shadow: inset 0 0 0 1px var(--blue);
}

.summary-grid strong,
.summary-grid span {
  display: block;
}

.summary-grid strong {
  font-size: 26px;
  line-height: 1;
}

.summary-grid span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.case-filter-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.case-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(176, 144, 88, 0.36);
  border-radius: var(--radius);
  background: #fbf7ef;
}

.case-filter-bar strong,
.case-filter-bar span {
  display: block;
}

.case-filter-bar strong {
  font-size: 14px;
}

.case-filter-bar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.customer-case-list {
  display: grid;
  gap: 10px;
}

.case-editor-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.case-editor-card.needs-review {
  border-color: rgba(184, 144, 72, 0.58);
  background: #fffdf7;
}

.case-review-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(184, 144, 72, 0.25);
  border-radius: var(--radius-small);
  background: #fff8e8;
}

.case-review-alert p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-editor-photo {
  display: grid;
  place-items: center;
  width: 100%;
  max-height: 210px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-small);
  background:
    linear-gradient(135deg, rgba(24, 40, 72, 0.04), rgba(176, 144, 88, 0.1)),
    #f1f0eb;
}

.case-editor-photo img {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: contain;
}

.document-photo img,
.doc-strip-item img,
.case-editor-photo img,
.ocr-thumb img,
.photo-modal img {
  image-orientation: from-image;
}

.case-editor-main {
  display: grid;
  gap: 10px;
}

.case-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.case-editor-head h3,
.case-editor-head p {
  margin: 0;
}

.case-editor-head h3 {
  font-size: 17px;
  line-height: 1.18;
  letter-spacing: 0;
}

.case-editor-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.case-editor-fields {
  display: grid;
  gap: 8px;
}

.case-identity-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.case-person-field {
  grid-column: 1 / -1;
}

.case-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: -2px;
}

.extract-button {
  min-height: 42px;
  padding-inline: 16px;
}

.review-confirm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(40, 102, 74, 0.24);
  border-radius: var(--radius-small);
  background: #eef7f2;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.confirm-update-button {
  min-height: 42px;
  padding-inline: 18px;
  box-shadow: 0 10px 22px rgba(17, 43, 83, 0.13);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #f0c9c6;
  border-radius: var(--radius-small);
  background: #fff6f5;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.danger-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.delete-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 20, 13, 0.58);
}

.delete-dialog-card {
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.delete-dialog-card h2,
.delete-dialog-card p {
  margin: 0;
}

.delete-dialog-card h2 {
  font-size: 20px;
  line-height: 1.2;
}

.delete-dialog-card p {
  color: var(--muted);
  font-size: 14px;
}

.delete-dialog-card strong {
  color: var(--ink);
}

.delete-dialog-hint {
  color: var(--red) !important;
  font-weight: 700;
}

.delete-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.new-case-panel {
  margin-bottom: 14px;
}

.new-case-form {
  display: grid;
  gap: 12px;
}

.new-case-upload {
  display: grid;
  gap: 10px;
}

.upload-drop {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 18px;
  border: 1.5px dashed rgba(176, 144, 88, 0.62);
  border-radius: var(--radius);
  background: #fffaf0;
  text-align: center;
}

.upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-drop span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  border-radius: var(--radius-small);
  background: var(--green);
  color: #fff;
}

.upload-drop svg {
  width: 20px;
  height: 20px;
}

.upload-drop strong,
.upload-drop small {
  display: block;
}

.upload-drop small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.new-case-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f1f0eb;
  color: var(--muted);
  font-size: 13px;
}

.new-case-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  image-orientation: from-image;
}

.ocr-status {
  padding: 9px 10px;
  border: 1px solid rgba(36, 71, 120, 0.16);
  border-radius: var(--radius-small);
  background: #f5f8ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.ocr-raw-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
}

.ocr-raw-box summary {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ocr-raw-box pre {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  padding: 0 12px 12px;
  white-space: pre-wrap;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}

.case-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green-2);
}

.dot.red {
  background: var(--red);
}

.dot.orange {
  background: var(--orange);
}

.dot.blue {
  background: var(--blue);
}

.document-card {
  overflow: hidden;
}

.document-photo {
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

.document-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #eef3ef;
}

.document-body {
  padding: 12px;
}

.document-card h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.info-table {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.info-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  font-size: 13px;
}

.info-row span {
  color: var(--muted);
}

.info-row b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.payment-row,
.log-row,
.ocr-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--green);
  white-space: nowrap;
}

.payment-client-card {
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.payment-client-card:focus-visible,
.payment-client-card:hover {
  border-color: var(--green-2);
  box-shadow: 0 10px 22px rgba(24, 40, 72, 0.08);
  outline: 0;
}

.payment-detail-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.payment-price-only {
  grid-template-columns: minmax(0, 1fr);
}

.payment-overview-panel {
  margin-bottom: 12px;
}

.payment-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.payment-overview-grid div {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(251, 250, 247, 0.98)),
    var(--surface-soft);
}

.payment-overview-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.payment-overview-grid strong {
  color: var(--ink);
  font-size: clamp(16px, 4vw, 24px);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.payment-price-panel {
  display: grid;
  gap: 10px;
}

.price-grid {
  display: grid;
  gap: 8px;
}

.price-field small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.case-price-list {
  display: grid;
  gap: 10px;
}

.case-price-row {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
}

.case-price-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.case-price-head strong,
.case-price-head span {
  display: block;
}

.case-price-head strong {
  color: var(--ink);
  font-size: 14px;
}

.case-price-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.case-price-fields {
  display: grid;
  gap: 8px;
}

.case-price-fields select,
.case-price-fields input {
  width: 100%;
}

.case-price-row .case-editor-actions {
  justify-content: flex-end;
}

.payment-balance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.payment-balance-grid div {
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
}

.payment-balance-grid span {
  color: var(--muted);
  font-size: 12px;
}

.payment-balance-grid strong {
  font-size: 15px;
  line-height: 1.25;
}

.payment-upload-form {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
}

.payment-proof-drop {
  min-height: 128px;
}

.payment-proof-preview {
  display: grid;
  place-items: center;
  min-height: 112px;
  overflow: hidden;
  border-radius: var(--radius-small);
  background: #f1f0eb;
  color: var(--muted);
  font-size: 13px;
}

.payment-proof-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  image-orientation: from-image;
}

.payment-record-fields {
  display: grid;
  gap: 8px;
}

.payment-record-line {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
}

.payment-record-line strong,
.payment-record-line span,
.payment-record-line p {
  margin: 0;
}

.payment-record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.payment-record-line p {
  color: var(--muted);
  font-size: 13px;
}

.payment-proof-thumb {
  justify-self: start;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.payment-record-dialog {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(24, 40, 72, 0.44);
}

.payment-record-dialog-card {
  display: grid;
  gap: 12px;
  width: min(760px, calc(100vw - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.payment-people-list {
  display: grid;
  gap: 10px;
}

.payment-person-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.payment-person-head,
.person-fee-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.payment-person-head h3,
.payment-person-head p {
  margin: 0;
}

.payment-person-head h3 {
  font-size: 16px;
}

.payment-person-head p,
.person-fee-line span {
  color: var(--muted);
  font-size: 12px;
}

.person-case-list {
  display: grid;
  gap: 8px;
}

.person-fee-line {
  align-items: center;
  padding: 9px;
  border-radius: var(--radius-small);
  background: #f8fbf9;
}

details.person-fee-line {
  display: block;
}

details.person-fee-line[open] {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(176, 144, 88, 0.18);
}

.person-fee-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.person-fee-summary::-webkit-details-marker {
  display: none;
}

.person-fee-edit-panel {
  margin-top: 10px;
}

.person-fee-edit-panel .case-price-row {
  padding: 0;
  border: 0;
  background: transparent;
}

.person-fee-edit-panel .case-price-head {
  display: none;
}

.person-fee-main {
  min-width: 0;
}

.person-fee-line strong {
  display: block;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.person-fee-price {
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.locked-panel {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  text-align: center;
}

.lock-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: var(--radius);
  background: #eef3ef;
  color: var(--green);
}

.lock-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.locked-panel p {
  max-width: 380px;
  margin: 8px auto 0;
  color: var(--muted);
}

.ocr-row {
  grid-template-columns: 68px 1fr auto;
}

.ocr-thumb {
  width: 58px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #edf2ee;
}

.ocr-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.empty-state {
  padding: 28px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(var(--nav-count, 5), minmax(0, 1fr));
  width: auto;
  max-width: none;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(24, 40, 72, 0.14);
  backdrop-filter: blur(18px);
  box-sizing: border-box;
}

.nav-button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 56px;
  padding: 4px 1px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: #5f6f65;
  font-size: 10px;
  font-weight: 700;
}

.nav-button.is-active {
  background: #f1eadf;
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(176, 144, 88, 0.18);
}

.bottom-nav .nav-icon {
  width: 20px;
  height: 20px;
}

.nav-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 20, 13, 0.72);
}

.photo-modal.is-hidden {
  display: none;
}

.photo-modal figure {
  width: min(92vw, 860px);
  margin: 0;
}

.photo-modal img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: #f0f4f1;
}

.photo-modal figcaption {
  margin-top: 10px;
  color: #fff;
  text-align: center;
  font-weight: 700;
}

.review-panel {
  margin-top: 12px;
}

.modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

@media (max-width: 374px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }

  .nav-button {
    font-size: 10px;
  }

}

@media (max-width: 719px) {
  html,
  body {
    max-width: 100%;
  }

  #mainApp {
    width: 100%;
    max-width: none;
  }

  .main,
  .topbar,
  .view-root {
    width: 100%;
    max-width: none;
  }

  .topbar,
  .view-root,
  .stats-grid,
  .dashboard-grid,
  .panel,
  .photo-strip,
  .bottom-nav {
    overflow-x: clip;
  }

  .mobile-brand strong {
    flex: 1 1 auto;
  }

  .shared-sync-panel {
    grid-template-columns: 1fr;
  }

  .shared-sync-panel .primary-button {
    width: 100%;
  }

  .logout-button {
    width: 46px;
    padding: 0;
  }

  .bottom-nav {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .logout-button {
    font-size: 12px;
  }

  .page-title h1 {
    font-size: 25px;
  }

  .page-copy {
    font-size: 14px;
    line-height: 1.5;
  }

  .stat-card span {
    font-size: 12px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .document-card,
  .panel,
  .customer-row,
  .quick-record,
  .locked-panel {
    border-radius: var(--radius);
  }

  .case-summary-panel .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 720px) {
  .login-screen {
    place-items: center;
    padding: 22px;
  }

  .login-card {
    width: 430px;
    max-width: calc(100vw - 44px);
  }

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

  .documents-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customers-list,
  .payments-grid,
  .logs-grid,
  .ocr-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-price-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .new-case-upload {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}

@media (min-width: 960px) {
  body {
    background:
      linear-gradient(180deg, rgba(24, 40, 72, 0.04), rgba(176, 144, 88, 0.08)),
      var(--bg);
  }

  .app-shell {
    align-items: stretch;
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex: 0 0 252px;
    height: 100vh;
    flex-direction: column;
    padding: 26px 18px;
    background: var(--green);
    color: #fff;
    box-shadow: 18px 0 38px rgba(24, 40, 72, 0.1);
  }

  .brand {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px;
    border: 1px solid rgba(176, 144, 88, 0.32);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
  }

  .brand strong,
  .brand span,
  .sidebar-user strong,
  .sidebar-user span {
    display: block;
  }

  .brand span,
  .sidebar-user span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
  }

  .brand strong {
    color: var(--ink);
  }

  .brand span {
    color: #6f746f;
  }

  .nav-list {
    display: grid;
    gap: 6px;
  }

  .sidebar .nav-button {
    grid-template-columns: 22px 1fr;
    justify-items: start;
    min-height: 44px;
    padding: 0 12px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 14px;
  }

  .sidebar .nav-button.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.08);
  }

  .sidebar-user .avatar {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
  }

  .main {
    padding-bottom: 0;
    min-width: 0;
  }

  .topbar {
    grid-template-columns: minmax(340px, 620px) minmax(360px, auto);
    justify-content: space-between;
    align-items: center;
    min-height: 72px;
    padding: 14px 32px;
    border-bottom-color: rgba(222, 216, 201, 0.72);
    background: rgba(255, 255, 255, 0.88);
  }

  .mobile-brand {
    display: none;
  }

  .search-box {
    grid-column: auto;
    grid-row: auto;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 52px;
    justify-content: end;
    align-items: center;
    width: 100%;
    min-width: 0;
  }

  .top-log-button,
  .logout-button {
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
    justify-self: auto;
  }

  .view-root {
    width: min(100%, 1420px);
    margin: 0 auto;
    padding: 28px 32px 36px;
  }

  .page-head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
  }

  .page-title {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
    align-items: start;
  }

  .dashboard-main,
  .dashboard-side {
    display: grid;
    gap: 12px;
  }

  .case-board {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .case-column {
    flex: 0 0 282px;
    min-width: 282px;
    width: 282px;
    scroll-snap-align: start;
  }

  .bottom-nav {
    display: none;
  }

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

  .customers-list,
  .payments-grid,
  .logs-grid,
  .ocr-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .customer-detail-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.8fr);
  }

  .payment-detail-grid {
    grid-template-columns: minmax(680px, 1fr) 340px;
    align-items: start;
    gap: 16px;
  }

  .payment-detail-grid > .panel:not(.payment-price-panel) {
    position: sticky;
    top: 88px;
  }

  .payment-price-panel {
    max-height: calc(100vh - 128px);
    overflow: hidden;
  }

  .payment-price-panel .panel-title {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: -2px 0 2px;
    padding-bottom: 8px;
    background: var(--surface);
  }

  .case-price-list {
    max-height: calc(100vh - 210px);
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
  }

  .case-price-row {
    padding: 12px;
    background: linear-gradient(180deg, #fff, #fcfbf8);
  }

  .case-price-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
  }

  .case-price-row .case-editor-actions {
    margin-top: -2px;
  }

  .payment-person-row {
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
  }

  .person-case-list {
    gap: 6px;
  }

  .case-board {
    display: grid;
    gap: 18px;
    overflow: visible;
    scroll-snap-type: none;
  }

  .case-column {
    width: 100%;
    min-width: 0;
    flex: initial;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.72);
    scroll-snap-align: none;
  }

  .case-stack {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
    align-items: start;
    gap: 12px;
  }

  .case-stack .case-editor-card {
    grid-template-columns: 206px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .case-stack .case-editor-photo {
    height: 210px;
    max-height: 210px;
  }

  .case-stack .case-editor-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-stack .case-person-field {
    grid-column: 1 / -1;
  }

  .case-stack .case-editor-main > .field {
    grid-column: 1 / -1;
  }

  .case-stack .case-editor-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .case-stack .case-editor-actions > button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    font-size: 13px;
  }

  .case-editor-card {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .case-review-alert {
    grid-column: 1 / -1;
  }

  .case-editor-photo,
  .case-editor-photo img {
    max-height: 190px;
  }

  .case-editor-fields {
    grid-template-columns: minmax(160px, 0.7fr) minmax(0, 1fr);
  }
}

@media (min-width: 1180px) {
  .documents-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
