:root {
  --ink: #20262d;
  --muted: #66727e;
  --line: #d8e0e7;
  --panel: #fff;
  --surface: #f4f7f8;
  --field: #fbfcfd;
  --teal: #0f766e;
  --blue: #285f86;
  --red: #b43737;
  --amber: #9a6500;
  --green: #16724f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--surface); }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font-size: 16px; }
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { display: grid; grid-template-columns: minmax(330px, 430px) 1fr; min-height: 100vh; }
.sidebar { padding: 22px; background: #eef3f2; border-right: 1px solid var(--line); overflow: auto; }
.workspace { padding: 24px; overflow: auto; }
.brand { display: grid; grid-template-columns: 48px 1fr; gap: 13px; margin-bottom: 18px; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 8px; background: #dcebe8; color: var(--teal); }
h1, h2, p { margin: 0; }
h1 { font-size: 1.2rem; line-height: 1.25; }
.brand p, .eyebrow, label span, .meta, .empty, .summary-grid span, .notice { color: var(--muted); }
.brand p { margin-top: 5px; font-size: .9rem; line-height: 1.4; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: 0 16px 34px rgba(24, 38, 52, .07); }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin-bottom: 12px; font-size: 1rem; }
.stack { display: grid; gap: 10px; }
label { display: grid; gap: 6px; }
label span { font-size: .82rem; font-weight: 850; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); padding: 9px 11px; color: var(--ink); }
textarea { min-height: 112px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid rgba(40, 95, 134, .16); }
.check-line { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); }
.check-line input, .signature-places input { width: 16px; min-height: 16px; }
.check-line span { color: var(--ink); }
.signature-places { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); }
.signature-places > span { font-size: .82rem; font-weight: 850; color: var(--muted); }
.signature-places label { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: var(--ink); font-size: .9rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button-row, .actions, .card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.primary, .secondary, .danger { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 8px; font-weight: 850; }
.primary { background: var(--teal); color: #fff; }
.secondary { background: #e8eef2; color: #26323d; border: 1px solid #c7d2da; }
.danger { background: #ffe5e5; color: var(--red); border: 1px solid #efb4b4; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.eyebrow { margin-bottom: 4px; font-size: .78rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0; }
.topbar h2 { font-size: clamp(1.35rem, 2vw, 2rem); line-height: 1.15; }
.actions { justify-content: flex-end; align-items: center; }
.actions input { width: min(330px, 100%); }
.restore-label input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-grid div { display: grid; gap: 4px; min-height: 78px; align-content: center; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.summary-grid strong { font-size: 1.35rem; overflow-wrap: anywhere; }
.summary-grid span { font-size: .8rem; font-weight: 850; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tabs button { min-height: 38px; padding: 0 12px; border-radius: 8px; background: #fff; color: #33404b; border: 1px solid var(--line); font-weight: 850; }
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.status { padding: 10px 12px; margin-bottom: 14px; border: 1px solid var(--line); background: #fff; border-radius: 8px; color: var(--muted); }
.content { display: grid; gap: 12px; }
.card { display: grid; gap: 10px; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--teal); border-radius: 8px; padding: 14px; }
.card-title { font-weight: 950; overflow-wrap: anywhere; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.badge { display: inline-flex; min-height: 27px; align-items: center; border-radius: 999px; padding: 0 9px; background: #eef3f5; color: #40505d; font-size: .78rem; font-weight: 900; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.draft-output { min-height: 360px; white-space: pre-wrap; line-height: 1.55; }
.template-text { min-height: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
.token-list { display: flex; flex-wrap: wrap; gap: 8px; }
.token-btn { min-height: 32px; font-size: .82rem; }
.small-btn { min-height: 30px; padding: 0 10px; width: fit-content; }
.how-box { display: grid; gap: 6px; padding: 10px; border: 1px solid #cbd8de; border-radius: 8px; background: #f2f7f8; line-height: 1.45; }
.objection-entry { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; line-height: 1.45; }
.annexure-entry { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; line-height: 1.45; }
.annexure-preview { max-width: 100%; max-height: 260px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.empty { min-height: 140px; display: grid; place-items: center; background: #fff; border: 1px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; }
@media (max-width: 1050px) { .app-shell { grid-template-columns: 1fr; } .sidebar { border-right: 0; border-bottom: 1px solid var(--line); } }
@media (max-width: 680px) { .sidebar, .workspace { padding: 15px; } .topbar, .card-head { flex-direction: column; align-items: stretch; } .two-col { grid-template-columns: 1fr; } .actions input, .primary, .secondary, .danger { width: 100%; } }
@media (max-width: 820px) {
  body { -webkit-text-size-adjust: 100%; }
  .app-shell { min-height: auto; }
  .sidebar, .workspace { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .panel { padding: 14px; box-shadow: none; }
  .brand { grid-template-columns: 42px 1fr; }
  .brand-mark { width: 42px; height: 42px; }
  input, select, textarea, .primary, .secondary, .danger { min-height: 46px; }
  textarea { min-height: 104px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .tabs button { flex: 0 0 auto; min-height: 44px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: 1fr; }
  .draft-output, .template-text { min-height: 300px; }
}
@media (max-width: 430px) {
  .summary-grid { grid-template-columns: 1fr; }
  .actions, .button-row, .card-actions { justify-content: stretch; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .tabs, .summary-grid, .status, .card-actions { display: none !important; }
  .app-shell { display: block; }
  .workspace { padding: 0; }
  .card { border: 0; padding: 0; }
}
