/* ---------- tokens ---------- */
:root {
  --paper: #FFFFFF;
  --ground: #F4F5F2;
  --ink: #17211E;
  --ink-soft: #5A6662;
  --ledger: #0E6B4F;
  --ledger-deep: #0A5540;
  --stamp: #D8492B;
  --line: #E3E6E1;
  --line-strong: #C9CEC8;
  --radius: 14px;
  --shadow-paper: 0 1px 2px rgba(23,33,30,.06), 0 12px 40px -12px rgba(23,33,30,.18);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Archivo", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--ground);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.site-header {
  display: flex; align-items: center; gap: 28px;
  padding: 18px clamp(20px, 5vw, 56px);
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--font-display);
  font-weight: 600; font-size: 24px;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
.brand-dot { color: var(--ledger); }
.site-nav { display: flex; gap: 22px; margin-left: 8px; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 15px; font-weight: 500;
}
.site-nav a:hover { color: var(--ink); }
.lang-select {
  margin-left: auto;
  font: 600 13px var(--font-body); color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 99px; padding: 7px 12px; cursor: pointer;
}

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding: clamp(44px, 8vw, 84px) 20px 12px;
  max-width: 780px; margin: 0 auto;
}
.eyebrow {
  font: 500 12.5px var(--font-mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ledger);
  margin-bottom: 18px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.04; letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero-sub {
  margin: 20px auto 0; max-width: 560px;
  font-size: 17.5px; color: var(--ink-soft); text-wrap: balance;
}

/* ---------- workbench ---------- */
.workbench {
  display: grid;
  grid-template-columns: 340px minmax(0, 760px);
  gap: 28px; justify-content: center;
  padding: clamp(28px, 5vw, 56px) 20px;
  align-items: start;
}

.controls {
  position: sticky; top: 86px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 1px 2px rgba(23,33,30,.04);
  display: flex; flex-direction: column; gap: 16px;
}
.controls-title {
  font: 600 12px var(--font-mono);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-soft);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ctl { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); }
.ctl select, .ctl input {
  font: 500 15px var(--font-body); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 11px; background: #fff; width: 100%;
}
.ctl select:focus-visible, .ctl input:focus-visible,
.p-input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ledger); outline-offset: 1px;
}

.btn-row {
  border: 1px dashed var(--line-strong); background: transparent;
  border-radius: 9px; padding: 10px; cursor: pointer;
  font: 500 14.5px var(--font-body); color: var(--ink-soft);
  transition: border-color .15s, color .15s;
}
.btn-row:hover { border-color: var(--ledger); color: var(--ledger); }

.btn-primary {
  border: 0; cursor: pointer;
  background: var(--ledger); color: #fff;
  font: 600 16px var(--font-body);
  padding: 14px; border-radius: 11px;
  transition: background .15s, transform .1s;
  box-shadow: 0 6px 16px -6px rgba(14,107,79,.5);
}
.btn-primary:hover { background: var(--ledger-deep); }
.btn-primary:active { transform: translateY(1px); }
.ctl-note { font-size: 12.5px; color: var(--ink-soft); text-align: center; }

/* ---------- paper ---------- */
.paper-wrap { min-width: 0; }
.paper {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
  padding: clamp(26px, 5vw, 52px);
  position: relative;
}

