:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #30332f;
  background: #eef1ef;
  --ink: #30332f;
  --muted: #777a73;
  --line: #d9dedb;
  --surface: #ffffff;
  --soft: #f1f3f2;
  --accent: #9b814d;
  --accent-dark: #7c6739;
  --accent-strong: #a88c54;
  --accent-soft: #f7f3e9;
  --success: #4e806d;
  --success-soft: #f0f7f4;
  --danger: #a33a32;
  --shadow: 0 16px 42px rgba(31, 43, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #eef1ef;
}

button,
input,
select {
  font: inherit;
}

button,
a,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lawyer-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.lawyer-brand-mark,
.lawyer-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 4px;
  color: #fff;
  background: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(214, 190, 128, 0.28);
  font-weight: 800;
}

.lawyer-brand strong,
.lawyer-brand small,
.lawyer-account-copy strong,
.lawyer-account-copy small {
  display: block;
}

.lawyer-brand strong {
  font-size: 15px;
}

.lawyer-brand small,
.lawyer-account-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.lawyer-eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.lawyer-primary-button {
  min-height: 44px;
  border: 1px solid var(--accent-dark);
  border-radius: 4px;
  padding: 10px 18px;
  color: #fff;
  background: var(--accent-dark);
  font-weight: 750;
}

.lawyer-primary-button:hover:not(:disabled) {
  border-color: #68552f;
  background: #68552f;
}

.lawyer-primary-button:focus-visible,
.lawyer-file-row button:focus-visible {
  outline: 3px solid rgba(118, 95, 49, 0.34);
  outline-offset: 2px;
}

.auth-shell {
  min-height: 100vh;
  background: #eef1ef;
}

.auth-header {
  height: 70px;
  padding: 16px clamp(20px, 5vw, 72px);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(168, 140, 84, 0.3);
}

.auth-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  align-items: center;
  gap: clamp(36px, 8vw, 120px);
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 50px 0;
}

.auth-intro {
  max-width: 620px;
  color: var(--ink);
}

.auth-intro .lawyer-eyebrow {
  color: var(--accent-strong);
}

.auth-intro h1 {
  margin: 0;
  font-size: 52px;
  line-height: 1.15;
}

.auth-intro p:last-child {
  max-width: 540px;
  margin: 20px 0 0;
  color: #626a64;
  font-size: 17px;
  line-height: 1.8;
}

.auth-panel {
  width: 100%;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 43, 38, 0.1);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.auth-tabs button {
  min-height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.auth-tabs button.is-active {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label,
.lawyer-account-menu label,
.billing-panel label {
  display: grid;
  gap: 7px;
  color: #49443a;
  font-size: 13px;
  font-weight: 700;
}

.auth-form input,
.lawyer-account-menu select,
.billing-panel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d5d0c5;
  border-radius: 4px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.auth-form input:focus,
.lawyer-account-menu select:focus,
.billing-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 129, 77, 0.14);
}

.auth-check {
  display: flex !important;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 9px !important;
  font-weight: 500 !important;
  line-height: 1.5;
}

.auth-check input {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.auth-feedback,
.billing-feedback {
  min-height: 20px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-feedback.error,
.billing-feedback.error,
.l4-inline-error {
  color: var(--danger);
}

.auth-feedback.success,
.billing-feedback.success {
  color: var(--success);
}

.lawyer-workbench {
  min-height: 100vh;
  background: #eef1ef;
}

.lawyer-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 18px rgba(31, 43, 38, 0.05);
}

.lawyer-header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lawyer-history-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 13px;
  color: var(--accent-dark);
  background: #fff;
  font-weight: 800;
}

.lawyer-history-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lawyer-billing-summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
}

.lawyer-billing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ba39f;
}

.lawyer-billing-summary.is-connected .lawyer-billing-dot {
  background: var(--accent);
}

.lawyer-billing-summary.is-warning .lawyer-billing-dot {
  background: var(--accent-strong);
}

.lawyer-account-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border: 0;
  padding: 3px 0 3px 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.lawyer-account-button .lawyer-avatar {
  width: 36px;
  height: 36px;
}

