:root {
  color: #18312f;
  background: #f4f1e9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #18312f;
  --muted: #63726e;
  --line: #d8d5ca;
  --paper: #fffdf8;
  --green: #175d51;
  --green-dark: #10463e;
  --gold: #c69a45;
  --red: #9e3a2f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }

.site-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  color: #fff;
  background: var(--ink);
  border-bottom: 3px solid var(--gold);
}

.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: .84rem; font-weight: 800; letter-spacing: .14em; }
.header-identity { display: flex; align-items: center; gap: 22px; }
.header-users-link { color: #e6bf69; text-decoration: none; font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: var(--ink); background: #f0cf88; border-radius: 50%; font-family: Georgia, serif; font-size: 1.1rem; letter-spacing: 0; }
.site-nav { align-self: stretch; display: flex; align-items: stretch; gap: 30px; }
.site-nav a { display: flex; align-items: center; padding: 3px 1px 0; color: #aebfba; border-bottom: 3px solid transparent; text-decoration: none; font-size: .79rem; font-weight: 700; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #fff; }
.site-nav a[aria-current="page"] { border-bottom-color: #e6bf69; }

main { max-width: 1180px; margin: 0 auto; padding: 62px 24px 90px; }
.hero { max-width: 820px; margin-bottom: 36px; }
.setup-import { margin-bottom: 28px; }
.setup-import > summary { cursor: pointer; color: var(--green); font-weight: 650; padding: 12px 0; }
#setup-import-target { overflow-wrap: anywhere; font-size: .8rem; }
#foundation-next-step { grid-template-columns: 1fr auto; align-items: center; }
#foundation-next-step p { margin-bottom: 0; }
#foundation-next-step .primary-link { align-self: center; }
input[readonly] { background: #edf0eb; color: var(--muted); }
@media (max-width: 700px) {
  #foundation-next-step { grid-template-columns: 1fr; }
}
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { max-width: 760px; margin: 0; color: #132b29; font-size: clamp(2.25rem, 5vw, 4.1rem); line-height: 1.02; letter-spacing: -.035em; }
.lede { max-width: 720px; margin: 22px 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }

.import-card { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr); gap: 36px; margin-bottom: 24px; padding: 25px 28px; background: #e9efe9; border: 1px solid #c5d1ca; border-radius: 4px; }
.import-card h2 { margin-bottom: 10px; }
.import-intro > p:last-child { margin: 0; color: #5c706b; font-size: .83rem; line-height: 1.55; }
.import-controls { display: grid; gap: 13px; align-content: center; }
.file-picker { display: flex; align-items: center; gap: 14px; padding: 14px; background: #fffdf8; border: 1px dashed #78948c; border-radius: 3px; cursor: pointer; }
.file-picker input { width: 118px; padding: 0; border: 0; box-shadow: none; color: transparent; }
.file-picker input::file-selector-button { padding: 8px 10px; color: var(--green); background: #f0f4ef; border: 1px solid #9fb2ac; border-radius: 2px; font-weight: 750; cursor: pointer; }
.file-picker span { display: grid; gap: 3px; min-width: 0; }
.file-picker strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-actions { display: flex; justify-content: flex-end; gap: 10px; }
.compact-button { min-width: 174px; }
.upload-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 20px; margin: 0; padding: 13px; background: #fffdf8; border: 1px solid #d2d9d4; }
.upload-summary div { min-width: 0; }
.upload-summary dt { color: var(--muted); font-size: .66rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.upload-summary dd { margin: 3px 0 0; overflow: hidden; color: #2b4641; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.entry-divider { display: flex; align-items: center; gap: 14px; margin: 21px 0; color: #78827e; font-size: .68rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.entry-divider::before, .entry-divider::after { content: ""; height: 1px; flex: 1; background: #d3d0c6; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.case-setup-main { max-width: 1000px; }
.setup-layout { display: block; }
.setup-layout #result-card { margin-top: 24px; }
#demo-dialog { width: min(620px, calc(100% - 32px)); padding: 28px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
#demo-dialog::backdrop { background: rgb(18 39 36 / 55%); }
#demo-dialog h2 { margin-top: 0; }
#demo-case-description { line-height: 1.6; }
.demo-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
#demo-dialog-error { color: var(--red); }
form { display: grid; gap: 18px; }
.form-card, .side-card { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 9px 30px rgba(31, 48, 45, .055); }
.form-card { display: grid; grid-template-columns: 58px 1fr; padding: 28px; border-radius: 4px; }
.admin-card { display: block; margin-bottom: 18px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 32px; }
.admin-directory { margin-top: 26px; padding: 26px 28px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 9px 30px rgba(31, 48, 45, .055); }
.admin-directory-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.admin-directory-heading h2 { margin: 0; }
.admin-directory-heading > p { max-width: 360px; margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.admin-list { display: grid; border-top: 1px solid var(--line); }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.admin-row-identity { display: grid; gap: 4px; min-width: 0; }
.admin-row-identity strong, .admin-row-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.admin-row-actions .secondary-button, .admin-row-actions .danger-button { min-height: 34px; padding: 6px 10px; font-size: .74rem; }
.admin-row-actions a.secondary-button { display: inline-flex; align-items: center; text-decoration: none; }
.danger-button { color: var(--red); background: transparent; border: 1px solid #d6a49e; border-radius: 3px; font-weight: 750; }
.confirmation-dialog { width: min(100% - 32px, 520px); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--red); box-shadow: 0 20px 58px rgba(18, 39, 36, .26); }
.confirmation-dialog::backdrop { background: rgba(18, 39, 36, .62); }
.confirmation-dialog-content { display: grid; gap: 18px; padding: 28px; }
.confirmation-dialog-content h2 { margin: 0; }
.confirmation-dialog-detail { margin: -4px 0 0; color: var(--muted); font-size: .87rem; line-height: 1.55; }
.confirmation-dialog-content .control-note { margin: 0; color: #6e352d; background: #fff1ec; border-left-color: var(--red); }
.confirmation-dialog-content code { color: var(--red); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; letter-spacing: .08em; }
.confirmation-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirmation-dialog-actions .danger-button { min-height: 43px; padding: 10px 18px; }
.section-number { display: grid; place-items: center; width: 34px; height: 34px; color: var(--green); border: 1px solid #93aca5; border-radius: 50%; font-family: Georgia, serif; font-size: 1rem; }
.section-content { min-width: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
h2 { margin: 0 0 24px; color: var(--ink); font-size: 1.62rem; line-height: 1.2; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.full-field { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #2c4542; font-size: .82rem; font-weight: 750; }
input, select, textarea { width: 100%; padding: 11px 12px; color: var(--ink); background: #fffefa; border: 1px solid #b9c2bd; border-radius: 3px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 93, 81, .12); }
input::placeholder, textarea::placeholder { color: #97a09d; }
textarea { min-height: 88px; resize: vertical; }
small { color: var(--muted); font-size: .73rem; font-weight: 450; line-height: 1.4; }
.optional { color: #82908d; font-weight: 500; }
.control-note { margin: 22px 0 0; padding: 13px 15px; color: #556a66; background: #f1f5f1; border-left: 3px solid #8cab9e; font-size: .8rem; line-height: 1.55; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset:disabled { opacity: .42; }

.text-button { padding: 2px 0; color: var(--green); background: transparent; border: 0; border-bottom: 1px solid #97b3ab; font-size: .78rem; font-weight: 750; white-space: nowrap; }
.switch-label { display: flex; align-items: center; gap: 8px; }
.switch-label input { width: 17px; height: 17px; accent-color: var(--green); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.primary-button, .secondary-button { min-height: 43px; padding: 10px 18px; border-radius: 3px; font-weight: 750; }
.primary-button { min-width: 208px; color: #fff; background: var(--green); border: 1px solid var(--green); }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { cursor: default; opacity: .66; }
.secondary-button { color: var(--green); background: transparent; border: 1px solid #95aaa4; }
.full-button { width: 100%; margin-top: 18px; }
.message { padding: 14px 16px; color: #812b22; background: #fff1ec; border: 1px solid #d6a49e; border-radius: 3px; font-size: .85rem; line-height: 1.45; }
.message[data-kind="success"] { color: #145044; background: #edf7f1; border-color: #9cc3af; }

.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;
}

aside { position: sticky; top: 24px; display: grid; gap: 18px; }
.side-card { padding: 24px; border-radius: 4px; }
.side-card h2 { margin-bottom: 14px; font-size: 1.4rem; }
.status-card ol { display: grid; gap: 0; margin: 5px 0 0; padding: 0; list-style: none; }
.status-card li { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px 0; }
.status-card li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 39px; bottom: -7px; width: 1px; background: #bdcbc6; }
.status-card li > span { display: grid; place-items: center; width: 27px; height: 27px; color: #fff; background: var(--green); border-radius: 50%; font-size: .73rem; font-weight: 800; }
.status-card li div { display: grid; gap: 3px; }
.status-card strong { font-size: .86rem; }
.status-card .muted > span { color: #73827e; background: #e5e8e2; }
.safeguard-card { color: #e8f0ed; background: var(--ink); border-color: var(--ink); }
.safeguard-card .eyebrow { color: #e7c578; }
.safeguard-card h2 { color: #fff; }
.safeguard-card p:not(.eyebrow) { color: #bdceca; font-size: .85rem; line-height: 1.55; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.tag-row span { padding: 5px 8px; color: #deebe7; border: 1px solid #52716b; border-radius: 2px; font-size: .67rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.result-card { border-top: 4px solid var(--gold); }
.result-card dl { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; margin: 0; }
.result-card dt { color: var(--muted); font-size: .72rem; }
.result-card dd { margin: 0; overflow-wrap: anywhere; color: #29423f; font-size: .78rem; line-height: 1.4; }

.primary-link { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; padding: 10px 18px; color: #fff; background: var(--green); border: 1px solid var(--green); border-radius: 3px; text-decoration: none; font-size: .84rem; font-weight: 750; }
.primary-link:hover { background: var(--green-dark); }
.inline-link, .back-link { color: var(--green); text-underline-offset: 3px; font-size: .82rem; font-weight: 750; }

.directory-main, .matter-main { max-width: 1240px; }
.directory-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 36px; }
.directory-hero h1 { font-size: clamp(2.4rem, 4vw, 3.7rem); }
.directory-hero .lede { margin-top: 16px; }
.directory-hero .primary-link { flex: 0 0 auto; margin-bottom: 4px; }
.directory-panel { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 9px 30px rgba(31, 48, 45, .055); }
.search-form { display: flex; align-items: flex-end; gap: 18px; padding: 22px 24px; background: #e9efe9; border-bottom: 1px solid #c5d1ca; }
.search-form label { flex: 1; }
.search-control { display: flex; gap: 8px; }
.search-control .compact-button { min-width: 112px; }
.search-form > .text-button { margin-bottom: 12px; }
.directory-panel > .message { margin: 20px 24px 0; }
.matter-list { display: grid; }
.matter-row { display: grid; grid-template-columns: minmax(210px, 1.3fr) minmax(155px, .8fr) minmax(210px, 1.2fr) minmax(150px, .65fr); gap: 26px; align-items: center; min-height: 116px; padding: 22px 24px; color: var(--ink); border-bottom: 1px solid #e1ded5; text-decoration: none; transition: background .15s; }
.matter-row:hover { background: #f7f7f1; }
.matter-title, .matter-cell, .matter-state { display: grid; gap: 5px; min-width: 0; }
.matter-title strong { overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-size: 1.16rem; font-weight: 600; }
.matter-title small, .matter-cell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matter-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.cell-label { color: #76847f; font-size: .64rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.matter-state { justify-items: end; text-align: right; }
.row-arrow { color: var(--gold); font-size: 1.2rem; }
.review-badge, .identity-badge, .count-badge { display: inline-flex; width: fit-content; align-items: center; justify-content: center; padding: 5px 8px; color: #52615d; background: #e8ebe5; border: 1px solid #cbd2cc; border-radius: 999px; font-size: .64rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.review-badge.unreviewed, .identity-badge.unresolved { color: #81551f; background: #fff5df; border-color: #e5c88e; }
.review-badge.setup_required { color: #81551f; background: #fff5df; border-color: #e5c88e; }
.review-badge.reviewed, .identity-badge.resolved, .identity-badge.canonical { color: #185448; background: #e9f6ef; border-color: #9fc8b5; }
.review-badge.rejected { color: var(--red); background: #fff0ed; border-color: #dbaaa4; }
.review-badge.pending_review { color: #81551f; background: #fff5df; border-color: #e5c88e; }
.header-session { display: flex; align-items: center; gap: 12px; min-width: 0; }
.session-identity { min-width: 0; margin: 0; overflow: hidden; color: #d7e2df; font-size: .76rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.header-button { flex: 0 0 auto; min-height: 32px; padding: 5px 12px; color: #f1e3c6; background: transparent; border: 1px solid #56746e; border-radius: 3px; font-size: .7rem; font-weight: 750; }
.header-button:hover { color: #fff; background: #24463f; }
.header-button:focus-visible { outline: 2px solid #e6bf69; outline-offset: 2px; }

.sign-in-dialog { width: min(100% - 32px, 470px); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--gold); box-shadow: 0 20px 58px rgba(18, 39, 36, .26); }
.sign-in-dialog::backdrop { background: rgba(18, 39, 36, .62); }
.sign-in-form { display: grid; gap: 16px; padding: 28px; }
.sign-in-form h2 { margin: 0; }
.sign-in-note { margin: -8px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.sign-in-form label { gap: 7px; }
.sign-in-error { margin: 0; color: var(--red); font-size: .8rem; line-height: 1.5; }
.sign-in-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 4px; }
.sign-in-actions .primary-button { min-width: 150px; }
/* Google sign-in offers one action, so its row centres a single button. */
.sign-in-actions-single { justify-content: center; }
.sign-in-google { display: inline-flex; align-items: center; justify-content: center; min-width: 208px; text-decoration: none; }
.sign-in-google:hover { color: #fff; text-decoration: none; }
.review-badge.not_configured, .review-badge.draft { color: #81551f; background: #fff5df; border-color: #e5c88e; }
.review-badge.approved, .identity-badge.active { color: #185448; background: #e9f6ef; border-color: #9fc8b5; }
.identity-badge.invited { color: #81551f; background: #fff5df; border-color: #e5c88e; }
.identity-badge.suspended { color: var(--red); background: #fff0ed; border-color: #dbaaa4; }
.loading-line, .empty-state { margin: 0; padding: 50px 24px; color: var(--muted); text-align: center; }
.load-more { display: block; margin: 20px auto; }

.my-work { margin-bottom: 44px; }
.my-work-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 18px; }
.my-work-head h2 { margin: 0; font-size: 1.7rem; }
.my-work-summary { margin: 0; color: var(--muted); font-size: .84rem; }
.my-work-matters { display: grid; gap: 26px; }
.my-work-progress { overflow-wrap: anywhere; }
.my-work-row { display: grid; grid-template-columns: minmax(215px, 1.2fr) minmax(195px, 1fr) minmax(165px, .7fr); gap: 26px; align-items: center; min-height: 100px; padding: 20px 24px; color: var(--ink); border-bottom: 1px solid #e1ded5; text-decoration: none; transition: background .15s; }
.my-work-row:last-child { border-bottom: 0; }
.my-work-row:hover { background: #f7f7f1; }
.my-work-row .matter-cell strong { overflow: visible; white-space: normal; color: var(--green); font-size: .92rem; font-weight: 750; }
.my-work-empty { margin: 0 0 44px; padding: 22px 24px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; font-size: .88rem; }

.matter-main { padding-top: 36px; }
.back-link { display: inline-block; margin-bottom: 30px; }
.matter-actions { display: flex; align-items: center; gap: 18px; }
.matter-actions .back-link { margin-bottom: 30px; }
.matter-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.matter-hero h1 { font-size: clamp(2.3rem, 4vw, 3.65rem); }
.matter-id { margin: 12px 0 0; color: var(--muted); font-size: .75rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.setup-required-panel { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 24px; padding: 30px; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 4px; box-shadow: 0 9px 30px rgba(31, 48, 45, .055); }
.setup-required-marker { display: grid; place-items: center; width: 46px; height: 46px; color: #76501f; background: #fff5df; border: 1px solid #e5c88e; border-radius: 50%; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; }
.setup-required-content { min-width: 0; }
.setup-required-content h2 { margin-bottom: 10px; font-size: 2rem; }
.setup-required-lede { max-width: 690px; margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.65; }
.setup-progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.setup-progress-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-content: start; min-height: 100px; padding: 15px; background: #f7f6f0; border: 1px solid #e1ded5; }
.setup-progress-item.complete { background: #edf7f1; border-color: #b8d4c5; }
.setup-progress-item.current { background: #fff8e9; border-color: #e5c88e; }
.setup-progress-item.pending { color: var(--muted); }
.setup-progress-number { display: grid; place-items: center; width: 27px; height: 27px; color: var(--green-dark); background: #fffdf8; border: 1px solid #a8bbb4; border-radius: 50%; font-size: .7rem; font-weight: 800; }
.setup-progress-item.current .setup-progress-number { color: #76501f; border-color: #d5ad63; }
.setup-progress-item > div { display: grid; gap: 5px; }
.setup-progress-item strong { font-size: .8rem; line-height: 1.35; }
.setup-progress-item small { font-size: .7rem; line-height: 1.45; }
.setup-required-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.setup-required-actions .secondary-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.provenance-banner { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 28px; padding: 18px 22px; background: #e9efe9; border: 1px solid #c5d1ca; border-radius: 4px; }
.provenance-banner > div { display: grid; gap: 4px; }
.provenance-banner strong { overflow-wrap: anywhere; font-size: .78rem; font-weight: 650; }
.review-workflow-panel { margin-bottom: 28px; padding: 26px 28px; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 4px; box-shadow: 0 9px 30px rgba(31, 48, 45, .055); }
.review-workflow-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.review-workflow-heading h2 { margin-bottom: 8px; }
.review-workflow-heading p:last-child { max-width: 680px; margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.55; }
.review-workflow-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 22px; }
.review-guardrail { grid-column: 1 / -1; margin: 0; padding: 13px 15px; font-size: .78rem; line-height: 1.5; border-left: 3px solid; }
.review-guardrail.blocked { color: #6b4b22; background: #fff7e6; border-color: var(--gold); }
.review-guardrail.enabled { color: var(--green-dark); background: #e9f6ef; border-color: var(--green); }
.review-assignment-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.review-assignment-card { display: grid; gap: 10px; padding: 15px 16px; background: #f5f5ee; border-left: 3px solid #8cab9e; }
.review-assignment-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.review-assignment-heading > div { display: grid; gap: 3px; }
.review-assignment-heading strong { font-size: .85rem; }
.review-assignment-heading small, .review-assignment-duties { color: var(--muted); font-size: .7rem; }
.review-assignment-duties { margin: 0; line-height: 1.45; }
.review-history, .review-role-catalog { margin-top: 20px; padding-top: 18px; border-top: 1px solid #e1ded5; }
.review-history summary, .review-role-catalog summary { cursor: pointer; color: var(--green); font-size: .78rem; font-weight: 750; }
.review-history summary .count-badge { margin-left: 5px; }
.review-event-list { display: grid; gap: 10px; margin-top: 15px; }
.review-event-card { display: grid; gap: 8px; padding: 13px 14px; background: #f7f6f0; border-left: 3px solid var(--green); }
.review-event-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.review-event-heading > div { display: grid; gap: 3px; }
.review-event-heading strong { font-size: .8rem; text-transform: capitalize; }
.review-event-heading small, .review-event-target { color: #76847f; font-size: .68rem; }
.review-event-target, .review-event-reason { margin: 0; }
.review-event-target { text-transform: capitalize; }
.review-event-reason { color: #40534f; font-size: .73rem; line-height: 1.45; }
.review-role-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
.review-role-card { display: grid; gap: 5px; padding: 13px 14px; background: #f7f6f0; border: 1px solid #e1ded5; }
.review-role-card strong { font-size: .78rem; }
.review-role-card p { margin: 0; color: #40534f; font-size: .72rem; line-height: 1.45; }
.review-role-card small { color: #76847f; font-size: .66rem; text-transform: capitalize; }
.correction-panel { margin-bottom: 28px; padding: 26px 28px; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 4px; box-shadow: 0 9px 30px rgba(31, 48, 45, .055); }
.correction-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.correction-heading h2 { margin-bottom: 8px; }
.correction-heading p:last-child { max-width: 650px; margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.55; }
.correction-form { margin-top: 24px; padding: 22px; background: #f4f6f1; border: 1px solid #d3dbd5; }
.correction-form .field-grid { align-items: end; }
.correction-form .control-note { margin: 0; }
.current-value { display: grid; align-content: center; gap: 5px; min-height: 67px; padding: 11px 13px; background: #ecece5; border-left: 3px solid #9ba8a3; }
.current-value strong { overflow-wrap: anywhere; font-size: .84rem; }
.correction-list { display: grid; gap: 12px; margin-top: 22px; }
.correction-empty { padding: 16px 0 2px; border-top: 1px solid #e1ded5; }
.correction-record { display: grid; gap: 13px; padding: 17px 18px; background: #f7f6f0; border: 1px solid #dedbd0; }
.correction-record-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.correction-record-heading > div { display: grid; gap: 4px; }
.correction-record-heading strong { overflow-wrap: anywhere; font-size: .86rem; }
.correction-comparison { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 13px 14px; background: #fffdf8; border: 1px solid #e0ddd3; }
.correction-arrow { color: var(--gold); font-size: 1.2rem; }
.correction-reason { margin: 0; color: #40534f; font-size: .8rem; line-height: 1.5; }
.correction-actor { color: #76847f; }
.case-list { display: grid; gap: 24px; }
.case-detail-card { padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 9px 30px rgba(31, 48, 45, .055); }
.case-detail-heading, .subsection-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.case-detail-heading { padding-bottom: 22px; border-bottom: 1px solid #e1ded5; }
.case-detail-heading h2 { margin: 0; }
.case-facts { display: grid; grid-template-columns: 1.4fr .7fr 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid #e1ded5; }
.detail-value { display: grid; align-content: start; gap: 4px; min-width: 0; }
.detail-value strong { overflow-wrap: anywhere; font-size: .82rem; }
.party-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; padding: 24px 0; border-bottom: 1px solid #e1ded5; }
.party-group, .notice-group { display: grid; align-content: start; gap: 12px; }
.party-group h3, .notice-group h3 { margin: 0 0 2px; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; font-weight: 600; }
.party-card { display: grid; gap: 5px; padding: 14px; background: #f5f5ee; border-left: 3px solid #8cab9e; }
.party-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.party-heading strong { overflow-wrap: anywhere; font-size: .84rem; }
.party-provenance { margin: 4px 0 0; color: var(--muted); font-size: .7rem; }
.notice-group { padding-top: 24px; }
.notice-row { display: grid; grid-template-columns: minmax(210px, 1.2fr) minmax(105px, .55fr) minmax(180px, 1fr) minmax(180px, 1fr); gap: 16px; align-items: start; padding: 16px 0; border-top: 1px solid #e1ded5; }
.notice-row .party-card { margin-top: -2px; }
.empty-inline { margin: 0; color: var(--muted); font-size: .82rem; }

@media (max-width: 900px) {
  .import-card { grid-template-columns: 1fr; gap: 18px; }
  .layout { grid-template-columns: 1fr; }
  aside { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-card { grid-column: 1 / -1; }
  .matter-row, .my-work-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matter-state { justify-items: start; text-align: left; }
  .notice-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-role-list, .review-assignment-list { grid-template-columns: 1fr; }
  .correction-comparison { grid-template-columns: 1fr; }
  .correction-arrow { transform: rotate(90deg); }
}

@media (max-width: 620px) {
  main { padding: 42px 14px 64px; }
  /* The identity line needs a full row of its own on a narrow display. */
  .site-header { flex-wrap: wrap; height: auto; min-height: 68px; padding: 10px 16px; row-gap: 8px; }
  .brand > span:last-child { display: none; }
  .header-session { flex: 1 0 100%; gap: 8px; }
  .session-identity { flex: 1 1 auto; font-size: .68rem; }
  .header-button { min-height: 30px; padding: 4px 9px; font-size: .64rem; }
  .sign-in-form { padding: 22px 18px; }
  .sign-in-actions { display: grid; grid-template-columns: 1fr; justify-items: stretch; }
  .sign-in-actions .primary-button { grid-row: 1; }
  .form-card { grid-template-columns: 1fr; gap: 16px; padding: 22px 18px; }
  .field-grid, aside { grid-template-columns: 1fr; }
  .import-card { padding: 22px 18px; }
  .file-picker { align-items: flex-start; flex-direction: column; }
  .import-actions { display: grid; grid-template-columns: 1fr; }
  .compact-button { min-width: 0; }
  .upload-summary { grid-template-columns: 1fr; }
  .full-field, .result-card { grid-column: auto; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .confirmation-dialog-content { padding: 22px 18px; }
  .confirmation-dialog-actions { display: grid; grid-template-columns: 1fr; }
  .primary-button { grid-row: 1; }
  .directory-hero, .matter-hero { align-items: flex-start; flex-direction: column; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-directory-heading, .admin-row { align-items: flex-start; flex-direction: column; }
  .admin-row-actions { justify-content: flex-start; }
  .search-form, .search-control { align-items: stretch; flex-direction: column; }
  .search-form > .text-button { align-self: flex-start; margin: 0; }
  .matter-row, .my-work-row, .provenance-banner, .review-workflow-summary, .case-facts, .party-columns, .notice-row { grid-template-columns: 1fr; }
  .setup-required-panel { grid-template-columns: 1fr; padding: 24px 18px; }
  .setup-progress { grid-template-columns: 1fr; }
  .setup-progress-item { min-height: 0; }
  .setup-required-actions { display: grid; grid-template-columns: 1fr; }
  .setup-required-actions .primary-link { grid-row: 1; }
  .matter-row, .my-work-row { gap: 18px; }
  .case-detail-card { padding: 22px 18px; }
  .case-detail-heading { align-items: flex-start; flex-direction: column; }
  .correction-panel { padding: 22px 18px; }
  .review-workflow-panel { padding: 22px 18px; }
  .review-workflow-heading, .review-assignment-heading { align-items: flex-start; flex-direction: column; }
  .correction-heading, .correction-record-heading { align-items: flex-start; flex-direction: column; }
  .correction-form { padding: 18px; }
}

.workspace-reset { margin-top: 32px; padding: 20px; border: 1px solid var(--line); border-left: 4px solid var(--gold); background: var(--paper); }
.workspace-reset h2 { margin: 0 0 8px; font-size: 1rem; }
.workspace-reset p { margin: 0 0 12px; color: var(--muted); font-size: .85rem; }
.workspace-reset-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.workspace-reset-form label { display: grid; gap: 6px; font-size: .8rem; }
.workspace-reset-message { margin: 12px 0 0; font-size: .85rem; }
