:root {
  --ink: #18221d;
  --muted: #68726c;
  --line: #dfe4df;
  --paper: #fff;
  --canvas: #f2f3ef;
  --green: #1f5a43;
  --green-dark: #174433;
  --mint: #dfece4;
  --amber: #9a5e15;
  --amber-bg: #fff4df;
  --red: #9a3939;
  --shadow: 0 16px 42px rgba(29, 42, 34, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button { font: inherit; }
.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 48px; }
.topbar { height: 80px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #d7dcd7; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-family: Georgia, serif; font-size: 20px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--green); border-radius: 9px; }
.brand-mark svg { width: 21px; fill: none; stroke: white; stroke-width: 1.6; }
.topbar-meta { display: flex; align-items: center; gap: 24px; font-size: 12px; }
.challenge-pill { padding: 7px 11px; border: 1px solid #ccd4cd; border-radius: 999px; color: #526159; font-weight: 700; letter-spacing: .03em; }
.connection { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #b58031; box-shadow: 0 0 0 3px rgba(181,128,49,.12); }
.connection.supported .dot { background: #34865f; box-shadow: 0 0 0 3px rgba(52,134,95,.12); }
.connection.unsupported .dot { background: #88928c; box-shadow: none; }

.intro { display: grid; grid-template-columns: 1.4fr .6fr; align-items: end; gap: 60px; padding: 66px 0 42px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin: 0; font-size: clamp(38px, 5vw, 62px); line-height: 1.04; letter-spacing: -.035em; font-weight: 500; }
h1 em { color: var(--green); font-weight: 400; }
.intro-copy { max-width: 420px; margin: 0 0 5px; color: var(--muted); font-size: 16px; line-height: 1.65; }

.workspace { display: grid; grid-template-columns: 1.35fr .85fr; min-height: 660px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.document-panel, .analysis-panel { padding: 30px; }
.document-panel { background: #e8eae5; border-right: 1px solid var(--line); }
.analysis-panel { padding: 30px 34px; }
.section-heading, .actions-heading { display: flex; justify-content: space-between; align-items: center; }
.section-heading { margin-bottom: 25px; }
.section-heading.compact { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.section-heading h2, .actions-heading h2 { margin: 0; font-size: 25px; font-weight: 500; letter-spacing: -.02em; }
.file-chip { color: #667169; background: rgba(255,255,255,.7); padding: 6px 9px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--green); cursor: pointer; transition: .2s ease; }
.icon-button:hover { background: var(--mint); transform: rotate(20deg); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.paper { width: min(520px, 90%); min-height: 525px; margin: 0 auto; padding: 42px 44px 35px; background: white; box-shadow: 0 12px 32px rgba(28,38,31,.13); color: #29312c; }
.paper-head, .paper-head > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.paper-head > div:first-child { gap: 10px; }
.paper-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: white; font-family: Georgia, serif; font-style: italic; }
.paper-head strong, .paper-head small { display: block; }
.paper-head strong { font-size: 12px; letter-spacing: .12em; }
.paper-head small { margin-top: 3px; color: #818984; font-size: 8px; }
.invoice-label { text-align: right; font-size: 20px; font-weight: 300; letter-spacing: .12em; }
.invoice-label small { letter-spacing: .03em; }
.paper-rule { height: 3px; margin: 24px 0; background: var(--green); }
.invoice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; font-size: 10px; }
.invoice-grid > div:last-child { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; }
.invoice-grid span { color: #818984; text-transform: uppercase; letter-spacing: .05em; }
.invoice-grid strong { font-size: 11px; }
.invoice-grid p { color: #6f7872; line-height: 1.55; }
.invoice-grid .due { color: var(--amber); }
.invoice-table { width: 100%; margin-top: 30px; border-collapse: collapse; font-size: 10px; }
.invoice-table th { padding: 9px 0; border-bottom: 1px solid #aeb7b0; text-align: left; color: #7b847e; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.invoice-table th:last-child, .invoice-table td:last-child { text-align: right; }
.invoice-table td { padding: 16px 0; border-bottom: 1px solid #e2e5e2; vertical-align: top; }
.invoice-table small { color: #87908a; }
.totals { display: grid; grid-template-columns: 1fr auto; align-items: baseline; margin-left: 50%; padding: 16px 0; border-bottom: 1px solid #d8ddd9; font-size: 10px; }
.totals strong { font-size: 16px; }
.totals small { grid-column: 1 / -1; margin-top: 4px; text-align: right; color: #87908a; font-size: 8px; }
.payment-note { display: flex; gap: 18px; margin-top: 26px; padding: 12px; background: #f3f5f1; font-size: 8px; line-height: 1.4; }
.payment-note strong { min-width: 72px; }

.analysis-list { margin: 0; }
.analysis-list > div { padding: 18px 0; border-bottom: 1px solid var(--line); }
.analysis-list dt { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.analysis-list dd { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.analysis-list .full dd { font-weight: 450; color: #48534d; }
.deadline { display: flex; align-items: flex-start; gap: 10px; }
.deadline + .deadline { margin-top: 10px; }
.deadline-date { flex: 0 0 auto; padding: 4px 7px; border-radius: 5px; background: var(--amber-bg); color: var(--amber); font-size: 10px; font-weight: 800; }
.empty { color: #929a95; font-style: italic; }

.actions-section { margin: 34px 0 0; padding: 32px 36px 28px; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.review-badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 7px; background: var(--amber-bg); color: var(--amber); font-size: 11px; font-weight: 750; }
.review-badge svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.action-grid { min-height: 108px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.action-card { position: relative; padding: 18px 20px 18px 48px; border: 1px solid #cfd8d1; border-radius: 11px; background: #fbfcfa; }
.action-card::before { content: ""; position: absolute; left: 20px; top: 22px; width: 10px; height: 10px; background: #d49338; border-radius: 50%; box-shadow: 0 0 0 4px #f8ead5; }
.action-card span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.action-card strong { font-size: 14px; overflow-wrap: anywhere; }
.action-card small { display: block; margin-top: 6px; color: var(--amber); }
.empty-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 104px; border: 1px dashed #d7ddd8; border-radius: 11px; color: var(--muted); }
.empty-actions strong { color: var(--ink); font-size: 14px; }
.empty-actions p { margin: 4px 0 0; font-size: 12px; }
.empty-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--mint); color: var(--green); font-weight: 800; }
.current-state { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0 24px; }
.current-state div { padding: 13px 16px; background: #f4f6f3; border-radius: 8px; }
.current-state span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.current-state strong { font-size: 13px; }
.decision-bar { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.status-message { display: flex; align-items: center; gap: 11px; }
.status-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e7ece8; color: var(--green); font-family: Georgia, serif; font-weight: 800; }
.status-message strong, .status-message small { display: block; }
.status-message strong { font-size: 13px; }
.status-message small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.decision-buttons { display: flex; gap: 10px; }
.button { min-width: 112px; height: 42px; border-radius: 8px; border: 1px solid var(--green); font-weight: 750; cursor: pointer; transition: .18s ease; }
.button:disabled { cursor: not-allowed; opacity: .4; }
.button.secondary { background: white; color: var(--green); }
.button.secondary:not(:disabled):hover { background: #f1f5f2; }
.button.primary { display: inline-flex; justify-content: center; align-items: center; gap: 7px; background: var(--green); color: white; }
.button.primary:not(:disabled):hover { background: var(--green-dark); transform: translateY(-1px); }
.button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
footer { display: flex; justify-content: space-between; padding: 25px 2px 40px; color: #858d88; font-size: 11px; }

@media (max-width: 900px) {
  .app-shell { padding: 0 20px; }
  .intro { grid-template-columns: 1fr; gap: 24px; padding-top: 44px; }
  .workspace { grid-template-columns: 1fr; }
  .document-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .paper { width: min(520px, 100%); }
}
@media (max-width: 620px) {
  .app-shell { padding: 0 12px; }
  .topbar { height: 70px; }
  .brand { font-size: 16px; }
  .challenge-pill { display: none; }
  h1 { font-size: 38px; }
  .document-panel, .analysis-panel, .actions-section { padding: 22px 18px; }
  .paper { padding: 28px 24px; min-height: 480px; }
  .paper-head > div:first-child small { display: none; }
  .action-grid, .current-state { grid-template-columns: 1fr; }
  .decision-bar { align-items: stretch; flex-direction: column; }
  .decision-buttons .button { flex: 1; }
  footer { gap: 8px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