.lawyer-account-copy strong {
  max-width: 180px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lawyer-account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(calc(100vw - 24px), 360px);
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(45, 40, 29, 0.16);
}

.lawyer-account-menu > div:first-child {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
}

.lawyer-account-menu > div:first-child span,
.lawyer-account-menu > p {
  color: var(--muted);
  font-size: 12px;
}

.lawyer-account-menu > p {
  margin: 12px 0;
}

.lawyer-account-menu > button,
.billing-panel button,
.lawyer-file-row button,
.l4-progress-head button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 11px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
}

.lawyer-account-menu > button:hover,
.billing-panel button:hover:not(:disabled),
.lawyer-file-row button:hover:not(:disabled),
.l4-progress-head button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.lawyer-account-menu > button {
  width: 100%;
  margin-top: 14px;
}

.billing-panel {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.billing-panel-head,
.lawyer-result-head,
.l4-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.billing-panel-head div {
  display: grid;
  gap: 3px;
}

.billing-panel-head span,
.lawyer-result-kicker,
.l4-progress-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.billing-status-pill,
.lawyer-result-status {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.billing-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.billing-metrics article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #faf9f6;
}

.billing-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.billing-metrics strong {
  overflow-wrap: anywhere;
}

.billing-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lawyer-main {
  /* Keep the authenticated workbench copy readable on its pale surfaces
     without changing the established login/header palette. */
  --muted: #62665f;
  --accent-strong: #765f31;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 80px;
}

.lawyer-hero {
  max-width: 880px;
  margin-bottom: 28px;
  border-left: 3px solid var(--accent);
  padding: 5px 0 5px 22px;
}

.lawyer-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: 34px;
  line-height: 1.3;
}

.lawyer-hero > p:last-child {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.lawyer-upload-card,
.lawyer-result-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lawyer-upload-card {
  border-top: 3px solid var(--accent-dark);
  padding: clamp(18px, 4vw, 34px);
}

.lawyer-drop-zone {
  display: grid;
  place-items: center;
  min-height: 176px;
  border: 1px dashed #b6aa8f;
  border-radius: 6px;
  padding: 26px;
  color: var(--ink);
  background: #f8faf9;
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}

.lawyer-drop-zone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lawyer-drop-zone:focus-visible {
  outline: 3px solid rgba(155, 129, 77, 0.32);
  outline-offset: 3px;
}

.lawyer-drop-zone.is-dragging {
  border-color: var(--accent-dark);
  background: var(--accent-soft);
}

.lawyer-drop-zone.is-disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.lawyer-drop-zone.is-disabled:hover {
  border-color: #b6aa8f;
  background: #f8faf9;
}

@media (prefers-reduced-motion: reduce) {
  .lawyer-drop-zone {
    transition: none;
  }
}

.lawyer-drop-zone.has-files {
  min-height: 124px;
}

.lawyer-drop-zone strong {
  margin: 10px 0 5px;
  font-size: 17px;
}

.lawyer-drop-zone > span:last-child,
.lawyer-file-copy small,
.lawyer-privacy-note {
  color: var(--muted);
  font-size: 12px;
}

.lawyer-drop-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent-dark);
  font-size: 22px;
}

#lawyer-document-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.lawyer-file-row {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border: 1px solid #d8cbaa;
  border-radius: 4px;
  padding: 12px;
  background: #fbf9f3;
}

.lawyer-file-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 4px;
}

.lawyer-file-summary strong {
  color: var(--ink);
  font-size: 13px;
}

.lawyer-file-summary span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.lawyer-file-list {
  display: grid;
}

.lawyer-file-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 2px;
}

.lawyer-file-item + .lawyer-file-item {
  border-top: 1px solid #e4dccb;
}

.lawyer-file-item.is-invalid {
  margin-right: -2px;
  margin-left: -2px;
  border-radius: 3px;
  background: #fff1ef;
}

.lawyer-file-type {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 4px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 900;
}

.lawyer-file-copy {
  min-width: 0;
}

.lawyer-file-copy strong,
.lawyer-file-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.lawyer-file-copy small {
  margin-top: 4px;
}

.lawyer-file-row button {
  white-space: nowrap;
}

