:root {
  color-scheme: light;
  --ink: #171c1a;
  --muted: #68716c;
  --rule: #d9ded9;
  --paper: #f8f7f2;
  --accent: #1f5c4c;
  --lime: #c6ff00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 28px clamp(24px, 5vw, 92px) 24px;
}

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar-actions { display: flex; align-items: center; gap: 20px; }

.topbar { padding-bottom: 22px; border-bottom: 1px solid var(--rule); }

.logo { width: 142px; height: auto; }

.environment,
.eyebrow,
.footer p {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.environment { color: var(--muted); display: flex; align-items: center; gap: 9px; }
.environment span { width: 8px; height: 8px; background: var(--lime); border: 1px solid var(--ink); }

.welcome { align-self: center; max-width: 960px; padding: 12vh 0; }
.eyebrow { color: var(--accent); margin-bottom: 28px; }

h1 {
  margin: 0;
  max-width: 900px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(46px, 7vw, 100px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: 0;
}

.lead { margin: 34px 0 0; color: var(--muted); font-size: 18px; line-height: 1.5; }

.primary-button,
.text-button {
  font: inherit;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 34px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  text-decoration: none;
}

.primary-button:hover { background: var(--accent); border-color: var(--accent); }

.setup-note { margin: 34px 0 0; color: var(--muted); font-size: 14px; }

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.workspace { align-self: center; max-width: 1120px; padding: 10vh 0; }
.workspace h1 { font-size: clamp(46px, 6vw, 86px); }

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 56px;
}

.workspace-grid section { border-top: 1px solid var(--rule); padding: 16px 0 0; }
.workspace-grid p { margin: 0; font-size: 15px; line-height: 1.5; }
.workspace-grid .label { margin-bottom: 10px; color: var(--accent); font-size: 12px; text-transform: uppercase; }

.matter-list { margin-top: 72px; border-top: 1px solid var(--ink); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.section-heading .eyebrow { margin: 0 0 8px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 32px; font-weight: 400; line-height: 1.1; }
.section-heading > p { max-width: 270px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; text-align: right; }
.matter-head,
.matter-row { display: grid; grid-template-columns: minmax(140px, 0.9fr) minmax(190px, 2fr) minmax(108px, 0.75fr) minmax(90px, 0.6fr); gap: 14px; align-items: center; }
.matter-head { padding: 12px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.matter-row { min-height: 60px; border-top: 1px solid var(--rule); color: var(--ink); font-size: 14px; text-decoration: none; }
.matter-row:last-child { border-bottom: 1px solid var(--rule); }
.matter-row:hover { color: var(--accent); }
.matter-number { font-variant-numeric: tabular-nums; }
.matter-name { font-weight: 600; }
.matter-label { color: var(--muted); font-size: 12px; text-transform: capitalize; }

.matter-detail { align-self: center; max-width: 1120px; padding: 8vh 0; }
.matter-detail h1 { font-size: clamp(46px, 6vw, 86px); }
.back-link { display: inline-block; margin-bottom: 40px; color: var(--accent); font-size: 13px; text-underline-offset: 3px; }
.matter-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 56px; }
.matter-facts section { border-top: 1px solid var(--rule); padding: 16px 0 0; }
.matter-facts p { margin: 0; font-size: 15px; line-height: 1.5; }
.matter-facts .label { margin-bottom: 10px; color: var(--accent); font-size: 12px; text-transform: uppercase; }
.document-list { margin-top: 72px; border-top: 1px solid var(--ink); }
.document-head,
.document-row { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(110px, 0.7fr) minmax(190px, 1fr); gap: 14px; align-items: center; }
.document-head { padding: 12px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.document-row { min-height: 60px; border-top: 1px solid var(--rule); font-size: 14px; }
.document-row:last-child { border-bottom: 1px solid var(--rule); }
.document-row span:not(:first-child) { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.document-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.document-actions form { margin: 0; }
.compact-button { min-height: 30px; padding: 0 9px; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; font: inherit; font-size: 12px; }
.compact-button:hover { border-color: var(--accent); color: var(--accent); }
.compact-button.danger { color: #9b3131; }
.compact-button.danger:hover { border-color: #9b3131; }
.state-note { color: var(--muted); font-size: 12px; text-transform: none; }
.document-intake { margin-top: 56px; max-width: 560px; border-top: 1px solid var(--ink); padding-top: 18px; }
.document-intake .eyebrow { margin: 0 0 8px; }
.document-intake h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 400; line-height: 1.15; }
.document-intake form { display: grid; gap: 9px; margin-top: 24px; }
.document-intake label { font-size: 12px; color: var(--muted); }
.document-intake input,
.document-intake select { width: 100%; min-height: 42px; border: 1px solid var(--rule); border-radius: 0; background: var(--paper); color: var(--ink); font: inherit; padding: 0 10px; }
.document-intake .primary-button { justify-self: start; margin-top: 14px; }
.audit-list { margin-top: 72px; border-top: 1px solid var(--ink); }
.audit-row { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(130px, 1fr) minmax(150px, 1fr) minmax(200px, 1.2fr); gap: 14px; align-items: center; min-height: 54px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.audit-row span:not(:first-child),
.audit-row time { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.empty-audit { margin: 0; padding: 18px 0; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 13px; }

.footer { border-top: 1px solid var(--rule); padding-top: 18px; color: var(--muted); }

@media (max-width: 600px) {
  .shell { padding: 20px 22px; }
  .topbar { padding-bottom: 18px; }
  .welcome { padding: 16vh 0; }
  .workspace { padding: 12vh 0; }
  .workspace-grid { grid-template-columns: 1fr; margin-top: 40px; }
  .matter-list { margin-top: 52px; }
  .matter-detail { padding: 8vh 0; }
  .matter-facts { grid-template-columns: 1fr; margin-top: 40px; }
  .document-list { margin-top: 52px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .section-heading > p { text-align: left; }
  .matter-head { display: none; }
  .matter-row { grid-template-columns: 1fr 1fr; gap: 4px 14px; padding: 14px 0; }
  .matter-name { grid-column: 1 / -1; grid-row: 1; }
  .matter-number { grid-column: 1; grid-row: 2; }
  .matter-label { grid-row: 2; }
  .document-head { display: none; }
  .document-row { grid-template-columns: 1fr 1fr; gap: 4px 14px; padding: 14px 0; }
  .document-row span:first-child { grid-column: 1 / -1; grid-row: 1; }
  .document-row span:not(:first-child) { grid-row: 2; }
  .document-actions { grid-column: 1 / -1; grid-row: 3; margin-top: 6px; }
  .document-intake { margin-top: 40px; }
  .audit-list { margin-top: 52px; }
  .audit-row { grid-template-columns: 1fr 1fr; gap: 4px 14px; padding: 14px 0; }
  .audit-row span:first-child { grid-column: 1 / -1; }
  .topbar-actions { gap: 14px; }
  .footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}