.p-input {
  font: inherit; color: inherit;
  border: 0; background: transparent; width: 100%;
  resize: none; border-radius: 6px; padding: 3px 6px; margin-left: -6px;
  transition: background .12s;
}
.p-input:hover { background: #F2F6F3; }
.p-input:focus { background: #EDF4EF; }
.p-input::placeholder { color: #A9B3AD; }
.p-strong { font-weight: 600; font-size: 17px; }
.p-mono { font-family: var(--font-mono); }

.paper-head { display: flex; justify-content: space-between; gap: 28px; }
.paper-from { flex: 1; max-width: 300px; display: flex; flex-direction: column; gap: 4px; }
.paper-from .p-input:not(.p-strong), .paper-billto .p-input:not(.p-strong) {
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.45;
}

.paper-title { text-align: right; }
.doc-word {
  font-family: var(--font-display);
  font-weight: 600; font-size: clamp(26px, 4vw, 38px);
  letter-spacing: .02em; color: var(--ink);
}
.doc-meta { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.doc-meta label { display: flex; justify-content: flex-end; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.doc-meta .p-input { width: 128px; font-size: 13px; text-align: right; margin-left: 0; }

.paper-billto { margin-top: 34px; max-width: 320px; display: flex; flex-direction: column; gap: 4px; }
.billto-label {
  font: 600 11px var(--font-mono);
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--ledger);
}

/* items table */
.items { width: 100%; border-collapse: collapse; margin-top: 34px; }
.items th {
  font: 600 11px var(--font-mono);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-soft); text-align: left;
  padding: 0 6px 8px;
  border-bottom: 1.5px solid var(--ink);
}
.items th.num { text-align: right; }
.items td { padding: 4px 2px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.items td .p-input { margin-left: 0; }
.items .c-qty, .items .c-rate { width: 88px; }
.items .c-qty .p-input, .items .c-rate .p-input { text-align: right; font-family: var(--font-mono); font-size: 14px; }
.items .c-amount { width: 110px; text-align: right; font: 500 14px var(--font-mono); white-space: nowrap; padding-right: 6px; }
.rm-col { width: 28px; border-bottom-color: transparent !important; }
.items td.rm-col { border-bottom: 0; }
.rm-btn {
  border: 0; background: transparent; cursor: pointer;
  color: var(--line-strong); font-size: 16px; line-height: 1;
  padding: 4px; border-radius: 6px; opacity: 0;
  transition: color .12s, opacity .12s;
}
.items tr:hover .rm-btn { opacity: 1; }
.rm-btn:hover { color: var(--stamp); }

/* totals — double-rule under the final figure, like a closed ledger entry */
.totals { margin-top: 18px; margin-left: auto; max-width: 300px; display: flex; flex-direction: column; gap: 8px; }
.t-row { display: flex; justify-content: space-between; font-size: 14.5px; color: var(--ink-soft); padding: 0 6px; }
.t-row .p-mono { color: var(--ink); }
.t-total {
  margin-top: 6px; padding-top: 12px;
  border-top: 1.5px solid var(--ink);
  font-weight: 600; font-size: 17px; color: var(--ink);
}
.t-total .p-mono {
  font-weight: 600; font-size: 19px; color: var(--ledger);
  border-bottom: 3px double var(--ink);
  padding-bottom: 2px;
}

.paper-notes { margin-top: 40px; display: flex; flex-direction: column; gap: 4px; }
.paper-notes .p-input { font-size: 13.5px; color: var(--ink-soft); }

.paper-brand {
  margin-top: 36px; text-align: center;
  font: 500 11.5px var(--font-mono);
  color: #B3BCB6; letter-spacing: .04em;
}

/* ---------- pricing ---------- */
.pricing { padding: clamp(48px, 8vw, 96px) 20px; max-width: 980px; margin: 0 auto; }
.section-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.015em;
  text-align: center; margin-bottom: 40px;
}
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.plan {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 26px;
  display: flex; flex-direction: column; gap: 10px;
}
.plan-featured { border-color: var(--ledger); box-shadow: 0 12px 32px -14px rgba(14,107,79,.35); }
.plan h3 { font-size: 16px; font-weight: 600; }
.plan-price { font: 600 34px var(--font-display); letter-spacing: -0.02em; }
.plan-price .per { font: 500 14px var(--font-body); color: var(--ink-soft); }
.plan-desc { font-size: 14.5px; color: var(--ink-soft); flex: 1; }
.btn-plan {
  text-align: center; text-decoration: none;
  font: 600 15px var(--font-body);
  padding: 11px; border-radius: 10px;
  border: 1.5px solid var(--ink); color: var(--ink);
  transition: background .15s, color .15s;
}
.btn-plan:hover { background: var(--ink); color: #fff; }
.plan-featured .btn-plan { background: var(--ledger); border-color: var(--ledger); color: #fff; }
.plan-featured .btn-plan:hover { background: var(--ledger-deep); }

/* ---------- faq ---------- */
.faq { padding: 0 20px clamp(48px, 8vw, 96px); max-width: 720px; margin: 0 auto; }
.faq-list { display: flex; flex-direction: column; }
.faq-list > div { padding: 20px 4px; border-top: 1px solid var(--line); }
.faq-list dt { font-weight: 600; font-size: 16.5px; margin-bottom: 6px; }
.faq-list dd { color: var(--ink-soft); font-size: 15px; }

/* ---------- footer ---------- */
.site-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 26px clamp(20px, 5vw, 56px);
  border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-soft);
}

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .controls { position: static; flex-direction: row; flex-wrap: wrap; align-items: end; }
  .controls-title { width: 100%; }
  .ctl { flex: 1 1 140px; }
  .btn-row, .btn-primary { flex: 1 1 160px; }
  .ctl-note { width: 100%; }
  .pricing-grid { grid-template-columns: 1fr; }
  #panel-mount, .manual-box { flex: 1 1 100%; width: 100%; }
  .doc-controls { flex-direction: column; max-height: none; align-items: stretch; }
  .chatside-log { height: 40vh; }
}
@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; row-gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  .site-nav {
    order: 3; width: 100%;
    gap: 16px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap; font-size: 14px;
  }
  .paper-head { flex-direction: column; }
  .paper-title { text-align: left; }
  .doc-meta label { justify-content: flex-start; }
  .items .c-qty, .items .c-rate { width: 64px; }
  .items .c-amount { width: 84px; }
}

/* ---------- hub: hero assistant bar ---------- */
.hub-ai {
  display: flex; align-items: center; gap: 10px;
  max-width: 620px; margin: 28px auto 0;
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
  border-radius: 99px;
  padding: 7px 7px 7px 18px;
  box-shadow: 0 10px 30px -14px rgba(23,33,30,.25);
  transition: border-color .15s, box-shadow .15s;
}
.hub-ai:focus-within {
  border-color: var(--ledger);
  box-shadow: 0 10px 30px -12px rgba(14,107,79,.35);
}
.hub-ai-input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font: 400 15.5px var(--font-body); color: var(--ink);
}
.hub-ai-input::placeholder { color: #A9B3AD; }
.hub-ai-send {
  flex: none; border: 0; cursor: pointer;
  background: var(--ledger); color: #fff;
  font: 600 15px var(--font-body);
  padding: 11px 22px; border-radius: 99px;
  transition: background .15s;
}
.hub-ai-send:hover { background: var(--ledger-deep); }
.hub-ai-note {
  margin-top: 12px; text-align: center;
  font-size: 13.5px; color: var(--ink-soft);
}

/* ---------- hub: tool catalog ---------- */
.catalog {
  max-width: 1040px; margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 20px;
  display: flex; flex-direction: column; gap: 40px;
}
.group-title {
  font: 600 12px var(--font-mono);
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--ledger);
  padding-bottom: 10px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tools {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.tool-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  text-decoration: none; color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card.is-ready:hover {
  transform: translateY(-3px);
  border-color: var(--ledger);
  box-shadow: 0 14px 32px -14px rgba(14,107,79,.35);
}
.tool-card:not(.is-ready) { opacity: .62; }
.tool-glyph {
  flex: none; width: 44px; height: 44px;
  display: grid; place-items: center;
  font: 600 13px var(--font-mono); letter-spacing: .05em;
  color: var(--ledger); background: #EBF3EE;
  border-radius: 10px;
}
.tool-glyph svg { width: 22px; height: 22px; }
.tool-card:not(.is-ready) .tool-glyph { color: var(--ink-soft); background: var(--ground); }
.tool-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-title { font-weight: 600; font-size: 16px; }
.tool-desc { font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }
.tool-status {
  margin-left: auto; flex: none;
  font: 600 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft); background: var(--ground);
  border-radius: 99px; padding: 4px 10px;
}
.tool-status.ok { color: #fff; background: var(--ledger); }
@media (max-width: 940px) { .tools { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .tools { grid-template-columns: 1fr; } }

/* ---------- AI assistant chat ---------- */
.ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  display: flex; align-items: center; gap: 9px;
  border: 0; cursor: pointer;
  background: var(--ink); color: #fff;
  font: 600 14.5px var(--font-body);
  padding: 13px 20px; border-radius: 99px;
  box-shadow: 0 10px 28px -8px rgba(23,33,30,.5);
  transition: transform .15s, background .15s;
}
.ai-fab:hover { transform: translateY(-2px); }
.ai-fab.is-open { background: var(--ledger-deep); }
.ai-fab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 3px rgba(74,222,128,.25);
}
.ai-panel {
  position: fixed; right: 22px; bottom: 78px; z-index: 90;
  width: min(360px, calc(100vw - 44px));
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px -16px rgba(23,33,30,.35);
}
.ai-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.ai-close { border: 0; background: transparent; cursor: pointer; color: var(--ink-soft); font-size: 14px; padding: 4px; }
.ai-hint { font-size: 12.5px; color: var(--ink-soft); padding: 10px 16px 0; }
.ai-log {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; height: 240px; overflow-y: auto;
}
.ai-msg {
  max-width: 85%; padding: 8px 12px;
  border-radius: 12px; font-size: 14px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.ai-bot { background: var(--ground); color: var(--ink); border-bottom-left-radius: 4px; align-self: flex-start; }
.ai-user { background: var(--ledger); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.ai-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ai-input {
  flex: 1; resize: none;
  font: 400 14px var(--font-body); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 8px 10px;
}
.ai-send {
  border: 0; cursor: pointer; align-self: flex-end;
  background: var(--ledger); color: #fff;
  font: 600 14px var(--font-body);
  padding: 9px 14px; border-radius: 10px;
}
.ai-send:hover { background: var(--ledger-deep); }

/* ---------- header extras: active link, account ---------- */
.site-nav a.is-active { color: var(--ink); font-weight: 600; }
.acct-slot { margin-left: 12px; position: relative; }
.acct-btn {
  border: 1.5px solid var(--ink); background: transparent; cursor: pointer;
  color: var(--ink); font: 600 13.5px var(--font-body);
  padding: 7px 16px; border-radius: 99px;
  transition: background .15s, color .15s;
}
.acct-btn:hover { background: var(--ink); color: #fff; }
.acct-avatar {
  width: 38px; height: 38px; padding: 0;
  border-radius: 50%; background: var(--ledger); border-color: var(--ledger);
  color: #fff; font-size: 13px; letter-spacing: .03em;
}
.acct-avatar:hover { background: var(--ledger-deep); }
.acct-wrap { position: relative; }
.acct-menu {
  position: absolute; right: 0; top: 46px; z-index: 100;
  min-width: 190px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px;
  box-shadow: 0 16px 40px -12px rgba(23,33,30,.3);
  display: flex; flex-direction: column;
}
.acct-menu-name {
  font-size: 12.5px; color: var(--ink-soft);
  padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acct-menu a, .acct-menu button {
  text-align: left; text-decoration: none; border: 0; background: transparent; cursor: pointer;
  font: 500 14px var(--font-body); color: var(--ink);
  padding: 8px 10px; border-radius: 8px;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--ground); }

/* ---------- modal & toast ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(23,33,30,.45);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: min(400px, 100%);
  background: var(--paper); border-radius: 16px;
  padding: 26px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.4);
}
.modal h3 { font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); }
.modal input {
  font: 500 15px var(--font-body); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 10px 12px;
}
.modal-note { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn-primary { padding: 11px 18px; }

.btn-ghost {
  border: 1.5px solid var(--line-strong); background: transparent; cursor: pointer;
  color: var(--ink); font: 600 14.5px var(--font-body);
  padding: 10px 16px; border-radius: 10px;
  transition: border-color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300;
  transform: translate(-50%, 16px); opacity: 0;
  background: var(--ink); color: #fff;
  font: 500 14.5px var(--font-body);
  padding: 12px 22px; border-radius: 99px;
  box-shadow: 0 12px 30px -8px rgba(23,33,30,.5);
  transition: transform .25s, opacity .25s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- my documents page ---------- */
.docs-page {
  max-width: 760px; margin: 0 auto;
  padding: clamp(32px, 6vw, 64px) 20px;
  min-height: 50vh;
}
.docs-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.docs-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.015em;
}
.folder-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.folder-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--paper); cursor: pointer;
  font: 500 13.5px var(--font-body); color: var(--ink-soft);
  padding: 7px 14px; border-radius: 99px;
  transition: border-color .15s, color .15s;
}
.folder-chip:hover { border-color: var(--ink); color: var(--ink); }
.folder-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.folder-x { font-size: 11px; opacity: .55; }
.folder-x:hover { opacity: 1; color: var(--stamp); }
.folder-chip.active .folder-x:hover { color: #FFB4A4; }

.docs-list { display: flex; flex-direction: column; gap: 10px; }
.doc-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-name {
  border: 0; background: transparent; cursor: pointer; text-align: left; padding: 0;
  font: 600 15.5px var(--font-body); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-name:hover { color: var(--ledger); }
.doc-meta { font-size: 12.5px; color: var(--ink-soft); }
.doc-folder {
  font: 500 13px var(--font-body); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; background: #fff; max-width: 130px;
}
.doc-act {
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft); font-size: 15px; padding: 6px; border-radius: 8px;
}
.doc-act:hover { background: var(--ground); color: var(--ink); }
.doc-del:hover { color: var(--stamp); }
.docs-empty { text-align: center; padding: 48px 0; color: var(--ink-soft); }
.docs-empty-cta { display: inline-block; margin-top: 18px; text-decoration: none; }

/* ---------- AI agent page ---------- */
.agent-body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.agent-body .site-header { position: static; flex: none; }
.agent-page {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  width: min(760px, 100%); margin: 0 auto;
  padding: 0 20px;
}
.agent-topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px;
}
.agent-status {
  display: flex; align-items: center; gap: 9px;
  font: 600 13px var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft);
}
.agent-new { padding: 7px 14px; font-size: 13.5px; }
.agent-thread {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 8px 4px 16px;
}
.agent-empty { margin: auto; text-align: center; padding: 20px 0; }
.agent-empty h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(28px, 4.5vw, 42px); letter-spacing: -0.015em;
  text-wrap: balance;
}
.agent-empty p { margin: 14px auto 0; max-width: 480px; color: var(--ink-soft); font-size: 15.5px; text-wrap: balance; }
.agent-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.agent-chip {
  border: 1px solid var(--line-strong); background: var(--paper); cursor: pointer;
  font: 500 13.5px var(--font-body); color: var(--ink-soft);
  padding: 8px 14px; border-radius: 99px;
  transition: border-color .15s, color .15s;
}
.agent-chip:hover { border-color: var(--ledger); color: var(--ledger); }
.ag-msg {
  max-width: 78%; padding: 11px 15px;
  border-radius: 16px; font-size: 15px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.ag-bot { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; }
.ag-user { background: var(--ledger); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.ag-action {
  display: inline-block; margin-top: 10px;
  background: var(--ledger); color: #fff; text-decoration: none;
  font: 600 14px var(--font-body);
  padding: 9px 16px; border-radius: 9px;
}
.ag-action:hover { background: var(--ledger-deep); }
.agent-inputbar {
  flex: none; display: flex; align-items: flex-end; gap: 10px;
  background: var(--paper); border: 1.5px solid var(--line-strong);
  border-radius: 18px; padding: 10px;
  margin: 6px 0 18px;
  transition: border-color .15s, box-shadow .15s;
}
.agent-inputbar:focus-within {
  border-color: var(--ledger);
  box-shadow: 0 8px 26px -12px rgba(14,107,79,.35);
}
.agent-inputbar textarea {
  flex: 1; resize: none; border: 0; outline: none; background: transparent;
  font: 400 15.5px var(--font-body); color: var(--ink);
  line-height: 1.45; max-height: 140px; padding: 6px 8px;
}
.agent-send {
  flex: none; width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; cursor: pointer; border-radius: 12px;
  background: var(--ledger); color: #fff;
  transition: background .15s;
}
.agent-send:hover { background: var(--ledger-deep); }
.agent-send svg { width: 19px; height: 19px; }

/* ---------- embedded agent panel (left half of tool pages) ---------- */
.chatside {
  display: flex; flex-direction: column;
  border: 1.5px solid var(--ledger);
  border-radius: 14px; overflow: hidden;
  background: #F7FAF8;
  box-shadow: 0 10px 26px -14px rgba(14,107,79,.35);
}
.chatside-head {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 9px;
  padding: 9px 10px 9px 14px;
  font-size: 13.5px; color: var(--ink);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.chatside-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.chat-tools { display: flex; gap: 4px; }
.chat-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft); border-radius: 8px;
  transition: background .15s, color .15s;
}
.chat-btn:hover { background: var(--ground); color: var(--ink); }
.chat-btn svg { width: 17px; height: 17px; }
.chat-menu {
  position: absolute; right: 8px; top: 44px; z-index: 120;
  width: 250px; max-height: 320px; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px;
  box-shadow: 0 16px 40px -12px rgba(23,33,30,.3);
  display: flex; flex-direction: column; gap: 2px;
}
.chat-menu-new {
  border: 0; background: transparent; cursor: pointer; text-align: left;
  font: 600 13.5px var(--font-body); color: var(--ledger);
  padding: 9px 10px; border-radius: 8px;
}
.chat-menu-new:hover { background: #EBF3EE; }
.chat-menu-empty { font-size: 12.5px; color: var(--ink-soft); padding: 8px 10px; }
.chat-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  padding: 8px 10px; border-radius: 8px;
}
.chat-menu-item:hover { background: var(--ground); }
.chat-menu-item.active { background: #EBF3EE; }
.cmi-title {
  font: 500 13.5px var(--font-body); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmi-date { flex: none; font: 500 11px var(--font-mono); color: var(--ink-soft); }
.chatside-log {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; height: min(46vh, 420px); overflow-y: auto;
}
.chatside-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--paper); }
.chatside-input {
  flex: 1; resize: none; min-width: 0;
  font: 400 14px var(--font-body); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 8px 10px;
}
.chatside-input:focus-visible { outline: 2px solid var(--ledger); outline-offset: 1px; }
.chatside .agent-send { width: 38px; height: 38px; align-self: flex-end; border-radius: 10px; }
.chatside-attach {
  flex: none; width: 38px; height: 38px; align-self: flex-end;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: transparent; cursor: pointer; color: var(--ink-soft);
  transition: border-color .15s, color .15s;
}
.chatside-attach:hover { border-color: var(--ledger); color: var(--ledger); }
.chatside-attach svg { width: 18px; height: 18px; }

.paper-logo {
  display: block;
  max-height: 56px; max-width: 170px;
  object-fit: contain; object-position: left;
  margin-bottom: 10px;
}
.ai-typing::after {
  content: "▍"; margin-left: 3px; color: var(--ledger);
  animation: p-blink 1s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) { .ai-typing::after { animation: none; } }
@keyframes p-blink { 50% { opacity: 0; } }

.manual-box { border: 1px solid var(--line); border-radius: 11px; padding: 0; }
.manual-box summary {
  cursor: pointer; list-style: none;
  font: 600 13.5px var(--font-body); color: var(--ink-soft);
  padding: 11px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.manual-box summary::after { content: "▾"; color: var(--ink-soft); transition: transform .15s; }
.manual-box[open] summary::after { transform: rotate(180deg); }
.manual-box summary::-webkit-details-marker { display: none; }
.manual-box .doc-fields { padding: 4px 14px 14px; }

/* ---------- app layout: sidebar + document + bottom chat dock ---------- */
.doc-app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.doc-app .site-header { position: static; flex: none; }
.app { flex: 1; min-height: 0; display: flex; }

.side {
  flex: none; width: 256px;
  display: flex; flex-direction: column; gap: 20px;
  padding: 14px 12px 20px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.side-section { display: flex; flex-direction: column; gap: 2px; }
.side-label {
  font: 600 10.5px var(--font-mono);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-soft);
  padding: 12px 10px 6px;
}
.side-new {
  border: 1.5px solid var(--ledger); background: transparent; cursor: pointer;
  color: var(--ledger); font: 600 14px var(--font-body);
  padding: 10px 12px; border-radius: 10px; text-align: center;
  transition: background .15s, color .15s;
}
.side-new:hover { background: var(--ledger); color: #fff; }
.side-cat {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  text-decoration: none; color: var(--ink);
  font-size: 13.5px;
}
.side-cat:hover { background: var(--ground); }
.side-cat.active { background: #EBF3EE; color: var(--ledger-deep); font-weight: 600; }
.side-cat-ic { flex: none; width: 18px; height: 18px; color: var(--ink-soft); display: grid; place-items: center; }
.side-cat.active .side-cat-ic { color: var(--ledger); }
.side-cat-ic svg { width: 17px; height: 17px; }
.side-cat-t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .chat-menu-item { width: 100%; }
.side .chat-menu-empty { padding: 4px 10px 8px; }

.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--ground); }
.stage-toolbar {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(14px, 3vw, 26px);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.side-toggle {
  display: none;
  width: 36px; height: 36px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft); border-radius: 8px;
  place-items: center;
}
.side-toggle svg { width: 20px; height: 20px; }
.stage-title {
  flex: 1; min-width: 0;
  font: 600 clamp(16px, 2vw, 20px) var(--font-display);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-actions { flex: none; display: flex; gap: 8px; }
.stage-save { padding: 8px 14px; font-size: 13.5px; }
.stage-dl { padding: 9px 16px; font-size: 13.5px; border-radius: 9px; }

.stage-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: clamp(16px, 3vw, 30px) clamp(14px, 3vw, 26px) 16px;
}
.stage-scroll .paper { max-width: 780px; margin: 0 auto; }
.stage-scroll .doc-disclaimer { max-width: 780px; margin: 12px auto 0; }

.dock {
  flex: none;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 8px clamp(14px, 3vw, 26px) 14px;
}
.dock-inner { max-width: 780px; margin: 0 auto; }
.dock-toggle {
  display: block;
  width: 44px; height: 18px;
  margin: -2px auto 2px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft); border-radius: 8px;
}
.dock-toggle:hover { color: var(--ink); background: var(--ground); }
.dock-toggle svg { width: 16px; height: 16px; transition: transform .15s; }
.dock-toggle.open svg { transform: rotate(180deg); }
.dock-log {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 30vh; overflow-y: auto;
  padding: 6px 2px 10px;
}
/* collapsed: only the agent's latest message stays visible, the document shows through */
.dock-log.collapsed .ai-msg { display: none; }
.dock-log.collapsed .ai-msg:last-child {
  display: block;
  max-height: 96px; overflow-y: auto;
}

.dl-wrap { position: relative; }
.dl-caret { font-size: 11px; opacity: .85; }
.dl-menu {
  position: absolute; right: 0; top: 44px; z-index: 130;
  min-width: 160px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px;
  box-shadow: 0 16px 40px -12px rgba(23,33,30,.3);
  display: flex; flex-direction: column; gap: 2px;
}
.dl-menu button {
  border: 0; background: transparent; cursor: pointer; text-align: left;
  font: 500 14px var(--font-body); color: var(--ink);
  padding: 9px 12px; border-radius: 8px;
}
.dl-menu button:hover { background: var(--ground); }

.stage-title { cursor: text; border-radius: 6px; padding: 2px 6px; margin-left: -6px; }
.stage-title:hover { background: var(--ground); }
.stage-title:focus { outline: 2px solid var(--ledger); outline-offset: 1px; background: #fff; }
.dock-form { display: flex; align-items: flex-end; gap: 8px; }
.dock-form .chatside-input {
  flex: 1; resize: none; min-width: 0;
  font: 400 15px var(--font-body); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: 12px;
  padding: 10px 12px; line-height: 1.4; max-height: 120px;
}
.dock-form .chatside-input:focus-visible { outline: 2px solid var(--ledger); outline-offset: 1px; }
.dock-form .agent-send, .dock-form .chatside-attach { width: 42px; height: 42px; border-radius: 12px; }

.side-backdrop {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(23,33,30,.4);
}

@media (max-width: 940px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 150;
    width: min(300px, 84vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 20px 0 60px -20px rgba(23,33,30,.4);
  }
  body.side-open .side { transform: none; }
  .side-toggle { display: grid; }
  .dock-log { max-height: 24vh; }
  .stage-save { display: none; }
}

/* ---------- generic document engine ---------- */
.doc-hero { text-align: center; padding-bottom: 8px; }
.doc-hero h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(28px, 4.5vw, 44px); letter-spacing: -0.015em;
}
.doc-controls { max-height: calc(100dvh - 120px); overflow-y: auto; }
.doc-fields { display: flex; flex-direction: column; gap: 14px; }
.doc-fields textarea {
  font: 400 14.5px var(--font-body); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 11px; background: #fff; width: 100%; resize: vertical;
}
.doc-paper-title { margin-bottom: 22px; }
.doc-body {
  white-space: pre-line;
  font-size: 15px; line-height: 1.65; color: var(--ink);
  overflow-wrap: break-word;
}
.doc-hint { color: var(--ink-soft); font-style: italic; }
.doc-disclaimer {
  margin-top: 14px; text-align: center;
  font-size: 12.5px; color: var(--ink-soft);
}

/* ---------- photo tool ---------- */
.photo-bench { align-items: start; }
.photo-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#ph-canvas {
  width: min(360px, 100%); height: auto;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
  cursor: grab; touch-action: none;
}
#ph-canvas:active { cursor: grabbing; }
.photo-hint { font-size: 13px; color: var(--ink-soft); text-align: center; }
.ctl input[type="file"] { padding: 7px; font-size: 13px; }
.ctl input[type="range"] { padding: 0; border: 0; accent-color: var(--ledger); }

/* ---------- pricing page ---------- */
.hero-slim { padding-bottom: 0; }
.pricing-note {
  margin-top: 28px; text-align: center;
  font-size: 14px; color: var(--ink-soft);
}

/* ---------- print: the paper becomes the PDF ---------- */
@media print {
  body { background: #fff; }
  .site-header, .hero, .controls, .pricing, .faq, .site-footer, .rm-btn,
  .ai-fab, .ai-panel, .catalog, .doc-disclaimer, .photo-stage,
  .side, .stage-toolbar, .dock, .side-backdrop { display: none !important; }
  .doc-app { height: auto; overflow: visible; display: block; }
  .app, .stage { display: block; }
  .stage-scroll { overflow: visible; padding: 0; }
  .workbench { display: block; padding: 0; }
  .paper { box-shadow: none; border-radius: 0; padding: 24px 8px; }
  .p-input { background: transparent !important; }
  .p-input::placeholder { color: transparent; }
}