.lawyer-file-feedback {
  margin-top: 9px;
  font-size: 12px;
  line-height: 1.55;
}

.lawyer-file-feedback.is-error {
  color: #a13d36;
}

.lawyer-file-feedback.is-note {
  color: var(--muted);
}

#lawyer-start-review {
  width: 100%;
  margin-top: 14px;
}

.lawyer-privacy-note {
  margin: 13px 0 0;
  line-height: 1.6;
}

.lawyer-progress-status {
  margin-top: 18px;
  border: 1px solid #d7cfbe;
  border-radius: 6px;
  padding: 18px;
  background: #f8faf9;
}

.lawyer-progress-status.is-failed {
  border-color: #e7b8b3;
  background: #fff8f7;
}

.l4-upload-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.l4-progress-head strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.l4-progress-head {
  align-items: center;
}

.l4-progress-head-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.l4-progress-timing {
  display: grid;
  grid-template-columns: repeat(2, minmax(100px, auto));
  gap: 0;
  margin: 0;
}

.l4-progress-timing > div {
  min-width: 0;
  padding: 0 16px;
  border-left: 1px solid var(--line);
}

.l4-progress-timing dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.l4-progress-timing dd {
  margin: 4px 0 0;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.l4-progress-steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.l4-progress-steps li {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-width: 0;
  color: #918c82;
  text-align: center;
}

.l4-progress-steps li > span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #c8c2b5;
  border-radius: 50%;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.l4-progress-steps li strong {
  font-size: 10px;
  line-height: 1.4;
}

.l4-progress-steps li.is-done,
.l4-progress-steps li.is-current {
  color: var(--accent-dark);
}

.l4-progress-steps li.is-done > span {
  border-color: #b49a5d;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.l4-progress-steps li.is-current > span {
  border-color: var(--accent-dark);
  color: #fff;
  background: var(--accent-dark);
  box-shadow: 0 0 0 4px rgba(155, 129, 77, 0.14);
}

.l4-inline-error {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.lawyer-result-card {
  margin-top: 24px;
  border-top: 3px solid var(--success);
  padding: clamp(18px, 4vw, 32px);
}

.lawyer-result-head h2 {
  margin: 5px 0 8px;
  font-size: 25px;
}

.lawyer-result-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.lawyer-result-status.is-ready {
  border-color: #b8d3c7;
  color: var(--success);
  background: var(--success-soft);
}

.l4-downloads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.l4-downloads a,
.l4-downloads > span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.l4-downloads a:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.l4-downloads > span {
  color: var(--muted);
  font-weight: 600;
}

.l4-result-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
}

.l4-result-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 15px 18px;
  border-left: 1px solid var(--line);
}

.l4-result-summary > div:first-child {
  border-left: 0;
}

.l4-result-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.l4-result-summary strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 17px;
}

.l4-result-actions {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(300px, 1.28fr);
  gap: 10px;
}

.l4-preview-button {
  min-height: 44px;
  border: 1px solid var(--accent-dark);
  border-radius: 4px;
  padding: 9px 14px;
  color: #fff;
  background: var(--accent-dark);
  font-weight: 800;
}

.l4-preview-button:hover:not(:disabled) {
  border-color: #68552f;
  background: #68552f;
}

.l4-result-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.l4-document-scope {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid #d8cbaa;
  border-radius: 4px;
  padding: 14px 16px;
  background: #fbf9f3;
}

.l4-document-scope.is-compact {
  margin-top: 12px;
  padding: 10px 12px;
}

.l4-document-scope-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.l4-document-scope-head strong {
  color: var(--ink);
  font-size: 13px;
}

.l4-document-scope-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.l4-document-scope-files {
  display: grid;
  gap: 3px;
  max-height: 220px;
  margin: 0;
  overflow-y: auto;
  padding-left: 18px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.l4-document-scope-warning {
  margin: 0;
  color: #a13d36;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.l4-document-scope-warning strong {
  font-weight: 800;
}

body.history-open,
body.preview-open {
  overflow: hidden;
}

.lawyer-history-backdrop {
  position: fixed;
  z-index: 39;
  inset: 0;
  background: rgba(37, 42, 38, 0.26);
}

.lawyer-history-drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(720px, 92vw);
  height: 100vh;
  border-left: 1px solid var(--line);
  background: #f3f6f4;
  box-shadow: -18px 0 50px rgba(31, 43, 38, 0.18);
}

.lawyer-history-drawer > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.lawyer-history-drawer h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.lawyer-history-drawer > header button,
.lawyer-history-message button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 11px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.lawyer-history-drawer > header button:hover,
.lawyer-history-message button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.lawyer-history-content {
  overflow-y: auto;
  padding: 22px 26px 36px;
}

.lawyer-history-list {
  display: grid;
  gap: 12px;
}

.lawyer-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  background: #fff;
}

.lawyer-history-item-main,
.lawyer-history-item-title,
.lawyer-history-item dl {
  min-width: 0;
}

.lawyer-history-item-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lawyer-history-item-title > span {
  flex: 0 0 auto;
  border: 1px solid #b8d3c7;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 11px;
  font-weight: 800;
}

.lawyer-history-item h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lawyer-history-item dl {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
}

.lawyer-history-item dl > div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 9px;
}

.lawyer-history-item dt,
.lawyer-history-item dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.lawyer-history-item dt {
  color: var(--muted);
}

.lawyer-history-item dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lawyer-history-item .l4-document-scope-files {
  max-height: 132px;
}

.lawyer-history-downloads {
  display: grid;
  grid-template-columns: repeat(2, 52px);
  gap: 6px;
}

.lawyer-history-downloads a {
  display: grid;
  place-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.lawyer-history-downloads a:hover {
  border-color: var(--accent-dark);
  background: #fff;
}

.lawyer-history-actions {
  display: grid;
  justify-items: stretch;
  gap: 8px;
  min-width: 110px;
}

.lawyer-history-actions > button {
  min-height: 36px;
  border: 1px solid var(--accent-dark);
  border-radius: 4px;
  padding: 7px 10px;
  color: #fff;
  background: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.lawyer-history-actions > button:hover {
  border-color: #68552f;
  background: #68552f;
}

.lawyer-history-unavailable,
.lawyer-history-message {
  color: var(--muted);
  font-size: 12px;
}

.lawyer-history-message {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 32px 4px;
}

.lawyer-history-message p {
  margin: 0;
}

.lawyer-history-message.is-error {
  color: var(--danger);
}

.lawyer-preview-backdrop {
  position: fixed;
  z-index: 49;
  inset: 0;
  background: rgba(31, 38, 34, 0.42);
}

.lawyer-preview-dialog {
  position: fixed;
  z-index: 50;
  top: 5vh;
  right: 50%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(960px, calc(100vw - 40px));
  height: min(90vh, 920px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(17, 24, 21, 0.28);
  transform: translateX(50%);
}

.lawyer-preview-dialog > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.lawyer-preview-dialog h2 {
  margin: 4px 0 6px;
  font-size: 23px;
  line-height: 1.35;
}

.lawyer-preview-dialog > header p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.lawyer-preview-dialog > header button {
  flex: 0 0 auto;
  min-width: 52px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 11px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.lawyer-preview-dialog > header button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.lawyer-preview-content {
  overflow-y: auto;
  background: #eef1ef;
  padding: 24px clamp(16px, 4vw, 38px) 42px;
}

.l4-preview-document {
  width: min(780px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 34px rgba(31, 43, 38, 0.07);
}

.l4-preview-section {
  padding: 28px clamp(18px, 4vw, 42px);
  border-top: 1px solid var(--line);
}

.l4-preview-section:first-child {
  border-top: 0;
}

.l4-preview-section > header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.l4-preview-section > header span {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
}

.l4-preview-section h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.45;
}

.l4-preview-section > p,
.l4-preview-item > p {
  margin: 0;
  color: #4e554f;
  line-height: 1.85;
  white-space: pre-wrap;
}

.l4-preview-items {
  display: grid;
  gap: 14px;
}

.l4-preview-section > p + .l4-preview-items {
  margin-top: 18px;
}

.l4-preview-item {
  border: 1px solid #dde2df;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 16px 17px;
  background: #fbfcfb;
}

.l4-preview-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.l4-preview-item-head h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.l4-preview-item-head > div {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.l4-preview-item-head span,
.l4-preview-item-head strong {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1.4;
}

.l4-preview-item-head span {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.l4-preview-item-head strong {
  color: var(--success);
  background: var(--success-soft);
}

.l4-preview-item dl {
  display: grid;
  gap: 0;
  margin: 14px 0 0;
  border-top: 1px solid #e3e7e4;
}

.l4-preview-item dl > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #e8ece9;
}

.l4-preview-item dl > div:last-child {
  border-bottom: 0;
}

.l4-preview-item dt,
.l4-preview-item dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
}

.l4-preview-item dt {
  color: var(--muted);
  font-weight: 700;
}

.l4-preview-item dd {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #414741;
  white-space: pre-wrap;
}

.lawyer-preview-message {
  width: min(780px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  padding: 30px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.lawyer-preview-message p {
  margin: 8px 0 0;
}

.lawyer-preview-message.is-error {
  color: var(--danger);
}

@media (max-width: 800px) {
  .auth-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    width: min(calc(100% - 24px), 560px);
    padding: 30px 0;
  }

  .auth-intro h1 {
    font-size: 34px;
  }

  .auth-intro p:last-child {
    font-size: 15px;
  }

  .lawyer-header {
    align-items: flex-start;
  }

  .lawyer-billing-summary {
    display: none;
  }

  .lawyer-history-button {
    min-height: 36px;
    padding: 7px 10px;
  }

  .lawyer-account-copy {
    display: none;
  }

  .lawyer-main {
    width: min(calc(100% - 24px), 720px);
    padding: 34px 0 56px;
  }

  .lawyer-hero h1 {
    font-size: 30px;
  }

  .l4-progress-head {
    align-items: flex-start;
  }

  .l4-progress-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .l4-progress-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    row-gap: 14px;
  }

  .l4-result-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .auth-header,
  .lawyer-header {
    padding-right: 12px;
    padding-left: 12px;
  }

  .auth-panel,
  .lawyer-upload-card,
  .lawyer-result-card {
    padding: 18px;
  }

  .lawyer-brand small {
    display: none;
  }

  .lawyer-history-drawer {
    width: 100vw;
  }

  .lawyer-history-drawer > header,
  .lawyer-history-content {
    padding-right: 18px;
    padding-left: 18px;
  }

  .lawyer-history-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .lawyer-history-actions {
    min-width: 0;
  }

  .lawyer-history-downloads {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lawyer-hero h1 {
    font-size: 26px;
  }

  .lawyer-file-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .lawyer-file-type {
    width: 42px;
    height: 42px;
  }

  .lawyer-file-item button {
    grid-column: 1 / -1;
  }

  .lawyer-file-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .lawyer-file-summary span {
    text-align: left;
  }

  .l4-downloads {
    grid-template-columns: 1fr;
  }

  .l4-result-summary {
    grid-template-columns: 1fr;
  }

  .l4-result-summary > div {
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .l4-result-summary > div:first-child {
    border-top: 0;
  }

  .lawyer-preview-dialog {
    top: 0;
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .lawyer-preview-dialog > header {
    padding: 17px 16px 14px;
  }

  .lawyer-preview-dialog h2 {
    font-size: 18px;
  }

  .lawyer-preview-content {
    padding: 12px 10px 28px;
  }

  .l4-preview-section {
    padding: 22px 16px;
  }

  .l4-preview-item-head {
    display: grid;
    gap: 9px;
  }

  .l4-preview-item-head > div {
    flex-wrap: wrap;
  }

  .l4-preview-item dl > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .l4-progress-head,
  .lawyer-result-head {
    display: grid;
    gap: 14px;
  }

  .l4-progress-head-actions {
    display: grid;
    width: 100%;
    gap: 12px;
  }

  .l4-progress-timing {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .l4-progress-timing > div {
    padding: 0 12px;
  }

  .l4-progress-timing > div:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .l4-progress-head-actions > button {
    width: 100%;
  }

  .l4-progress-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
